1$(function () { 2 window.isMobile = !!("ontouchstart" in window); 3 4 function AddFavorite(sURL, sTitle) { 5 if (/firefox/i.test(navigator.userAgent)) { 6 return false; 7 } else if (window.external && window.external.addFavorite) { 8 window.external.addFavorite(sURL, sTitle); 9 return true; 10 } else if (window.sidebar && window.sidebar.addPanel) { 11 window.sidebar.addPanel(sTitle, sURL, ""); 12 return true; 13 } else { 14 var touch = (navigator.userAgent.toLowerCase().indexOf('mac') != -1 ? 'Command' : 'CTRL'); 15 layer.msg('è¯·ä½¿ç¨ ' + touch + ' + D æ·»å å°æ¶è夹.'); 16 return false; 17 } 18 } 19 20 var len = function (str) { 21 if (!str) 22 return 0; 23 var length = 0; 24 for (var i = 0; i < str.length; i++) { 25 if (str.charCodeAt(i) >= 0x4e00 && str.charCodeAt(i) <= 0x9fa5) { 26 length += 2; 27 } else { 28 length++; 29 } 30 } 31 return length; 32 }; 33 34 //new LazyLoad({elements_selector: ".lazy"}); 35 36 layer.config({focusBtn: false}); 37 38 //æ ç®é«äº® 39 var nav = $("header.header .navbar-nav"); 40 if ($("li.active", nav).length === 0) { 41 var current = nav.data("current"); 42 var currentNav = $("a[href='" + location.href + "']", nav)[0] || $("a[href='" + location.pathname + "']", nav)[0] || $("li[value='" + current + "'] > a", nav)[0]; 43 currentNav && $(currentNav, nav).parents("li").addClass("active"); 44 } 45 46 $(".collapse.navbar-collapse.active").on("mousedown click", ".dropdown-menu .dropdown-submenu a[data-toggle='dropdown']", function (e) { 47 e.stopPropagation(); 48 }); 49 50 $("header.header .navbar-right").insertBefore($("header.header .navbar-right").prev()); 51 52 //ç§»å¨æµè§å¨å·¦å³æ»å¨ 53 $(document).on('touchstart', '.carousel', function (event) { 54 const xClick = event.originalEvent.touches[0].pageX; 55 $(this).one('touchmove', function (event) { 56 const xMove = event.originalEvent.touches[0].pageX; 57 const sensitivityInPx = 5; 58 59 if (Math.floor(xClick - xMove) > sensitivityInPx) { 60 $(this).carousel('next'); 61 } else if (Math.floor(xClick - xMove) < -sensitivityInPx) { 62 $(this).carousel('prev'); 63 } 64 }); 65 $(this).on('touchend', function () { 66 $(this).off('touchmove'); 67 }); 68 }); 69 70 // ç¹å»æ¶è 71 $(".addbookbark").attr("rel", "sidebar").click(function () { 72 //ä½¿ç¨æ°æ®åºæ¶è 73 CMS.api.ajax({ 74 url: $(this).data("action"), 75 data: {type: $(this).data("type"), aid: $(this).data("aid")} 76 }); 77 //ä½¿ç¨æµè§å¨æ¶è 78 //return !AddFavorite(window.location.href, $(this).attr("title")); 79 }); 80 81 // ç¹èµ 82 $(document).on("click", ".btn-like", function () { 83 var that = this; 84 var id = $(this).data("id"); 85 var type = $(this).data("type"); 86 if (CMS.api.storage(type + "vote." + id)) { 87 layer.msg("ä½ å·²ç»ç¹è¿èµäº"); 88 return false; 89 } 90 CMS.api.ajax({ 91 data: $(this).data() 92 }, function (data, ret) { 93 $("span", that).text(type === 'like' ? ret.data.likes : ret.data.dislikes); 94 CMS.api.storage(type + "vote." + id, true); 95 return false; 96 }, function () { 97 return false; 98 }); 99 }); 100 101 // å è½½æ´å¤ 102 $(document).on("click", ".btn-loadmore", function () { 103 var that = this; 104 var page = parseInt($(this).data("page")); 105 var container = $(this).data("container"); 106 container = container ? $(container) : $(".article-list,.product-list"); 107 var loadmoreText = $(this).text(); 108 $(that).text("æ£å¨å è½½").prop("disabled", true); 109 CMS.api.ajax({ 110 url: $(that).attr("href"), 111 }, function (data, ret) { 112 if (data) { 113 $(data).appendTo(container); 114 page++; 115 $(that).attr("href", $(that).data("url").replace("__page__", page)).data("page", page); 116 $(that).text(loadmoreText).prop("disabled", false); 117 } else { 118 $(that).replaceWith('<div class="loadmore loadmore-line loadmore-nodata"><span class="loadmore-tips">ææ æ´å¤æ°æ®</span></div>'); 119 } 120 return false;
121 }, function (data) { 122 $(that).text(loadmoreText).prop("disabled", false); 123 }); 124 return false; 125 }); 126 127 //æ»å¨å è½½æ´å¤ 128 $(window).scroll(function () { 129 var loadmore = $(".btn-loadmore"); 130 if (loadmore.length > 0 && !loadmore.prop("disabled") && (loadmore.data("autoload") === undefined || loadmore.data("autoload"))) { 131 if ($(window).scrollTop() - loadmore.height() > loadmore.offset().top - $(window).height()) { 132 loadmore.trigger("click"); 133 } 134 } 135 }); 136 setTimeout(function () { 137 if ($(window).scrollTop() > 0) { 138 $(window).trigger("scroll"); 139 } 140 }, 500); 141 142 //è¯è®ºå表 143 if ($("#comment-container").length > 0) { 144 var ci, si; 145 $("#commentlist dl dd div,#commentlist dl dd dl dd").on({ 146 mouseenter: function () { 147 clearTimeout(ci); 148 var _this = this; 149 ci = setTimeout(function () { 150 $(_this).find("small:first").find("a").stop(true, true).css('display', 'inline-block'); 151 }, 100); 152 }, 153 mouseleave: function () { 154 clearTimeout(ci); 155 $(this).find("small:first").find("a").stop(true, true).fadeOut(); 156 } 157 }); 158 $(".reply").on("click", function () { 159 $("#pid").val($(this).data("id")); 160 $(this).parent().parent().append($("div#postcomment").detach()); 161 $("#postcomment h3 a").show(); 162 $("#commentcontent").focus().val($(this).attr("title")); 163 }); 164 $("#postcomment h3 a").bind("click", function () { 165 $("#comment-container").append($("div#postcomment").detach()); 166 $(this).hide(); 167 }); 168 $(".expandall a").on("click", function () { 169 $(this).parent().parent().find("dl.hide").fadeIn(); 170 $(this).fadeOut(); 171 }); 172 173 $(document).on("click", "#submit", function () { 174 var btn = $(this); 175 var tips = $("#actiontips"); 176 tips.removeClass(); 177 var content = $("#commentcontent").val(); 178 if (len(content) < 3) { 179 tips.addClass("text-danger").html("è¯è®ºå 容é¿åº¦ä¸æ£ç¡®ï¼æå°3个å符").fadeIn().change(); 180 return false; 181 } 182 if (btn.prop("disabled")) { 183 return false; 184 } 185 var form = $("#postform"); 186 btn.attr("disabled", "disabled"); 187 tips.html('æ£å¨æäº¤...'); 188 $.ajax({ 189 url: form.prop("action"), 190 type: 'POST', 191 data: form.serialize(), 192 dataType: 'json', 193 success: function (json) { 194 btn.removeAttr("disabled"); 195 if (json.code == 1) { 196 $("#pid").val(0); 197 tips.addClass("text-success").html(json.msg || "è¯è®ºæåï¼").fadeIn(300).change(); 198 $("#commentcontent").val(''); 199 $("#commentcount").text(parseInt($("#commentcount").text()) + 1); 200 setTimeout(function () { 201 location.reload(); 202 }, 1500); 203 } else { 204 tips.addClass("text-danger").html(json.msg).fadeIn(); 205 } 206 if (json.data && json.data.token) { 207 $("#postform input[name='__token__']").val(json.data.token); 208 } 209 }, 210 error: function () { 211 btn.removeAttr("disabled"); 212 tips.addClass("text-danger").html("è¯è®ºå¤±è´¥ï¼è¯·å·æ°é¡µé¢éè¯ï¼").fadeIn(); 213 } 214 }); 215 return false; 216 }); 217 $("#commentcontent").on("keydown", function (e) { 218 if ((e.metaKey || e.ctrlKey) && (e.keyCode == 13 || e.keyCode == 10)) { 219 $("#submit").trigger('click'); 220 return false;
221 } 222 }); 223 $("#actiontips").on("change", function () { 224 clearTimeout(si); 225 si = setTimeout(function () { 226 $("#actiontips").fadeOut(); 227 }, 8000); 228 }); 229 $(document).on("keyup change", "#commentcontent", function (e) { 230 if (e.metaKey || e.ctrlKey || [13, 10, 18, 91].indexOf(e.keyCode) > -1) { 231 return false; 232 } 233 var max = 1000; 234 var c = $(this).val(); 235 var length = len(c); 236 var t = $("#actiontips"); 237 if (max >= length) { 238 t.removeClass().show().addClass("loading").html("ä½ è¿å¯ä»¥è¾å ¥ <font color=green>" + (Math.floor((max - length) / 2)) + "</font> å"); 239 $("#submit").removeAttr("disabled"); 240 } else { 241 t.removeClass().show().addClass("loading").html("ä½ å·²ç»è¶ åº <font color=red>" + (Math.ceil((length - max) / 2)) + "</font> å"); 242 $("#submit").attr("disabled", "disabled"); 243 } 244 }); 245 } 246 // ä½é¢æ¯ä»æç¤º 247 $(document).on('click', '.btn-balance', function (e) { 248 var that = this; 249 layer.confirm("确认æ¯ä»ï¿¥" + $(this).data("price") + "å ç¨äºè´ä¹°ï¼", function () { 250 CMS.api.ajax({ 251 url: $(that).attr("href") 252 }, function (data, ret) { 253 CMS.api.msg(ret.msg, ret.url); 254 }, function (data, ret) { 255 if (ret.msg && ret.msg.indexOf("ç»å½") > -1) { 256 layer.alert(ret.msg, {btn: ["å»ç»å½", "æä¸ç»å½"]}, function () { 257 location.href = ret.url; 258 }); 259 return false; 260 } 261 }); 262 }); 263 return false; 264 }); 265 // åå°é¡¶é¨ 266 $('#back-to-top').on('click', function (e) { 267 e.preventDefault(); 268 $('html,body').animate({ 269 scrollTop: 0 270 }, 700); 271 }); 272 273 //妿æ¯PCåç§»é¤navbarçdropdownç¹å»äºä»¶ 274 if (!/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Mobi/i.test(navigator.userAgent)) { 275 $("#navbar-collapse [data-toggle='dropdown']").removeAttr("data-toggle"); 276 } else { 277 $(".navbar-nav ul li:not(.dropdown-submenu):not(.dropdown) a").removeAttr("data-toggle"); 278 } 279 280 if (!isMobile) { 281 var search = $("#searchinput"); 282 var form = search.closest("form"); 283 search.autoComplete({ 284 minChars: 1, 285 cache: false, 286 menuClass: 'autocomplete-searchmenu', 287 header: '', 288 footer: '', 289 source: function (term, response) { 290 try { 291 xhr.abort(); 292 } catch (e) { 293 } 294 xhr = $.getJSON(search.data("suggestion-url"), {q: term}, function (data) { 295 response(data); 296 }); 297 }, 298 onSelect: function (e, term, item) { 299 if (typeof callback === 'function') { 300 callback.call(elem, term, item); 301 } else { 302 form.trigger("submit"); 303 } 304 } 305 }); 306 } 307 308 // ææºç«¯å·¦å³æ»å¨åæ¢èåæ 309 if (isMobile && 'ontouchstart' in document.documentElement) { 310 var startX, startY, moveEndX, moveEndY, relativeX, relativeY, element; 311 element = $('#navbar-collapse'); 312 $("body").on("touchstart", function (e) { 313 startX = e.originalEvent.changedTouches[0].pageX; 314 startY = e.originalEvent.changedTouches[0].pageY; 315 }); 316 $("body").on("touchend", function (e) { 317 moveEndX = e.originalEvent.changedTouches[0].pageX; 318 moveEndY = e.originalEvent.changedTouches[0].pageY; 319 relativeX = moveEndX - startX; 320 relativeY = moveEndY - startY; 321 322 //峿» 323 if (relativeX > 45) { 324 if ((Math.abs(relativeX) - Math.abs(relativeY)) > 50 && !element.hasClass("active") && startX < ($(window).width() / 4)) { 325 $(".sidebar-toggle").trigger("click"); 326 } 327 } 328 //å·¦æ» 329 else if (relativeX < -45) { 330 if ((Math.abs(relativeX) - Math.abs(relativeY)) > 50 && element.hasClass("active")) { 331 $(".sidebar-toggle").trigger("click"); 332 } 333 } 334 }); 335 } 336 337 // æèµ 338 $(".btn-donate").popover({ 339 trigger: 'hover', 340 placement: 'top', 341 html: true, 342 content: function () { 343 return "<img src='" + $(this).data("image") + "' width='250' height='250'/>"; 344 } 345 }); 346 $(document).on("click", ".btn-paynow", function () { 347 var paytype = $(this).data("paytype"); 348 var price = $(this).data("price"); 349 var nameArr = {wechat: "微信", alipay: "æ¯ä»å®", balance: "ä½é¢"}; 350 var that = this; 351 var tips = function () { 352 layer.confirm("è¯·æ ¹æ®æ¯ä»ç¶æéæ©ä¸é¢çæä½æé®", {title: "温馨æç¤º", icon: 0, btn: ["æ¯ä»æå", "æ¯ä»å¤±è´¥"]}, function () { 353 location.reload(); 354 }); 355 }; 356 if (paytype) { 357 layer.confirm("确认使ç¨" + (typeof nameArr[paytype] !== 'undefined' ? nameArr[paytype] : "æªç¥") + "è¿è¡æ¯ä»?<br>æ¯ä»éé¢ï¼ï¿¥" + price + "å ", {title: "温馨æç¤º", icon: 3, focusBtn: false, btn: ["ç«å³æ¯ä»", "åæ¶æ¯ä»"]}, function (index, layero) { 358 $(".layui-layer-btn0", layero).attr("href", $(that).attr("href")).attr("target", "_blank"); 359 tips(); 360 }); 361 return false;
362 } else { 363 tips(); 364 } 365 }); 366 367 //ç¹å»åæ¢ 368 $(document).on("click", ".sidebar-toggle", function () { 369 var collapse = $("#navbar-collapse"); 370 if (collapse.hasClass("active")) { 371 $(".navbar-collapse-bg").remove(); 372 } else { 373 $("<div />").addClass("navbar-collapse-bg").insertAfter(collapse).on("click", function () { 374 $(".sidebar-toggle").trigger("click"); 375 }); 376 } 377 collapse.toggleClass("active"); 378 $(this).toggleClass("active"); 379 }); 380 381 //å 容ä¸çå¾çç¹å»äºä»¶ 382 $(document).on("click", ".article-text img", function () { 383 if ($(this).closest("a").length > 0) { 384 return; 385 } 386 var that = this; 387 var data = []; 388 var index = 0; 389 $(".article-text img").each(function (i, j) { 390 if (that == this) { 391 index = i; 392 } 393 data.push({ 394 "src": $(this).attr("src") //åå¾å°å 395 }); 396 }); 397 layer.photos({ 398 photos: { 399 "start": index, "data": data 400 }, 401 // scrollbar: true, 402 // full: true, 403 // closeBtn: 1 404 }); 405 return false; 406 }); 407 408 //åäº«åæ°é ç½® 409 var shareConfig = { 410 title: $("meta[property='og:title']").attr("content") || document.title, 411 description: $("meta[property='og:description']").attr("content") || $("meta[name='description']").attr("content") || "", 412 url: $("meta[property='og:url']").attr("content") || location.href, 413 // image: $("meta[property='og:image']").attr("content") || "" 414 image:"https://www.cctv-cmpany.net/uploads/20241217/f42639c957c4b161a33914077f1e990e.jpg" 415 }; 416 417 //å¾®ä¿¡å ¬ä¼å·å å享 418 if (typeof wx != 'undefined') { 419 shareConfig.url = location.href; 420 CMS.api.ajax({ 421 url: "/addons/cms/ajax/share", 422 data: {url: shareConfig.url}, 423 loading: false 424 }, function (data, ret) { 425 try { 426 wx.config({ 427 appId: data.appId, 428 timestamp: data.timestamp, 429 nonceStr: data.nonceStr, 430 signature: data.signature, 431 jsApiList: [ 432 'checkJsApi', 433 'updateAppMessageShareData', 434 'updateTimelineShareData', 435 ] 436 }); 437 var shareData = { 438 title: shareConfig.title, 439 desc: shareConfig.description, 440 link: shareConfig.url, 441 imgUrl: shareConfig.image, 442 success: function () { 443 layer.closeAll(); 444 }, 445 cancel: function () { 446 layer.closeAll(); 447 } 448 }; 449 wx.ready(function () { 450 wx.updateAppMessageShareData(shareData); 451 wx.updateTimelineShareData(shareData); 452 }); 453 454 } catch (e) { 455 console.log(e); 456 } 457 return false; 458 }, function () { 459 return false; 460 } 461 ); 462 463 $(".social-share").on("click", ".icon-wechat", function () { 464 layer.msg("请ç¹å»å³ä¸è§çâââè¿è¡å享"); 465 return false; 466 }).find(".wechat-qrcode").remove(); 467 } 468 // æ´æ¢é¦é¡µlogo 469 var pathname = window.location.pathname; 470 if (pathname == '/') { 471 var logoimg = '/uploads/20241125/d7a94678746f86f9458216a1c6fe989d.png'; 472 $('.navbar-brand img').attr('src',logoimg) 473 $('.nav-home').hide() 474 } 475 476 $('#more_open').click(function(){ 477 $('.nav3').animate({height:'468px'}); 478 $(this).hide(); 479 $('#more_close').show(); 480 }) 481 $('#more_close').click(function(){ 482 $('.nav3').animate({height:'35px'}); 483 $(this).hide(); 484 $('#more_open').show() 485 }) 486});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.