Small simplification

This commit is contained in:
Zixaphir 2013-07-03 02:01:41 -07:00
parent 0935d1c297
commit 5ab152ee34
5 changed files with 19 additions and 46 deletions

View File

@ -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. * Licensed under the MIT license.
* https://github.com/zixaphir/appchan-x/blob/master/LICENSE * https://github.com/zixaphir/appchan-x/blob/master/LICENSE

View File

@ -18,7 +18,7 @@
// ==/UserScript== // ==/UserScript==
/* /*
* appchan x - Version 2.1.3 - 2013-06-21 * appchan x - Version 2.1.3 - 2013-07-03
* *
* Licensed under the MIT license. * Licensed under the MIT license.
* https://github.com/zixaphir/appchan-x/blob/master/LICENSE * https://github.com/zixaphir/appchan-x/blob/master/LICENSE
@ -11378,19 +11378,11 @@
cat = _ref[title]; cat = _ref[title];
for (name in cat) { for (name in cat) {
setting = cat[name]; setting = cat[name];
if (setting[2]) { if (!Conf[name] || setting[2] === 'text') {
if (setting[2] === 'text') { continue;
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);
} }
hyphenated = ("" + name + (setting[2] ? " " + Conf[name] : "")).toLowerCase().replace(/^4/, 'four').replace(/\s+/g, '-');
$.addClass(doc, hyphenated);
} }
} }
MascotTools.init(); MascotTools.init();

View File

@ -1,6 +1,6 @@
// Generated by CoffeeScript // 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. * Licensed under the MIT license.
* https://github.com/zixaphir/appchan-x/blob/master/LICENSE * https://github.com/zixaphir/appchan-x/blob/master/LICENSE
@ -11367,19 +11367,11 @@
cat = _ref[title]; cat = _ref[title];
for (name in cat) { for (name in cat) {
setting = cat[name]; setting = cat[name];
if (setting[2]) { if (!Conf[name] || setting[2] === 'text') {
if (setting[2] === 'text') { continue;
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);
} }
hyphenated = ("" + name + (setting[2] ? " " + Conf[name] : "")).toLowerCase().replace(/^4/, 'four').replace(/\s+/g, '-');
$.addClass(doc, hyphenated);
} }
} }
MascotTools.init(); MascotTools.init();

View File

@ -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. editTheme = {} # Currently editted theme.
editMascot = {} # Which mascot we're editting. editMascot = {} # Which mascot we're editting.
userNavigation = {} # ... userNavigation = {} # ...

View File

@ -15,19 +15,14 @@ Style =
$.addClass doc, 'fourchan-x' $.addClass doc, 'fourchan-x'
$.addClass doc, 'appchan-x' $.addClass doc, 'appchan-x'
$.addClass doc, g.VIEW $.addClass doc, g.VIEW
$.add d.body, Style.svg $.add d.body, Style.svg
for title, cat of Config.style for title, cat of Config.style
for name, setting of cat for name, setting of cat
if setting[2] continue if !Conf[name] or setting[2] is 'text'
continue if setting[2] is 'text' hyphenated = "#{name}#{if setting[2] then " #{Conf[name]}" else ""}".toLowerCase().replace(/^4/, 'four').replace /\s+/g, '-'
hyphenated = "#{name} #{Conf[name]}".toLowerCase().replace(/^4/, 'four').replace /\s+/g, '-' $.addClass doc, hyphenated
$.addClass doc, hyphenated
else
continue unless Conf[name]
hyphenated = "#{name}".toLowerCase().replace(/^4/, 'four').replace /\s+/g, '-'
$.addClass doc, hyphenated
MascotTools.init() MascotTools.init()
@ -138,7 +133,7 @@ Style =
} }
if background if background
bgHex = Style.colorToHex background bgHex = Style.colorToHex background
bg = { bg = {
r: parseInt(bgHex.substr(0, 2), 16) / 255 r: parseInt(bgHex.substr(0, 2), 16) / 255
g: parseInt(bgHex.substr(2, 2), 16) / 255 g: parseInt(bgHex.substr(2, 2), 16) / 255
@ -146,7 +141,7 @@ Style =
} }
[fg, bg or fg] [fg, bg or fg]
filter: ([fg, bg]) -> 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}" "#{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.nav = Header.bar
Style.padding.pages = $ '.pagelist', d.body Style.padding.pages = $ '.pagelist', d.body
css = """<%= grunt.file.read('src/General/css/padding.nav.css') %>""" css = """<%= grunt.file.read('src/General/css/padding.nav.css') %>"""
if Style.padding.pages if Style.padding.pages
css += """<%= grunt.file.read('src/General/css/padding.pages.css') %>""" css += """<%= grunt.file.read('src/General/css/padding.pages.css') %>"""