User:Aesulus/common.js: Difference between revisions

Content added Content deleted
No edit summary
(remove redundant check)
Line 69: Line 69:
else if (node.nodeType === Node.ELEMENT_NODE) { // check if it's an element node
else if (node.nodeType === Node.ELEMENT_NODE) { // check if it's an element node
if (node.tagName == "STYLE") { // don't pekofy yourself
if (node.tagName == "STYLE") { // don't pekofy yourself
return;
}
if (node.tagName == "A" && node.getAttribute('href') == node.textContent) { // don't pekofy links
return;
return;
}
}
Line 130: Line 127:
}
}


// Begin here. Only run pekofy script while *viewing* (i.e. not editing) wiki subject pages and only if cookies are enabled
function onLoadCheck() {
function onLoadCheck() {
if(document.body.classList.contains('ns-subject') && document.body.classList.contains('action-view') && navigator.cookieEnabled) {
if(document.body.classList.contains('ns-subject') && document.body.classList.contains('action-view') && navigator.cookieEnabled) {
Line 136: Line 134:
}
}


// Begin here. Only run pekofy script while *viewing* (i.e. not editing) wiki subject pages and only if cookies are enabled
if (document.readyState === 'loading') {
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', onLoadCheck);
document.addEventListener('DOMContentLoaded', onLoadCheck);