1var MyTheme = { 2 'Browser': { 3 url: document.URL, 4 domain: document.domain, 5 title: document.title, 6 language: (navigator.browserLanguage || navigator.language).toLowerCase(), 7 canvas: function() { 8 return !!document.createElement("canvas").getContext 9 }(), 10 useragent: function() { 11 var a = navigator.userAgent; 12 return { 13 mobile: !! a.match(/AppleWebKit.*Mobile.*/), 14 ios: !! a.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), 15 android: -1 < a.indexOf("Android") || -1 < a.indexOf("Linux"), 16 iPhone: -1 < a.indexOf("iPhone") || -1 < a.indexOf("Mac"), 17 iPad: -1 < a.indexOf("iPad"), 18 trident: -1 < a.indexOf("Trident"), 19 presto: -1 < a.indexOf("Presto"), 20 webKit: -1 < a.indexOf("AppleWebKit"), 21 gecko: -1 < a.indexOf("Gecko") && -1 == a.indexOf("KHTML"), 22 weixin: -1 < a.indexOf("MicroMessenger") 23 } 24 }() 25 }, 26 'Cookie': { 27 'Set':function(name,value,days){ 28 var expires; 29 if (days) { 30 expires = days; 31 } else{ 32 expires = ""; 33 } 34 $.cookie(name,value,{expires:expires,path:'/'}); 35 }, 36 'Get':function(name){ 37 var styles = $.cookie(name); 38 return styles; 39 }, 40 'Del':function(name,tips){ 41 if(window.confirm(tips)){ 42 $.cookie(name,null,{expires:-1,path: '/'}); 43 location.reload(); 44 }else{ 45 return false; 46 } 47 } 48 }, 49 'Ajax':function(url,type,dataType,data,sfun,efun,cfun){ 50 type=type||'get'; 51 dataType=dataType||'json'; 52 data=data||''; 53 efun=efun||''; 54 cfun=cfun||''; 55 56 $.ajax({ 57 url:url, 58 type:type, 59 dataType:dataType, 60 data:data, 61 timeout: 5000, 62 beforeSend:function(XHR){ 63 }, 64 error:function(XHR,textStatus,errorThrown){ 65 if(efun) efun(XHR,textStatus,errorThrown); 66 }, 67 success:function(data){ 68 sfun(data); 69 }, 70 complete:function(XHR, TS){ 71 if(cfun) cfun(XHR, TS); 72 } 73 }) 74 }, 75 'Mobile': { 76 'Nav': { 77 'Init': function() { 78 if($(".nav-slide").length){ 79 $(".nav-slide").each(function(){ 80 var $that = $(this); 81 MyTheme.Mobile.Nav.Set($that,$that.attr('data-align')); 82 }); 83 } 84 }, 85 'Set': function(id,align) { 86 $index = id.find('.active').index()*1; 87 if($index > 3){ 88 $index = $index-3; 89 }else{ 90 $index = 0; 91 } 92 id.flickity({ 93 cellAlign: align, 94 freeScroll: true, 95 contain: true, 96 prevNextButtons: false, 97 pageDots: false, 98 percentPosition: true, 99 initialIndex: $index 100 }); 101 } 102 }, 103 'Mshare': function() { 104 $(".open-share").click(function() { 105 MyTheme.Browser.useragent.weixin ? $("body").append('<div class="mobile-share share-weixin"></div>') : $("body").append('<div class="mobile-share share-other"></div>'); 106 $(".mobile-share").click(function() { 107 $(".mobile-share").remove(); 108 $("body").removeClass("modal-open"); 109 }); 110 }); 111 } 112 }, 113 'Images': { 114 'Lazyload': function() { 115 $(".lazyload").lazyload({ 116 effect: "fadeIn", 117 threshold: 200, 118 failure_limit : 1, 119 skip_invisible : false, 120 }); 121 }, 122 'Qrcode': { 123 'Init': function() { 124 if($("#qrcode").length){ 125 var $that = $("#qrcode"); 126 MyTheme.Images.Qrcode.Set($that.attr('data-link'),$that.attr('data-dark'),$that.attr('data-light')); 127 $that.attr("class","img-responsive"); 128 } 129 }, 130 'Set': function(url,dark,light) { 131 url=0||location.href; 132 var qrcode = new QRCode('qrcode', { 133 text: url, 134 width: 120, 135 height: 120, 136 colorDark : dark, 137 colorLight : light, 138 correctLevel : QRCode.CorrectLevel.H 139 }); 140 } 141 }, 142 'Flickity': { 143 'Init': function() { 144 if($(".flickity").length){ 145 $(".flickity").each(function(){ 146 var $that = $(this); 147 MyTheme.Images.Flickity.Set($that,$that.attr('data-align'),$that.attr('data-dots'),$that.attr('data-next'),$that.attr('data-play')); 148 //MyTheme.Images.Lazyload(); 149 }); 150 } 151 },
152 'Set': function(id,align,dots,next,play) { 153 dots=dots||false; 154 next=next||false; 155 play=play||false; 156 id.flickity({ 157 cellAlign: align, 158 wrapAround: true, 159 contain: true, 160 pageDots: dots, 161 autoPlay: play, 162 percentPosition: true, 163 prevNextButtons: next 164 }); 165 } 166 } 167 }, 168 'Link': { 169 'Copy': { 170 'Init': function() { 171 $(".myui-copy-link").each(function(){ 172 var links = $(this).attr("data-url"); 173 MyTheme.Link.Copy.Set(this,links); 174 }); 175 $(".myui-copy-html").each(function(){ 176 var html = $(this).parent().find(".content").html(); 177 MyTheme.Link.Copy.Set(this,html); 178 }); 179 }, 180 'Set': function(id,content) { 181 var clipboard = new Clipboard(id, { 182 text: function() { 183 return content; 184 } 185 }); 186 clipboard.on('success', function(e) { 187 layer.msg('å¤å¶æå'); 188 }); 189 clipboard.on("error",function(e){ 190 layer.msg('å¤å¶å¤±è´¥ï¼è¯·æå¨å¤å¶'); 191 }); 192 } 193 194 }, 195 'Short': function(){ 196 $(".myui-short").each(function(){ 197 var codyId = this; 198 var shortId = $(this); 199 var shortUrl = shortId.val() || shortId.attr("data-url"); 200 var linkText = shortId.attr("data-text"); 201 if(myui.short==1){ 202 $.ajax({ 203 type : 'GET', 204 url : myui.shortapi+shortUrl, 205 dataType : 'jsonp', 206 success : function(r) { 207 url_short = r.data.url_short; 208 if(shortId.val()){ 209 shortId.val(linkText+url_short); 210 }else if(shortId.attr("data-url")){ 211 shortId.attr("data-url",url_short); 212 MyTheme.Link.Copy.Set(codyId,linkText+url_short); 213 } 214 } 215 }); 216 }else{ 217 if(shortId.val()){ 218 shortId.val(linkText+shortUrl); 219 }else if(shortId.attr("data-url")){ 220 shortId.attr("data-url",shortUrl); 221 MyTheme.Link.Copy.Set(codyId,linkText+shortUrl); 222 } 223 } 224 }); 225 } 226 }, 227 'Layer': { 228 'Img': function(title,src,text) { 229 layer.open({ 230 type: 1, 231 title: title, 232 skin: 'layui-layer-rim', 233 content: '<div class="col-pd"><p><img src="'+src+'" width="240" /></p><p class="text-center">'+text+'</p></div>' 234 }); 235 }, 236 'Html': function(title,html) { 237 layer.open({ 238 type: 1, 239 title: title, 240 skin: 'layui-layer-rim', 241 content: '<div class="col-pd">'+html+'</div>' 242 }); 243 }, 244 'Popbody': function(name,title,html,day,wide,high) { 245 var pop_is = MyTheme.Cookie.Get(name); 246 var html = $(html).html(); 247 if(!pop_is){ 248 layer.open({ 249 type: 1, 250 title: title, 251 skin: 'layui-layer-rim', 252 content: html, 253 area: [wide+'px', high+'px'], 254 cancel: function(){ 255 MyTheme.Cookie.Set(name,1,day); 256 } 257 }); 258 } 259 } 260 }, 261 'Other': { 262 'Headroom': function() { 263 if($("#header-top").length){ 264 var header = document.querySelector("#header-top"); 265 var headroom = new Headroom(header, { 266 tolerance: 5, 267 offset: 205, 268 classes: { 269 initial: "top-fixed", 270 pinned: "top-fixed-up", 271 unpinned: "top-fixed-down" 272 } 273 }); 274 headroom.init(); 275 } 276 $(".dropdown-hover").click(function(){ 277 $(this).find(".dropdown-box").toggle(); 278 }); 279 }, 280 'Popup': function(id) { 281 $(id).addClass("popup-visible"); 282 $("body").append('<div class="mask"></div>').addClass("hidden"); 283 $(".close-popup").click(function() { 284 $(id).removeClass("popup-visible"); 285 $(".mask").remove(); 286 $("body").removeClass("hidden"); 287 }); 288 $(".mask").click(function() { 289 $(id).removeClass("popup-visible"); 290 $(this).remove(); 291 $("body").removeClass("hidden"); 292 }); 293 }, 294 'Bootstrap': function() { 295 $('a[data-toggle="tab"]').on("shown.bs.tab", function(a) { 296 var b = $(a.target).text(); 297 $(a.relatedTarget).text(); 298 $("span.active-tab").html(b); 299 }); 300 }, 301 'Skin': function() { 302 var skinnum = 0,act; 303 var lengths = $("link[name='skin']").length; 304 $('.btnskin').click(function() { 305 skinnum+=1; 306 if(skinnum==lengths){skinnum=0;} 307 var skin = $("link[name='skin']").eq(skinnum).attr("href"); 308 layer.msg("æ£å¨åæ¢ç®è¤ï¼è¯·ç¨å...",{anim:5,time: 2000},function(){ 309 $("link[name='default']").attr({href:skin}); 310 }); 311 MyTheme.Cookie.Set('skinColor',skin,365); 312 }); 313 var color = MyTheme.Cookie.Get('skinColor'); 314 if(color){ 315 $("link[name='default']").attr({href:color}); 316 } 317 }, 318 'Sort': function() { 319 $(".sort-button").each(function(){ 320 $(this).on("click",function(e){ 321 e.preventDefault(); 322 $(this).parent().parent().parent().find(".sort-list").each(function(){ 323 var playlist=$(this).find("li"); 324 for(let i=0,j=playlist.length-1;i<j;){ 325 var l=playlist.eq(i).clone(true); 326 var r=playlist.eq(j).replaceWith(l); 327 playlist.eq(i).replaceWith(r); 328 ++i; 329 --j; 330 } 331 }); 332 }); 333 }); 334 }, 335 'Search': function() { 336 $(".search-select p,.search-select li").click(function() { 337 var action =$(this).attr("data-action"); 338 $("#search").attr("action",action); 339 $(".search-select .text").text($(this).html()); 340 }); 341 $(".search_submit").click(function() { 342 var value=$(".search_wd").val(); 343 if (!value) {
344 var wd=$(".search_wd").attr("placeholder"); 345 $(".search_wd").val(wd); 346 } 347 }); 348 $(".open-search").click(function(){ 349 var seacrhBox=$(".search-box"); 350 seacrhBox.addClass("active").siblings().hide(); 351 seacrhBox.find(".form-control").focus(); 352 seacrhBox.find(".head-dropdown").toggle(); 353 $(".search-close").click(function(){ 354 seacrhBox.removeClass("active").siblings().show(); 355 seacrhBox.find(".dropdown-box").hide(); 356 }); 357 }); 358 }, 359 'Collapse': function() { 360 $(".text-collapse").each(function(){ 361 $(this).find(".details").on("click",function(){ 362 $(this).parent().find(".sketch").addClass("hide"); 363 $(this).parent().find(".data").css("display",""); 364 $(this).remove(); 365 }); 366 }); 367 }, 368 'Scrolltop': function() { 369 var a = $(window); 370 $scrollTopLink = $("a.backtop"); 371 a.scroll(function() { 372 500 < $(this).scrollTop() ? $scrollTopLink.css("display", "") : $scrollTopLink.css("display", "none"); 373 }); 374 $scrollTopLink.on("click", function() { 375 $("html, body").animate({ 376 scrollTop: 0 377 }, 400); 378 return true; 379 }); 380 }, 381 'Slidedown': function() { 382 var display = $('.slideDown-box'); 383 $(".slideDown-btn").click(function() { 384 if(display.css('display') == 'block'){ 385 display.slideUp("slow"); 386 $(this).html('å±å¼ <i class="fa fa-angle-down"></i>'); 387 MyTheme.Mobile.Nav.Init(); 388 }else{ 389 display.slideDown("slow"); 390 $(this).html('æ¶èµ· <i class="fa fa-angle-up"></i>'); 391 MyTheme.Mobile.Nav.Init(); 392 } 393 }); 394 }, 395 'History': { 396 'Init':function(){ 397 if($(".vod_history").length){ 398 var $that = $(".vod_history"); 399 MyTheme.Other.History.Set($that.attr('data-name'),$that.attr('data-link'),$that.attr('data-pic'),$that.attr('data-part'),$that.attr('data-limit')); 400 } 401 }, 402 'Set':function(name,link,pic,part,limit){ 403 if(!link){ link = document.URL;} 404 var history = MyTheme.Cookie.Get("history"); 405 var len=0; 406 var canadd=true; 407 if(history){ 408 history = eval("("+history+")"); 409 len=history.length; 410 $(history).each(function(){ 411 if(name==this.name){ 412 canadd=false; 413 var json="["; 414 $(history).each(function(i){ 415 var temp_name,temp_img,temp_url,temp_part; 416 if(this.name==name){ 417 temp_name=name;temp_img=pic;temp_url=link;temp_part=part; 418 }else{ 419 temp_name=this.name;temp_img=this.pic;temp_url=this.link;temp_part=this.part; 420 } 421 json+="{\"name\":\""+temp_name+"\",\"pic\":\""+temp_img+"\",\"link\":\""+temp_url+"\",\"part\":\""+temp_part+"\"}"; 422 if(i!=len-1) 423 json+=","; 424 }) 425 json+="]"; 426 MyTheme.Cookie.Set('history',json,365); 427 return false; 428 } 429 }); 430 } 431 if(canadd){ 432 var json="["; 433 var start=0; 434 var isfirst="]"; 435 isfirst=!len?"]":","; 436 json+="{\"name\":\""+name+"\",\"pic\":\""+pic+"\",\"link\":\""+link+"\",\"part\":\""+part+"\"}"+isfirst; 437 if(len>limit-1) 438 len-=1; 439 for(i=0;i<len-1;i++){ 440 json+="{\"name\":\""+history[i].name+"\",\"pic\":\""+history[i].pic+"\",\"link\":\""+history[i].link+"\",\"part\":\""+history[i].part+"\"},"; 441 } 442 if(len>0){ 443 json+="{\"name\":\""+history[len-1].name+"\",\"pic\":\""+history[len-1].pic+"\",\"link\":\""+history[len-1].link+"\",\"part\":\""+history[len-1].part+"\"}]"; 444 } 445 MyTheme.Cookie.Set('history',json,365); 446 } 447 } 448 }, 449 'Player': function() { 450 if($("#player-left").length){ 451 var PlayerLeft = $("#player-left"); 452 var PlayerSide = $("#player-sidebar"); 453 var LeftHeight = PlayerLeft.outerHeight(); 454 var Position = $("#playlist li.playon").position().top; 455 $("#player-sidebar-is").click(function() {
456 PlayerSide.toggle(); 457 if(PlayerSide.css("display")==='none') { 458 PlayerLeft.css("width","100%"); 459 $(this).html("<i class='fa fa-angle-left'></i>"); 460 } 461 if(PlayerSide.css("display")==='block') { 462 PlayerLeft.css("width",""); 463 $(this).html("<i class='fa fa-angle-right'></i>"); 464 } 465 }); 466 if(!MyTheme.Browser.useragent.mobile){ 467 PlayerSide.css({"height":LeftHeight,"overflow":"auto"}); 468 PlayerSide.scrollTop(Position); 469 } 470 } 471 if($(".player-fixed").length){ 472 if(!MyTheme.Browser.useragent.mobile){ 473 $(window).scroll(function(){ 474 if($(window).scrollTop()>window.outerHeight){ 475 $(".player-fixed").addClass("fixed fadeInDown"); 476 $(".player-fixed-off").show(); 477 478 }else if($(window).scrollTop()<window.outerHeight){ 479 $(".player-fixed").removeClass("fixed fadeInDown"); 480 $(".player-fixed-off").hide(); 481 } 482 }); 483 } 484 $(".player-fixed-off").click(function() { 485 $(".player-fixed").removeClass("fixed fadeInDown"); 486 }); 487 } 488 489 }, 490 'Close': function() { 491 $(".close-btn").on("click",function(){ 492 $(this).parents(".close-box").remove(); 493 }); 494 }, 495 'Roll': function(obj,higt) { 496 setInterval(function(){ 497 $(obj).find("ul").animate({ 498 marginTop : higt, 499 },500,function(){ 500 $(this).css({marginTop : "0px"}).find("li:first").appendTo(this); 501 }) 502 }, 3000); 503 }, 504 'Share': function(){ 505 if(".bdshare".length){ 506 window._bd_share_config = { 507 common: { 508 bdText: '', 509 bdDesc: '', 510 bdUrl: '', 511 bdPic: '' 512 }, 513 share: [{ 514 "bdSize": 24, 515 bdCustomStyle: myui.tpl+'statics/css/mytheme-share.css' 516 }] 517 } 518 with(document)0[(getElementsByTagName("head")[0]||body).appendChild(createElement('script')).src=''+myui.bdapi+'?cdnversion='+~(-new Date()/36e5)]; 519 } 520 } 521 } 522}; 523 524$(function(){ 525 if(MyTheme.Browser.useragent.mobile){ 526 MyTheme.Mobile.Nav.Init(); 527 MyTheme.Mobile.Mshare(); 528 } 529 MyTheme.Images.Lazyload(); 530 MyTheme.Images.Flickity.Init(); 531 MyTheme.Link.Copy.Init(); 532 MyTheme.Link.Short(); 533 MyTheme.Other.Bootstrap(); 534 MyTheme.Other.Sort(); 535 MyTheme.Other.Headroom(); 536 MyTheme.Other.Search(); 537 MyTheme.Other.Collapse(); 538 MyTheme.Other.Slidedown(); 539 MyTheme.Other.Scrolltop(); 540 MyTheme.Other.History.Init(); 541 MyTheme.Other.Player(); 542 MyTheme.Other.Close(); 543});
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.