Further reduce redundancy in style switching.

Ok, I'm done with that now.
This commit is contained in:
Zixaphir 2014-01-11 10:50:49 -07:00
parent 9d6e29616d
commit 989f1b3c7b
3 changed files with 19 additions and 20 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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}'"