1var HOME = {}; 2 3HOME.Login = (function(){ 4 5 var _cache = {}; 6 7 var checkInputVal = function(){ 8 if(_cache.inputs){ 9 for(var i = 0, len = _cache.inputs.length; i < len; i++){ 10 var input = _cache.inputs[i]; 11 var label = input.prev(); 12 if(input.val() != ""){ 13 label.css("display") != "none" && label.hide(); 14 } 15 else{ 16 label.css("display") == "none" && label.show(); 17 } 18 } 19 } 20 } 21 22 var checkFun = function(input){ 23 var val = input.val(); 24 var type = input.attr("errortype"); 25 switch(type){ 26 case "notempty": 27 if($.trim(val) == ""){ 28 return false; 29 } 30 if(input.attr("minlen") && val.length < Number(input.attr("minlen"))){ 31 return false; 32 } 33 break; 34 } 35 36 return true; 37 } 38 39 var showMsg = function(input, error_msg){ 40 var intid = input.attr("id"); 41 var msg = input.attr("errmsg"); 42 if(error_msg){ 43 msg = error_msg; 44 } 45 $("#js_"+intid).children("span").text(msg); 46 $("#js_"+intid).show(); 47 } 48 49 var hideMsg = function(input){ 50 var intid = input.attr("id"); 51 $("#js_"+intid).hide(); 52 } 53 54 var _focusTimer; 55 var bindInput = function(input){ 56 var label = input.prev(); 57 label.on("mouseover", function(){ 58 if(_focusTimer) window.clearTimeout(_focusTimer); 59 _focusTimer = window.setTimeout(function(){ 60 input.focus(); 61 }, 200); 62 }).on("mouseout", function(){ 63 if(_focusTimer) window.clearTimeout(_focusTimer); 64 }); 65 } 66 var aesEn = function(plain_text, key){ 67 window.GibberishAES.size(256); 68 return window.GibberishAES.aesEncrypt(plain_text, key); 69 } 70 var checkLogin = function(){ 71 var account = $("#account"), pwd = $("#passwd"),cod = $("#code"); 72 if(pwd.val() && account.val() == ""){ 73 window.setTimeout(function(){ 74 $("#J_Message").show().find("span").html("请è¾å ¥å¸å·"); 75 account.focus();account.next().hide(); 76 }, 10); 77 return false; 78 } 79 if(pwd.val()=="" && account.val()){ 80 window.setTimeout(function(){ 81 $("#J_Message").show().find("span").html("请è¾å ¥å¯ç "); 82 pwd.focus();pwd.next().hide(); 83 }, 10); 84 return false; 85 } 86 if(pwd.val()=="" && account.val()==""){ 87 window.setTimeout(function(){ 88 $("#J_Message").show().find("span").html("请è¾å ¥å¸å·åå¯ç "); 89 account.focus();account.next().hide(); 90 }, 10); 91 return false; 92 } 93 if(cod.val() == "" && cod.css("display")=="block") 94 { 95 $("#J_Message").show().find("span").html('请è¾å ¥éªè¯ç '); 96 cod.focus(); 97 return false; 98 } 99 $('#en_account').val(aesEn(account.val(), enkey)); 100 $('#en_passwd').val(aesEn(pwd.val(), enkey)); 101 $("#js_login_form").submit(); 102 } 103 104 return { 105 Init: function(form){ 106 var account = $("#account"), pwd = $("#passwd"),cod = $("#code"); 107 _cache.inputs = [account, pwd]; 108 bindInput(account); 109 account.on("keypress", function(e){ 110 if(e.keyCode == 13){ 111 checkLogin(); 112 } 113 }); 114 pwd.on("keypress", function(e){ 115 if(e.keyCode == 13){ 116 checkLogin(); 117 } 118 }); 119 cod.on("keypress", function(e){ 120 if(e.keyCode == 13){ 121 checkLogin(); 122 } 123 }); 124 bindInput(pwd);
125 for(var i = 0, len = _cache.inputs.length; i < len; i++){ 126 var ele = _cache.inputs[i]; 127 ele.on("keydown", function(){ 128 hideMsg($(this)); 129 }) 130 } 131 132 form.on("submit", function(){ 133 var res = true; 134 var firstDom; 135 if($("#js_send_code").css("display")=="block") _cache.inputs.push(cod); 136 for(var i = 0, len = _cache.inputs.length; i < len; i++){ 137 var ele = _cache.inputs[i]; 138 if(!checkFun(ele)){ 139 showMsg(ele); 140 res = false; 141 if(!firstDom){ 142 firstDom = ele; 143 } 144 } 145 else{ 146 hideMsg(ele); 147 } 148 } 149 if(firstDom){ 150 firstDom.focus(); 151 } 152 return res; 153 }); 154 155 $("#js_login_submit").on("click",function(){ 156 checkLogin(); 157 }); 158 159 window.setInterval(checkInputVal, 100); 160 }, 161 ShowMsg: function(input, msg){ 162 showMsg(input, msg); 163 }, 164 HideMsg: function(input){ 165 hideMsg(input); 166 } 167 } 168})(); 169 170HOME.Misc = (function(){ 171 var setHomePage = function(url){ 172 if(!window.confirm("æ¯å¦è®¾ç½®http://"+document.location.host+"为é¦é¡µ?")) return false; 173 if (window.sidebar) 174 { 175 try { 176 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); 177 } 178 catch (e) 179 { 180 alert("æ¤æä½è¢«æµè§å¨æç»ï¼\nè¯·å¨æµè§å¨å°åæ è¾å ¥âabout:configâå¹¶å车\nç¶åå°[signed.applets.codebase_principal_support]设置为âtrueâ"); 181 } 182 var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch); 183 prefs.setCharPref('browser.startup.homepage',url); 184 185 } 186 } 187 188 var addBookmark = function(title,url){ 189 try{ 190 window.external.addFavorite(url, title); 191 } 192 catch (e){ 193 try{ 194 window.sidebar.addPanel(title, url, ""); 195 } 196 catch(e){ 197 alert("å å ¥æ¶è失败ï¼è¯·ä½¿ç¨Ctrl+Dè¿è¡æ·»å "); 198 } 199 } 200 } 201 return { 202 setHomePage: function(url){ 203 setHomePage(url); 204 }, 205 addBookmark: function(title,url){ 206 addBookmark(title,url); 207 } 208 } 209})();
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.