Further reduce redundancy in style switching.
Ok, I'm done with that now.
This commit is contained in:
parent
9d6e29616d
commit
989f1b3c7b
@ -12031,12 +12031,13 @@
|
|||||||
}
|
}
|
||||||
Navigate.updateTitle(board);
|
Navigate.updateTitle(board);
|
||||||
sfw = !!board.ws_board;
|
sfw = !!board.ws_board;
|
||||||
findStyle = function(regex, base) {
|
findStyle = function(_arg) {
|
||||||
var style;
|
var base, style, type;
|
||||||
style = d.cookie.match(regex);
|
type = _arg[0], base = _arg[1];
|
||||||
return (style ? style[1] : base);
|
style = d.cookie.match(new RegExp("" + type + "\_style\=([^;]+)"));
|
||||||
|
return [(style ? style[1] : base), "" + type + "_style"];
|
||||||
};
|
};
|
||||||
_ref = sfw ? [findStyle(/ws\_style\=([^;]+)/, 'Yotsuba B New'), 'ws_style'] : [findStyle(/nws\_style\=([^;]+)/, 'Yotsuba New'), 'nws_style'], style = _ref[0], type = _ref[1];
|
_ref = findStyle(sfw ? [ws, 'Yotsuba B New'] : [nws, 'Yotsuba New']), style = _ref[0], type = _ref[1];
|
||||||
$.globalEval("var style_group = '" + type + "'");
|
$.globalEval("var style_group = '" + type + "'");
|
||||||
mainStyleSheet = $('link[title=switch]', d.head);
|
mainStyleSheet = $('link[title=switch]', d.head);
|
||||||
newStyleSheet = $("link[title='" + style + "']", d.head);
|
newStyleSheet = $("link[title='" + style + "']", d.head);
|
||||||
|
|||||||
@ -12020,12 +12020,13 @@
|
|||||||
}
|
}
|
||||||
Navigate.updateTitle(board);
|
Navigate.updateTitle(board);
|
||||||
sfw = !!board.ws_board;
|
sfw = !!board.ws_board;
|
||||||
findStyle = function(regex, base) {
|
findStyle = function(_arg) {
|
||||||
var style;
|
var base, style, type;
|
||||||
style = d.cookie.match(regex);
|
type = _arg[0], base = _arg[1];
|
||||||
return (style ? style[1] : base);
|
style = d.cookie.match(new RegExp("" + type + "\_style\=([^;]+)"));
|
||||||
|
return [(style ? style[1] : base), "" + type + "_style"];
|
||||||
};
|
};
|
||||||
_ref = sfw ? [findStyle(/ws\_style\=([^;]+)/, 'Yotsuba B New'), 'ws_style'] : [findStyle(/nws\_style\=([^;]+)/, 'Yotsuba New'), 'nws_style'], style = _ref[0], type = _ref[1];
|
_ref = findStyle(sfw ? [ws, 'Yotsuba B New'] : [nws, 'Yotsuba New']), style = _ref[0], type = _ref[1];
|
||||||
$.globalEval("var style_group = '" + type + "'");
|
$.globalEval("var style_group = '" + type + "'");
|
||||||
mainStyleSheet = $('link[title=switch]', d.head);
|
mainStyleSheet = $('link[title=switch]', d.head);
|
||||||
newStyleSheet = $("link[title='" + style + "']", d.head);
|
newStyleSheet = $("link[title='" + style + "']", d.head);
|
||||||
|
|||||||
@ -136,17 +136,14 @@ Navigate =
|
|||||||
return unless board
|
return unless board
|
||||||
Navigate.updateTitle board
|
Navigate.updateTitle board
|
||||||
sfw = !!board.ws_board
|
sfw = !!board.ws_board
|
||||||
findStyle = (regex, base) ->
|
findStyle = ([type, base]) ->
|
||||||
style = d.cookie.match regex
|
style = d.cookie.match new RegExp "#{type}\_style\=([^;]+)"
|
||||||
return (if style then style[1] else base)
|
return [(if style then style[1] else base), "#{type}_style"]
|
||||||
|
|
||||||
[style, type] = if sfw then [
|
[style, type] = findStyle if sfw
|
||||||
findStyle /ws\_style\=([^;]+)/, 'Yotsuba B New'
|
[ws, 'Yotsuba B New']
|
||||||
'ws_style'
|
else
|
||||||
] else [
|
[nws, 'Yotsuba New']
|
||||||
findStyle /nws\_style\=([^;]+)/, 'Yotsuba New'
|
|
||||||
'nws_style'
|
|
||||||
]
|
|
||||||
|
|
||||||
$.globalEval "var style_group = '#{type}'"
|
$.globalEval "var style_group = '#{type}'"
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user