Make themes more customizable

(cherry picked from commit dffb2706a158784e2f3091f895a868e373683bc8)
This commit is contained in:
Silvio Giebl
2019-05-20 09:48:57 +02:00
parent 418cf1d640
commit cba53a6914
12 changed files with 44 additions and 81 deletions

View File

@@ -274,11 +274,25 @@ function initSearch() {
}
}
// Focus
function pageFocus() {
var mainContent = document.querySelector('.js-main-content');
mainContent.focus();
}
// Switch theme
jtd.getTheme = function() {
var cssFileHref = document.querySelector('[rel="stylesheet"]').getAttribute('href');
return cssFileHref.substring(cssFileHref.lastIndexOf('-') + 1, cssFileHref.length - 4);
}
jtd.setTheme = function(theme) {
var cssFile = document.querySelector('[rel="stylesheet"]');
cssFile.setAttribute('href', '{{ "assets/css/just-the-docs-" | absolute_url }}' + theme + '.css');
}
// Document ready
jtd.onReady(function(){