mirror of
https://github.com/vichan-devel/vichan.git
synced 2024-11-28 01:10:51 +01:00
Merge pull request #803 from Zankaria/more-busting
More cache busting with resource_version
This commit is contained in:
commit
c95877bdcb
@ -3,21 +3,21 @@
|
|||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=yes">
|
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=yes">
|
||||||
{% if config.meta_keywords %}<meta name="keywords" content="{{ config.meta_keywords }}">{% endif %}
|
{% if config.meta_keywords %}<meta name="keywords" content="{{ config.meta_keywords }}">{% endif %}
|
||||||
{% if config.default_stylesheet.1 != '' %}<link rel="stylesheet" type="text/css" id="stylesheet" href="{{ config.uri_stylesheets }}{{ config.default_stylesheet.1 }}">{% endif %}
|
{% if config.default_stylesheet.1 != '' %}<link rel="stylesheet" type="text/css" id="stylesheet" href="{{ config.uri_stylesheets }}{{ config.default_stylesheet.1 }}?v={{ config.resource_version }}">{% endif %}
|
||||||
{% if config.font_awesome %}<link rel="stylesheet" href="{{ config.root }}{{ config.font_awesome_css }}">{% endif %}
|
{% if config.font_awesome %}<link rel="stylesheet" href="{{ config.root }}{{ config.font_awesome_css }}?v={{ config.resource_version }}">{% endif %}
|
||||||
{% if config.country_flags_condensed %}<link rel="stylesheet" href="{{ config.root }}{{ config.country_flags_condensed_css }}">{% endif %}
|
{% if config.country_flags_condensed %}<link rel="stylesheet" href="{{ config.root }}{{ config.country_flags_condensed_css }}?v={{ config.resource_version }}">{% endif %}
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var configRoot="{{ config.root }}";
|
var configRoot="{{ config.root }}";
|
||||||
var inMod = {% if mod %} true {% else %} false {% endif %};
|
var inMod = {% if mod %} true {% else %} false {% endif %};
|
||||||
var modRoot = "{{ config.root }}" + (inMod ? "mod.php?/" : "");
|
var modRoot = "{{ config.root }}" + (inMod ? "mod.php?/" : "");
|
||||||
</script>
|
</script>
|
||||||
{% if not nojavascript %}
|
{% if not nojavascript %}
|
||||||
<script type="text/javascript" src="{{ config.url_javascript }}?v={{ config.resource_version }}"></script>
|
<script type="text/javascript" src="{{ config.url_javascript }}?v={{ config.resource_version }} data-resource-version="{{ config.resource_version }}"></script>
|
||||||
{% if not config.additional_javascript_compile %}
|
{% if not config.additional_javascript_compile %}
|
||||||
{% for javascript in config.additional_javascript %}<script type="text/javascript" src="{{ config.additional_javascript_url }}{{ javascript }}?v={{ config.resource_version }}"></script>{% endfor %}
|
{% for javascript in config.additional_javascript %}<script type="text/javascript" src="{{ config.additional_javascript_url }}{{ javascript }}?v={{ config.resource_version }}"></script>{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if mod %}
|
{% if mod %}
|
||||||
<script type="text/javascript" src="/js/mod/mod_snippets.js"></script>
|
<script type="text/javascript" src="/js/mod/mod_snippets.js?v={{ config.resource_version }}"></script>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if config.captcha.provider == 'recaptcha' %}<script src="//www.recaptcha.net/recaptcha/api.js"></script>
|
{% if config.captcha.provider == 'recaptcha' %}<script src="//www.recaptcha.net/recaptcha/api.js"></script>
|
||||||
|
@ -141,7 +141,33 @@ function changeStyle(styleName, link) {
|
|||||||
x.appendChild(s);
|
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;
|
selectedstyle = styleName;
|
||||||
|
|
||||||
if (document.getElementsByClassName('styles').length != 0) {
|
if (document.getElementsByClassName('styles').length != 0) {
|
||||||
@ -162,6 +188,7 @@ function changeStyle(styleName, link) {
|
|||||||
|
|
||||||
|
|
||||||
{% endverbatim %}
|
{% endverbatim %}
|
||||||
|
var resourceVersion = document.currentScript.getAttribute('data-resource-version');
|
||||||
{% if config.stylesheets_board %}
|
{% if config.stylesheets_board %}
|
||||||
{% verbatim %}
|
{% verbatim %}
|
||||||
|
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
<script src='main.js?v={{ config.resource_version }}'></script>
|
<script src='main.js?v={{ config.resource_version }}' data-resource-version="{{ config.resource_version }}"></script>
|
||||||
<script src='js/jquery.min.js'></script>
|
<script src='js/jquery.min.js?v={{ config.resource_version }}'></script>
|
||||||
<script src='js/mobile-style.js'></script>
|
<script src='js/mobile-style.js?v={{ config.resource_version }}'></script>
|
||||||
<script src='js/strftime.min.js'></script>
|
<script src='js/strftime.min.js?v={{ config.resource_version }}'></script>
|
||||||
<script src='js/longtable/longtable.js'></script>
|
<script src='js/longtable/longtable.js?v={{ config.resource_version }}'></script>
|
||||||
<script src='js/mod/ban-list.js'></script>
|
<script src='js/mod/ban-list.js?v={{ config.resource_version }}'></script>
|
||||||
<link rel='stylesheet' href='stylesheets/longtable/longtable.css'>
|
<link rel='stylesheet' href='stylesheets/longtable/longtable.css?v={{ config.resource_version }}'>
|
||||||
<link rel='stylesheet' href='stylesheets/mod/ban-list.css'>
|
<link rel='stylesheet' href='stylesheets/mod/ban-list.css?v={{ config.resource_version }}'>
|
||||||
|
|
||||||
<form action="?/bans" method="post" class="banform">
|
<form action="?/bans" method="post" class="banform">
|
||||||
{% if token %}
|
{% if token %}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<script type="text/javascript" src="js/jquery.min.js"></script>
|
<script type="text/javascript" src="js/jquery.min.js?v={{ config.resource_version }}"></script>
|
||||||
<div style="text-align:center">
|
<div style="text-align:center">
|
||||||
<p class="unimportant">
|
<p class="unimportant">
|
||||||
{% if board %}
|
{% if board %}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<script src="{{ config.additional_javascript_url }}js/mod/recent-posts.js"></script>
|
<script src="{{ config.additional_javascript_url }}js/mod/recent-posts.js?v={{ config.resource_version }}"></script>
|
||||||
{% if not posts|length %}
|
{% if not posts|length %}
|
||||||
<p style="text-align:center" class="unimportant">({% trans 'There are no active posts.' %})</p>
|
<p style="text-align:center" class="unimportant">({% trans 'There are no active posts.' %})</p>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
@ -4,11 +4,11 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
|
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
|
||||||
<title>{{ settings.title }}</title>
|
<title>{{ settings.title }}</title>
|
||||||
<link rel="stylesheet" media="screen" href="{{ config.url_stylesheet }}"/>
|
<link rel="stylesheet" media="screen" href="{{ config.url_stylesheet }}?v={{ config.resource_version }}"/>
|
||||||
<link rel="stylesheet" media="screen" href="{{ config.root }}{{ settings.css }}"/>
|
<link rel="stylesheet" media="screen" href="{{ config.root }}{{ settings.css }}?v={{ config.resource_version }}"/>
|
||||||
{% if config.url_favicon %}<link rel="shortcut icon" href="{{ config.url_favicon }}" />{% endif %}
|
{% if config.url_favicon %}<link rel="shortcut icon" href="{{ config.url_favicon }}" />{% endif %}
|
||||||
{% if config.default_stylesheet.1 != '' %}<link rel="stylesheet" type="text/css" id="stylesheet" href="{{ config.uri_stylesheets }}{{ config.default_stylesheet.1 }}">{% endif %}
|
{% if config.default_stylesheet.1 != '' %}<link rel="stylesheet" type="text/css" id="stylesheet" href="{{ config.uri_stylesheets }}{{ config.default_stylesheet.1 }}?v={{ config.resource_version }}">{% endif %}
|
||||||
{% if config.font_awesome %}<link rel="stylesheet" href="{{ config.root }}{{ config.font_awesome_css }}">{% endif %}
|
{% if config.font_awesome %}<link rel="stylesheet" href="{{ config.root }}{{ config.font_awesome_css }}?v={{ config.resource_version }}">{% endif %}
|
||||||
{% include 'header.html' %}
|
{% include 'header.html' %}
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
Loading…
Reference in New Issue
Block a user