User:Aesulus/common.js: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 1:
function getPekoCookie(key) {
const matchArray = document.cookie.match(new RegExp('\b' + key + '=([^;]+)'));
return (matchArray == null) ? null : matchArray[1];
Line 21:
const style = document.createElement('style');
style.textContent = '\
body.isPeko .mw-wiki-logo {\
background-image: url(https://static.miraheze.org/hololivewiki/thumb/9/9a/PekoliveFanWiki-logo-black.png/480px120px-PekoliveFanWiki-logo-black.png);\
}\
#pekofyButton {\
Line 127:
document.body.classList.remove('isPeko');
unpekofy(document.body);
}
 
function onLoadCheck() {
if(document.body.classList.contains('ns-subject') && document.body.classList.contains('action-view') && navigator.cookieEnabled) {
addButton();
}
}
 
// Begin here. Only run pekofy script while *viewing* (i.e. not editing) wiki subject pages and only if cookies are enabled
if (document.addEventListener(readyState === 'DOMContentLoadedloading',) {
document.addEventListener('DOMContentLoaded', onLoadCheck);
function() {
}
if(document.body.classList.contains('ns-subject') && document.body.classList.contains('action-view') && navigator.cookieEnabled) {
else {
addButton();
onLoadCheck();
}
});