PageSourceSearch

https://kattani.kz/js/loader.js

js kattani.kz collected 2026-10-02 23:45:59 UTC 6,620 bytes, 164 lines download raw bytes

1var mailru = mailru || {};
2mailru.loader = {
3    modvers: {
4        receiver: 1,
5        proxy: 22,
6        api: 118,
7        api_dev: 3,
8        xdm: 5
9    },
10    modreleases: {
11        receiver: null,
12        proxy: null,
13        api: null,
14        api_dev: null,
15        xdm: null
16    },
17    _modulePath: 'http://my2.imgsmail.ru/mail/ru/images/js/connect/',
18    moduleEnv: {}, //additional environment data for the modules
19    initEnv: function(){
20        'use strict';
21        var env = mailru.loader.getEnv(),
22            modulePaths = {
23                'https-alpha': 'https://' + env.branch + '.myalpha.imgsmail.ru/mail/ru/images/js/connect/',
24                'http-alpha':  'http://'  + env.branch + '.myalpha.imgsmail.ru/mail/ru/images/js/connect/',
25                'https-live':  'https://my2.imgsmail.ru/mail/ru/images/js/connect/',
26                'http-live':   'http://my2.imgsmail.ru/mail/ru/images/js/connect/'
27            },
28            modulePath = modulePaths[mailru.loader.getMode(env)];
29
30        mailru.loader._modulePath = modulePath;
31        mailru.loader.moduleEnv = env;
32    },
33    _loaded: {},
34    _readyCallbacks: {},
35    require: function(module, onready, deferLoad){
36        mailru.loader.initEnv();
37        if(this._loaded[module]){
38            onready();
39        } else {
40            if(!this._readyCallbacks[module]){
41                if(typeof this._readyCallbacks[module] === 'undefined')
42                    this._readyCallbacks[module] = [];
43                this._readyCallbacks[module].push(onready);
44                var modver = (this.modvers[module] && ('?'+ this.modvers[module])) || '';
45                var modrelease = (this.modreleases[module] && ('/' + this.modreleases[module]) + '/') || '/';
46                deferLoad = mailru.isIE && deferLoad? true : false;
47                document.URL.match(/testmode=1/) && (modver = '');
48
49                with(document.getElementsByTagName('head')[0].appendChild(document.createElement('script'))){
50                    type = 'text/javascript';
51                    // todo: enable min back or think how versions could be switched at runtime
52                    // src = this._modulePath+ module+ modrelease+ (module === 'api' ? 'api_min' : module)+ '.js' +modver;
53                    src = this._modulePath+ module+ modrelease+ (module === 'api' ? 'api' : module)+ '.js' +modver;
54                    if(deferLoad){
55                        defer = "defer";
56                    }
57                }
58            } else {
59                this._readyCallbacks[module].push(onready);
60            }
61
62        }
63    },
64    onready: function(module){
65        if(this._readyCallbacks[module]){
66            this._loaded[module] = true;
67            var cbs = this._readyCallbacks[module],
68                throwingMatch = location.href.match(/throwing=1/i),
69                throwExceptions = (throwingMatch && throwingMatch.length > 0);
70            if(cbs.length) {
71                for(var i=0; i<cbs.length; i++){
72                    if (!throwExceptions) {
73                        try{
74                            cbs[i]();
75                        } catch(e) {
76                        }
77                    } else {
78                        cbs[i]();
79                    }
80                }
81            }
82
83        }
84    },
85    getEnv: function(){
86        var isHttps = location.protocol === 'https:',
87            branchMatch = location.href.match(/__branch=([a-z0-9\-]*)/i),
88            branch = (branchMatch && branchMatch.length > 0) ? branchMatch[1] : '';
89        return { 'branch': branch, 'isHttps': isHttps};
90    },
91    getMode: function(moduleEnv){
92
93        //default mode is always http-live
94        var mode = 'http-live';
95
96        // if current protocol is HTTPS and the branch is set, all content will be served from alphas via https, 
97        // branch parameter will be persisted in all consequent URLs
98        if (moduleEnv.branch !== '' && moduleEnv.isHttps) {
99            mode ='https-alpha';
100        }
101        // if current protocol is not https but branch is set, content will be served from alphas with branch 
102        // via http, branch will be persisted in all consequent URLs
103        else if (moduleEnv.branch !== '') {
104            mode ='http-alpha';
105        }
106        // if current protocol is https and no branch is set, then it's a live site with 
107        // https, all content should be served from live https
108        else if (moduleEnv.isHttps) {
109            mode ='https-live';
110        }
111
112        // if no conditions apply, it's just a live site served via http
113        return mode;
114    }
115
116};
117
118mailru.loader.initEnv();
119
120mailru.isIE = (function () {
121    var tmp = document.documentMode, e, isIE;
122    try{document.documentMode = "";}
123    catch(e){ };
124    isIE = typeof document.documentMode == "number" ? 11 : eval("/*@cc_on!@*/!1");
125    try{document.documentMode = tmp;}
126    catch(e){ };
127    return isIE;
128})()
129mailru.isOpera = !!window.opera;
130mailru.isApp = false;
131
132if (window.name.indexOf('app') !== -1 && window.name.indexOf('mailruapp') !== -1) {
133    mailru.isApp = true;
134}
135
136mailru.intercomType = ( (window.postMessage && !mailru.isIE) || (mailru.isApp && mailru.isIE && window.postMessage))? 'event' : (((function(){var i,a,o,p,s="Shockwave",f="Flas
136h",t=" 2.0",u=s+" "+f,v=s+f+".",rSW=RegExp("^"+u+" (\\d+)");if((o=navigator.plugins)&&(p=o[u]||o[u+t])&&(a=p.description.match(rSW)))return a[1];else if(!!(window.ActiveXObject))for(i=10;i>0;i--)try{if(!!(new ActiveXObject(v+v+i)))return i}catch(e){}return 0;})() < 10) ? 'hash' : 'flash');
137
138mailru.init = function(onready, private_key, DOMFlashId){
139    mailru.loader.require('api', function(){
140        try{
141            mailru.app.init(private_key);
142        }catch(e){}
143        var e;
144        if(DOMFlashId && (e=document.getElementById(DOMFlashId))){
145            setTimeout(onready, 1);
146            mailru.events.listen('event', function(name, data){
147                document.getElementById(DOMFlashId).mailruEvent(name, data);
148            });
149        }
150    })
151}
152mailru.autoInit = (function(){
153    if (!mailru.disableAutoInit) {
154        var a = document.getElementsByTagName('a'), al = a.length;
155        for(var i = 0; i < al; i++){
156            if (typeof a[i] !== 'undefined' && a[i].className.indexOf('mrc__plugin') != -1) {
157                mailru.loader.require('api', function(){
158                    mailru.plugin.init();
159                });
160                break;
161            }
162        }
163    }
164})();

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.