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);
|
||||
sfw = !!board.ws_board;
|
||||
findStyle = function(regex, base) {
|
||||
var style;
|
||||
style = d.cookie.match(regex);
|
||||
return (style ? style[1] : base);
|
||||
findStyle = function(_arg) {
|
||||
var base, style, type;
|
||||
type = _arg[0], base = _arg[1];
|
||||
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 + "'");
|
||||
mainStyleSheet = $('link[title=switch]', d.head);
|
||||
newStyleSheet = $("link[title='" + style + "']", d.head);
|
||||
|
||||
@ -12020,12 +12020,13 @@
|
||||
}
|
||||
Navigate.updateTitle(board);
|
||||
sfw = !!board.ws_board;
|
||||
findStyle = function(regex, base) {
|
||||
var style;
|
||||
style = d.cookie.match(regex);
|
||||
return (style ? style[1] : base);
|
||||
findStyle = function(_arg) {
|
||||
var base, style, type;
|
||||
type = _arg[0], base = _arg[1];
|
||||
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 + "'");
|
||||
mainStyleSheet = $('link[title=switch]', d.head);
|
||||
newStyleSheet = $("link[title='" + style + "']", d.head);
|
||||
|
||||
@ -136,17 +136,14 @@ Navigate =
|
||||
return unless board
|
||||
Navigate.updateTitle board
|
||||
sfw = !!board.ws_board
|
||||
findStyle = (regex, base) ->
|
||||
style = d.cookie.match regex
|
||||
return (if style then style[1] else base)
|
||||
findStyle = ([type, base]) ->
|
||||
style = d.cookie.match new RegExp "#{type}\_style\=([^;]+)"
|
||||
return [(if style then style[1] else base), "#{type}_style"]
|
||||
|
||||
[style, type] = if sfw then [
|
||||
findStyle /ws\_style\=([^;]+)/, 'Yotsuba B New'
|
||||
'ws_style'
|
||||
] else [
|
||||
findStyle /nws\_style\=([^;]+)/, 'Yotsuba New'
|
||||
'nws_style'
|
||||
]
|
||||
[style, type] = findStyle if sfw
|
||||
[ws, 'Yotsuba B New']
|
||||
else
|
||||
[nws, 'Yotsuba New']
|
||||
|
||||
$.globalEval "var style_group = '#{type}'"
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user