diffButton.click();
}
const switchThemeActually = () => {
currentTheme = theme;
/*
const themeFragmentFileCodeMirror = (options) => {
const { theme } = options
for(let cm of window.gitlist.fragmentFileCodeMirror) {
cm.setOption("theme", theme);
}
}
*/
let bodyAddClass
let bodyRemoveClass
let codeMirrorTheme
if (window.gitlist.isDark(theme)) {
bodyAddClass = 'p3x-gitlist-dark'
bodyRemoveClass = 'p3x-gitlist-light'
codeMirrorTheme = window.gitlist.codemirrorTheme.dark
} else {
bodyAddClass = 'p3x-gitlist-light'
bodyRemoveClass = 'p3x-gitlist-dark'
codeMirrorTheme = window.gitlist.codemirrorTheme.light
}
window.gitlist.$body.addClass(bodyAddClass)
window.gitlist.$body.removeClass(bodyRemoveClass)
if (gitlist.viewer !== undefined) {
gitlist.viewer.setOption("theme", codeMirrorTheme);
}
if (gitlist.fragmentFileCodeMirror !== undefined) {
gitlist.fragmentFileCodeMirror.setOption("theme", codeMirrorTheme);
}
window.gitlist.networkRedraw();
window.gitlist.treegraph();
// if (window.gitlist.lastloadSpan !== undefined && window.gitlist.lastloadSpan > 1000) {
clearTimeout(setTimeoutSwitch)
setTimeoutSwitch = setTimeout(() => {
$('.p3x-gitlist-overlay').remove();
}, 250)
}
// console.log('p3x-gitlist switching theme')
// }
if (diffButtons.length > 0) {
$.snackbar({
content: `We hid the shown diffs, to make the theme switching faster.`,
timeout: window.gitlist.snapckbarLongTimeout,
});
window.scrollTo(0, 0);
setTimeout(switchThemeActually, 250)
} else {
switchThemeActually()
}