Improve responsiveness of style switcher
This commit is contained in:
parent
a44e75862f
commit
ebf6808297
@ -11988,7 +11988,7 @@
|
|||||||
mainStyleSheet = $('link[title=switch]', d.head);
|
mainStyleSheet = $('link[title=switch]', d.head);
|
||||||
newStyleSheet = $("link[title='" + style + "']", d.head);
|
newStyleSheet = $("link[title='" + style + "']", d.head);
|
||||||
mainStyleSheet.href = newStyleSheet.href;
|
mainStyleSheet.href = newStyleSheet.href;
|
||||||
return Main.initStyle();
|
return Main.setClass();
|
||||||
};
|
};
|
||||||
fullBoardList = $('#full-board-list', Header.boardList);
|
fullBoardList = $('#full-board-list', Header.boardList);
|
||||||
$.rmClass($('.current', fullBoardList), 'current');
|
$.rmClass($('.current', fullBoardList), 'current');
|
||||||
@ -12880,7 +12880,7 @@
|
|||||||
return $.ready(Main.initReady);
|
return $.ready(Main.initReady);
|
||||||
},
|
},
|
||||||
initStyle: function() {
|
initStyle: function() {
|
||||||
var mainStyleSheet, setStyle, style, styleSheets, _ref;
|
var _ref;
|
||||||
$.off(d, '4chanMainInit', Main.initStyle);
|
$.off(d, '4chanMainInit', Main.initStyle);
|
||||||
if (!Main.isThisPageLegit() || $.hasClass(doc, 'fourchan-x')) {
|
if (!Main.isThisPageLegit() || $.hasClass(doc, 'fourchan-x')) {
|
||||||
return;
|
return;
|
||||||
@ -12893,6 +12893,10 @@
|
|||||||
$.addClass(doc, 'seaweedchan');
|
$.addClass(doc, 'seaweedchan');
|
||||||
$.addClass(doc, g.VIEW);
|
$.addClass(doc, g.VIEW);
|
||||||
$.addStyle(Main.css);
|
$.addStyle(Main.css);
|
||||||
|
return Main.setClass();
|
||||||
|
},
|
||||||
|
setClass: function() {
|
||||||
|
var mainStyleSheet, setStyle, style, styleSheets;
|
||||||
if (g.VIEW === 'catalog') {
|
if (g.VIEW === 'catalog') {
|
||||||
$.addClass(doc, $.id('base-css').href.match(/catalog_(\w+)/)[1].replace('_new', '').replace(/_+/g, '-'));
|
$.addClass(doc, $.id('base-css').href.match(/catalog_(\w+)/)[1].replace('_new', '').replace(/_+/g, '-'));
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -11977,7 +11977,7 @@
|
|||||||
mainStyleSheet = $('link[title=switch]', d.head);
|
mainStyleSheet = $('link[title=switch]', d.head);
|
||||||
newStyleSheet = $("link[title='" + style + "']", d.head);
|
newStyleSheet = $("link[title='" + style + "']", d.head);
|
||||||
mainStyleSheet.href = newStyleSheet.href;
|
mainStyleSheet.href = newStyleSheet.href;
|
||||||
return Main.initStyle();
|
return Main.setClass();
|
||||||
};
|
};
|
||||||
fullBoardList = $('#full-board-list', Header.boardList);
|
fullBoardList = $('#full-board-list', Header.boardList);
|
||||||
$.rmClass($('.current', fullBoardList), 'current');
|
$.rmClass($('.current', fullBoardList), 'current');
|
||||||
@ -12869,7 +12869,7 @@
|
|||||||
return $.ready(Main.initReady);
|
return $.ready(Main.initReady);
|
||||||
},
|
},
|
||||||
initStyle: function() {
|
initStyle: function() {
|
||||||
var mainStyleSheet, setStyle, style, styleSheets, _ref;
|
var _ref;
|
||||||
$.off(d, '4chanMainInit', Main.initStyle);
|
$.off(d, '4chanMainInit', Main.initStyle);
|
||||||
if (!Main.isThisPageLegit() || $.hasClass(doc, 'fourchan-x')) {
|
if (!Main.isThisPageLegit() || $.hasClass(doc, 'fourchan-x')) {
|
||||||
return;
|
return;
|
||||||
@ -12882,6 +12882,10 @@
|
|||||||
$.addClass(doc, 'seaweedchan');
|
$.addClass(doc, 'seaweedchan');
|
||||||
$.addClass(doc, g.VIEW);
|
$.addClass(doc, g.VIEW);
|
||||||
$.addStyle(Main.css);
|
$.addStyle(Main.css);
|
||||||
|
return Main.setClass();
|
||||||
|
},
|
||||||
|
setClass: function() {
|
||||||
|
var mainStyleSheet, setStyle, style, styleSheets;
|
||||||
if (g.VIEW === 'catalog') {
|
if (g.VIEW === 'catalog') {
|
||||||
$.addClass(doc, $.id('base-css').href.match(/catalog_(\w+)/)[1].replace('_new', '').replace(/_+/g, '-'));
|
$.addClass(doc, $.id('base-css').href.match(/catalog_(\w+)/)[1].replace('_new', '').replace(/_+/g, '-'));
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -84,7 +84,10 @@ Main =
|
|||||||
$.addClass doc, 'seaweedchan'
|
$.addClass doc, 'seaweedchan'
|
||||||
$.addClass doc, g.VIEW
|
$.addClass doc, g.VIEW
|
||||||
$.addStyle Main.css
|
$.addStyle Main.css
|
||||||
|
|
||||||
|
Main.setClass()
|
||||||
|
|
||||||
|
setClass: ->
|
||||||
if g.VIEW is 'catalog'
|
if g.VIEW is 'catalog'
|
||||||
$.addClass doc, $.id('base-css').href.match(/catalog_(\w+)/)[1].replace('_new', '').replace /_+/g, '-'
|
$.addClass doc, $.id('base-css').href.match(/catalog_(\w+)/)[1].replace('_new', '').replace /_+/g, '-'
|
||||||
return
|
return
|
||||||
|
|||||||
@ -151,7 +151,7 @@ Navigate =
|
|||||||
|
|
||||||
mainStyleSheet.href = newStyleSheet.href
|
mainStyleSheet.href = newStyleSheet.href
|
||||||
|
|
||||||
Main.initStyle()
|
Main.setClass()
|
||||||
|
|
||||||
fullBoardList = $ '#full-board-list', Header.boardList
|
fullBoardList = $ '#full-board-list', Header.boardList
|
||||||
$.rmClass $('.current', fullBoardList), 'current'
|
$.rmClass $('.current', fullBoardList), 'current'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user