PageSourceSearch

https://www.xingguo.gov.cn/xgzf/xhtml/shilaohua/shilaohua.js

js xingguo.gov.cn collected 2026-10-02 17:02:40 UTC 22,126 bytes, 639 lines download raw bytes

1//定义setTimeout执行方法
2			var TimeFn = null;
3			//点击次数
4			var isclick = 0;
5			//护眼模式组
6			var eyecareArr = ['original','filter-ha','filter-rh','filter-gl','filter-gdb','filter-hd']
7			//当前皮肤
8			var isskin = window.localStorage.getItem('slh_isskin') || 'original';
9			//字号
10			var isfont = window.localStorage.getItem('slh_isfont') || 18;
11			//行高
12			var isline = window.localStorage.getItem('slh_isline') || 0;
13			//语速
14			var speech = window.localStorage.getItem('slh_speech') || 1;
15			//护眼
16			var iseyecare = window.localStorage.getItem('slh_iseyecare') || 0;
17			//是否开启语音
18			var isAudio = window.localStorage.getItem('slh_isAudio') || 0;
19			//是否开启适老化
20			var isSlh = window.localStorage.getItem('slh_isSlh') || 0;
21			//上一个点击元素
22			var istopDom = null;
23			 var isoldDom = null;
24			
25			// 初次加载
26			$(function(){
27				if(isSlh == 1){
28					initialLoad()
29				}
30				//开启适老化
31				$("#shilaohuas").click(function(){
32					openSLH()
33				})
34			})
35			
36			// 加载
37			function initialLoad(){
38				domInitializefun()
39				initializefun()
40				$("body *:not(table,tbody,thead,tfoot,tr)").off("click", onyuying);
41				$("body *:not(table,tbody,thead,tfoot,tr)").on("click",onyuying)
42				
43				$(".setup-title div").click(function(){
44					$(".suit-old-setup").slideUp()
45				})
46				
47				//设置切换
48				$(".setup-nav-item").click(function(){
49					$(this).addClass("active").siblings().removeClass("active")
50					$(".setup-cont").eq($(this).index()).show().siblings(".setup-cont").hide()
51				})
52				
53				//设置护眼模式
54				$(".eyecare .eyecare-itembox div").click(function(){
55					if(isskin == 'original'){
56						// setTimeout(function(){
57						// 	tts_audio('护眼模式需先设置主题')
58						// },600);
59						
60						return false
61					}
62					$(this).addClass("active").siblings().removeClass("active")
63					$("html").removeClass().addClass(eyecareArr[$(this).index()])
64					iseyecare = $(this).index()
65					window.localStorage.setItem('slh_iseyecare',iseyecare);
66				})
67				
68				//子页面元素添加语音
69				if($("iframe").length > 0){
70					$("iframe").each(function(i,item){
71						console.log(666)
72						document.getElementsByTagName('iframe')[i].contentWindow.document.body.setAttribute("jm","jm")
73						$(item).contents().find("body *:not(table,tbody,thead,tfoot,tr)").addClass("zjm")
74						$(item).contents().find("body *:not(table,tbody,thead,tfoot,tr)").off("click", onyuying);
75						$(item).contents().find("body *:not(table,tbody,thead,tfoot,tr)").on("click",onyuying);
76					})
77				}
78				
79				setTimeout(function(){
80					console.log(777)
81					$("body *:not(table,tbody,thead,tfoot,tr)").addClass("zhang")
82					$("body *:not(table,tbody,thead,tfoot,tr)").off("click", onyuying);
83					$("body *:not(table,tbody,thead,tfoot,tr)").on("click",onyuying)
84					//子页面元素添加语音
85					if($("iframe").length > 0){
86						$("iframe").each(function(i,item){
87							document.getElementsByTagName('iframe')[i].contentWindow.document.body.setAttribute("mm","mm")
88							$(item).contents().find("body *:not(table,tbody,thead,tfoot,tr)").addClass("zhang")
89							$(item).contents().find("body *:not(table,tbody,thead,tfoot,tr)").off("click", onyuying);
90							$(item).contents().find("body *:not(table,tbody,thead,tfoot,tr)").on("click",onyuying);
91						})
92					}
93				},2000)
94				
95			}
96			
97			
98			//触发语音
99			function onyuying(e){
100					//双击计算
101					isclick++
102					let that = $(this)
103					// let parent = that.parents("a")
104					let parentType = parentEach(that)
105					if(parentType != false && parentType[0].tagName == 'A' && parentType.attr("href").indexOf("javascript") == -1){
106						e.stopPropagation();
107						// let parentType = parentEach(that)
108						let target = parentType != false ? parentType.attr("target") : false
109						console.log(target,444)
110						if(!target || target == "_blank" || target == "_self" || target == "_parent" || target == "_top"){
111							console.log(target,'aaaa')
112							e.preventDefault();
113						}
114					}else{ 
115						let isoldDomtxt =  isoldDom != null ? isoldDom.parent().text() : false
116						let thattxt =  that.text()
117						if(isoldDomtxt == thattxt){
118							isclick = 0
119							isoldDom = null
120							return false
121						}
122					}
123					isoldDom = that
124					console.log(that,111)
125					if(isAudio != 1){
126						if(that[0].tagName == 'A'){
127							towclick($(this))
128						}else{
129							// let parentType = parentEach(that)
130							if(parentType != false){
131								towclick(parentType)
132							}else{
133								isclick = 0
134							}
135						}
136					}else{
137						//语音开启后执行
138						//阻止链接跳转
139						$(".audio-line").removeClass("audio-line")
140						if($("iframe").length > 0){
141							$("iframe").each(function(i,item){
142								$(item).contents().find(".audio-line").removeClass("audio-line")
143							})	
144						}
145						// if(istopDom != null){
146						// 	istopDom.css("box-shadow","")
147						// }
148						that.addClass("audio-line")
149						// that.css("box-shadow","inset 0 0 2px 2px red")
150						istopDom = that
151						
152						//判断父级
153						let type = parentEach(that)
154						// if(type[0].tagName == 'A'){
155						// 	e.preventDefault();
156						// }
157						
158						if(isclick > 1 && type != false && type[0].tagName == 'A'){
159							console.log(222)
160							clearTimeout(TimeFn);
161							towclick(type)
162						}else{
163							console.log(333)
164							clearTimeout(TimeFn);
165							TimeFn = setTimeout(function(){
166								isclick = 0
167								let ttsText = that.text()
168								if(that[0].tagName == 'IMG'){
169									ttsText = '图片'
170								}else if(type != false && type[0].tagName == 'A'){
171									ttsText = '链接'+that.text()+'连续点击后跳转'
172								}
173								tts_audio(ttsText)
174							},500);
175						}
176						
177						//不判断父级
178						// e.stopPropagation();
179						// if(that[0].tagName == 'A'){
180						// 	e.preventDefault();
181						// }
182						// if(isclick > 1 && that[0].tagName == 'A'){
183						// 	clearTimeout(TimeFn);
184						// 	towclick(that)
185						// }else{
186						// 	let type = parentEach(that)
187						// 	if(isclick > 1 && type != false && type[0].tagName == 'A'){
188						// 		clearTimeout(TimeFn);
189						// 		towclick(type)
190						// 	}else{
191						// 		clearTimeout(TimeFn);
192						// 		TimeFn = setTimeout(function(){
193						// 			isclick = 0
194						// 			let ttsText = that.text()
195						// 			if(that[0].tagName == 'IMG'){
196						// 				ttsText = '图片'
197						// 			}else if(type != false && type[0].tagName == 'A'){
198						// 				ttsText = '链接,'+that.text()+'双击后跳转'
199						// 			}
200						// 			tts_audio(ttsText)
201						// 		},500);
202						// 	}
203						// }
204						
205					}
206					
207					if(isSlh == 1){
208						setTimeout(function(){
209							$("body *").addClass('skin-'+isskin)
210							$("body *").addClass('font'+isfont)
211							$("body *").addClass('line'+isline)
212						},100);
213					}
214					if(isSlh == 1 && $("iframe").length > 0){
215						setTimeout(function(){
216							$("iframe").each(function(i,item){
217								if($(item).contents().find(".shilaohuaCSS").length < 1){
218									let csslink = $(".shilaohuaCSS").attr("href")
219									let str = `<link class="shilaohuaCSS" rel="stylesheet" href="${csslink}">`
220									$(item).contents().find("body").append(str)
221								}
222								$(item).contents().find("body").addClass('skin-'+isskin);
223								$(item).contents().find("body *").addClass('skin-'+isskin);
224								$(item).contents().find("body *").addClass('font'+isfont)
225								$(item).contents().find("body *").addClass('line'+isline)
226							})	
227						},1000);
228					}
229					
230			}
231			
232			//初始化
233			function initializefun(){
234				if(isSlh == 1){
235					$(".suit-old-box").show()
236					$("#bottomPaddingDom").show()
237					$("body").addClass("onButtom")
238				}
239				//皮肤
240				let arr = ['original','blue','red','black','green']
241				$.each(arr,function(i,item){
242					$("body").removeClass('skin-'+item)
243					$("body *").removeClass('skin-'+item)
244				})
245				$("body").addClass('skin-'+isskin)
246				$("body *").addClass('skin-'+isskin)
247				
248				//子页面元素修改
249				if($("iframe").length > 0){
250					setTimeout(function(){
251						$("iframe").each(function(i,item){
252							if($(item).contents().find(".shilaohuaCSS").length < 1){
253								let csslink = $(".shilaohuaCSS").attr("href")
254								let str = `<link class="shilaohuaCSS" rel="stylesheet" href="${csslink}">`
255								$(item).contents().find("body").append(str)
256							}
257							$.each(arr,function(j,item2){
258								$(item).contents().find("body").removeClass('skin-'+item2)
259								$(item).contents().find("body *").removeClass('skin-'+item2)
260							})
261							$(item).contents().find("body").addClass('skin-'+type);
262							$(item).contents().find("body *").addClass('skin-'+type);
263						})	
264					},1000)
265				}
266				
267				$(".default-"+isskin).addClass("active").siblings().removeClass("active")
268				// 护眼
269				if(isskin == 'original'){
270					$("html").removeClass().addClass('original')
271				}else{
272					$("html").removeClass().addClass(eyecareArr[iseyecare])
273				}
274				$(".eyecare-itembox div").eq(iseyecare).addClass("active").siblings().removeClass("active")
275				// 字号
276				$("body *").removeClass('font18 font22 font26')
277				if($("iframe").length > 0){
278					setTimeout(function(){
279						$("iframe").each(function(i,item){
280							$(item).contents().find("body *").removeClass('font18 font22 font26');
281						})
282					},1000)
283				}
284				if(isSlh == 1){
285					$("body *").addClass('font'+isfont)
286					//子页面元素修改字号
287					if($("iframe").length > 0){
288						setTimeout(function(){
289							$("iframe").each(function(i,item){
290								$(item).contents().find("body *").addClass('font'+isfont);
291							})
292						},1000)
293					}
294					$(".font-but.default-font"+isfont).addClass("active").parent().siblings().find(".font-but").removeClass("active")
295				}
296				// 行高
297				$("body *").removeClass('line0 line150 line200')
298				$("body *").addClass('line'+isline)
299				//子页面元素修改行高
300				if($("iframe").length > 0){
301					setTimeout(function(){
302						$("iframe").each(function(i,item){
303							$(item).contents().find("body *").removeClass('line0 line150 line200')
304							$(item).contents().find("body *").addClass('line'+isline);
305						})
306					},1000)
307				}
308				$(".font-line.default-line"+isline).addClass("active").siblings().removeClass("active")
309				//语速
310				$(".speech"+speech).addClass("active").siblings().removeClass("active")
311				//语音
312				if(isAudio == 0){
313					$(".suit-old-item.audio-switch").removeClass("isopen")
314				}else{
315					$(".suit-old-item.audio-switch").addClass("isopen")
316				}
317			}
318			
319			//dom初始化
320			function domInitializefun(){
321				if($("#bdtts_div_id").length > 0){
322					return false
323				}
324				let str = `
325					<div id="bdtts_div_id">
326					    <audio id="tts_autio_id" autoplay="autoplay">
327					        <source id="tts_source_id" src="https://dds.dui.ai/runtime/v1/synthesize?text=无障碍功能已开启&voiceId=qianranfa&volume=100&speed=0.7" type="audio/mpeg">
328					        <embed id="tts_embed_id" height="0" width="0" src="">
329					    </audio>
330					</div>
331					
332					<div class="suit-old-box" style="display:none;">
333						<div class="suit-old-item revert" onclick="revertSkin(this)">重置</div>
334						<div class="suit-old-item audio-switch isopen active" onclick="tabAudio(this)">语音</div>
335						<div class="suit-old-item set-up" onclick="setUpOpen(this)">设置</div>
336						<div class="suit-old-item sign-out" onclick="closeSlh()">退出</div>
337					</div>
338					
339					<div id="bottomPaddingDom" style="display:none;"></div>
340					
341					<div class="suit-old-setup">
342						<div class="setup-title">
343							<span>设置</span>
344							<div></div>
345						</div>
346						<div class="setup-nav">
347							<div class="setup-nav-item skin active">主题</div>
348							<div class="setup-nav-item fontsize">字号</div>
349							<div class="setup-nav-item fontline">行高</div>
350							<div class="setup-nav-item speech">语速</div>
351							<div class="setup-nav-item eyecare">护眼</div>
352						</div>
353						<div class="setup-cont skin active">
354							<div class="default-original active" onclick="tabSkin(this,'original')">默认</div>
355							<div class="default-blue" onclick="tabSkin(this,'blue')">深蓝白</div>
356							<div class="default-red" onclick="tabSkin(this,'red')">巧克力色</div>
357							<div class="default-black" onclick="tabSkin(this,'black')">黑底白字</div>
358							<div class="default-green" onclick="tabSkin(this,'green')">森林绿</div>
359						</div>
360						<div class="setup-cont fontsize">
361							<div class="default-font26">字号预览<div class="font-but default-font26" onclick="setfont(this,26)">特大</div></div>
362							<div class="default-font22">字号预览<div class="font-but default-font22" onclick="setfont(this,22)">较大</div></div>
363							<div class="default-font18">字号预览<div class="font-but default-font18 active" onclick="setfont(this,18)">适中</div></div>
364						</div>
365						<div class="setup-cont fontline">
366							<div class="font-line default-line0 active" onclick="setline(this,0)">默认</div>
367							<div class="font-line default-line150" onclick="setline(this,150)">150%</div>
368							<div class="font-line default-line200" onclick="setline(this,200)">200%</div>
369						</div>
370						<div class="setup-cont speech">
371							<div class="speech3" onclick="setspeech(this,3)">缓慢</div>
372							<div class="speech2" onclick="setspeech(this,2)">适度</div>
373							<div class="speech1" class="active" onclick="setspeech(this,1)">快速</div>
374						</div>
375						<div class="setup-cont eyecare">
376							<div class="eyecare-itembox">
377								<div class="active">默认</div>
378								<div>黑暗模式</div>
379								<div>柔和模式</div>
380								<div>高亮模式</div>
381								<div>
381高对比模式</div>
382								<div>灰度模式</div>
383							</div>
384						</div>
385					</div>
386				`
387				$("body").append(str)
388			}
389			
390			//还原
391			function revertfun(){
392				//当前皮肤
393				isskin = 'original';
394				window.localStorage.setItem('slh_isskin',isskin)
395				//字号
396				isfont = 18;
397				window.localStorage.setItem('slh_isfont',isfont)
398				//行高
399				isline = 0;
400				window.localStorage.setItem('slh_isline',isline)
401				//语速
402				speech = 1;
403				window.localStorage.setItem('slh_speech',speech)
404				//护眼
405				iseyecare = 0;
406				window.localStorage.setItem('slh_iseyecare',iseyecare)
407				//是否开启语音
408				isAudio = 1;
409				window.localStorage.setItem('slh_isAudio',isAudio)
410				initializefun()
411			}
412			
413			//遍历父级
414			function parentEach(parent){
415				if(parent[0].tagName == 'A'){
416					return parent
417				}else{
418					if(parent[0].tagName == 'BODY'){
419						return false
420					}else{
421						return parentEach(parent.parent())
422					}
423				}
424			}
425			
426			
427			//语音组件
428			function tts_audio(ttsText){
429				if(isAudio == 0){
430					return false;
431				}
432				var ttsDiv = document.getElementById('bdtts_div_id');
433				var ttsAudio = document.getElementById('tts_autio_id');
434				// 这样就可实现播放内容的替换了
435				ttsDiv.removeChild(ttsAudio);
436				var au1 = '<audio id="tts_autio_id" autoplay="autoplay">';
437				// var sss = '<source id="tts_source_id" src="https://tts.baidu.com/text2audio?tex='+ttsText+'&cuid=baike&lan=ZH&ie=utf-8&ctp=1&pdt=301&vol=1&rate=32&per=0&spd='+speech+'" type="audio/mpeg">';
438				// var sss = '<source id="tts_source_id" src="https://fanyi.sogou.com/reventondc/synthesis?text='+encodeURI(ttsText)+'&lang=zh-CHS&from=translateweb&speaker=6&speed='+speech+'" type="audio/mpeg">';
439				let speeds = 1
440				if(speech == 1){
441					speeds = 0.7
442				}else if(speech == 2){
443					speeds = 1
444				}else if(speech == 3){
445					speeds = 1.4
446				}
447				var sss = '<source id="tts_source_id" src="https://dds.dui.ai/runtime/v1/synthesize?text=' + encodeURI(ttsText) + '&voiceId=qianranfa&volume=100&speed=' + speeds+'" type="audio/mpeg">'
448				var eee = '<embed id="tts_embed_id" height="0" width="0" src="">';
449				var au2 = '</audio>';
450				ttsDiv.innerHTML = au1 + sss + eee + au2;
451				 
452				ttsAudio = document.getElementById('tts_autio_id');
453				 
454				ttsAudio.play();
455			}
456			
457			//双击
458			function towclick(that){
459				isclick = 0
460				let href = that.attr("href")
461				let target = that.attr("target")
462				console.log(href,444)
463				if(target == "_blank" || target == "_self" || target == "_parent" || target == "_top"){
464					tts_audio("")
465					window.open(href,target)
466				}else if(!target){
467					console.log(href,555)
468					window.location.href = href
469				}else{
470					setTimeout(function(){
471						if($("iframe").length > 0){
472							$("iframe").each(function(i,item){
473								$(item).contents().find("body *:not(table,tbody,thead,tfoot,tr)").off("click", onyuying);
474								$(item).contents().find("body *:not(table,tbody,thead,tfoot,tr)").on("click",onyuying);
475							})
476						}
477					},1000)
478				}
479			}
480			
481			function openSLH(){
482				isSlh = 1;
483				window.localStorage.setItem('slh_isSlh',isSlh)
484				isAudio = 1;
485				window.localStorage.setItem('slh_isAudio',isAudio)
486				// initializefun()
487				// $("body").addClass("onButtom")
488				initialLoad()
489			}
490			
491			//重置
492			function revertSkin(that){
493				//选中效果
494				$(that).addClass("active").siblings().removeClass("active")
495				$(".suit-old-setup").slideUp()
496				revertfun()
497			}
498			//退出
499			function closeSlh(){
500				tts_audio("退出")
501				revertfun()
502				$(".suit-old-box").hide()
503				$(".suit-old-setup").hide()
504				$("#bottomPaddingDom").hide()
505				$(".audio-line").removeClass("audio-line")
506				if($("iframe").length > 0){
507					$("iframe").each(function(i,item){
508						$(item).contents().find(".audio-line").removeClass("audio-line")
509					})	
510				}
511				if(istopDom != null){
512					istopDom.css("box-shadow","")
513				}
514				isAudio = 0;
515				window.localStorage.setItem('slh_isAudio',isAudio)
516				isSlh = 0;
517				window.localStorage.setItem('slh_isSlh',isSlh)
518				setTimeout(function(){
519					$("body *").removeClass('font18 font22 font26')
520				},300);
521				$("body").removeClass("onButtom")
522			}
523			
524			//关闭语音
525			function tabAudio(that){
526				if(isAudio == 1){
527					tts_audio("语音已关闭")
528					isAudio = 0;
529					$(".audio-line").removeClass("audio-line")
530					if($("iframe").length > 0){
531						$("iframe").each(function(i,item){
532							$(item).contents().find(".audio-line").removeClass("audio-line")
533						})	
534					}
535					$(".audio-switch").removeClass("isopen")
536				}else{
537					isAudio = 1;
538					$(".audio-switch").addClass("isopen")
539					setTimeout(function(){
540						tts_audio("语音已开启")
541					},600);
542				}
543				window.localStorage.setItem('slh_isAudio',isAudio);
544				//选中效果
545				$(that).addClass("active").siblings().removeClass("active")
546				$(".suit-old-setup").slideUp()
547			}
548			
549			//设置开启
550			function setUpOpen(that){
551				$(that).addClass("active").siblings().removeClass("active")
552				$(".suit-old-setup").slideToggle()
553			}
554			
555			
556			//切换皮肤
557			function tabSkin(that,type){
558				//选中效果
559				$(that).addClass("active").siblings().removeClass("active")
560				//切换
561				// isskin++
562				let arr = ['original','blue','red','black','green']
563				// if(isskin > arr.length-1){
564				// 	isskin = 0
565				// 	$("body").removeClass('skin-'+arr[arr.length-1])
566				// 	$("body *").removeClass('skin-'+arr[arr.length-1])
567				// }else{
568				// 	$("body").removeClass('skin-'+arr[isskin-1])
569				// 	$("body *").removeClass('skin-'+arr[isskin-1])
570				// }
571				isskin = type;
572				window.localStorage.setItem('slh_isskin',isskin);
573				$.each(arr,function(i,item){
574					$("body").removeClass('skin-'+item)
575					$("body *").removeClass('skin-'+item)
576				})
577				$("body").addClass('skin-'+type)
578				$("body *").addClass('skin-'+type)
579				
580				//子页面元素修改
581				if($("iframe").length > 0){
582					$("iframe").each(function(i,item){
583						$.each(arr,function(j,item2){
584							$(item).contents().find("body").removeClass('skin-'+item2)
585							$(item).contents().find("body *").removeClass('skin-'+item2)
586						})
587						$(item).contents().find("body").addClass('skin-'+type);
588						$(item).contents().find("body *").addClass('skin-'+type);
589					})
590				}
591				
592				if(type == 'original'){
593					$("html").removeClass().addClass('original')
594				}else{
595					$("html").removeClass().addClass(eyecareArr[iseyecare])
596				}
597			}
598			
599			//设置字号
600			function setfont(that,num){
601				$(that).addClass("active").parent().siblings().find(".font-but").removeClass("active")
602				$("body *").removeClass('font18 font22 font26')
603				$("body *").addClass('font'+num)
604				
605				//子页面元素修改字号
606				if($("iframe").length > 0){
607					$("iframe").each(function(i,item){
608						$(item).contents().find("body *").removeClass('font18 font22 font26');
609						$(item).contents().find("body *").addClass('font'+num);
610					})
611				}
612				
613				isfont = num;
614				window.localStorage.setItem('slh_isfont',isfont);
615			}
616			//设置行高
617			function setline(that,num){
618				$(that).addClass("active").siblings().removeClass("active")
619				$("body *").removeClass('line0 line150 line200')
620				$("body *").addClass('line'+num)
621				
622				//子页面元素修改行高
623				if($("iframe").length > 0){
624					$("iframe").each(function(i,item){
625						$(item).contents().find("body *").removeClass('line0 line150 line200');
626						$(item).contents().find("body *").addClass('line'+num);
627					})
628				}
629				
630				isline = num;
631				window.localStorage.setItem('slh_isline',isline);
632			}
633			//设置语速
634			function setspeech(that,num){
635				$(that).addClass("active").siblings().removeClass("active")
636				speech = num;
637				window.localStorage.setItem('slh_speech',speech);
638			}
639			

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.