User:Aesulus/common.js: Difference between revisions
Content added Content deleted
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
function getPekoCookie(key) { |
function getPekoCookie(key) { |
||
const matchArray = document.cookie.match(new RegExp(key + '=([^;]+)')); |
const matchArray = document.cookie.match(new RegExp('\b' + key + '=([^;]+)')); |
||
return (matchArray == null) ? null : matchArray[1]; |
return (matchArray == null) ? null : matchArray[1]; |
||
Line 21: | Line 21: | ||
const style = document.createElement('style'); |
const style = document.createElement('style'); |
||
style.textContent = '\ |
style.textContent = '\ |
||
.mw-wiki-logo {\ |
body.isPeko .mw-wiki-logo {\ |
||
background-image: url(https://static.miraheze.org/hololivewiki/thumb/9/9a/PekoliveFanWiki-logo-black.png/ |
background-image: url(https://static.miraheze.org/hololivewiki/thumb/9/9a/PekoliveFanWiki-logo-black.png/120px-PekoliveFanWiki-logo-black.png);\ |
||
}\ |
}\ |
||
#pekofyButton {\ |
#pekofyButton {\ |
||
Line 127: | Line 127: | ||
document.body.classList.remove('isPeko'); |
document.body.classList.remove('isPeko'); |
||
unpekofy(document.body); |
unpekofy(document.body); |
||
} |
|||
⚫ | |||
⚫ | |||
⚫ | |||
} |
|||
} |
} |
||
// Begin here. Only run pekofy script while *viewing* (i.e. not editing) wiki subject pages and only if cookies are enabled |
// Begin here. Only run pekofy script while *viewing* (i.e. not editing) wiki subject pages and only if cookies are enabled |
||
document. |
if (document.readyState === 'loading') { |
||
document.addEventListener('DOMContentLoaded', onLoadCheck); |
|||
⚫ | |||
} |
|||
⚫ | |||
else { |
|||
⚫ | |||
onLoadCheck(); |
|||
} |
|||
} |
} |