PageSourceSearch

https://www.xwboo.com/UserManage/JS/drag.js?v=1119

js xwboo.com collected 2026-10-06 14:01:03 UTC 7,020 bytes, 174 lines download raw bytes

1/* 
2 * drag 1.0
3 * create by [email protected]
4 * date 2015-08-18
5 * 拖动滑块
6 */
7var intvalidCode = "0";
8var intvalidCode2 = "0";
9var dragWiht=0;
10(function ($) {
11    $.fn.drag = function (options) {
12        var x, drag = this, isMove = false, defaults = {
13        };
14        var options = $.extend(defaults, options);
15        //添加背景,文字,滑块
16        var html = '<div class="drag_bg"></div>' +
17            '<div class="drag_text" onselectstart="return false;" unselectable="on">拖动滑块验证</div>' +
18            '<div class="handler handler_bg"></div>';
19        this.html(html);
20
21        var handler = drag.find('.handler');
22        var drag_bg = drag.find('.drag_bg');
23        var text = drag.find('.drag_text');
24        var maxWidth = drag.width() - handler.width();  //能滑动的最大间距
25        if (maxWidth<=0 && dragWiht>0) {
26            maxWidth = dragWiht;
27        }
28        dragWiht = maxWidth;
29        //鼠标按下时候的x轴的位置
30        handler.mousedown(function (e) {
31            isMove = true;
32            x = e.pageX - parseInt(handler.css('left'), 10);
33        });
34
35        //鼠标指针在上下文移动时,移动距离大于0小于最大间距,滑块x轴位置等于鼠标移动距离
36        $(document).mousemove(function (e) {
37            var _x = e.pageX - x;
38            if (isMove) {
39                if (_x > 0 && _x <= maxWidth) {
40                    handler.css({ 'left': _x });
41                    drag_bg.css({ 'width': _x });
42                } else if (_x > maxWidth) {  //鼠标指针移动距离达到最大时清空事件
43                    handler.css({ 'left': maxWidth });
44                    drag_bg.css({ 'width': maxWidth });
45                    dragOk();
46                }
47            }
48        }).mouseup(function (e) {
49            isMove = false;
50            var _x = e.pageX - x;
51            if (_x < maxWidth) { //鼠标松开时,如果没有达到最大距离位置,滑块就返回初始位置
52                handler.css({ 'left': 0 });
53                drag_bg.css({ 'width': 0 });
54            }
55        });
56
57        //清空事件
58        function dragOk() {
59            handler.removeClass('handler_bg').addClass('handler_ok_bg');
60            text.text('验证通过');
61            drag.css({ 'color': '#fff' });
62            handler.unbind('mousedown');
63            $(document).unbind('mousemove');
64            $(document).unbind('mouseup');
65            intvalidCode = CommonFunc.DragOk().value;
66            //            login(validCode);
67            if (options.type == 2) {
68                //拖动验证成功
69                intvalidCode2 = intvalidCode;
70            } else {
71                DragOklogin();
72            }
73        }
74    };
75})(jQuery);
76//清空事件
77function Cleardrag() {
78    jQuery('#drag').drag({type: 1});
79    $('#drag').css("color", "");
80    intValidCode = "0";
81}
82function Cleardrag2() {
83    jQuery('#drag2').drag({type: 2});
84    $('#drag2').css("color", "");
85    intValidCode2 = "0";
86}
87function Cleardrag3() {
88    jQuery('#drag').drag({ type: 2 });
89    $('#drag2').css("color", "");
90    intValidCode2 = "0";
91}
92function DragOklogin() {
93    if ($("#txtUserName").val().length < 1) {
94        Boxy.hide();
95        Boxy.alert('请填写用户名!', function () { $("#txtUserName").focus(); }, { title: "错误", modal: true, closeable: false });
96        return false;
97    }
98    if ($("#txtPassWord").val().length < 1) {
99        Boxy.hide();
100        Boxy.alert('请填写密码!', function () { $("#txtPassWord").focus(); }, { title: "错误", modal: true, closeable: false });
101        return false;
102    }
103    var cbCookies = $("#cbCookies").is(':checked') ? "true" : "false";
104    $('#btnOk').attr("disabled", "disabled");
105    var result = CommonFunc.DragCheckLogin(intvalidCode, $("#txtUserName").val(), $("#txtPassWord").val(), cbCookies).value;
106    $('#btnOk').removeAttr("disabled");
107    if (result == "-1") {
108        Boxy.alert('滑动验证错误,请刷新页面和重新滑动!', '', { title: "错误", modal: true });
109        return false;
110    } else if (result.indexOf("次") > 0) {
111        Boxy.alert("您还有<span style='color:red'>" + result + "</span>机会来填写正确的用户名和密码", "", { title: "错误", modal: true });
112        return false;
113    } else {
114        var jsonOjbect = eval("data=" + result);
115        if (jsonOjbect.Error) {
116            $("#ValidCodeImg").attr("src", "/UserManage/ValidCode.aspx?" + Math.random());
117            $("#txtValidCode").val('');
118            if (jsonOjbect.Error == "-2")
119                Boxy.alert('该账号不存在!', '', { title: "错误", modal: true });
120            else if (jsonOjbect.Error == "-1")
121                Boxy.alert('用户名或密码错误,请二十分钟后重试。', '', { title: "错误", modal: true });
122            else if (jsonOjbect.Error == "-3")
123                Boxy.alert('您注册的邮箱未验证,请验证后重新登录!', '', { title: "错误", modal: true });
124            else if (jsonOjbect.Error == "-4") {
125                Boxy.alert('很遗憾,您长时间未登录,账号已被冻结。<br>请使用APP扫码验证登录或联系本站客服:<br>电话:' + $("#CsPhone").val() + '<br>QQ:' + $("#CsQuin").val(), { title: "错误", modal: true });
126            }
127            else if (jsonOjbect.Error == "-20230810") {
128                Boxy.alert('很遗憾,您长时间未登录,账号已被冻结。<br>请联系本站客服', { title: "错误", modal: true });
129            }
130            else
131                Boxy.alert('登陆失败!', '', { title: "错误", modal: true });
132            return false;
133        }
134    }
135    if (getCookie('gourl') != undefined) {
136        var url = getCookie('gourl');
137        deleteCookie('gourl');
138        window.location = url;
139        return true;
140    }
141    if (result == "1") {
142        window.location = '/UserManage/Default.aspx';
143    }
144    else if (result == "2") {
145        window.location = '/PurchasManage/Default.aspx';
146    }
147    else
148        window.location = '/UserManage/Default.aspx';
149
150    return true;
151}
152//js混淆加密压缩
153
154function getCookie(cookie_name) {
155    var allcookies = document.cookie;
156    var cookie_pos = allcookies.indexOf(cookie_name);
157    if (cookie_pos != -1) {
158        cookie_pos += cookie_name.length + 1;
159        var cookie_end = allcookies.indexOf(";", cookie_pos);
160        if (cookie_end == -1) {
161            cookie_end = allcookies.length;
162        }
163        var value = unescape(allcookies.substring(cookie_pos, cookie_end));
164    }
165    return value;
166}
167function deleteCookie(name) {
168    //获取当前时间
169    var date = new Date();
170    //将date设置为过去的时间
171    date.setTime(date.getTime() - 10000);
172    document.cookie = name + "=v; expires=" + date.toGMTString() + ";path=/;domain=ybzhan.cn" ;
173
174} 

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.