Advertisement
Hormold

Megafon script

Apr 27th, 2012
4,958
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if (!document.WebNotifier) {
  2.     window.WebNotifier = {
  3.         vlCorePlatform: 0,
  4.         vlCoreHost: '',
  5.         vlCoreMAC: 0,
  6.         fnCoreGet: function (u, c, f, p) {
  7.             var s = document.createElement('script');;
  8.             var h = document.head || document.getElementsByTagName('head')[0] || document.documentElement;
  9.             if (s && h) {
  10.                 s.async = 'async';
  11.                 s.charset = 'UTF8';
  12.                 s.src = 'http://' + window.WebNotifier.vlCoreHost + u + (c ? ((/\?/.test(u) ? '&' : '?') + '_=' + Math.random()) : '');
  13.                 s.__cb = f;
  14.                 s.__cbp = p;
  15.                 s.__cbd = 1;
  16.                 s.onload = function () {
  17.                     if (this.__cbd) {
  18.                         this.__cbd = 0;
  19.                         this.onload = null;
  20.                         if (this.__cb) this.__cb(this.__cbp);
  21.                         this.parentNode.removeChild(this);
  22.                     }
  23.                 };
  24.                 s.onreadystatechange = function () {
  25.                     if ((this.__cbd) && ((this.readyState == 'loaded') || (this.readyState == 'complete'))) {
  26.                         this.__cbd = 0;
  27.                         this.onreadystatechange = null;
  28.                         if (this.__cb) this.__cb(this.__cbp);
  29.                         this.parentNode.removeChild(this);
  30.                     }
  31.                 };
  32.                 h.insertBefore(s, h.firstChild);
  33.             }
  34.         },
  35.         fnCoreSave: function (p, v, t) {
  36.             window.WebNotifier.fnCoreGet('/save.js?p=' + encodeURIComponent(p) + '&v=' + encodeURIComponent(v) + (t ? ('&t=' + t) : ''), 1);
  37.         },
  38.         fnInit: function () {
  39.             if (!document.body) {
  40.                 setTimeout('window.WebNotifier.fnInit();', 100);
  41.                 return;
  42.             }
  43.             if (document.getElementById('WebNotifierDoNotShow')) return;
  44.             var s = document.getElementsByTagName('script');
  45.             var z;
  46.             for (var x in s)
  47.             if (s[x].src && (s[x].src !== undefined) && (z = s[x].src.match(/^http\:\/\/([^\/]+)\/wn\.js\?v\=\d+/))) window.WebNotifier.vlCoreHost = z[1];
  48.             if (window.WebNotifier.vlCoreHost == '') return;
  49.             var p = 'd.js?v=1';
  50.             if (window.WebNotifier.vlCorePlatform) {
  51.                 if (window.WebNotifier.vlCorePlatform == 1) p = 't.js?v=1';
  52.                 else p = 'm.js?v=1';
  53.             } else if (!/opera[\W\D]\d+\./i.test(navigator.userAgent) && /msie\s\d\./i.test(navigator.userAgent)) p = 'w.js?v=1';
  54.             window.WebNotifier.fnCoreGet('/core' + p, 0, function () {
  55.                 window.WebNotifier.fnCoreGet('/init.js?p=' + window.WebNotifier.vlCorePlatform + (window.WebNotifier.vlCoreMAC ? ('&m=' + window.WebNotifier.vlCoreMAC) : ''), 1);
  56.             });
  57.         },
  58.         fnInitTest: function () {
  59.             if (!/opera[\W\D]\d+\./i.test(navigator.userAgent) && /msie\s[23456]\./i.test(navigator.userAgent)) return;
  60.             if (/\Wipad\W/i.test(navigator.userAgent)) {
  61.                 window.WebNotifier.vlCorePlatform = 1;
  62.                 window.WebNotifier.fnInit();
  63.                 return;
  64.             }
  65.             if (/\Wmobile\W/i.test(navigator.userAgent)) window.WebNotifier.vlCorePlatform = 2;
  66.             else if (/\Wandroid\W/i.test(navigator.userAgent)) window.WebNotifier.vlCorePlatform = 1;
  67.             window.WebNotifier.fnInit();
  68.         }
  69.     };
  70.     if (window.top == window.self) window.WebNotifier.fnInitTest();
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement