1$(document).ready(function() { 2 var $searchPlaceholder = $("#searchPlaceholder"); 3 var $searchContent = $(".search-content"); 4 var $searchInput = $("#headSearchInput"); 5 var $searchDel = $(".search-content .search-del"); 6 7 $(".js-open-download-modal").on("click", function (event) { 8 event.preventDefault(); 9 var $trigger = $(this); 10 var modalTarget = $trigger.attr("data-download-modal"); 11 var handlerName = $trigger.attr("data-download-handler") || "openDownloadModal"; 12 var handler = window[handlerName]; 13 var tabIndex = $trigger.attr("data-download-tab-index"); 14 15 if (typeof handler !== "function") { 16 return; 17 } 18 if (typeof tabIndex !== "undefined" && tabIndex !== "") { 19 handler(modalTarget, parseInt(tabIndex, 10)); 20 } else { 21 handler(modalTarget); 22 } 23 }); 24 25 // ********** å ³é®è¯å表 ********** 26 var keywords = ["æç´¢"]; 27 var sIndex = 0; 28 var timer = null; 29 30 // å è½½çæ 31 $.getJSON("/index_hotSearch.action", function (res) { 32 keywords = res.data ? res.data.split(";") : ["æç´¢"]; 33 for (var index = 0; index < keywords.length; index++) { 34 var element = keywords[index]; 35 // type 3 æç¨ type 4 èµè®¯ 36 $(".search-quick-list").append( 37 '<a href="/index_search.action?type=3&model=1&k=' + 38 element + 39 '">' + 40 element + 41 "</a>" 42 ); 43 } 44 $searchInput.attr("placeholder", keywords[sIndex]); 45 $searchPlaceholder.text(keywords[sIndex]); 46 }); 47 48 $(document).on("click.module1", function(e) { 49 // Head å¤çæç´¢æ¡å¤é¨ç¹å»å ³é 50 if ( 51 !$searchContent.is(e.target) && 52 !$searchPlaceholder.is(e.target) && 53 !$searchContent.has(e.target).length 54 ) { 55 $searchContent.removeClass("show"); 56 $searchInput.val(""); 57 } 58 }); 59 60 /** 61 * Header Search 62 */ 63 if ($searchPlaceholder.length && $searchContent.length) { 64 $searchPlaceholder.on("click", function(e) { 65 e.stopPropagation(); 66 $searchContent.toggleClass("show"); 67 setTimeout(function() { 68 $searchInput.focus(); 69 }, 300); 70 }); 71 // å ³éæç´¢æ¡ 72 $searchDel.on("click", function() { 73 $searchContent.removeClass("show"); 74 $searchInput.val(""); 75 }); 76 // 黿¢ç»ä»¶å é¨äºä»¶å泡 77 $searchContent.on("click", function(e) { 78 e.stopPropagation(); 79 }); 80 81 // å¯å¨è½®æ 82 function startCarousel() { 83 stopCarousel(); // 鲿¢éå¤å¼ 84 timer = setInterval(function () { 85 // åªæå¨è¾å ¥æ¡ä¸ºç©ºæ¶æè½®æ 86 if ($searchInput.val().trim() === "") { 87 sIndex = (sIndex + 1) % keywords.length; 88 $searchInput.attr("placeholder", keywords[sIndex]); 89 $searchPlaceholder.text(keywords[sIndex]); 90 } 91 }, 3000); 92 } 93 // åæ¢è½®æ 94 function stopCarousel() { 95 if (timer) { 96 clearInterval(timer); 97 timer = null; 98 } 99 } 100 // åå§ placeholder 101 $searchInput.attr("placeholder", keywords[sIndex]); 102 $searchPlaceholder.text(keywords[sIndex]); 103 startCarousel(); 104 // è¾å ¥çå¬ 105 $searchInput.on("input", function () { 106 if ($searchInput.val().trim() !== "") { 107 stopCarousel(); // æè¾å ¥ â åæ¢è½®æ 108 } 109 }); 110 // å车æç´¢ 111 $searchInput.on("keydown", function (e) { 112 if (e.keyCode == 13) { 113 toSearch(); 114 } 115 }); 116 // èç¦æ¶/åæ¢è½®æ 117 $searchInput.on("focus", function () { 118 stopCarousel(); 119 }); 120 // å¤±ç¦æ¶/妿è¾å ¥ä¸ºç©ºï¼æ¢å¤è½®æ 121 $searchInput.on("blur", function () { 122 if ($searchInput.val().trim() === "") { 123 $searchPlaceholder.text(keywords[sIndex]); 124 startCarousel(); 125 } 126 }); 127 128 function toSearch() { 129 var val = $searchInput.val().trim(); 130 var keyword = val || $searchInput.attr("placeholder"); 131 var type = $("#search-tabs").attr("attr_value"); 132 window.location.href = 133 "/index_search.action?type=" + type + "&model=1&k=" + keyword; 134 //alert("æ£å¨æç´¢: " + keyword); 135 }
136 // æç´¢æé® 137 $("#headSearchBtn").on("click", toSearch); 138 } 139}); 140 141// ä¸è½½ 142function openDownloadModal(ele) { 143 $(ele).addClass("show"); 144 // $('body').css('overflow', 'hidden'); 145} 146 147// æå¼PC端 148function openPcClient() { 149 if (navigator.userAgent.toLocaleLowerCase().indexOf("mac") > -1) { 150 var oFrm = document.createElement("iframe"); 151 oFrm.style.height = "0px"; 152 oFrm.src = "PCi4Tools://1"; 153 document.body.appendChild(oFrm); 154 setTimeout(function () { 155 oFrm.remove(); 156 }, 5000); 157 return; 158 } else { 159 //pc 160 window.location = "PCi4Tools://"; 161 } 162} 163 164/** 165 * 鲿彿° 166 * @param {*} func éè¦é²æç彿° 167 * @param {*} delay å»¶è¿æ¶é´(毫ç§) 168 * @param {*} immediate æ¯å¦ç«å³æ§è¡ä¸æ¬¡ 169 * @returns 170 */ 171function debounce(func, delay, immediate) { 172 if (typeof delay === "undefined") { 173 delay = 100; 174 } 175 if (typeof immediate === "undefined") { 176 immediate = false; 177 } 178 var timer = null; 179 180 return function () { 181 var args = arguments; 182 var context = this; 183 184 if (timer) { 185 clearTimeout(timer); 186 } 187 188 if (immediate && !timer) { 189 func.apply(context, args); 190 } 191 192 timer = setTimeout(function() { 193 if (!immediate) { 194 func.apply(context, args); 195 } 196 timer = null; 197 }, delay); 198 }; 199} 200 201var Dialog = { 202 show: function (msg) { 203 $("body").append( 204 '<div id="dialogWrapper">' + 205 '<div class="dialog-content">' + 206 '<p class="dialog-desc">' + msg + '</p>' + 207 '<a href="javascript:;" class="dialog-btn" onclick="Dialog.hide()">ç¡®å®</a>' + 208 '</div>' + 209 '</div>' 210 ); 211 }, 212 hide: function () { 213 $("#dialogWrapper").remove(); 214 } 215};
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.