Improve responsiveness of style switcher

This commit is contained in:
Zixaphir 2014-01-10 17:52:09 -07:00
parent a44e75862f
commit ebf6808297
4 changed files with 16 additions and 5 deletions

View File

@ -11988,7 +11988,7 @@
mainStyleSheet = $('link[title=switch]', d.head);
newStyleSheet = $("link[title='" + style + "']", d.head);
mainStyleSheet.href = newStyleSheet.href;
return Main.initStyle();
return Main.setClass();
};
fullBoardList = $('#full-board-list', Header.boardList);
$.rmClass($('.current', fullBoardList), 'current');
@ -12880,7 +12880,7 @@
return $.ready(Main.initReady);
},
initStyle: function() {
var mainStyleSheet, setStyle, style, styleSheets, _ref;
var _ref;
$.off(d, '4chanMainInit', Main.initStyle);
if (!Main.isThisPageLegit() || $.hasClass(doc, 'fourchan-x')) {
return;
@ -12893,6 +12893,10 @@
$.addClass(doc, 'seaweedchan');
$.addClass(doc, g.VIEW);
$.addStyle(Main.css);
return Main.setClass();
},
setClass: function() {
var mainStyleSheet, setStyle, style, styleSheets;
if (g.VIEW === 'catalog') {
$.addClass(doc, $.id('base-css').href.match(/catalog_(\w+)/)[1].replace('_new', '').replace(/_+/g, '-'));
return;

View File

@ -11977,7 +11977,7 @@
mainStyleSheet = $('link[title=switch]', d.head);
newStyleSheet = $("link[title='" + style + "']", d.head);
mainStyleSheet.href = newStyleSheet.href;
return Main.initStyle();
return Main.setClass();
};
fullBoardList = $('#full-board-list', Header.boardList);
$.rmClass($('.current', fullBoardList), 'current');
@ -12869,7 +12869,7 @@
return $.ready(Main.initReady);
},
initStyle: function() {
var mainStyleSheet, setStyle, style, styleSheets, _ref;
var _ref;
$.off(d, '4chanMainInit', Main.initStyle);
if (!Main.isThisPageLegit() || $.hasClass(doc, 'fourchan-x')) {
return;
@ -12882,6 +12882,10 @@
$.addClass(doc, 'seaweedchan');
$.addClass(doc, g.VIEW);
$.addStyle(Main.css);
return Main.setClass();
},
setClass: function() {
var mainStyleSheet, setStyle, style, styleSheets;
if (g.VIEW === 'catalog') {
$.addClass(doc, $.id('base-css').href.match(/catalog_(\w+)/)[1].replace('_new', '').replace(/_+/g, '-'));
return;

View File

@ -84,7 +84,10 @@ Main =
$.addClass doc, 'seaweedchan'
$.addClass doc, g.VIEW
$.addStyle Main.css
Main.setClass()
setClass: ->
if g.VIEW is 'catalog'
$.addClass doc, $.id('base-css').href.match(/catalog_(\w+)/)[1].replace('_new', '').replace /_+/g, '-'
return

View File

@ -151,7 +151,7 @@ Navigate =
mainStyleSheet.href = newStyleSheet.href
Main.initStyle()
Main.setClass()
fullBoardList = $ '#full-board-list', Header.boardList
$.rmClass $('.current', fullBoardList), 'current'