PageSourceSearch

http://cncptsintl.com/static/js/select_banner.js

js cncptsintl.com collected 2026-10-08 13:12:20 UTC 16,450 bytes, 425 lines download raw bytes

1function getByClassNames(classStr, tag) {
2    if (document.getElementsByClassName) {
3        return document.getElementsByClassName(classStr)
4    } else {
5        var nodes = document.getElementsByTagName('body');
6        var ret = [];
7        if (tag && Object.prototype.toString.call(tag).toLowerCase() !== '[object string]') {
8             nodes = tag;
9        }
10        for (var i = 0; i < nodes.length; i++) {
11            if (hasClass(nodes[i], classStr)) {
12                ret.push(nodes[i])
13            }
14            return ret;
15        }
16    }
17}
18
19var select_banner = function () {
20    var baseMimgUrl = 'static/mimg';
21    // if(window.cssPath && typeof window.cssPath === 'string'){
22    //     var _url = window.cssPath.split('/');
23    //     for (var index = 0; index < _url.length; index++) {
24    //         var element = _url[index];
25    //         if(element && element!== 'http' && element!== 'https'){
26    //             baseMimgUrl = element;
27    //             break; 
28    //         }
29    //     }
30    // }
31    var lxStyledBanners = ['/'+ baseMimgUrl +'/p/official_site/admin/imageRight.png',
32                         '/'+ baseMimgUrl +'/p/official_site/admin/imageLeft.png',
33                         '/'+ baseMimgUrl +'/p/official_site/admin/imageCenter.png',
34                         '/' + baseMimgUrl + '/p/official_site/admin/imageRight.png'],
35        computedBanner;
36
37    // 如果用户使用默认背景,则根据样式选择默认背景
38    // 否则根据文件名称判断用户的自定义背景图片是改版之前上传还是改版之后上传
39    // 改版之前上传的图片需要做兼容处理(不显示登录框背景、设置登录框背景色
40
41    var $loginModWrapper = getId('login-mod-wrapper');
42
43
44    if (isDefaultBg) {
45        computedBanner = lxStyledBanners[currentStyle];
46    } else {
47        computedBanner = currentBanner;
48        var timeStr = computedBanner.match(/\/([\d]+)\.[^\/]+$/) && computedBanner.match(/\/([\d]+)\.[^\/]+$/)[1] || undefined,
49            uploadTime = timeStr && new Number(timeStr) || undefined,
50            judgeTime = 1353600000000;//2012-11-23 00:00:00
51        if (!uploadTime || uploadTime < judgeTime) {
52            $loginModWrapper.style.backgroundImage = 'none';
53            $loginModWrapper.style.backgroundColor = '#fff';
54        }
55    }
56    // 设置背景banner图片
57    var $mainPart = getId('main-part');
58    $mainPart.style.backgroundImage = 'url(' + computedBanner.replace('http:','https:') + ')';
59    if (isDefaultBg) {
60        // 默认背景时加上点击跳转
61        $mainPart.style.cursor = 'pointer';
62        
63        $mainPart.onclick =function () {
64            var win_mail = window.open("//dashi.163.com/index.html?from=mail413");
65            win_mail.opener = null;
66            window.DATracker && DATracker.track('click_login_pic_download');
67        };
68    }
69
70    // 根据style设置登录框的样式
71    setLoginStyle('login-mod-wrapper');
72    setLoginStyle('login-mod-qr');
73
74    function setLoginStyle(domId){
75        var $loginbox = getId(domId);
76        if($loginbox){
77            addClass($loginbox,'login-mod-wrapper-' + currentStyle);
78            $loginbox.style.cursor = 'default';
79            $loginbox.onclick = function (e) {
80                if ( e && e.stopPropagation ) {
81                    e.stopPropagation();
82                } else { 
83                    window.event.cancelBubble = true;
84                }
85            };
86        }
87    }
88    
89    getId('login-mod-wrapper').style.display = 'block';
90
91    if(getId('official_app')){
92        getId('official_app').onclick = function() {
93           // window.open('https://hubble.netease.com/sl/aaagOQ');
94            window.DATracker && DATracker.track('click_login_topbar_mailapplication');
95        };
96
97        getId('official_app').onmouseenter = function() {
98            window.DATracker && DATracker.track('scan_login_topbar_mailappliction');
99        };
100        
101        // getId('donwload_block').onclick =function() {
102        //     window.DATracker && DATracker.track('click_login_account_download');
103        //     window.open('https://hubble.netease.com/sl/aaagOK');
104        // };
105    }
106
107    function QrLogin() {
108        this.type = "";
109        this.lang = "zh_cn"
110        var param = window.location.search.split("?")[1];
111        if(param && param.indexOf("hl=en_US") > -1){
112            this.lang = "en_US"
113        }
114    }
115
116    Object.extend = function(destination, source) {
117        for (var property in source) {
118            destination[property] = source[property];   
119        }
120        return destination;   
121    }
122
123    Object.extend(QrLogin.prototype, {
124        map: {
125            "dashi":{
126                getQrSrc : function (t) {
127                   return "https://mail.qiye.163.com/commonweb/qrcode/getqrcode.do?w=130&h=130&t=" + (t ? Date.now() : "");
128                },
129                getQrCheck: function () {
130                    return "https://mail.qiye.163.com/commonweb/qrcode/checkstatus.do?p=qiyemail"
131                },
132                name: {
133                    "zh_cn": "邮箱大师",
134                    "en_US": "Mail Master"
135                },
136            },
137            "wechat":{
138                getQrSrc : function (t) {
139                    var domain = getId('domain') ? (getId('domain').value || '') : '';
140                    return "https://open.qiye.163.com/miniapp/qrcode/create?type=1&w=130&h=130&t=" + (t ? Date.now() : "") + "&domain=" + domain;
141                },
142                getQrCheck: function () {
143                    return "https://open.qiye.163.com/miniapp/qrcode/check?p=qiyemail&all_secure=1&hl=zh_CN&ch="
144                },
145                name:{
146                    "zh_cn": "微信",
147                    "en_US": "Wechat"
148                }
149            },
150            "qiyewechat":{
151                getQrSrc: function () {
152                    return ''
153                },
154                getQrCheck : function () {
155                    return void(0);
156                },
157                getOpenLink : function () {
158                    var searchParamGroup = [];
159                    var param = window.location.search.split("?")[1];
160                    searchParamGroup.push({
161                        key: 'domain',
162                        value: getId('domain') ? (getId('domain').value || '') : ''
163                    });
164                    searchParamGroup.push({
165                        key:'hl',
166                        value: (param && param.indexOf("hl=en_US") > -1) ? 'en_US' : 'zh_CN'
167                    });
168                    searchParamGroup.push({
169                        key:'all_secure',
170                        value: getId('all_secure') ? (getId('all_secure').value || "1") : "1"
171                    });
172                    var queryStrArr = [];
173                    for (var index = 0; index < searchParamGroup.length; index++) {
174                        var p = searchParamGroup[index];
175                        queryStrArr.push(p.key + '=' + p.value);
176                    }
177                    var url = 'https://open.qiye.163.com/miniapp/qiye_weixin/qr/login?' + queryStrArr.join('&')
178                    return url;
179                },
180                name:{
181                    "zh_cn":'企业微信',
182                    'en_US': 'WeCom'
183                }
184            },
185            "dingtalk":{
186                getQrSrc: function (t) {
187                    var domain = getId('domain') ? (getId('domain').value || '') : '';
188                    return "https://open.qiye.163.com/miniapp/qrcode/create?type=2&w=130&h=130&t=" + (t ? Date.now() : "") + "&domain=" + domain ;
189                },
190                getQrCheck : function () {
191                    return "https://open.qiye.163.com/miniapp/qrcode/check?p=qiyemail&all_secure=1&hl=zh_CN&ch="
192                },
193                name:{
194                    "zh_cn":'钉钉',
195                    'en_US': 'DingTalk'
196                }
197            },
198            "sirius":{
199                getQrSrc: function (t) {
200                    var domain = getId('domain') ? (getId('domain').value || '') : '';
201                    return "https://open.qiye.163.com/miniapp/qrcode/create?type=5&w=130&h=130&t=" + (t ? Date.now() : "") + "&domain=" + domain ;
202                },
203                getQrCheck : function () {
204                    return "https://open.qiye.163.com/miniapp/qrcode/check?p=sirius&all_secure=1&hl=zh_CN&ch="
205                },
206                name:{
207                    "zh_cn":'网易灵犀办公客户端',
208                    'en_US': 'NetEase Lingxi Client'
209                }
210            }
211        },
212
213        //刷新二维码
214        refreshQrCode: function () {
215            var that = this;
216            var appCodeImg = getId("appCode");
217            var imgUrl = that.map[that.type].getQrSrc(true);
218            var openLink = that.map[that.type].getOpenLink && that.map[that.type].getOpenLink();
219            if(imgUrl){
220                appCodeImg.src =imgUrl;
221                return true;
222            }
223            if(openLink){
224                window.open(openLink,'_blank');
225                return false;
226            }
227        },
228        //开始二维码扫描轮询
229        startScan: function () {
230            var that = this;
231            /*重置扫码状态  开始*/
232            that.stopScan();
233            if(!that.refreshQrCode()){
234                return;
235            }
236            var appLoginWait = getId('appLoginWait');
237            var appLoginScan = getId('appLoginScan');
238            appLoginWait.style.display = 'block';
239            appLoginScan.style.display = 'none';
240            var url = that.map[that.type].getQrCheck();
241            /*重置扫码状态  结束*/
242            that.scanTimer = setTimeout(checkCode, 2000);
243            function checkCode() {
244                JSONP({
245                    url: url,
246                   // type: 'get',
247                    //dataType: 'jsonp',
248                    success: function (response) {
249                        if(response && (response.code === 200 || response.suc)){
250                            var data = response.result || response.con;
251                            if (data.status == 0) {
252                                //未扫码
253                            }
254                            else if (data.status == 1) {
255                                //扫码成功
256                                appLoginWait.style.display = 'none';
257                                appLoginScan.style.display = 'block';
258                            }
259                            else if (data.status == 2) {
260                                //登录成功
261                                return window.location.href = data.loginurl ||  data.loginUrl;
262                            }
263                            else if (data.status == 3) {
264                                //不存在或已过期
265                                that.showCodeRefresh();
266                            }
267                        }
268                        that.scanTimer = setTimeout(checkCode, 2000);
269                    },
270                    error: function () {
271                        that.showCodeRefresh();
272                    }
273                });
274            }
275           
276        },
277        //停止二维码扫描轮询
278        stopScan: function () {
279            var that = this;
280            clearTimeout(that.scanTimer);
281            clearInterval(that.scanTimer);
282        },
283        //显示二维码失效遮罩
284        showCodeRefresh: function () {
285            var that = this;
286            that.stopScan();
287            getId('appCodeRefresh').style.display = 'block';
288            removeClass(getId('appCodeWrap'),'allowmove');
289        },
290        //隐藏二维码失效遮罩
291        hideCodeRefresh: function () {
292            var that = this;
293            getId('appCodeRefresh').style.display = 'none';
294            addClass(getId('appCodeWrap'),'allowmove');
295            that.startScan();
296        },
297        initQrcode: function () {
298            var that = this;
299            //var $appList = getId('appList');
300           // var $appList = getByClassNames('J_appList');
301           // var $siriusScan = getByClassNames('J_app_sirius');
302            var $appList = $dom.get('.J_appList');
303            var $siriusScan = $dom.get('.J_app_sirius');
304            that.scanTimer = null;
305            var $codebox = getId("codeContain");
306            var $appName = getId("appName");
307            var $siriusPc = getId("sirius_pc_wrapper");
308            var $closeBtn = getId("closeEntryBtn");
309            var $siriusWrapper = getId("app_sirius_wrapper");
310            $codebox.onclick = function (e) {
311                if ( e && e.stopPropagation ) {
312                    e.stopPropagation();
313                } else { 
314                    window.event.cancelBubble = true;
315                }
316            }
317
318
319            for(var i=0;i<$appList.length;i++){
320                $appList[i].onclick = thirdScanCallback;
321            }
322
323            for(var i=0;i<$siriusScan.length;i++){
324                $siriusScan[i].onclick = thirdScanCallback;
325            }
326
327            function thirdScanCallback (e) {
328                var event = e || window.event;
329                var target= event.target || event.srcElement;
330                var id = target.getAttribute('id');
331                if(id == 'accountlogin'){
332                    getId('loginmod').style.display = 'block';
333                    getId('mobilemod').style.display = 'none';
334                    return;
335                }
336
337                if(id == 'mobilelogin'){
338                    getId('loginmod').style.display = 'none';
339                    getId('mobilemod').style.display = 'block';
340                    return;
341                } 
342
343                switch (id) {
344                    case "appDashi":
345                        that.type = "dashi";
346                        break;
347                    case "appWechat":
348                        that.type = "wechat";
349                        break;
350                    case "appQiyeWechat":
351                        that.type = "qiyewechat";
352                        break;
353                    case "appDingtalk":
354                        that.type = "dingtalk";
355                        break;
356                     case "appSirius":
357                        that.type = "sirius";
358                        break;
359                    default:
360                        return
361                }
362                if(!that.refreshQrCode()){
363                    return
364                }
365                $appName.innerHTML = that.map[that.type].name[that.lang];
366
367                if(id == 'appSirius'){
368                    $siriusPc.style.display = 'block';
369                    $closeBtn.style.display = 'none';
370                }else{
371                    if($siriusPc){
372                        $siriusPc.style.display = 'none';
373                    }
374                    $closeBtn.style.display = 'block';
375                }
376
377                $codebox.style.display = 'block';
378                $codebox.style.left = '0';
379                $codebox.style.top = '0';
380                $codebox.style.opacity = 1;
381                that.startScan();
382            };
383
384            $siriusPc.onclick = closeQrCodeCallback;
385            $closeBtn.onclick = closeQrCodeCallback;
386            
387            function closeQrCodeCallback(e) {
388                var event = e || window.event;
389                var target= event.target || event.srcElement;
390                var id = target.getAttribute('id');
391                $codebox.style.left = '413px';
392                $codebox.style.top = '335px';
393                $codebox.style.opacity = 0;
394                getId('appCodeRefresh').style.display = 'none';
395                addClass(getId('appCodeWrap'),'allowmove');
396                that.type = "";
397                that.stopScan();
398            };
399
400            getId('appLoginRestart').onclick =  function () {
401                that.startScan();
402            };
403            getId('appCodeRefresh').onclick =function () {
404                that.hideCodeRefresh();
405            }
406
407        },
408        scanCodeHandler: function () {
409            var that = this;
410            that.initQrcode();
411        }
412    })
413
414    var qrLogin = new QrLogin()
415    qrLogin.scanCodeHandler()
416    // 设置错误消息
417    if (errMsg.trim().length > 0) {
418        setMsgpid(errMsg);
419    }
420};
421
422select_banner();
423// $dom.onready(function(){
424// 	select_banner();
425// })

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.