mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-06-06 23:16:52 +00:00
Fix code format for busuanzi.js
This commit is contained in:
@@ -1,54 +1,94 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
let bszCaller, bszTag, scriptTag, ready
|
let bszCaller, bszTag, scriptTag, ready
|
||||||
|
|
||||||
let t; let e; let n; let a = !1
|
let intervalId;
|
||||||
let c = []
|
let executeCallbacks;
|
||||||
|
let onReady;
|
||||||
|
let isReady = false;
|
||||||
|
let callbacks = [];
|
||||||
|
|
||||||
// 修复Node同构代码的问题
|
// 修复Node同构代码的问题
|
||||||
if (typeof document !== 'undefined') {
|
if (typeof document !== 'undefined') {
|
||||||
ready = function (t) {
|
ready = function (callback) {
|
||||||
return a || document.readyState === 'interactive' || document.readyState === 'complete'
|
if (isReady || document.readyState === 'interactive' || document.readyState === 'complete') {
|
||||||
? t.call(document)
|
callback.call(document);
|
||||||
: c.push(function () {
|
} else {
|
||||||
return t.call(this)
|
callbacks.push(function () {
|
||||||
}), this
|
return callback.call(this);
|
||||||
}, e = function () {
|
});
|
||||||
for (let t = 0, e = c.length; t < e; t++) c[t].apply(document)
|
}
|
||||||
c = []
|
return this;
|
||||||
}, n = function () {
|
};
|
||||||
a || (a = !0, e.call(window),
|
|
||||||
document.removeEventListener ? document.removeEventListener('DOMContentLoaded', n, !1) : document.attachEvent && (document.detachEvent('onreadystatechange', n), window == window.top && (clearInterval(t), t = null)))
|
executeCallbacks = function () {
|
||||||
}, document.addEventListener
|
for (let i = 0, len = callbacks.length; i < len; i++) {
|
||||||
? document.addEventListener('DOMContentLoaded', n, !1)
|
callbacks[i].apply(document);
|
||||||
: document.attachEvent && (document.attachEvent('onreadystatechange', function () {
|
}
|
||||||
/loaded|complete/.test(document.readyState) && n()
|
callbacks = [];
|
||||||
}), window == window.top && (t = setInterval(function () {
|
};
|
||||||
try {
|
|
||||||
a || document.documentElement.doScroll('left')
|
onReady = function () {
|
||||||
} catch (t) {
|
if (!isReady) {
|
||||||
return
|
isReady = true;
|
||||||
|
executeCallbacks.call(window);
|
||||||
|
if (document.removeEventListener) {
|
||||||
|
document.removeEventListener('DOMContentLoaded', onReady, false);
|
||||||
|
} else if (document.attachEvent) {
|
||||||
|
document.detachEvent('onreadystatechange', onReady);
|
||||||
|
if (window == window.top) {
|
||||||
|
clearInterval(intervalId);
|
||||||
|
intervalId = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
n()
|
}
|
||||||
}, 5)))
|
};
|
||||||
|
|
||||||
|
if (document.addEventListener) {
|
||||||
|
document.addEventListener('DOMContentLoaded', onReady, false);
|
||||||
|
} else if (document.attachEvent) {
|
||||||
|
document.attachEvent('onreadystatechange', function () {
|
||||||
|
if (/loaded|complete/.test(document.readyState)) {
|
||||||
|
onReady();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (window == window.top) {
|
||||||
|
intervalId = setInterval(function () {
|
||||||
|
try {
|
||||||
|
if (!isReady) {
|
||||||
|
document.documentElement.doScroll('left');
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
onReady();
|
||||||
|
}, 5);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bszCaller = {
|
bszCaller = {
|
||||||
fetch: function (t, e) {
|
fetch: function (url, callback) {
|
||||||
const n = 'BusuanziCallback_' + Math.floor(1099511627776 * Math.random())
|
const callbackName = 'BusuanziCallback_' + Math.floor(1099511627776 * Math.random())
|
||||||
t = t.replace('=BusuanziCallback', '=' + n)
|
url = url.replace('=BusuanziCallback', '=' + callbackName)
|
||||||
scriptTag = document.createElement('SCRIPT'), scriptTag.type = 'text/javascript', scriptTag.defer = !0, scriptTag.src = t, scriptTag.referrerPolicy = "no-referrer-when-downgrade", document.getElementsByTagName('HEAD')[0].appendChild(scriptTag)
|
scriptTag = document.createElement('SCRIPT');
|
||||||
window[n] = this.evalCall(e)
|
scriptTag.type = 'text/javascript';
|
||||||
|
scriptTag.defer = true;
|
||||||
|
scriptTag.src = url;
|
||||||
|
scriptTag.referrerPolicy = "no-referrer-when-downgrade";
|
||||||
|
document.getElementsByTagName('HEAD')[0].appendChild(scriptTag);
|
||||||
|
window[callbackName] = this.evalCall(callback)
|
||||||
},
|
},
|
||||||
evalCall: function (e) {
|
evalCall: function (callback) {
|
||||||
return function (t) {
|
return function (data) {
|
||||||
ready(function () {
|
ready(function () {
|
||||||
try {
|
try {
|
||||||
e(t)
|
callback(data);
|
||||||
if (scriptTag && scriptTag.parentElement && scriptTag.parentElement.contains(scriptTag)) {
|
if (scriptTag && scriptTag.parentElement && scriptTag.parentElement.contains(scriptTag)) {
|
||||||
scriptTag.parentElement.removeChild(scriptTag)
|
scriptTag.parentElement.removeChild(scriptTag);
|
||||||
}
|
}
|
||||||
} catch (t) {
|
} catch (e) {
|
||||||
// console.log(t), bszTag.hides()
|
// console.log(e);
|
||||||
|
// bszTag.hides();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -56,41 +96,44 @@ bszCaller = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const fetch = () => {
|
const fetch = () => {
|
||||||
bszTag && bszTag.hides()
|
if (bszTag) {
|
||||||
bszCaller.fetch('//busuanzi.ibruce.info/busuanzi?jsonpCallback=BusuanziCallback', function (t) {
|
bszTag.hides();
|
||||||
// console.log('不蒜子',t)
|
}
|
||||||
bszTag.texts(t), bszTag.shows()
|
bszCaller.fetch('//busuanzi.ibruce.info/busuanzi?jsonpCallback=BusuanziCallback', function (data) {
|
||||||
|
// console.log('不蒜子',data)
|
||||||
|
bszTag.texts(data);
|
||||||
|
bszTag.shows();
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
bszTag = {
|
bszTag = {
|
||||||
bszs: ['site_pv', 'page_pv', 'site_uv'],
|
bszs: ['site_pv', 'page_pv', 'site_uv'],
|
||||||
texts: function (n) {
|
texts: function (data) {
|
||||||
this.bszs.map(function (t) {
|
this.bszs.map(function (key) {
|
||||||
const e = document.getElementsByClassName('busuanzi_value_' + t)
|
const elements = document.getElementsByClassName('busuanzi_value_' + key)
|
||||||
if(e){
|
if (elements) {
|
||||||
for (var element of e) {
|
for (var element of elements) {
|
||||||
element.innerHTML = n[t]
|
element.innerHTML = data[key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
hides: function () {
|
hides: function () {
|
||||||
this.bszs.map(function (t) {
|
this.bszs.map(function (key) {
|
||||||
const e = document.getElementsByClassName('busuanzi_container_' + t)
|
const elements = document.getElementsByClassName('busuanzi_container_' + key)
|
||||||
if(e){
|
if (elements) {
|
||||||
for (var element of e){
|
for (var element of elements) {
|
||||||
element.style.display = 'none'
|
element.style.display = 'none';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
shows: function () {
|
shows: function () {
|
||||||
this.bszs.map(function (t) {
|
this.bszs.map(function (key) {
|
||||||
const e = document.getElementsByClassName('busuanzi_container_' + t)
|
const elements = document.getElementsByClassName('busuanzi_container_' + key)
|
||||||
if(e){
|
if (elements) {
|
||||||
for(var element of e){
|
for (var element of elements) {
|
||||||
element.style.display = 'inline'
|
element.style.display = 'inline';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user