You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
291 lines
7.7 KiB
JavaScript
291 lines
7.7 KiB
JavaScript
6 years ago
|
$(function(){
|
||
|
|
||
|
//Cht.cityInfo.getWeather("weatherId");
|
||
|
Cht.cityInfo.getHotelList("indexHotelList");
|
||
|
|
||
|
Cht.SNS.getTwitterNum("ttShare");
|
||
|
Cht.SNS.getFaceBookSharerNum("fbShare");
|
||
|
|
||
|
//================点击发布数据=================
|
||
|
|
||
|
$("#reviewBut").click(function(){
|
||
|
var thisRwStr=$("#reviewbody").val();
|
||
|
if($("#fbcheck").attr("checked")==true){
|
||
|
Cht.SNS.sharerToFaceBook();
|
||
|
}
|
||
|
if($("#ttcheck").attr("checked")==true){
|
||
|
Cht.SNS.sharerToTwitter(thisRwStr);
|
||
|
}
|
||
|
});
|
||
|
|
||
|
//===============JS广告系统===================
|
||
|
|
||
|
//顶部广告
|
||
|
var topAds=$("#promoBox");
|
||
|
if(topAds.length>0){
|
||
|
var thisType=topAds.attr("type");
|
||
|
var thisTitle=topAds.attr("name").toLowerCase().replace(/\ /g,'-');
|
||
|
$.ajax({
|
||
|
type: "get",
|
||
|
url:"/jsAds/headAds/"+thisTitle+".txt",
|
||
|
success:function(data){
|
||
|
topAds.html(data);
|
||
|
},
|
||
|
error:function(){
|
||
|
topAds.load("/jsAds/headAds/"+thisType+".txt");
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
});
|
||
|
|
||
|
//导航手风Q
|
||
|
function showTree(pid){
|
||
|
$(".mainNav").css({"cursor":"pointer"});
|
||
|
var allLi=$(".leftNav li.subNav");
|
||
|
allLi.hide();
|
||
|
$("."+pid).show();
|
||
|
$(".mainNav").toggle(function(){
|
||
|
var showClass=".s"+$(this).attr("id");
|
||
|
if(showClass!=".s"){
|
||
|
$(showClass).show();
|
||
|
}else{
|
||
|
var url=$(this).find("a").attr("href");
|
||
|
window.location.href=url;
|
||
|
}
|
||
|
},function(){
|
||
|
var showClass=".s"+$(this).attr("id");
|
||
|
$(showClass).hide();
|
||
|
});
|
||
|
}
|
||
|
|
||
|
//ShortList
|
||
|
function shortList(){
|
||
|
document.writeln('<script type="text/javascript" src="/js/jquery.cookies.js"></script>');
|
||
|
document.writeln('<script type="text/javascript" src="/js/artDialog.min.js"></script>');
|
||
|
document.writeln('<link href="/css/diy.css" rel="stylesheet" type="text/css" />');
|
||
|
|
||
|
var shorNum=0;
|
||
|
if($.cookie("selectActDatas")!=null){
|
||
|
shorNum=$.cookie("selectActDatas").split("],").length;
|
||
|
}else{
|
||
|
$.cookie('selectActDatas', "",{path: '/',expires: 7});
|
||
|
}
|
||
|
|
||
|
var listDom=$("<div id='shortList'><span id='selectAttraction'>Select this attraction</span> / <span id='shorBut'>Short list(<span id='shorNum'>0</span>)</span></div>");
|
||
|
$("#contentHead").append(listDom);
|
||
|
$("#selectAttraction,#shorBut").css({"text-decoration":"underline","cursor":"pointer"});
|
||
|
if(shorNum>0){
|
||
|
$("#shorNum").text(shorNum-1);
|
||
|
}
|
||
|
$("#selectAttraction").click(function(){
|
||
|
var nowselectActDatas=$.cookie("selectActDatas");
|
||
|
//alert(nowselectActDatas);
|
||
|
var thisTitle=$("h1").text();
|
||
|
if(nowselectActDatas==null){
|
||
|
$.cookie("selectActDatas","["+thisTitle+"],");
|
||
|
}
|
||
|
var thisIndex=$.cookie("selectActDatas").indexOf(thisTitle+"],");
|
||
|
if(thisIndex==-1){
|
||
|
$.cookie("selectActDatas",nowselectActDatas+"["+thisTitle+"],",{path: '/',expires: 7});
|
||
|
}else{
|
||
|
$("#shorBut").css("color","#A31022");
|
||
|
setTimeout(function(){$("#shorBut").css("color","#555");},100);
|
||
|
setTimeout(function(){$("#shorBut").css("color","#A31022");},200);
|
||
|
setTimeout(function(){$("#shorBut").css("color","#555");},400);
|
||
|
setTimeout(function(){$("#shorBut").css("color","#A31022");},600);
|
||
|
setTimeout(function(){$("#shorBut").css("color","#555");},800);
|
||
|
}
|
||
|
|
||
|
shorNum=$.cookie("selectActDatas").split("],").length;
|
||
|
|
||
|
$("#shorNum").text(shorNum-1);
|
||
|
|
||
|
});
|
||
|
|
||
|
$("#shorBut").click(function(){
|
||
|
var selectActDatas=$.cookie("selectActDatas");
|
||
|
var selectActDatasArr=selectActDatas.split(",");
|
||
|
var selectContent=$("<div></div>");
|
||
|
for(var i=0;i<selectActDatasArr.length-1;i++){
|
||
|
var thisActDom=$("<div class='selectActDatas'><span>"+selectActDatasArr[i]+"</span> <u onclick=\"delAct("+i+")\">Del</u></div>");
|
||
|
thisActDom.css({"width":"360px","margin-bottom":"5px","padding-bottom":"5px","border-bottom":"1px dotted #DDD"});
|
||
|
thisActDom.find("span").css({"margin-right":"10px","font-weight":"bold"});
|
||
|
thisActDom.find("u").css("cursor","pointer");
|
||
|
selectContent.append(thisActDom);
|
||
|
}
|
||
|
var msgContent=selectContent.html();
|
||
|
var actBox=art.dialog({
|
||
|
content:msgContent,
|
||
|
okValue:"Submit my orders",
|
||
|
ok:function(){
|
||
|
|
||
|
}
|
||
|
});
|
||
|
actBox.lock();
|
||
|
});
|
||
|
|
||
|
}
|
||
|
|
||
|
function delAct(e){
|
||
|
var selectActDatas=$.cookie("selectActDatas");
|
||
|
var selectActDatasArr=selectActDatas.split(",");
|
||
|
selectActDatasArr.shift(e);
|
||
|
selectActDatas="";
|
||
|
for(var i=0;i<selectActDatasArr.length-1;i++){
|
||
|
selectActDatas+=selectActDatasArr[i]+",";
|
||
|
}
|
||
|
$.cookie("selectActDatas",selectActDatas,{path: '/',expires: 7});
|
||
|
$(".selectActDatas").eq(e).remove();
|
||
|
shorNum=$.cookie("selectActDatas").split("],").length;
|
||
|
$("#shorNum").text(shorNum-1);
|
||
|
}
|
||
|
|
||
|
//图片排版功能
|
||
|
function diyPicDom(e){
|
||
|
|
||
|
var lsLeft=0;
|
||
|
var lsTop=new Array(4);
|
||
|
|
||
|
lsTop[0]=0;
|
||
|
lsTop[1]=0;
|
||
|
lsTop[2]=0;
|
||
|
lsTop[3]=0;
|
||
|
lsLeft=0;
|
||
|
|
||
|
var dom=$(e);
|
||
|
dom.css({"position":"relative"});
|
||
|
var loadDom=$("<div id='loadBox'><img src='/pic/loadLine.gif' id='loadPic' /></div>");
|
||
|
var percentageDom=$("<p id='loadNum'>0 %<p>");
|
||
|
dom.find("div").hide();
|
||
|
dom.append(loadDom);
|
||
|
dom.append(percentageDom);
|
||
|
$("#loadNum").css({"text-align":"center","color":"#999","font-weight":"bold"});
|
||
|
var thisDivImg=dom.find("img");
|
||
|
var thisLiNum=thisDivImg.length;
|
||
|
var divImgNum=0;
|
||
|
var imgPercentage=0;
|
||
|
thisDivImg.load(function(){
|
||
|
divImgNum++;
|
||
|
imgPercentage=((divImgNum/thisLiNum)*100).toFixed(2);
|
||
|
$("#loadNum").html(imgPercentage+" %");
|
||
|
$("#loadPic").css({"width":imgPercentage+"%","height":"39px"});
|
||
|
|
||
|
if(divImgNum==thisLiNum){
|
||
|
var thisDivHeight=$("#showBox").css("height");
|
||
|
dom.find("div").css({"position":"absolute"});
|
||
|
$("#loadBox").remove();
|
||
|
$("#loadNum").remove();
|
||
|
dom.find("div").show();
|
||
|
|
||
|
var lastTopPx=0;
|
||
|
|
||
|
for(var q=0;q<thisLiNum;q++){
|
||
|
|
||
|
var nowNum=q+1;
|
||
|
var nowTop=nowNum % 4;
|
||
|
var thisLi=dom.find("div").eq(q);
|
||
|
var thisLiWidth=thisLi.css("width");
|
||
|
var thisLiHeight=thisLi.css("height");
|
||
|
|
||
|
thisLi.css({"left":lsLeft+"px","top":lsTop[3-nowTop]+"px"});
|
||
|
|
||
|
lsLeft=lsLeft+parseInt(thisLiWidth)+50;
|
||
|
lsTop[3-nowTop]=lsTop[3-nowTop]+parseInt(thisLiHeight)+50;
|
||
|
if(nowTop == 0){
|
||
|
lsLeft=0;
|
||
|
}
|
||
|
|
||
|
if(q==thisLiNum-1){
|
||
|
var maxTop=0;
|
||
|
for(var t=0;t<4;t++){
|
||
|
if(t==0 && isNaN(lsTop[t])==false){
|
||
|
maxTop=lsTop[t];
|
||
|
}else{
|
||
|
if(lsTop[t]>maxTop && isNaN(lsTop[t])==false){maxTop=lsTop[t]}
|
||
|
}
|
||
|
}
|
||
|
lastTopPx=maxTop;
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
dom.css("height",(lastTopPx+60)+"px");
|
||
|
|
||
|
dom.find("div img").hover(function(){
|
||
|
$(this).css("opacity","0.9");
|
||
|
},function(){
|
||
|
$(this).css("opacity","1");
|
||
|
});
|
||
|
|
||
|
dom.find("div").css("background","#f0f0f0");
|
||
|
dom.find("p a").css("text-decoration","none");
|
||
|
|
||
|
}
|
||
|
|
||
|
});
|
||
|
//dom
|
||
|
}
|
||
|
|
||
|
//search当前页功能
|
||
|
|
||
|
var DOM = (document.getElementById) ? 1 : 0;
|
||
|
var NS4 = (document.layers) ? 1 : 0;
|
||
|
var IE4 = 0;
|
||
|
if (document.all) {
|
||
|
IE4 = 1;
|
||
|
DOM = 0;
|
||
|
}
|
||
|
var win = window;
|
||
|
var n = 0;
|
||
|
|
||
|
function findIt() {
|
||
|
if (document.getElementById("searchstr").value != "") findInPage(document.getElementById("searchstr").value);
|
||
|
}
|
||
|
|
||
|
function findInPage(str) {
|
||
|
var txt, i, found;
|
||
|
if (str == "") return false;
|
||
|
if (DOM) {
|
||
|
win.find(str, false, true);
|
||
|
return true;
|
||
|
}
|
||
|
if (NS4) {
|
||
|
if (!win.find(str)) while (win.find(str, false, true)) n++;
|
||
|
else n++;
|
||
|
if (n == 0) alert("Could not find the specified content.");
|
||
|
}
|
||
|
if (IE4) {
|
||
|
txt = win.document.body.createTextRange();
|
||
|
for (i = 0; i <= n && (found = txt.findText(str)) != false; i++) {
|
||
|
txt.moveStart("character", 1);
|
||
|
txt.moveEnd("textedit");
|
||
|
}
|
||
|
if (found) {
|
||
|
txt.moveStart("character", -1);
|
||
|
txt.findText(str);
|
||
|
txt.select();
|
||
|
txt.scrollIntoView();
|
||
|
n++;
|
||
|
} else {
|
||
|
if (n > 0) {
|
||
|
n = 0;
|
||
|
findInPage(str);
|
||
|
} else alert("Could not find the specified content.");
|
||
|
}
|
||
|
}
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
$(function(){
|
||
|
$(".closeBar").click(function(){
|
||
|
$(".dealsRight").hide();
|
||
|
});
|
||
|
});
|
||
|
//删除 discoverIcon 图标 by tdy
|
||
|
function RMdiscoverIcon(){
|
||
|
$("span.discoverIcon").remove()
|
||
|
}
|
||
|
|
||
|
|