window.gitlist.isDark =(theme) => { for(var i = 0; i < window.gitlist.dark.length; i++ ) { if (window.gitlist.dark[i] === theme) { return true; } } return false; } let $body; window.gitlist.setTheme = () => { if ($body === undefined) { setTimeout(() => { window.gitlist.setTheme(theme) }) return; } const theme = global.gitlist.getThemeCookie() const actualTheme = theme.split('-')[1] if (window.gitlist.isDark(actualTheme)) { $body.addClass('p3x-gitlist-dark') $body.removeClass('p3x-gitlist-light') if (gitlist.viewer !== undefined) { gitlist.viewer.setOption("theme", 'blackboard'); } } else { $body.addClass('p3x-gitlist-light') $body.removeClass('p3x-gitlist-dark') if (gitlist.viewer !== undefined) { gitlist.viewer.setOption("theme", 'default'); } } let setTimeoutSwitch; if (window.gitlist.lastloadSpan !== undefined && window.gitlist.lastloadSpan > 1000) { clearTimeout(setTimeoutSwitch) setTimeoutSwitch = setTimeout(() => { $('.p3x-gitlist-overlay').remove(); }, window.gitlist.lastloadSpan) } } $(function () { $body = $('body'); const es = document.getElementsByTagName('a') for(let i=0; i