PageSourceSearch

https://www.bookschina.com/js/login.js

js bookschina.com collected 2026-09-24 21:14:03 UTC 13,898 bytes, 361 lines download raw bytes

1var isCanAlyValid = true;
2var aliyResult = 0;
3var aliyParam = { aliyData: '', aliyToken: '', aliySessionId: '42smrk55', aliySig: '' };
4
5$(document).ready(function () {
6    function IsValidAlyValid() {
7        if (isCanAlyValid) {
8            var canvasSupported = !!document.createElement('canvas').getContext;
9            var userAgent = navigator.userAgent;
10            //ÅжÏÊÇ·ñIE<11ä¯ÀÀÆ÷
11            var isIE = userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1;
12            if (isIE) {
13                var reIE = new RegExp("MSIE (\\d+\\.\\d+);");
14                reIE.test(userAgent);
15                var iEVersion = parseFloat(RegExp["$1"]);
16                if (iEVersion >= 8 && canvasSupported)
17                    isCanAlyValid = true;
18                else
19                    isCanAlyValid = false;
20            }
21            else {
22                if (canvasSupported) {
23                    isCanAlyValid = true;
24                }
25            }
26        }
27        //isCanAlyValid = false;
28        ChangImgLogin();
29    }
30
31    //  µã»÷°´Å¥µÇ¼
32    //$("#btnLogin").click(function () {
33    //    BtnLogin();
34    //});
35    // µã»÷»Ø³µ¼üµÇ¼
36    $(document).keypress(function (event) {
37        var e = event ? event : (window.event ? window.event : null);
38        var key = e.which;
39        if (key == 13) {
40            if ($(".tabTit").find("a.cur").attr("data-id") == 0) {
41                pwdLogin()
42            } else {
43                phoneLogin()
44            }
45        }
46    });
47    // µÇ¼º¯Êý
48    function pwdLogin() {
49
50        var userName = $("#userName");  //  Óû§Ãû
51        var userPas = $("#userPas") //  ÃÜÂë
52        var imgcode = $("#imgcode");// ÑéÖ¤Âë
53        var loginBtn = $("#loginBtn");
54
55        //  Óû§Ãû»òÃÜÂëΪ¿Õ
56        if (!$.trim(userName.val())) {
57            userName.parents(".inputItem").addClass("error");
58            userName.parents(".inputItem").find(".megTip").find("span").html("ÇëÊäÈëÓû§Ãû");
59            return false;
60        }
61
62        if (!$.trim(userPas.val())) {
63            userPas.parents(".inputItem").addClass("error");
64            userPas.parents(".inputItem").find(".megTip").find("span").html("ÇëÊäÈëÃÜÂë");
65            return false;
66        }
67        if (!isCanAlyValid && !$.trim(imgcode.val())) {
68            imgcode.parents(".inputItem").addClass("error");
69            imgcode.parents(".inputItem").find(".megTip").find("span").html("ÇëÊäÈëͼƬÑéÖ¤Âë");
70            return false;
71        }
72
73
74        $.post("/ashx/User.ashx", { Type: "Login", Name: userName.val(), Pass: userPas.val(), Code: imgcode.val(), url: $("#loginurl").val(), aliyData: aliyParam.aliyData, aliyToken: aliyParam.aliyToken, aliySessionId: aliyParam.aliySessionId, aliySig: aliyParam.aliySig }, function (result) {
75
76            imgcode.parents(".inputItem").removeClass("num");
77            imgcode.parents(".inputItem").find(".megTip").find("span").html("");
78            $("#statrNum").html(result.State);
79            if (result.State == 10500) {
80                ChangImgLogin();
81            }
82            else if (result.State == 300) {
83                window.location = result.SafeUrl;
84            }
85            else if (result.State == 302) {
86                aliyunSet();
87                userPas.parents(".inputItem").addClass("num");
88                userPas.parents(".inputItem").find(".megTip").find("span").html(result.Msg);
89                return false;
90            }
91            else if (result.State == 301) {
92                window.location = '/reguser/L34aspx.aspx';
93            }
94            else if (result.State == 200) {
95                loginBtn.find("a").html("ÕýÔڵǼ...");
96                var url = getParam("url");
97                if (url != "")
98                    window.location = unescape($("#loginurl").val());
99                else
100                    window.location = "/";
101            } else {
102                identifyImg();
103                loginBtn.find("a").html("怬");
104                alert(result.Msg);
105            }
106        }, "json");
107    }
108
109    //  ½øÈëÒ³ÃæÑ­»· ÊäÈë¿òÊÇ·ñ³öÏֹرհ´Å¥ 
110    $(".inputBlock").each(function () {
111        var $this = $(this);
112        var thisValue = $.trim($this.val());
113        if (thisValue) {
114            $this.parents(".inputItem").find(".clearInput").show();
115        } else {
116            $this.parents(".inputItem").find(".clearInput").hide();
117        }
118    })
119    //  ±í¿ò»ñÈ¡½¹µã
120    $(".inputBlock").focus(function () {
121        var $this = $(this);
122        var $thisP = $this.parents(".inputItem");
123        var megTip = $thisP.find(".megTip");
124        $thisP.addClass("focus").removeClass("error");
125        megTip.find("span").html(megTip.attr("data-defaultMeg"));
126
127    })
128    // ±í¿òʧȥ½¹µã 
129    $(".inputBlock").blur(function () {
130        var $this = $(this);
131        var $thisP = $this.parents(".inputItem");
132        var megTip = $thisP.find(".megTip");
133        $thisP.removeClass("focus");
134        megTip.find("span").html(megTip.attr("data-defaultMeg"));
135    })
136    // Çå³ý¹¦ÄÜ
137    $(".clearInput").click(function () {
138        var $this = $(this);
139        $this.parent().find("input").val("").focus();
140        $this.parents(".inputItem ").removeClass("error")
141        $this.hide();
142    });
143    // ¼¤»îÇå³ý¹¦ÄÜ
144    $(".inputBlock").keyup(function () {
145        $(".inputBlock").on("input propertychange", function () {
146            var $this = $(this);
147            var len = $this.val().length;
148            if (len > 0) {
149                $this.parents(".inputItem").removeClass("error").find(".clearInput").show();
150            } else {
151                $this.parents(".inputItem").find(".clearInput").hide();
152            }
153        })
154    })
155
156    // ¼ÓÔØÑéÖ¤Âë
157    function identifyImg() {
158        if ($(".tabTit").find("a.cur").attr("data-id") == 0) {
159            $("#imgcode").val("").parents(".inputItem ").removeClass("error");
160            $(".imgWrap.w1 img").attr("src", "/Shop_Cart/YzmCode.aspx?ckname=ck&t=" + new Date().getTime());
161        } else {
162            $("#imgcode1").val("").parents(".inputItem ").removeClass("error");
163            $(".imgWrap.w2 img").attr("src", "/Shop_Cart/YzmCode.aspx?ckname=ck&t=" + new Date().getTime());
164        }
165    }
166    // µã»÷ÑéÖ¤
167    $(".imgWrap.w1,.imgWrap.w2,.changeImgCoad").click(function () {
168        identifyImg();
169    })
170    $(".channelKind .tabTit a").click(function () {
171        var $this = $(this), thisIndex = $this.index();
172        $this.addClass("cur").siblings().removeClass("cur");
173        $(".channelKind .tabItem ").eq(thisIndex).show().siblings().hide();
174        $("#channeLazyLoad").trigger('scroll');
175    })
176
177
178    // ÊÖ»úµÇ¼
179    $(".labInpWr").on("click", ".imgWrap.yzm", function () {
180        var $this = $(this);
181        var userMobile = $("#phoneNumber");
182        var imgcode = $("#imgcode1");// ÑéÖ¤Âë
183        if (!$.trim(userMobile.val())) {
184            userMobile.parents(".inputItem").addClass("error");
185            userMobile.parents(".inputItem").find(".megTip").find("span").html("ÇëÊäÈëÊÖ»úºÅ");
186            return false;
187        }
188        ////°¢ÀïÔÆÎÞºÛÑéÖ¤
189        //if (aliyResult != 10800 && isCanAlyValid) {
190        //    aliyParam.aliyData = getNVCVal();
191        //}
192
193        ////°¢ÀïÔÆ»¬¿éÑéÖ¤
194        //if (aliyResult == 10800 && aliyParam.aliySessionId == '') {
195        //    alert("Ç뻬¶¯ÑéÖ¤£¡");
196        //    return false;
197        //}
198
199        //if (!isCanAlyValid && !$.trim(imgcode.val())) {
200        //    imgcode.parents(".inputItem").addClass("error");
201        //    imgcode.parents(".inputItem").find(".megTip").find("span").html("ÇëÊäÈëͼƬÑéÖ¤Âë");
202        //    return false;
203        //}
204
205        $.post("/ashx/User.ashx", { Type: "AlyValidMobileCode", mobile: userMobile.val(), mtype: 7, code: imgcode.val(), aliyData: aliyParam.aliyData, aliyToken: aliyParam.aliyToken, aliySessionId: aliyParam.aliySessionId, aliySig: aliyParam.aliySig }, function (result) {
206            if (result.State == 10500) {
207                ChangImgLogin();
208            }
209            else if (result.State == 200) {
210                $this.removeClass("yzm").addClass("past").html('ÖØÐ»ñÈ¡ÑéÖ¤Â루60£©');
211                times();
212            } else {
213                imgcode.parents(".inputItem").addClass("error");
214                imgcode.parents(".inputItem").find(".megTip").find("span").html(result.Msg);
215            }
216        }, "json");
217    })
218
219    function times() {
220        var left_time = 60;
221        var tt = window.setInterval(function () {
222            left_time = left_time - 1;
223            if (left_time <= 0) {
224                window.clearInterval(tt);
225                $(".imgWrap.past").removeClass("past").addClass("yzm").html('ÖØÐ»ñÈ¡ÑéÖ¤Âë');
226            } else {
227                $(".imgWrap.past").html('ÖØÐ»ñÈ¡ÑéÖ¤Â루' + left_time + '£©');
228            }
229        }, 1000);
230    }
231
232    //  µã»÷°´Å¥µÇ¼
233    //$("#phoneBtn").click(function () {
234    //    phoneLogin()
235    //})
236
237    function phoneLogin() {
238        var phoneNumber = $("#phoneNumber");  //  ÊÖ»úºÅ
239        var phoneCode = $("#phoneCode");// ÊÖ»úÑéÖ¤Âë
240        var loginBtn = $("#loginBtn");
241        // ÊÖ»úºÅ»òÑéÖ¤ÂëΪ¿Õ
242        if (!$.trim(phoneNumber.val())) {
243            phoneNumber.parents(".inputItem").addClass("error");
244            phoneNumber.parents(".inputItem").find(".megTip").find("span").html("ÇëÊäÈëÊÖ»úºÅ");
245            return false;
246        }
247
248        if (!$.trim(phoneCode.val())) {
249            phoneCode.parents(".inputItem").addClass("error");
250            phoneCode.parents(".inputItem").find(".megTip").find("span").html("ÇëÊäÈëÊÖ»úÑéÖ¤Âë");
251            return false;
252        }
253
254        $.post("/ashx/User.ashx", { Type: "MobileCodeLogin", mobile: phoneNumber.val(), code: phoneCode.val(), aliyData: aliyParam.aliyData, aliySessionId: aliyParam.aliySessionId }, function (result) {
255            if (result.State == 300) {
256                window.location = result.SafeUrl;
257            }
258            else if (result.State == 101) {
259                phoneCode.parents(".inputItem").addClass("num");
260                phoneCode.parents(".inputItem").find(".megTip").find("span").html(result.Msg);
261                return false;
262            }
263            else if (result.State == 301) {
264                window.location = '/reguser/L34aspx.aspx';
265            }
266            else if (result.State == 200) {
267                loginBtn.find("a").html("ÕýÔڵǼ...");
268                var url = getParam("url");
269                if (url != "")
270                    window.location = unescape($("#loginurl").val());
271                else
272                    window.location = "/";
273            } else {
274                aliyunSet();
275                identifyImg();
276                loginBtn.find("a").html("怬");
277                alert(result.Msg);
278            }
279        }, "json");
280    }
281
282    function BtnLogin() {
283        var tabIndex = $(".tabTit").find("a.cur").attr("data-id");
284        if (tabIndex == 0) {
285            pwdLogin();
286        }
287        else {
288            phoneLogin();
289        }
290    }
291
292    function aliyunSet() {
293        try {
294            // µ¯³öʽ£¬³ýregionºÍprefixÒÔÍâµÄ²ÎÊý
295            window.initAliyunCaptcha({
296                // ³¡¾°ID¡£¸ù¾Ý²½Öè¶þн¨ÑéÖ¤³¡¾°ºó£¬Äú¿ÉÒÔÔÚÑéÖ¤Â볡¾°ÁÐ±í£¬»ñÈ¡¸Ã³¡¾°µÄ³¡¾°ID
297                SceneId: aliyParam.aliySessionId,
298                // ÑéÖ¤Âëģʽ£¬popup±íʾµ¯³öʽ£¬embed±íʾǶÈëʽ¡£ÎÞÐèÐÞ¸Ä
299                mode: "popup",
300                // Ò³ÃæÉÏÔ¤ÁôµÄäÖȾÑéÖ¤ÂëµÄÔªËØ£¬ÓëÔ­´úÂëÖÐÔ¤ÁôµÄÒ³ÃæÔªËØ±£³ÖÒ»Ö¡£
301                element: "#captcha-element",
302                // ´¥·¢ÑéÖ¤Â뵯´°»òÎÞºÛÑéÖ¤µÄÔªËØ
303                button: "#btnLogin",
304                // ÑéÖ¤ÂëÑé֤ͨ¹ý»Øµ÷º¯Êý
305                success: function (captchaVerifyParam) {
306                    aliyParam.aliyData = captchaVerifyParam;
307                    BtnLogin();
308                    //alert(1);
309                    // Èë²ÎΪÑéÇ©captchaVerifyParam
310                    // 1.Ïòºó¶Ë·¢ÆðÒµÎñÇëÇó½øÐÐÑéÖ¤ÂëÑéÇ©captchaVerifyParamУÑé
311                    // 2.¸ù¾ÝУÑé½á¹ûÀ´½øÐÐÒµÎñ´¦Àí
312                    // 3.ÈçÒµÎñÐèÒªÖØÐ½øÐÐÑéÖ¤ÂëÑéÖ¤£¬µ÷ÓÃÑéÖ¤Âë³õʼ»¯·½·¨initAliyunCaptchaÖØÐ³õʼ»¯ÑéÖ¤Âë
313                },
314                // ÑéÖ¤ÂëÑéÖ¤²»Í¨¹ý»Øµ÷º¯Êý
315                fail: function (result) {
316                    // Èë²ÎΪ²»Í¨¹ýÐÅÏ¢
317                    // Õý³£ÑéÖ¤ÓÐЧÆÚÄÚ²»ÐèÒª×öÈκβÙ×÷£¬ÑéÖ¤Âë×Ô¶¯Ë¢Ð£¬ÖØÐ½øÐÐÑéÖ¤
318                    console.log(result);
319                },
320                // °ó¶¨ÑéÖ¤ÂëʵÀý»Øµ÷º¯Êý£¬¸Ã»Øµ÷»áÔÚÑéÖ¤Âë³õʼ»¯³É¹¦ºóµ÷ÓÃ
321                getInstance: function (instance) {
322                    captcha = instance;
323                },
324                // »¬¿éÑéÖ¤ºÍÒ»µã¼´¹ýµÄÑéÖ¤ÐÎ̬´¥·¢¿òÌåÑùʽ£¬Ö§³Ö×Ô¶¨Òå¿í¶ÈºÍ¸ß¶È£¬µ¥Î»Îªpx¡£
325                slideStyle: {
326                    width: 300,
327                    height: 40,
328                },
329                // ÒµÎñÇëÇó(´øÑéÖ¤ÂëУÑé)»Øµ÷º¯Êý£¬ÎÞÐèÐÞ¸Ä
330                //captchaVerifyCallback: aaa,
331                // ÒµÎñÇëÇó½á¹û»Øµ÷º¯Êý£¬ÎÞÐèÐÞ¸Ä
332                //onBizResultCallback: onBizResultCallback,
333                // ...ÆäËû²ÎÊý£¬²Î¿¼initAliyunCaptcha²ÎÊý˵Ã÷
334            });
335        } catch (e) {
336            isCanAlyValid = false;
337        }
338    }
339
340    function ChangImgLogin() {
341        if (!isCanAlyValid) {
342            $("#alDiv").hide();
343            $("#alDiv1").hide();
344            $(".imgcodeWrap").show();
345
346            $("#btnLogin").click(function () {
347                BtnLogin();
348            });
349        }
350        else {
351            $(".imgcodeWrap").hide();
352        }
353    }
354
355    aliyunSet();
356    IsValidAlyValid();
357})
358
359
360
361

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.