ElEditors, Interface administrators, Administrators
70,866
edits
No edit summary |
No edit summary |
||
Line 24: | Line 24: | ||
} | } | ||
var loadJS = function(url, implementationCode, location){ | var loadJS = function (url, implementationCode, location) { | ||
var scriptTag = document.createElement('script'); | var scriptTag = document.createElement('script'); | ||
scriptTag.src = url; | scriptTag.src = url; | ||
Line 31: | Line 31: | ||
location.appendChild(scriptTag); | location.appendChild(scriptTag); | ||
}; | }; | ||
var popperLoaded = function() { | var popperLoaded = function () { | ||
var tippyLoaded = function() { | var tippyLoaded = function () { | ||
tippy('.tippy-btn', { | tippy('.tippy-btn', { | ||
interactive: true, | interactive: true, | ||
Line 180: | Line 180: | ||
setCookie('elwiki-dark-mode', 'true'); | setCookie('elwiki-dark-mode', 'true'); | ||
} | } | ||
setTimeout(function(){ | setTimeout(function () { | ||
window.location.reload(1); | window.location.reload(1); | ||
}, 50) | }, 50) | ||
Line 543: | Line 543: | ||
performIE(); | performIE(); | ||
enhancements(); | enhancements(); | ||
} | |||
}); | |||
// Now also fix the preview button | |||
// This is a complete ChatGPT moment, I couldn't be arsed to debug on my own | |||
$(document).on('DOMNodeInserted', function (event) { | |||
var element = event.target; | |||
if ($(element).hasClass('previewnote')) { | |||
var previewLoaded = $(element).find('.previewloading').length == 0; | |||
if (previewLoaded && !$(element).hasClass('custom-preview-run')) { | |||
$(element).addClass('custom-preview-run'); | |||
enhancements(); | |||
} | |||
} | } | ||
}); | }); |