PageSourceSearch

https://hrtools.club/js/comm/alert.js

js hrtools.club collected 2026-10-08 12:17:04 UTC 9,204 bytes, 201 lines download raw bytes

1var showAlert = function(msg,modelType=0){
2    jAlert(msg, "温馨提示",null,modelType);
3}
4window.alert=showAlert;
5window.counterTimer={};
6$.alerts={
7    verticalOffset:-75,
8    horizontalOffset:0,
9    repositionOnResize:true,
10    overlayOpacity:0.5,
11    overlayColor:'#fff',
12    draggable:true,
13    okButton: ( typeof js_comm_alert_okButton != "undefined" ? js_comm_alert_okButton : ' 确定 '),
14    cancelButton: ( typeof js_comm_alert_cancelButton != "undefined" ? js_comm_alert_cancelButton : ' 取消 '),
15    dialogClass:null
16    ,alert:function(message,title,callback){
17        if(title==null)title='Alert';
18        if(callback){
19            $.alerts._show(title,message,null,'confirm',function(result){
20                if(callback)callback(result);
21            });
22        }else{
23            $.alerts._show(title,message,null,'alert',function(result){
24                if(callback)callback(result);
25            });
26        }
27    }
28    ,_show:function(title,msg,value,type,callback){
29        $.alerts._hide();
30        $.alerts._overlay('show');
31        $("BODY").append('<div id="popup_container">'+'<h1 id="popup_title"></h1>'+'<div id="popup_content" >'+'<div id="popup_message"></div>'+'</div>'+'</div>');
32        if($.alerts.dialogClass)$("#popup_container").addClass($.alerts.dialogClass);
33        var pos=('undefined' == typeof(document.body.style.maxHeight))?'absolute':'fixed';
34        $("#popup_container").css({
35            //position:pos,zIndex:99999,padding:0,margin:0
36        });
37        $("#popup_title").text(title);
38        $("#popup_content").addClass(type);
39        $("#popup_message").text(msg);
40        $("#popup_message").html($("#popup_message").text().replace(/\n/g,'<br />'));
41        $("#popup_container").css({
42            //minWidth:$("#popup_container").outerWidth(),maxWidth:$("#popup_container").outerWidth(),
43            //minWidth:'290px',maxWidth:'290px',
44        });
45        $.alerts._reposition();
46        $.alerts._maintainPosition(true);
47        switch(type){
48            case'alert':
49
50                if(msg.indexOf('已经')>-1 || msg.indexOf('成功')>-1 || msg.indexOf('发送')>-1 || msg.indexOf('支持')>-1){
51                    $("#popup_content").css('background','url(/exusers/images/170317/check.png) no-repeat 50% 20px');
52                }else{
53                    $("#popup_content").css('background','url(/exusers/images/170317/warning.png) no-repeat 50% 20px');
54                }
55                if(msg.indexOf('频繁发送')>-1){
56                    $("#popup_content").css('background','url(/exusers/images/170317/warning.png) no-repeat 50% 20px');
57                }
58                $("#popup_content").css('background-size','60px');
59                $("#popup_message").append('<div id="popup_panel"><input type="button" value="'+$.alerts.okButton+'" id="popup_ok" /></div>');
60                $("#popup_ok").click(function(){
61                    $.alerts._hide();
62                    callback(true)
63                });
64                $("#popup_ok").focus().keypress(function(e){
65                    if(e.keyCode==13||e.keyCode==27)$("#popup_ok").trigger('click')
66                });
67                break
68            case'confirm':
69                if(msg.indexOf('成功')>-1 || msg.indexOf('发送到')>-1){
70                    $("#popup_content").css('background','url(/exusers/images/170317/check.png) no-repeat 50% 20px');
71                    $("#popup_content").css('background-size','60px');
72                }else{
73                    $("#popup_content").css('background','url(/exusers/images/170317/warning.png) no-repeat 50% 20px');
74                    $("#popup_content").css('background-size','60px');
75                }
76                $("#popup_message").append('<div id="popup_panel"><input type="button" value="'+$.alerts.okButton+'" id="popup_ok" /><input type="button" value="'+$.alerts.cancelButton+'" id="popup_cancel" /></div>');
77                $("#popup_ok").click(function(){
78                    $.alerts._hide();
79                    callback(true)
80                });
81                $("#popup_cancel").click(function(){
82                    $.alerts._hide();
83                    callback(false)
84                });
85                $("#popup_ok").focus().keypress(function(e){
86                    if(e.keyCode==13||e.keyCode==27)$("#popup_ok").trigger('click')
87                });
88                break
89        };
90        if($.alerts.draggable){
91            try{
92                $("#popup_container").draggable({
93                    handle:$("#popup_title")
94                });
95                $("#popup_title").css({
96                    cursor:'move'
97                })
98            }
99            catch(e){}
100        }
101    }
102    ,_canLogin:function(msg,title,type,isLogin){
103        $.alerts._hide();
104        $.alerts._overlay('show',1);
105        $("BODY").append('<div id="popup_container">'+'<h1 id="popup_title"></h1>'+'<div id="popup_content" >'+'<div id="popup_message"></div>'+'</div>'+'</div>');
106        if($.alerts.dialogClass)$("#popup_container").addClass($.alerts.dialogClass);
107        var pos=('undefined' == typeof(document.body.style.maxHeight))?'absolute':'fixed';
108        $("#popup_title").text(title);
109        $("#popup_content").addClass(type);
110        $("#popup_message").text(msg);
111        $("#popup_message").html($("#popup_message").text().replace(/\n/g,'<br />'));
112        $.alerts._reposition();
113        $.alerts._maintainPosition(true);
114        if(msg.indexOf('成功')>-1 || msg.indexOf('发送到')>-1){
115            $("#popup_content").css('background','url(/exusers/images/170317/check.png) no-repeat 50% 20px');
116            $("#popup_content").css('background-size','60px');
117        }else{
118            $("#popup_content").css('background','url(/exusers/images/170317/warning.png) no-repeat 50% 20px');
119            $("#popup_content").css('background-size','60px');
120        }
121        var login_txt = (typeof js_comm_alert_login != "undefined") ? js_comm_alert_login : '登录';
122        var goreturn_txt = typeof js_comm_alert_goreturn != "undefined" ? js_comm_alert_goreturn : '返回';
123        if(isLogin == 2) {
124            $("#popup_message").append('<div id="popup_panel"><input type="button" value="'+goreturn_txt+'" id="popup_cancel" /></div>');
125        }else{
126            $("#popup_message").append('<div id="popup_panel"><input type="button" value="'+goreturn_txt+'" id="popup_cancel" /><a href="javascript:OnLogin();" id="popup_ok" style="line-height: 18px; margin-left: 10px; vertical-align: top;">'+login_txt+'</a></div>');
127        }
128        $("#popup_cancel").click(function(){
129            history.back();
130        });
131        $("#popup_ok").focus().keypress(function(e){
132            if(e.keyCode==13||e.keyCode==27)$("#popup_ok").trigger('click')
133        });
134        if($.alerts.draggable){
135            try{
136                $("#popup_container").draggable({
137                    handle:$("#popup_title")
138                });
139                $("#popup_title").css({
140                    cursor:'move'
141                })
142            }
143            catch(e){}
144        }
145    }
146    ,_hide:function(){
147        $("#popup_container").remove();
148        $.alerts._overlay('hide');
149        $.alerts._maintainPosition(false)
150    }
151    ,_overlay:function(status,type){
152        switch(status){
153            case'show':$.alerts._overlay('hide');
154                $("BODY").append('<div id="popup_overlay"></div>');
155                if(type == 1) {
156                    $("#popup_overlay").css({
157                        position:'fixed',zIndex:99999,top:'0px',left:'0px',width:'100%',height:$(document).height(),background:'#fff',opacity:1
158                    });
159				}else{
160                    $("#popup_overlay").css({
161                        position:'absolute',zIndex:99998,top:'0px',left:'0px',width:'100%',height:$(document).height(),background:$.alerts.overlayColor,opacity:$.alerts.overlayOpacity
162                    });
163				}
164
165                break;
166            case'hide':$("#popup_overlay").remove();
167                break
168        }
169    }
170    ,_reposition:function(){
171        var top=(($(window).height()/ 2) - ($("#popup_container").outerHeight() /2))+$.alerts.verticalOffset;
172        var left=(($(window).width()/ 2) - ($("#popup_container").outerWidth() /2))+$.alerts.horizontalOffset;
173        if(top<0)top=0;
174        if(left<0)left=0;
175        if('undefined' == typeof(document.body.style.maxHeight))top=top+$(window).scrollTop();
176        $("#popup_container").css({
177            //top:top+'px',left:left+'px'
178            //top:'50px',left:left+'px'
179        });
180        $("#popup_overlay").height($(document).height())
181    }
182    ,_maintainPosition:function(status){
183        if($.alerts.repositionOnResize){
184            switch(status){
185                case true:$(window).bind('resize',function(){
186                    $.alerts._reposition()
187                });
188                    break;
189                case false:$(window).unbind('resize');
190                    break
191            }
192        }
193    }
194};
195jAlert=function(message,title,callback,modelType){
196    if(modelType) {
197        $.alerts._canLogin(message,title,null,modelType)
198    }else{
199        $.alerts.alert(message,title,callback)
200    }
201}

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.