diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index 1c07afd98..a25ea4cc2 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -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); diff --git a/builds/crx/script.js b/builds/crx/script.js index 0f6628edd..34bea2b40 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -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); diff --git a/src/General/Navigate.coffee b/src/General/Navigate.coffee index 539c60977..04cde2188 100644 --- a/src/General/Navigate.coffee +++ b/src/General/Navigate.coffee @@ -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}'"