PageSourceSearch

https://www.dot.gov.tw/template/js/portal.js

js dot.gov.tw collected 2026-10-02 04:02:41 UTC 5,023 bytes, 135 lines download raw bytes

1function isMobile() {
2    try{ 
3        document.createEvent("TouchEvent"); 
4		return true; 
5    } catch(e){ 
6    	return false;
7    }
8}
9
10function isEmail(email) {
11	var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
12    return regex.test(email);
13}
14//財政部_統計指標
15function changeImgtxtStatistics(id,link,imgKey,target,title, alt){
16	var statisticsId = document.getElementById(id);
17	var img = $($(statisticsId).find("img").get());
18	img.attr('src',imgKey);
19	img.attr('alt', alt);
20	img.parent().attr("href",link);
21	img.parent().attr("title",title);
22	if(target == "Y"){
23		img.parent().attr("target","_blank");
24	}else{
25		img.parent().attr("target","_self");
26	}
27}
28$(document).ready(function() {
29    //模組下拉選單連結共用js add By ting
30    $('.input-dropdownlist').click(function(){
31		var $selected = $(document.getElementById($(this).attr("data-selectId"))).find(":selected"),_target = $selected.attr("data-isnewwindow")?"_blank":"_self" ;
32		if ($selected.attr('data-href')) { 
33		 	window.open($selected.attr('data-href'), _target); 
34		 } 
35	});
36	//無障礙Esc(退出彈跳視窗)
37    $(document).keyup(function(e) { 
38    	if (e.which == 27) {
39    		if ($('.light-msg-box').is(':visible')) {
40    			 $(".butn-close").trigger("click");
41    		}
42    		else if ($('.light-box').is(':visible')) {
43    			$(".mail-eliminate").trigger("click");
44    		}
45    		
46    		else if ($('#___gcse_0 .gsc-results-wrapper-overlay.gsc-results-wrapper-visible').is(':visible')){
47    			$("#___gcse_0 .gsc-results-close-btn.gsc-results-close-btn-visible").trigger("click");
48    		}
49    		
50    		else if ($('#___gcse_1 .gsc-results-wrapper-overlay.gsc-results-wrapper-visible').is(':visible')){
51    			$("#___gcse_1 .gsc-results-close-btn.gsc-results-close-btn-visible").trigger("click");
52    		}
53    		
54    		else if ($('.menu-box').is(':visible') && $('.menu-box').attr('style')) {
55    			$(".hamburgerMenu").trigger("click");
56    		}
57    	}
58    });
59    
60    // 網頁載入完成後,直接執行時間判斷邏輯
61    var nowMs = new Date().getTime();
62    
63    $('.time-filter-item').each(function() {
64        var $item = $(this); 
65        
66        // 取得綁定在 HTML 上的毫秒數
67        var onlineTimeMs = parseInt($item.attr('data-online-time'), 10);
68        var offlineTimeMs = parseInt($item.attr('data-offline-time'), 10);
69        
70        // 判斷邏輯
71        var isOnline = (!onlineTimeMs || nowMs >= onlineTimeMs);
72        var isNotOffline = (!offlineTimeMs || nowMs <= offlineTimeMs);
73        
74        // 執行顯示或隱藏
75        if (isOnline && isNotOffline){
76            $item.show(); 
77        } else {
78            $item.remove(); 
79        }
80    });
81    
82    //google 搜尋框
83    tabForward = false;
84    $(document).keydown(function (e) {
85        if (e.key === "Tab") {
86            tabForward = !e.shiftKey; // true = 正向 Tab, false = Shift+Tab
87        }
88        
89        const gscIds = ["#___gcse_0", "#___gcse_1"];
90        
91        gscIds.forEach(function(id){
92            // branding → tab 正向離開才關閉
93            $(id + " .gcsc-find-more-on-google-branding .gcsc-branding a").off()
94                .on("focusout", function () {
95                    if (tabForward) {
96                        $(id + " .gsc-results-close-btn.gsc-results-close-btn-visible").trigger("click");
97                    }
98                });
99
100            // closeBtn → shift+tab 反向離開才關閉
101            $(id + " .gsc-results-close-btn.gsc-results-close-btn-visible").off()
102                .on("focusout", function () {
103                    if (!tabForward) {
104                        $(id + " .gsc-results-close-btn.gsc-results-close-btn-visible").trigger("click");
105                    }
106                });
107        });
108    });
109    
110    //字級大小切換
111    $(".chgfontSize").click(function() {
112    	$(".chgfontSize").removeClass("selected").attr("aria-pressed", "false");
113    	var size = $(this).attr("data-size");
114    	var selectedSize = document.getElementsByClassName(size);
115    	if(size == "medium"){
116    		$("html").removeClass();
117    	}else{
118    		$("html").removeClass().addClass("set-font-size-"+size);
119    	}
120    	$(selectedSize).addClass("selected").attr("aria-pressed", "true");
121    });
122    //輪播無障礙 aria-live 來標示 Live Region 需延遲添加屬性
123    setTimeout(function(){
124    	$(".slick-list").attr("aria-live","off");
125    	if($("html").attr("lang") !="en"){
126    		$(".slick-next").attr("aria-label","下一張");
127    		$(".slick-next").html("下一張");
128    		$(".slick-prev").attr("aria-label","上一張");
129    		$(".slick-prev").html("上一張");
130    		$("#toTop").html("<span  id=\"toTopHover\" role=\"button\" style=\"opacity: 0;\"></span>回到頂端");
131    	}else{
132    		$("#toTop").html("<span  id=\"toTopHover\" role=\"button\" style=\"opacity: 0;\"></span>To Top");
133    	}
134    },'100');
135});

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.