Stop using $.extend for Style

This commit is contained in:
Zixaphir 2013-08-06 18:22:46 -07:00
parent 7d20ee32c4
commit 24d2f47c52
3 changed files with 41 additions and 28 deletions

View File

@ -11568,22 +11568,24 @@
}); });
} }
}, },
addSheet: function(_arg) {
var id, key, text;
key = _arg[0], text = _arg[1], id = _arg[2];
return Style[key] = $.addStyle(text, id);
},
setup: function() { setup: function() {
var theme; var i, item, items, theme;
theme = Themes[Conf['theme']] || Themes['Yotsuba B']; theme = Themes[Conf['theme']] || Themes['Yotsuba B'];
Style.svg = $.el('div', { Style.svg = $.el('div', {
id: 'svg_filters' id: 'svg_filters'
}); });
$.extend(Style, { items = [['layoutCSS', Style.layout, 'layout'], ['themeCSS', Style.theme(theme), 'theme'], ['emojiCSS', Emoji.css(), 'emoji'], ['dynamicCSS', Style.dynamic(), 'dynamic'], ['icons', "", 'icons'], ['paddingSheet', "", 'padding'], ['mascot', "", 'mascotSheet']];
layoutCSS: $.addStyle(Style.layout, 'layout'), i = 0;
themeCSS: $.addStyle(Style.theme(theme), 'theme'), while (item = items[i++]) {
emojiCSS: $.addStyle(Emoji.css(), 'emoji'), Style.addSheet(item);
dynamicCSS: $.addStyle(Style.dynamic(), 'dynamic'), }
icons: $.addStyle("", 'icons'),
paddingSheet: $.addStyle("", 'padding'),
mascot: $.addStyle("", 'mascotSheet')
});
$.addStyle(JSColor.css(), 'jsColor'); $.addStyle(JSColor.css(), 'jsColor');
if (d.head) { if (d.head) {
this.remStyle(); this.remStyle();

View File

@ -11556,22 +11556,24 @@
}); });
} }
}, },
addSheet: function(_arg) {
var id, key, text;
key = _arg[0], text = _arg[1], id = _arg[2];
return Style[key] = $.addStyle(text, id);
},
setup: function() { setup: function() {
var theme; var i, item, items, theme;
theme = Themes[Conf['theme']] || Themes['Yotsuba B']; theme = Themes[Conf['theme']] || Themes['Yotsuba B'];
Style.svg = $.el('div', { Style.svg = $.el('div', {
id: 'svg_filters' id: 'svg_filters'
}); });
$.extend(Style, { items = [['layoutCSS', Style.layout, 'layout'], ['themeCSS', Style.theme(theme), 'theme'], ['emojiCSS', Emoji.css(), 'emoji'], ['dynamicCSS', Style.dynamic(), 'dynamic'], ['icons', "", 'icons'], ['paddingSheet', "", 'padding'], ['mascot', "", 'mascotSheet']];
layoutCSS: $.addStyle(Style.layout, 'layout'), i = 0;
themeCSS: $.addStyle(Style.theme(theme), 'theme'), while (item = items[i++]) {
emojiCSS: $.addStyle(Emoji.css(), 'emoji'), Style.addSheet(item);
dynamicCSS: $.addStyle(Style.dynamic(), 'dynamic'), }
icons: $.addStyle("", 'icons'),
paddingSheet: $.addStyle("", 'padding'),
mascot: $.addStyle("", 'mascotSheet')
});
$.addStyle(JSColor.css(), 'jsColor'); $.addStyle(JSColor.css(), 'jsColor');
if (d.head) { if (d.head) {
this.remStyle(); this.remStyle();

View File

@ -47,18 +47,27 @@ Style =
$.on exLink, "click", -> $.on exLink, "click", ->
setTimeout Rice.nodes, 100 setTimeout Rice.nodes, 100
addSheet: ([key, text, id]) ->
Style[key] = $.addStyle text, id
setup: -> setup: ->
theme = Themes[Conf['theme']] or Themes['Yotsuba B'] theme = Themes[Conf['theme']] or Themes['Yotsuba B']
Style.svg = $.el 'div', Style.svg = $.el 'div',
id: 'svg_filters' id: 'svg_filters'
$.extend Style,
layoutCSS: $.addStyle Style.layout, 'layout' items = [
themeCSS: $.addStyle Style.theme(theme), 'theme' ['layoutCSS', Style.layout, 'layout']
emojiCSS: $.addStyle Emoji.css(), 'emoji' ['themeCSS', Style.theme(theme), 'theme']
dynamicCSS: $.addStyle Style.dynamic(), 'dynamic' ['emojiCSS', Emoji.css(), 'emoji']
icons: $.addStyle "", 'icons' ['dynamicCSS', Style.dynamic(), 'dynamic']
paddingSheet: $.addStyle "", 'padding' ['icons', "", 'icons']
mascot: $.addStyle "", 'mascotSheet' ['paddingSheet', "", 'padding']
['mascot', "", 'mascotSheet']
]
i = 0
while item = items[i++]
Style.addSheet item
# Non-customizable # Non-customizable
$.addStyle JSColor.css(), 'jsColor' $.addStyle JSColor.css(), 'jsColor'