PageSourceSearch

http://www.yh-dm.com/template/mytheme/statics/js/mytheme-ui.js?v=2.8

js yh-dm.com collected 2026-10-06 13:15:44 UTC 21,764 bytes, 723 lines download raw bytes

1/*!
2 * 版本:MYUI Copyright © 2019
3 * 作者:QQ726662013版权所有
4 * 官网:https://www.mytheme.cn
5 */
6
7var MyTheme = {
8	'Browser': {
9		url: document.URL,
10		domain: document.domain,
11		title: document.title,
12		language: (navigator.browserLanguage || navigator.language).toLowerCase(),
13		canvas: function() {
14			return !!document.createElement("canvas").getContext
15		}(),
16		useragent: function() {
17			var a = navigator.userAgent;
18			return {
19				mobile: !! a.match(/AppleWebKit.*Mobile.*/),
20				ios: !! a.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/),
21				android: -1 < a.indexOf("Android") || -1 < a.indexOf("Linux"),
22				iPhone: -1 < a.indexOf("iPhone") || -1 < a.indexOf("Mac"),
23				iPad: -1 < a.indexOf("iPad"),
24				trident: -1 < a.indexOf("Trident"),
25				presto: -1 < a.indexOf("Presto"),
26				webKit: -1 < a.indexOf("AppleWebKit"),
27				gecko: -1 < a.indexOf("Gecko") && -1 == a.indexOf("KHTML"),
28				weixin: -1 < a.indexOf("MicroMessenger")
29			}
30		}()
31	},
32	'Cookie': {
33		'Set':function(name,value,days){
34	        var expires;
35	        if (days) {
36	            expires = days;
37	        } else{
38	            expires = "";
39	        }
40	        $.cookie(name,value,{expires:expires,path:'/'});
41		},
42		'Get':function(name){
43			var styles = $.cookie(name);
44		    return styles;
45		},
46		'Del':function(name,tips){
47			if(window.confirm(tips)){
48	            $.cookie(name,null,{expires:-1,path: '/'});
49	            location.reload();
50	       	}else{
51	            return false;
52	        }
53		}
54	},
55	'Ajax':function(url,type,dataType,data,sfun,efun,cfun){
56        type=type||'get';
57        dataType=dataType||'json';
58        data=data||'';
59        efun=efun||'';
60        cfun=cfun||'';
61
62        $.ajax({
63            url:url,
64            type:type,
65            dataType:dataType,
66            data:data,
67            timeout: 5000,
68            beforeSend:function(XHR){
69            },
70            error:function(XHR,textStatus,errorThrown){
71                if(efun) efun(XHR,textStatus,errorThrown);
72            },
73            success:function(data){
74                sfun(data);
75            },
76            complete:function(XHR, TS){
77                if(cfun) cfun(XHR, TS);
78            }
79        })
80    },
81	'Mobile': {	
82		'Nav': {
83			'Init': function() {
84				if($(".nav-slide").length){
85					$(".nav-slide").each(function(){
86						var $that = $(this);
87	                	MyTheme.Mobile.Nav.Set($that,$that.attr('data-align'));
88	                });
89				}
90			},
91			'Set': function(id,align) {
92				$index = id.find('.active').index()*1;
93				if($index > 3){
94					$index = $index-3;
95				}else{
96					$index = 0;
97				}
98				id.flickity({
99				  	cellAlign: align,
100					freeScroll: true,
101					contain: true,
102					prevNextButtons: false,				
103					pageDots: false,
104					percentPosition: true,
105					initialIndex: $index
106				});	
107			}	
108		},
109		'Mshare': function() {
110			$(".open-share").click(function() {
111				MyTheme.Browser.useragent.weixin ? $("body").append('<div class="mobile-share share-weixin"></div>') : $("body").append('<div class="mobile-share share-other"></div>');
112				$(".mobile-share").click(function() {
113					$(".mobile-share").remove();
114					$("body").removeClass("modal-open");
115				});
116			});
117		}
118	},
119	'Images': {
120		'Lazyload': function() {
121			$(".lazyload").lazyload({
122				effect: "fadeIn",
123				threshold: 200,
124				failure_limit : 10,
125				skip_invisible : false
126			});
127		},
128		'Qrcode': {
129			'Init': function() {
130				if($("#qrcode").length){
131					var $that = $("#qrcode");
132	                MyTheme.Images.Qrcode.Set($that.attr('data-link'),$that.attr('data-dark'),$that.attr('data-light'));
133	                $that.attr("class","img-responsive");
134				}
135			},
136			'Set':  function(url,dark,light) {
137				url=0||location.href;
138				var qrcode = new QRCode('qrcode', {
139				  	text: url,
140				  	width: 120,
141				  	height: 120,
142				  	colorDark : dark,
143				  	colorLight : light,
144				  	correctLevel : QRCode.CorrectLevel.H
145				});
146			}	
147		},
148		'Flickity': {
149			'Init': function() {
150				if($(".flickity").length){
151					$(".flickity").each(function(){
152						var $that = $(this);
153	                	MyTheme.Images.Flickity.Set($that,$that.attr('data-align'),$that.attr('data-dots'),$that.attr('data-next'),$that.attr('data-play'));
154						$(this).click(function() {
155							$(".lazyload").lazyload();
156						});
157	                });
158				}
159			},
160			'Set': function(id,align,dots,next,play) {
161				dots=dots||false;
162				next=next||false;
163				play=play||false;
164				id.flickity({
165				  	cellAlign: align,
166				  	wrapAround: true,
167				  	contain: true,
168				  	pageDots: dots,
169					autoPlay: play,
170				  	percentPosition: true,
171				  	prevNextButtons: next
172				});	
173			}	
174		}
175	},
176	'Link': {
177		'Copy': {
178			'Init': function() {
179				$(".myui-copy-link").each(function(){
180					var links = $(this).attr("data-url");
181					MyTheme.Link.Copy.Set(this,links);
182				});
183				$(".myui-copy-html").each(function(){
184					var html = $(this).parent().find(".content").html();
185					MyTheme.Link.Copy.Set(this,html);
186				});
187			},
188			'Set': function(id,content) {
189				var clipboard = new Clipboard(id, {
190					text: function() {									
191						return content;
192					}
193				});
194				clipboard.on('success', function(e) {
195					layer.msg('复制成功');
196				});
197				clipboard.on("error",function(e){
198				    layer.msg('复制失败,请手动复制');
199				});
200			}
201			
202		},
203		'Short': function(){
204			$(".myui-short").each(function(){
205				var codyId = this;
206				var shortId = $(this);
207				var shortUrl = shortId.val() || shortId.attr("data-url");
208				var linkText = shortId.attr("data-text");
209				if(myui.short==1){
210					$.ajax({
211						type : 'GET',
212						url : myui.shortapi+encodeURIComponent(shortUrl),
213						dataType : 'jsonp',
214						success : function(r) {
215							url_short = r.data.urls[0].url_short;
216							if(shortId.val()){
217								shortId.val(linkText+url_short);
218							}else if(shortId.attr("data-url")){
219								shortId.attr("data-url",url_short);
220								MyTheme.Link.Copy.Set(codyId,linkText+url_short);
221							}
222						}
223					});
224				}else{
225					if(shortId.val()){
226						shortId.val(linkText+shortUrl);
227					}else if(shortId.attr("data-url")){
228						shortId.attr("data-url",shortUrl);
229						MyTheme.Link.Copy.Set(codyId,linkText+shortUrl);
230					}	
231				}
232			});
233		}
234	},
235	'Layer': {
236		'Img': function(title,src,text) {
237			layer.open({
238	   			type: 1,
239		    	title: title,
240		  		skin: 'layui-layer-rim',
241		  		content: '<div class="col-pd"><p><img src="'+src+'" width="240" /></p><p class="text-center">'+text+'</p></div>'
242		    });
243		},
244		'Html': function(title,html) {
245			layer.open({
246	   			type: 1,
247		    	title: title,
248		  		skin: 'layui-layer-rim',
249		  		content: '<div class="col-pd">'+html+'</div>'
250		    });
251		},
252		'Div': function(id) {
253			layer.open({
254				type: 1,
255				title:false,
256				skin: 'layui-layer-rim',
257				content: $(id)
258			});
259		},
260		'Popbody': function(name,html,day,wide,high) {
261			var pop_is = MyTheme.Cookie.Get(name);
262			var html = $(html).html();
263			if(!pop_is){
264				layer.open({
265					type: 1,
266					title: false,
267					//skin: 'layui-layer-rim',
268					content: html,
269					area: [wide+'px', high+'px'],
270					cancel: function(){
271						MyTheme.Cookie.Set(name,1,day);
272					}
273				});
274			}
275		}
276	},
277	'Other': {
278		'Headroom': function() {
279			if($("#header-top").length){
280				var header = document.querySelector("#header-top");
281	            var headroom = new Headroom(header, {
282					tolerance: 5,
283					offset: 205,
284					classes: {
285						initial: "top-fixed",
286						pinned: "top-fixed-up",
287						unpinned: "top-fixed-down"
288					}
289				});
290				headroom.init();
291			}
292			
293		},
294		'Popup': function(id) {
295			$(id).addClass("popup-visible");
296			$("body").append('<div class="mask"></div>').addClass("hidden");
297			$(".close-popup").click(function() {
298				$(id).removeClass("popup-visible");
299				$(".mask").remove();
300				$("body").removeClass("hidden");
301			});
302			$(".mask").click(function() {
303				$(id).removeClass("popup-visible");
304				$(this).remove();
305				$("body").removeClass("hidden");
306			});
307		},
308		'Bootstrap': function() {
309			$('a[data-toggle="tab"]').on("shown.bs.tab", function(a) {
310				var b = $(a.target).text();
311				$(a.relatedTarget).text();
312				$("span.active-tab").html(b);
313				$(".lazyload").lazyload();
314			});
315		},
316		'Skin': function() {
317			var skinnum = 0,act;
318		    var lengths = $("link[name='skin']").length;
319		    $('.btnskin').click(function() {
320		        skinnum+=1;
321		        if(skinnum==lengths){skinnum=0;}
322		        var skin = $("link[name='skin']").eq(skinnum).attr("href");
323		        layer.msg("正在切换皮肤,请稍后...",{anim:5,time: 2000},function(){
324		        	$("link[name='default']").attr({href:skin});
325		        });
326		        MyTheme.Cookie.Set('skinColor',skin,365);
327		    });
328		    var color = MyTheme.Cookie.Get('skinColor');
329		    if(color){
330		        $("link[name='default']").attr({href:color});
331		    }  
332		},
333		'Sort': function() {
334			$(".sort-button").each(function(){
335				$(this).on("click",function(e){
336					e.preventDefault();
337					$(this).parent().parent().parent().find(".sort-list").each(function(){
338					    var playlist=$(this).find("li");
339					    for(let i=0,j=playlist.length-1;i<j;){
340					        var l=playlist.eq(i).clone(true);
341					        var r=playlist.eq(j).replaceWith(l);
342					        playlist.eq(i).replaceWith(r);
343					        ++i;
344					        --j;
345					    }
346					});
347				});
348			});
349		},
350		'Search': function() {		    	
351			$(".search-select p,.search-select li").click(function() {
352	    		var action =$(this).attr("data-action");
353	    		$("#search").attr("action",action);
354	    		$(".search-select .text").text($(this).html());
355		    });			
356			$(".search_submit").click(function() {
357	    		var value=$(".search_wd").val();
358                if (!value) {
359                    var wd=$(".search_wd").attr("placeholder");
360                    $(".search_wd").val(wd);
361                }
362	    	});
363	    	$(".open-search").click(function(){
364				var seacrhBox=$(".search-box");
365				seacrhBox.addClass("active").siblings().hide();
366				seacrhBox.find(".form-control").focus();
367				seacrhBox.find(".head-dropdown").toggle();
368				$(".search-close").click(function(){
369					seacrhBox.removeClass("active").siblings().show();
370					seacrhBox.find(".dropdown-box").hide();
371				});
372			});	
373		},
374		'Collapse': function() {
375			$(".text-collapse").each(function(){
376				$(this).find(".details").on("click",function(){
377					$(this).parent().find(".sketch").addClass("hide");
378					$(this).parent().find(".data").css("display","");
379					$(this).remove();
380				});
381			});
382			$(".dropdown-hover").click(function(){
383				$(this).find(".dropdown-box").toggle();
384			});
385		},
386		'Scrolltop': function() {
387			var a = $(window);
388			$scrollTopLink = $("a.backtop");
389			a.scroll(function() {
390				500 < $(this).scrollTop() ? $scrollTopLink.css("display", "") : $scrollTopLink.css("display", "none");
391			});
392			$scrollTopLink.on("click", function() {
393				$("html, body").animate({
394					scrollTop: 0
395				}, 400);
396				return true;
397			});
398		},
399		'Slidedown': function() {
400			var display = $('.slideDown-box');
401			
402			$(".slideDown-btn").click(function() {
403				
404		  		if(display.css('display') == 'block'){
405		  			display.slideUp("slow");
406		  			$(this).html('展开  <i class="fa fa-angle-down"></i>');
407				}else{
408					display.slideDown("slow"); 
409					$(this).html('收起   <i class="fa fa-angle-up"></i>');
410				}
411			});
412		},
413		'History': {
414			'Init':function(){
415				if($(".vod_history").length){
416	                var $that = $(".vod_history");
417	                MyTheme.Other.History.Set($that.attr('data-name'),$that.attr('data-link'),$that.attr('data-pic'),$that.attr('data-part'),$that.attr('data-limit'));
418	            }
419			},
420			'Set':function(name,link,pic,part,limit){
421				if(!link){ link = document.URL;}
422				var history = MyTheme.Cookie.Get("history");
423			    var len=0;
424			    var canadd=true;
425			    if(history){
426			        history = eval("("+history+")"); 
427			        len=history.length;
428			        $(history).each(function(){
429			            if(name==this.name){
430			                canadd=false;
431			                var json="[";
432			                $(history).each(function(i){
433			                    var temp_name,temp_img,temp_url,temp_part;
434			                    if(this.name==name){
435			                        temp_name=name;temp_img=pic;temp_url=link;temp_part=part;
436			                    }else{
437			                        temp_name=this.name;temp_img=this.pic;temp_url=this.link;temp_part=this.part;
438			                    }
439			                    json+="{\"name\":\""+temp_name+"\",\"pic\":\""+temp_img+"\",\"link\":\""+temp_url+"\",\"part\":\""+temp_part+"\"}";
440			                    if(i!=len-1)
441			                    json+=",";
442			                })
443			                json+="]";
444			                MyTheme.Cookie.Set('history',json,365);
445			                return false;
446			            }
447			        });
448			    }
449			    if(canadd){
450			        var json="[";
451			        var start=0;
452			        var isfirst="]";
453			        isfirst=!len?"]":",";
454			        json+="{\"name\":\""+name+"\",\"pic\":\""+pic+"\",\"link\":\""+link+"\",\"part\":\""+part+"\"}"+isfirst;
455			        if(len>limit-1)
456		            	len-=1;
457		        	for(i=0;i<len-1;i++){
458		            	json+="{\"name\":\""+history[i].name+"\",\"pic\":\""+history[i].pic+"\",\"link\":\""+history[i].link+"\",\"part\":\""+history[i].part+"\"},";
459		       	 	}
460		        	if(len>0){
461		            	json+="{\"name\":\""+history[len-1].name+"\",\"pic\":\""+history[len-1].pic+"\",\"link\":\""+history[len-1].link+"\",\"part\":\""+history[len-1].part+"\"}]";
462		        	}
463			        MyTheme.Cookie.Set('history',json,365);
464			    }  
465			}
466		},
467		'Player': function() {
468			if($("#player-left").length){
469				var PlayerLeft = $("#player-left");
470		    	var PlayerSide = $("#player-sidebar");
471				var LeftHeight = PlayerLeft.outerHeight();
472				var Position = $("#playlist li.active").position().top;
473				$("#player-sidebar-is").click(function() {
474					PlayerSide.toggle();
475					if(PlayerSide.css("display")==='none') {
476						PlayerLeft.css("width","100%");
477						$(this).html("<i class='fa fa-angle-left'></i>");
478					}	
479					if(PlayerSide.css("display")==='block') {
480						PlayerLeft.css("width","");
481						$(this).html("<i class='fa fa-angle-right'></i>");
482					}
483				});
484				if(!MyTheme.Browser.useragent.mobile){
485					PlayerSide.css({"height":LeftHeight,"overflow":"auto"});
486					PlayerSide.scrollTop(Position);
487				}
488				PlayerSide.scroll(function(){
489					$(".lazyload").lazyload();
490				});
491			}		
492			if($(".player-fixed").length){
493				if(!MyTheme.Browser.useragent.mobile){
494					$(window).scroll(function(){
495						if($(window).scrollTop()>window.outerHeight){
496							$(".player-fixed").addClass("fixed fadeInDown");
497							$(".player-fixed-off").show();
498							$(".close-box").hide();
499						}else if($(window).scrollTop()<window.outerHeight){
500							$(".player-fixed").removeClass("fixed fadeInDown");
501							$(".player-fixed-off").hide();
502							$(".close-box").show();
503						}
504					});
505				}
506				$(".player-fixed-off").click(function() {
507					$(".player-fixed").removeClass("fixed fadeInDown");
508				});
509			}
510			
511		},
512		'Close': function() {
513			$(".close-btn").on("click",function(){
514				$(this).parents(".close-box").remove();
515			});
516		},
517		'Roll': function(obj,higt,time) {
518			setInterval(function(){ 
519				$(obj).find("ul").animate({
520					marginTop : higt,
521				},time,function(){
522					$(this).css({marginTop : "0px"}).find("li:first").appendTo(this);
523				})
524			}, 3000);
525		},
526		'Xunlei': function() {
527			$.getScript(myui.thunderurl, function() {
528
529				$(".common_down").on("click",function(){
530					var link=$(this).parents("li").find("input[type='text']");
531					var url=link.eq(0).val();
532					var filename=$(this).parents("li").find(".text").eq(0).text();
533					thunderLink.newTask({
534						downloadDir: '下载目录',
535						tasks: [{
536							name: filename,
537							url: url,
538							size: 0
539						}]
540					});
541				});
542
543				$("input[name='checkall']").on("click",function(e){
544					var checkboxs=$(this).parent().parent().parent().parent().find("input[name^='down_url_list_']");
545					for(let i=checkboxs.length;i--;)
546						checkboxs[i].checked=this.checked;
547				});
548		
549				$(".thunder_down_all").on("click",function(){
550					checked=$(this).parents(".downlist").find("li input[type='checkbox']:checked");
551					
552					if(checked.length<1){
553							layer.msg("请选中要下载的文件");
554						}
555					else
556						{
557							var tasks=[];
558							var links=$(this).parents(".downlist").find("li .down_url");
559							var selectbox=$(this).parents(".downlist").find("li input[type='checkbox']");
560				
561							for(let i=0;i<links.length;++i){
562								if(selectbox.eq(i).is(':checked')){
563									var task={
564										url:links.eq(i).val(),
565										size:0
566									};
567									tasks.push(task);
568								}
569							}
570									
571							thunderLink.newTask({
572								downloadDir: '下载目录',
573								installFile: '',
574								taskGroupName: '下载文件',
575								tasks: tasks,
576								excludePath: ''
577						   });           	
578					}
579					
580				});
581			
582				//启动迅雷看看
583				if($(".thunderkk").length){
584					$(".thunderkk").on("click",function(){
585						var link=$(this).parents(".downlist").find("li .down_url");
586						var url=link.eq(0).val();
587						kkPlay(url,"");
588					});        
589				
590					var kkDapCtrl = null;
591					
592					function kkGetDapCtrl() {
593						if (null == kkDapCtrl) {
594							try {
595								if (window.ActiveXObject) {
596									kkDapCtrl = new ActiveXObject("DapCtrl.DapCtrl");
597								} else {
598									var browserPlugins = navigator.plugins;
599									for (var bpi = 0; bpi < browserPlugins.length; bpi++) {
600										try {
601											if (browserPlugins[bpi].name.indexOf('Thunder DapCtrl') != -1) {
602												var e = document.createElement("object");
603												e.id = "dapctrl_history";
604												e.type = "application/x-thunder-dapctrl";
605												e.width = 0;
606												e.height = 0;
607												document.body.appendChild(e);
608												break;
609											}
610										} catch(e) {}
611									}
612									kkDapCtrl = document.getElementById('dapctrl_history');
613								}
614							} catch(e) {}
615						}
616						return kkDapCtrl;
617					}
618					function kkPlay(url, moviename) {
619						var dapCtrl = kkGetDapCtrl();
620						try {
621							var ver = dapCtrl.GetThunderVer("KANKAN", "INSTALL");
622							var type = dapCtrl.Get("IXMPPACKAGETYPE");
623							if (ver && type && ver >= 672 && type >= 2401) {
624								dapCtrl.Put("SXMP4ARG", '"' + url + '" /title "' + moviename + '" /startfrom "_web_xunbo" /openfrom "_web_xunbo"');
625							} else {
626								var r = confirm("\u8bf7\u5148\u4e0b\u8f7d\u5b89\u88c5\u8fc5\u96f7\u770b\u770b\uff0c\u70b9\u786e\u5b9a\u8fdb\u5165\u8fc5\u96f7\u770b\u770b\u5b98\u7f51\u4e0b\u8f7d");
627								if (r == true) {
628									window.open('http://www.kankan.com/app/xmp.html','','');
629								}
630							}
631						} catch(e) {
632							var r = confirm("\u8bf7\u5148\u4e0b\u8f7d\u5b89\u88c5\u8fc5\u96f7\u770b\u770b\uff0c\u70b9\u786e\u5b9a\u8fdb\u5165\u8fc5\u96f7\u770b\u770b\u5b98\u7f51\u4e0b\u8f7d");
633							if (r == true) {
634								window.open('http://www.kankan.com/app/xmp.html','','');
635							}
636						}
637					}
638				}
639			});
640			$(".Codyurl").each(function(){
641				var downurl = $(this).attr("data-text");
642				MyTheme.Link.Copy.Set(this,downurl);
643			});
644		},
645		'Language':function(){
646			
647			String.prototype.s2t = function() {
648				var k='';
649				for(var i=0;i<this.length;i++){
650					var c = this.charAt(i);
651					var p = simple().indexOf(c)
652					k += p < 0 ? c : traditional().charAt(p);
653				}
654				return k;
655			 }
656			 
657			 String.prototype.t2s = function() {			 
658					var k='';
659					for(var i=0;i<this.length;i++){
660						var c = this.charAt(i);
661						var p = traditional().indexOf(c)
662						k += p < 0 ? c : simple().charAt(p);
663					}
664			      return k;
665			 }
666
667			function s2t() {
668				document.body.innerHTML = document.body.innerHTML.s2t();
669			}
670			
671			function t2s() {
672			    document.body.innerHTML = document.body.innerHTML.t2s();
673			}
674			
675			var language = MyTheme.Cookie.Get('language')||myui.language;
676			if (language == 1) {
677				s2t();
678			} else {
679				t2s();
680			}
681			
682			$('.language').click(function() {
683				if (language == 0) {
684					layer.msg("正在切换繁体,请稍后...",{anim:5,time: 2000},function(){
685						s2t();
686						window.location.reload();
687					});
688					MyTheme.Cookie.Set('language',1,365);
689				} else {
690					layer.msg("正在切换简体,请稍后...",{anim:5,time: 2000},function(){
691						t2s();
692						window.location.reload();
693					});
694					MyTheme.Cookie.Set('language',0,365);
695				}
696			});
697			
698			Myui.Score();
699		}
700	}	
701};
702
703$(function(){
704	if(MyTheme.Browser.useragent.mobile){
705		MyTheme.Mobile.Nav.Init();
706		MyTheme.Mobile.Mshare();
707	}
708	MyTheme.Images.Lazyload();
709	MyTheme.Images.Flickity.Init();	
710	MyTheme.Link.Copy.Init();
711	MyTheme.Link.Short();
712	MyTheme.Other.Bootstrap();
713	MyTheme.Other.Sort();
714	MyTheme.Other.Search();
715	MyTheme.Other.Collapse();
716	MyTheme.Other.Slidedown();
717	MyTheme.Other.Scrolltop();
718	MyTheme.Other.History.Init();
719	MyTheme.Other.Player();
720	MyTheme.Other.Close();
721// 	MyTheme.Other.Xunlei();
722	
723});

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.