1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-11-28 17:31:00 +01:00

Applies the theme to all board pages and catalog.

This commit is contained in:
fourfivesix 2014-09-24 13:56:38 -03:00
parent 4238249af6
commit 94f2fae196
2 changed files with 18 additions and 5 deletions

View File

@ -53,8 +53,13 @@ function changeStyle(styleName, link) {
var x = document.getElementsByTagName('head')[0];
x.appendChild(s);
}
{% endraw %}
var root = "{{ config.root }}";
{% raw %}
root = root.replace(/\/$/, "");
document.getElementById('stylesheet').href = styles[styleName];
document.getElementById('stylesheet').href = root + styles[styleName];
selectedstyle = styleName;
if (document.getElementsByClassName('styles').length != 0) {
@ -76,7 +81,7 @@ function changeStyle(styleName, link) {
{% endraw %}
function init_stylechooser() {
var matches = document.URL.match(/\/(\w+)\/($|{{ config.dir.res|replace({'/': '\\/'}) }}{{ config.file_page|replace({'%d': '\\d+', '.': '\\.'}) }}|{{ config.file_index|replace({'.': '\\.'}) }}|{{ config.dir.res|replace({'/': '\\/'}) }}{{ config.file_page50|replace({'+': '\\+', '%d': '\\d+', '.': '\\.'}) }})/);
var matches = document.URL.match(/\/(\w+)\/($|{{ config.dir.res|replace({'/': '\\/'}) }}{{ config.file_page|replace({'%d': '\\d+', '.': '\\.'}) }}|{{ config.file_index|replace({'.': '\\.'}) }}|{{ config.dir.res|replace({'/': '\\/'}) }}{{ config.file_page50|replace({'+': '\\+', '%d': '\\d+', '.': '\\.'}) }}|{{ config.file_page|replace({'%d': '\\d+', '.': '\\.'}) }}|{{ config.catalog_link|replace({'.': '\\.'}) }})/);
var newElement = document.createElement('div');
newElement.className = 'styles';

View File

@ -83,9 +83,17 @@
<br><a href="http://tinyboard.org/">Tinyboard</a> Copyright &copy; 2010-2014 Tinyboard Development Group
<br><a href="https://int.vichan.net/devel/">vichan</a> Copyright &copy; 2012-2014 vichan-devel</p>
</footer>
<script type="text/javascript">
ready();
</script>
<script type="text/javascript">{% raw %}
var styles = {
{% endraw %}
{% for name, uri in config.stylesheets %}{% raw %}'{% endraw %}{{ name|addslashes }}{% raw %}' : '{% endraw %}/stylesheets/{{ uri|addslashes }}{% raw %}',
{% endraw %}{% endfor %}{% raw %}
}; onready(init);
{% endraw %}</script>
<script type="text/javascript">{% raw %}
ready();
{% endraw %}</script>
</body>
</html>
{% endfilter %}