1var _PUSHME_APP_CLIENT = "wordpress-plugin"; 2var _PUSHME_APP_CLIENT_VERSION = "1.0.0"; 3var invictumPushMe = (typeof invictumPushMe !== 'undefined' && invictumPushMe) || { 4 token: '', publicKey: '', lastSavedToken: null, initOnDocLoad: false, 5 initialized: false, inFlight: false, retryTimer: null, attempts: 0, 6 init: function(key) { 7 this.publicKey = key; 8 if (this.initialized) return; 9 this.initialized = true; 10 // Old ipn_last_token was written before acknowledgement; resync it once. 11 this.lastSavedToken = this.storageGet('push_confirmed_v2'); 12 this.previousToken = this.lastSavedToken || this.storageGet('ipn_last_token'); 13 if (window.addEventListener) window.addEventListener('online', function() { invictumPushMe.attempts = 0; invictumPushMe.saveToken(); }); 14 }, 15 iOS: function() { return /iPad|iPhone|iPod/.test(navigator.userAgent); }, 16 macOS: function() { return navigator.platform.toUpperCase().indexOf('MAC') >= 0; }, 17 storageGet: function(k) { try { return localStorage.getItem('ipm' + k); } catch(e) { return null; } }, 18 storageSet: function(k,v) { try { localStorage.setItem('ipm' + k,v); } catch(e) {} }, 19 requestPermission: function() {}, // Firebase bootstrap supplies the implementation. 20 initEvents: function() {}, 21 getToken: function() { return this.token; }, 22 setToken: function(token) { 23 if (typeof token !== 'string' || token.length < 11 || token.length > 4096) return; 24 if (!this.initialized) this.init(this.publicKey); 25 if (this.token !== token) this.attempts = 0; 26 this.token = token; 27 this.saveToken(); 28 }, 29 saveToken: function() { 30 if (!this.token || this.inFlight || this.retryTimer) return; 31 var confirmedAt = Number(this.storageGet('push_confirmed_at') || 0); 32 if (this.token === this.lastSavedToken && Date.now() - confirmedAt < 86400000) return; 33 this.doReq({type: 'subscribe_general'}, 'save'); 34 }, 35 doReq: function(extra, action) { 36 action = action || 'save'; 37 var saving = action === 'save', sentToken = this.token; 38 if (saving && this.inFlight) return; 39 var data = {act: action, token: sentToken, old_token: this.previousToken || '', 40 website: window.location.hostname, home_url: window.location.protocol + '//' + window.location.host, 41 client: _PUSHME_APP_CLIENT, client_version: typeof _PUSHME_APP_CLIENT_VERSION_V !== 'undefined' ? _PUSHME_APP_CLIENT_VERSION_V : _PUSHME_APP_CLIENT_VERSION}; 42 if (saving) { data.type = 'subscribe_general'; this.inFlight = true; } 43 var failed = function() { 44 if (!saving) return; 45 invictumPushMe.inFlight = false; 46 if (++invictumPushMe.attempts > 5) return; // Next visit/online event tries again. 47 invictumPushMe.retryTimer = setTimeout(function() { invictumPushMe.retryTimer = null; invictumPushMe.saveToken(); }, Math.min(60000, 2000 * Math.pow(2, invictumPushMe.attempts - 1))); 48 }; 49 jQuery.ajax({type:'POST', url:_PUSHME_SUBSCRIBE_URL, data:data, dataType:'json', timeout:20000, 50 success:function(result) { 51 if (saving) { 52 if (!result || (result.success !== 1 && result.success !== true)) { failed(); return; } 53 invictumPushMe.inFlight = false; invictumPushMe.attempts = 0; 54 invictumPushMe.lastSavedToken = sentToken; invictumPushMe.previousToken = sentToken; 55 invictumPushMe.storageSet('push_confirmed_v2', sentToken); 56 invictumPushMe.storageSet('push_confirmed_at', String(Date.now())); 57 invictumPushMe.storageSet('ipn_last_token', sentToken); 58 if (invictumPushMe.storageGet('web_pn_allow_approved') !== 'approved') invictumPushMe.doReq({},'web_pn_allow_approved'); 59 if (invictumPushMe.token !== sentToken) invictumPushMe.saveToken(); 60 } else if (result && result.saved === (action === 'web_pn_allow_showed' ? 'showed' : 'approved')) { 61 invictumPushMe.storageSet(action, result.saved); 62 } 63 }, error:failed}); 64 }, 65 pushNotificationDeniedShowError: function() { jQuery('#operateri-pn-error-overlay,#operateri-pn-error').show(); }, 66 pushNotificationDeniedHideError: function() { jQuery('#operateri-pn-error-overlay,#operateri-pn-error').hide(); } 67}; 68 69var INV_ADS_DEVICE_TYPE = jQuery(window).width() < 1000 ? 'mobile' : 'desktop'; 70var INV_ADS_CHCK_CNT = 0; 71var INV_ADS_LD_CNT = 0; 72function _invLoadAdsFill(){ 73 jQuery('.adsbygoogle:not(.ldf)').each(function(){ 74 //console.log('ad1', this); 75 jQuery(this).addClass('ldf').css('background-image', 'url(' + INV_ADS_BANNER_PLACEHOLDER + ')'); 76 }); 77 78 79 jQuery('.adsbygoogle.ldf[data-ad-status="filled"]').each(function(){ 80 //console.log('ad2', this); 81 jQuery(this).addClass('ldf').css('background-image', 'none'); 82 }); 83 84 85 INV_ADS_LD_CNT ++;
86 if(INV_ADS_LD_CNT < 10){ 87 setTimeout(_invLoadAdsFill, 1000); 88 } 89} 90 91 92function _invEmptyAdsFill(){ 93 jQuery('.adsbygoogle[data-ad-status="unfilled"]').each(function(){ 94 if(!jQuery(this).hasClass('invfill') && (!jQuery(this).hasClass('adsbygoogle-noablate') || jQuery(this).closest('.google-auto-placed').length > 0)){ 95 jQuery(this).addClass('invfill'); 96 if(jQuery(this).width() < 600){ 97 INV_ADS_DEVICE_TYPE = 'mobile'; 98 }else{ 99 INV_ADS_DEVICE_TYPE = 'desktop'; 100 } 101 var rnd = Math.floor(Math.random() * (INV_ADS_BANNER_REPLACEMNT.length-1 - 0 + 1)) + 0; 102 var bnr = INV_ADS_BANNER_REPLACEMNT[rnd]; 103 var bnrImg = INV_ADS_DEVICE_TYPE == 'mobile' ? bnr.mobile_img : bnr.desktop_img; 104 105 if(bnr.desktop_html_banner && INV_ADS_DEVICE_TYPE != 'mobile'){ 106 var mRand = Math.floor(Math.random() * (999999 - 1 + 1)) + 1; 107 var htmlBnr = bnr.desktop_html_banner; 108 htmlBnr = htmlBnr.replaceAll('RNDCRA', mRand); 109 jQuery(this) 110 .css('min-height', jQuery(this).height() < 280 ? 280 : jQuery(this).height() ) 111 .html(htmlBnr) 112 .css('background-color', 'transparent') 113 .css('background-image', 'none'); 114 }else if(bnr.mobile_html_banner && INV_ADS_DEVICE_TYPE == 'mobile'){ 115 var mRand = Math.floor(Math.random() * (999999 - 1 + 1)) + 1; 116 var htmlBnr = bnr.mobile_html_banner; 117 htmlBnr = htmlBnr.replaceAll('RNDCRA', mRand); 118 jQuery(this) 119 .css('min-height', jQuery(this).height() < 280 ? 280 : jQuery(this).height() ) 120 .html(htmlBnr) 121 .css('background-color', 'transparent') 122 .css('background-image', 'none'); 123 }else{ 124 jQuery(this) 125 .css('min-height', jQuery(this).height() < 280 ? 280 : jQuery(this).height() ) 126 .html('') 127 .css('background-image', 'url('+INV_ADS_BASE_URL+bnrImg+')') 128 .css('background-position', 'center center') 129 .css('background-size', 'contain') 130 .css('background-repeat', 'no-repeat') 131 .css('cursor', 'pointer') 132 .attr('onclick', "window.open('" + bnr.link + "', '_blank').focus();"); 133 } 134 } 135 }); 136 INV_ADS_CHCK_CNT ++; 137 if(INV_ADS_CHCK_CNT < 10){setTimeout(_invEmptyAdsFill, 1000);} 138}
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.