Conflicts:
	templates/index.html
	templates/post_thread.html
	templates/thread.html
This commit is contained in:
czaks 2013-07-23 10:25:33 -04:00
commit 1aa522e138
33 changed files with 10893 additions and 20 deletions

View file

@ -4,6 +4,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=yes">
{% 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.font_awesome %}<link rel="stylesheet" media="screen" href="{{ config.root }}{{ config.font_awesome_css }}">{% endif %}
<script type="text/javascript">var configRoot="{{ config.root }}";</script>
{% if not nojavascript %}
<script type="text/javascript" src="{{ config.url_javascript }}"></script>

View file

@ -31,9 +31,19 @@ var styles = {
{% for stylesheet in stylesheets %}{% raw %}'{% endraw %}{{ stylesheet.name|addslashes }}{% raw %}' : '{% endraw %}{{ stylesheet.uri|addslashes }}{% raw %}',
{% endraw %}{% endfor %}{% raw %}
};
var board_name = false;
function changeStyle(styleName, link) {
localStorage.stylesheet = styleName;
function changeStyle(styleName, link) {
{% endraw %}
{% if config.stylesheets_board %}{% raw %}
if (board_name) {
stylesheet_choices[board_name] = styleName;
localStorage.board_stylesheets = JSON.stringify(stylesheet_choices);
}
{% endraw %}{% else %}
localStorage.stylesheet = styleName;
{% endif %}
{% raw %}
if (!document.getElementById('stylesheet')) {
var s = document.createElement('link');
@ -49,7 +59,7 @@ function changeStyle(styleName, link) {
if (document.getElementsByClassName('styles').length != 0) {
var styleLinks = document.getElementsByClassName('styles')[0].childNodes;
for (i = 0; i < styleLinks.length; i++) {
for (var i = 0; i < styleLinks.length; i++) {
styleLinks[i].className = '';
}
}
@ -58,15 +68,44 @@ function changeStyle(styleName, link) {
link.className = 'selected';
}
}
if (localStorage.stylesheet) {
for (styleName in styles) {
if (styleName == localStorage.stylesheet) {
changeStyle(styleName);
break;
{% endraw %}
{% if config.stylesheets_board %}
{# This is such an unacceptable mess. There needs to be an easier way. #}
var matches = document.URL.match(/\/(\w+)\/($|{{ config.dir.res|replace({'/': '\\/'}) }}{{ config.file_page|replace({'%d': '\\d+', '.': '\\.'}) }}|{{ config.file_index|replace({'.': '\\.'}) }}|{{ config.file_page|replace({'%d': '\\d+', '.': '\\.'}) }})/);
{% raw %}
if (matches) {
board_name = matches[1];
}
if (!localStorage.board_stylesheets) {
localStorage.board_stylesheets = '{}';
}
var stylesheet_choices = JSON.parse(localStorage.board_stylesheets);
if (board_name && stylesheet_choices[board_name]) {
for (var styleName in styles) {
if (styleName == stylesheet_choices[board_name]) {
changeStyle(styleName);
break;
}
}
}
{% endraw%}
{% else %}
{% raw %}
if (localStorage.stylesheet) {
for (var styleName in styles) {
if (styleName == localStorage.stylesheet) {
changeStyle(styleName);
break;
}
}
}
}
}
{% endraw %}
{% endif %}
{% raw %}
function init_stylechooser() {
var newElement = document.createElement('div');

View file

@ -99,15 +99,27 @@
{% endif %}">
{{ post.id }}
</a>
{% if post.sticky %}
<img class="icon" title="Sticky" src="{{ config.image_sticky }}" alt="Sticky" />
{% endif %}
{% if post.locked %}
<img class="icon" title="Locked" src="{{ config.image_locked }}" alt="Locked" />
{% endif %}
{% if post.bumplocked and (config.mod.view_bumplock < 0 or (post.mod and post.mod|hasPermission(config.mod.view_bumplock, board.uri))) %}
<img class="icon" title="Bumplocked" src="{{ config.image_bumplocked }}" alt="Bumplocked" />
{% endif %}
{% if post.sticky %}
{% if config.font_awesome %}
<i class="icon-pushpin icon"></i>
{% else %}
<img class="icon" title="Sticky" src="{{ config.image_sticky }}" alt="Sticky" />
{% endif %}
{% endif %}
{% if post.locked %}
{% if config.font_awesome %}
<i class="icon-lock icon"></i>
{% else %}
<img class="icon" title="Locked" src="{{ config.image_locked }}" alt="Locked" />
{% endif %}
{% endif %}
{% if post.bumplocked and (config.mod.view_bumplock < 0 or (post.mod and post.mod|hasPermission(config.mod.view_bump$
{% if config.font_awesome %}
<i class="icon-anchor icon"></i>
{% else %}
<img class="icon" title="Bumplocked" src="{{ config.image_bumplocked }}" alt="Bumplocked" />
{% endif %}
{% endif %}
{% if index %}
<a href="{{ post.root }}{{ board.dir }}{{ config.dir.res }}{{ config.file_page|sprintf(post.id) }}">[{% trans %}Reply{% endtrans %}]</a>
{% endif %}