Attempt to stop screen flashes with stylechooser

This commit is contained in:
Fredrick Brennan 2015-03-12 15:44:33 +08:00
parent e4e25d86e3
commit ba34a81f38
4 changed files with 14 additions and 19 deletions

View File

@ -27,7 +27,9 @@ var submit = $("<input type='button' value='"+_("Save custom CSS")+"'>").css({
apply_css();
}).appendTo(tab.content);
onready(function(){
var main = function(){
if (typeof styles === "undefined") return;
var stylechooser = $("<select id='stylechooser'></select>").appendTo(tab.content);
// Handle empty localStorage
if (!localStorage.stylesheets_all_boards) localStorage.stylesheets_all_boards = "false";
@ -78,7 +80,7 @@ onready(function(){
});
update_textarea();
});
}
var apply_css = function() {
var to_apply;
@ -125,5 +127,5 @@ var update_textarea = function() {
apply_css();
};
main();
}();

View File

@ -17,6 +17,13 @@
{% if config.locale != "en" %}
<script type="text/javascript" src="{{ config.root }}inc/locale/{{ config.locale|split('.')[0] }}/LC_MESSAGES/javascript.js"></script>
{% endif %}
<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 %}
};
{% endraw %}</script>
{% if not nojavascript %}
<script type="text/javascript" src="{{ config.url_javascript }}"></script>
{% if not config.additional_javascript_compile %}

View File

@ -88,16 +88,9 @@
{% for footer in config.footer %}<p class="unimportant" style="text-align:center;">{{ footer }}</p>{% endfor %}
</footer>
<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();
onready(init); ready();
{% endraw %}</script>
</body>
</html>

View File

@ -79,16 +79,9 @@
<br><a href="https://int.vichan.net/devel/">vichan</a> Copyright &copy; 2012-2014 vichan-devel</p>
{% for footer in config.footer %}<p class="unimportant" style="text-align:center;">{{ footer }}</p>{% endfor %}
</footer>
<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();
onready(init); ready();
{% endraw %}</script>
</body>
</html>