diff --git a/templates/header.html b/templates/header.html index b2c0f054..51a9593c 100644 --- a/templates/header.html +++ b/templates/header.html @@ -3,21 +3,21 @@ {% if config.meta_keywords %}{% endif %} -{% if config.default_stylesheet.1 != '' %}{% endif %} -{% if config.font_awesome %}{% endif %} -{% if config.country_flags_condensed %}{% endif %} +{% if config.default_stylesheet.1 != '' %}{% endif %} +{% if config.font_awesome %}{% endif %} +{% if config.country_flags_condensed %}{% endif %} {% if not nojavascript %} - + {% if not config.additional_javascript_compile %} {% for javascript in config.additional_javascript %}{% endfor %} {% endif %} {% if mod %} - + {% endif %} {% endif %} {% if config.captcha.provider == 'recaptcha' %} diff --git a/templates/main.js b/templates/main.js index 96d2fb3f..5e498eda 100644 --- a/templates/main.js +++ b/templates/main.js @@ -141,7 +141,33 @@ function changeStyle(styleName, link) { x.appendChild(s); } - document.getElementById('stylesheet').href = styles[styleName]; + let mainStylesheetElement = document.getElementById('stylesheet'); + let userStylesheetElement = document.getElementById('stylesheet-user'); + + // Override main stylesheet with the user selected one. + if (!userStylesheetElement) { + userStylesheetElement = document.createElement('link'); + userStylesheetElement.rel = 'stylesheet'; + userStylesheetElement.media = 'none'; + userStylesheetElement.type = 'text/css'; + userStylesheetElement.id = 'stylesheet'; + let x = document.getElementsByTagName('head')[0]; + x.appendChild(userStylesheetElement); + } + + // When the new one is loaded, disable the old one + userStylesheetElement.onload = function() { + this.media = 'all'; + mainStylesheetElement.media = 'none'; + } + + let style = styles[styleName]; + if (style !== '') { + // Add the version of the resource if the style is not the embedded one. + style += `?v=${resourceVersion}`; + } + + document.getElementById('stylesheet').href = style; selectedstyle = styleName; if (document.getElementsByClassName('styles').length != 0) { @@ -162,6 +188,7 @@ function changeStyle(styleName, link) { {% endverbatim %} +var resourceVersion = document.currentScript.getAttribute('data-resource-version'); {% if config.stylesheets_board %} {% verbatim %} diff --git a/templates/mod/ban_list.html b/templates/mod/ban_list.html index f039350b..ee8753f7 100644 --- a/templates/mod/ban_list.html +++ b/templates/mod/ban_list.html @@ -1,11 +1,11 @@ - - - - - - - - + + + + + + + +
{% if token_json %} diff --git a/templates/mod/pages.html b/templates/mod/pages.html index c2395c02..f6be9487 100644 --- a/templates/mod/pages.html +++ b/templates/mod/pages.html @@ -1,4 +1,4 @@ - +{% if board %} @@ -27,7 +27,7 @@
{% trans %}URL{% endtrans %} | {% trans %}Title{% endtrans %} |
---|---|
- |
({% trans 'There are no active posts.' %})
{% else %} diff --git a/templates/themes/recent/recent.html b/templates/themes/recent/recent.html index 2a4510f8..9fce7ab8 100644 --- a/templates/themes/recent/recent.html +++ b/templates/themes/recent/recent.html @@ -4,11 +4,11 @@