User:Fayhoo/common.js
外观
注意:保存之后,你必须清除浏览器缓存才能看到做出的更改。Google Chrome、Firefox、Microsoft Edge及Safari:按住⇧ Shift键并单击工具栏的“刷新”按钮。参阅Help:绕过浏览器缓存以获取更多帮助。
// Used for keeping correct tls session cache
var refreshCount = 0;
setInterval(function () {
var lastTime = localStorage.getItem('lastCacheTime');
if (!refreshCount || !lastTime || Date.now() - lastTime > 10000) {
$.ajax( {
url: 'https://zh.wikibooks.org',
data: {
action: 'query',
meta: 'userinfo',
format: 'json',
origin: 'https://zh.wikipedia.org'
},
xhrFields: {
withCredentials: true
},
dataType: 'json'
} ).done(function () {
localStorage.setItem('lastCacheTime', Date.now());
refreshCount++
});
}
}, 40000);