From 5ab152ee3404003eca73bf4889d2788c22631dbd Mon Sep 17 00:00:00 2001 From: Zixaphir Date: Wed, 3 Jul 2013 02:01:41 -0700 Subject: [PATCH] Small simplification --- LICENSE | 2 +- builds/appchan-x.user.js | 18 +++++------------- builds/crx/script.js | 18 +++++------------- src/General/Globals.coffee | 6 ------ src/Theming/Style.coffee | 21 ++++++++------------- 5 files changed, 19 insertions(+), 46 deletions(-) diff --git a/LICENSE b/LICENSE index 1d460ed8f..cadc85117 100644 --- a/LICENSE +++ b/LICENSE @@ -1,5 +1,5 @@ /* -* appchan x - Version 2.1.3 - 2013-06-21 +* appchan x - Version 2.1.3 - 2013-07-03 * * Licensed under the MIT license. * https://github.com/zixaphir/appchan-x/blob/master/LICENSE diff --git a/builds/appchan-x.user.js b/builds/appchan-x.user.js index b1f092325..56c0eec46 100644 --- a/builds/appchan-x.user.js +++ b/builds/appchan-x.user.js @@ -18,7 +18,7 @@ // ==/UserScript== /* -* appchan x - Version 2.1.3 - 2013-06-21 +* appchan x - Version 2.1.3 - 2013-07-03 * * Licensed under the MIT license. * https://github.com/zixaphir/appchan-x/blob/master/LICENSE @@ -11378,19 +11378,11 @@ cat = _ref[title]; for (name in cat) { setting = cat[name]; - if (setting[2]) { - if (setting[2] === 'text') { - continue; - } - hyphenated = ("" + name + " " + Conf[name]).toLowerCase().replace(/^4/, 'four').replace(/\s+/g, '-'); - $.addClass(doc, hyphenated); - } else { - if (!Conf[name]) { - continue; - } - hyphenated = ("" + name).toLowerCase().replace(/^4/, 'four').replace(/\s+/g, '-'); - $.addClass(doc, hyphenated); + if (!Conf[name] || setting[2] === 'text') { + continue; } + hyphenated = ("" + name + (setting[2] ? " " + Conf[name] : "")).toLowerCase().replace(/^4/, 'four').replace(/\s+/g, '-'); + $.addClass(doc, hyphenated); } } MascotTools.init(); diff --git a/builds/crx/script.js b/builds/crx/script.js index 050a9fe98..d8ea706ad 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -1,6 +1,6 @@ // Generated by CoffeeScript /* -* appchan x - Version 2.1.3 - 2013-06-21 +* appchan x - Version 2.1.3 - 2013-07-03 * * Licensed under the MIT license. * https://github.com/zixaphir/appchan-x/blob/master/LICENSE @@ -11367,19 +11367,11 @@ cat = _ref[title]; for (name in cat) { setting = cat[name]; - if (setting[2]) { - if (setting[2] === 'text') { - continue; - } - hyphenated = ("" + name + " " + Conf[name]).toLowerCase().replace(/^4/, 'four').replace(/\s+/g, '-'); - $.addClass(doc, hyphenated); - } else { - if (!Conf[name]) { - continue; - } - hyphenated = ("" + name).toLowerCase().replace(/^4/, 'four').replace(/\s+/g, '-'); - $.addClass(doc, hyphenated); + if (!Conf[name] || setting[2] === 'text') { + continue; } + hyphenated = ("" + name + (setting[2] ? " " + Conf[name] : "")).toLowerCase().replace(/^4/, 'four').replace(/\s+/g, '-'); + $.addClass(doc, hyphenated); } } MascotTools.init(); diff --git a/src/General/Globals.coffee b/src/General/Globals.coffee index fb67c3cd2..0cd9e06a3 100644 --- a/src/General/Globals.coffee +++ b/src/General/Globals.coffee @@ -1,9 +1,3 @@ -<% if (type === 'userjs') { %> -# Opera doesn't support the @match metadata key, -# return 4chan X here if we're not on 4chan. -return unless /^[a-z]+\.4chan\.org$/.test location.hostname -<% } %> - editTheme = {} # Currently editted theme. editMascot = {} # Which mascot we're editting. userNavigation = {} # ... diff --git a/src/Theming/Style.coffee b/src/Theming/Style.coffee index 328bbd561..4364e3c28 100644 --- a/src/Theming/Style.coffee +++ b/src/Theming/Style.coffee @@ -15,19 +15,14 @@ Style = $.addClass doc, 'fourchan-x' $.addClass doc, 'appchan-x' $.addClass doc, g.VIEW - + $.add d.body, Style.svg - + for title, cat of Config.style for name, setting of cat - if setting[2] - continue if setting[2] is 'text' - hyphenated = "#{name} #{Conf[name]}".toLowerCase().replace(/^4/, 'four').replace /\s+/g, '-' - $.addClass doc, hyphenated - else - continue unless Conf[name] - hyphenated = "#{name}".toLowerCase().replace(/^4/, 'four').replace /\s+/g, '-' - $.addClass doc, hyphenated + continue if !Conf[name] or setting[2] is 'text' + hyphenated = "#{name}#{if setting[2] then " #{Conf[name]}" else ""}".toLowerCase().replace(/^4/, 'four').replace /\s+/g, '-' + $.addClass doc, hyphenated MascotTools.init() @@ -138,7 +133,7 @@ Style = } if background bgHex = Style.colorToHex background - + bg = { r: parseInt(bgHex.substr(0, 2), 16) / 255 g: parseInt(bgHex.substr(2, 2), 16) / 255 @@ -146,7 +141,7 @@ Style = } [fg, bg or fg] - + filter: ([fg, bg]) -> "#{bg.r} #{-fg.r} 0 0 #{fg.r} #{bg.g} #{-fg.g} 0 0 #{fg.g} #{bg.b} #{-fg.b} 0 0 #{fg.b}" @@ -292,7 +287,7 @@ Style = Style.padding.nav = Header.bar Style.padding.pages = $ '.pagelist', d.body css = """<%= grunt.file.read('src/General/css/padding.nav.css') %>""" - + if Style.padding.pages css += """<%= grunt.file.read('src/General/css/padding.pages.css') %>"""