diff --git a/builds/appchan-x.user.js b/builds/appchan-x.user.js index 891a1fba5..920da5c81 100644 --- a/builds/appchan-x.user.js +++ b/builds/appchan-x.user.js @@ -7943,7 +7943,7 @@ if (response) { response = response.trim(); if (!/\s/.test(response)) { - response = "" + response + " " + response; + response += " " + response; } } return { @@ -10982,7 +10982,6 @@ editMascot = {}; } editMascot.name = key || ''; - MascotTools.init(editMascot); layout = { name: ["Mascot Name", "", "text"], image: ["Image", "", "text"], @@ -11002,6 +11001,7 @@ nodes = []; for (name in layout) { item = layout[name]; + value = editMascot[name] || (editMascot[name] = item[1]); switch (item[2]) { case "text": div = this.input(item, name); @@ -11051,14 +11051,13 @@ }); break; case "select": - value = editMascot[name] || item[1]; optionHTML = "
" + item[0] + "
"; + optionHTML += ""; div = $.el('div', { className: "mascotvar", innerHTML: optionHTML @@ -11071,7 +11070,6 @@ }); break; case "checkbox": - value = editMascot[name] || item[1]; div = $.el("div", { className: "mascotvar", innerHTML: "" @@ -11083,6 +11081,7 @@ } nodes.push(div); } + MascotTools.init(editMascot); $.add($("#mascotcontent", dialog), nodes); $.on($('#save > a', dialog), 'click', function() { return MascotTools.save(editMascot); @@ -11101,7 +11100,7 @@ value = editMascot[name][0]; } } else { - value = editMascot[name] || item[1]; + value = editMascot[name]; } editMascot[name] = value; div = $.el("div", { @@ -14135,10 +14134,9 @@ }); }, mascots: function(section, mode) { - var addoptions, batchmascots, categories, cb, keys, mascot, mascotEl, mascotHide, mascotoptions, menu, name, node, nodes, option, suboptions, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _m, _ref, _ref1, _ref2; + var addoptions, batchmascots, categories, cb, container, div, keys, mascot, mascotEl, mascotHide, mascotoptions, menu, name, node, option, suboptions, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref, _ref1; categories = {}; - menu = []; cb = Settings.cb.mascot; if (typeof mode !== 'string') { mode = 'default'; @@ -14167,24 +14165,23 @@ } return $.add(this, mascotoptions); }; - nodes = {}; _ref = MascotTools.categories; for (_i = 0, _len = _ref.length; _i < _len; _i++) { name = _ref[_i]; - nodes[name] = []; - categories[name] = $.el("div", { - className: "mascots-container", + menu = $('div', mascotHide); + categories[name] = div = $.el("div", { id: name, - innerHTML: "

" + name + "

" + className: "mascots-container", + innerHTML: "

" + name + "

", + hidden: Conf["Hidden Categories"].contains(name) }); - if (Conf["Hidden Categories"].contains(name)) { - categories[name].hidden = true; - } - menu.push(option = $.el("label", { + option = $.el("label", { name: name, innerHTML: "" + name - })); + }); $.on($('input', option), 'change', cb.category); + $.add(suboptions, div); + $.add(menu, option); } for (_j = 0, _len1 = keys.length; _j < _len1; _j++) { name = keys[_j]; @@ -14193,35 +14190,24 @@ } mascot = Mascots[name]; mascotEl = $.el('div', { - className: Conf[g.MASCOTSTRING].contains(name) ? 'mascot enabled' : 'mascot', id: name, + className: Conf[g.MASCOTSTRING].contains(name) ? 'mascot enabled' : 'mascot', innerHTML: "
" + (name.replace(/_/g, " ")) + "
" }); $.on(mascotEl, 'click', cb.select); $.on(mascotEl, 'mouseover', addoptions); - if (MascotTools.categories.contains(mascot.category)) { - nodes[mascot.category].push(mascotEl); - } else { - nodes[MascotTools.categories[0]].push(mascotEl); - } + $.add(categories[mascot.category] || categories[MascotTools.categories[0]], mascotEl); } - _ref1 = MascotTools.categories; - for (_k = 0, _len2 = _ref1.length; _k < _len2; _k++) { - name = _ref1[_k]; - $.add(categories[name], nodes[name]); - $.add(suboptions, categories[name]); - } - $.add($('div', mascotHide), menu); batchmascots = $.el('div', { id: "mascots_batch", innerHTML: " Clear All\n/\nSelect All\n/\nAdd Mascot\n/\nImport Mascot\n/\nUndelete Mascots\n/\nGet More Mascots!" }); $.on($('#clear', batchmascots), 'click', function() { - var enabledMascots, _l, _len3; + var enabledMascots, _k, _len2; enabledMascots = JSON.parse(JSON.stringify(Conf[g.MASCOTSTRING])); - for (_l = 0, _len3 = enabledMascots.length; _l < _len3; _l++) { - name = enabledMascots[_l]; + for (_k = 0, _len2 = enabledMascots.length; _k < _len2; _k++) { + name = enabledMascots[_k]; $.rmClass($.id(name), 'enabled'); } return $.set(g.MASCOTSTRING, Conf[g.MASCOTSTRING] = []); @@ -14260,12 +14246,11 @@ return Settings.openSection.apply(mascots, ['restore']); }); } else { - nodes = []; - categories = $.el("div", { + container = $.el("div", { className: "mascots" }); - for (_l = 0, _len3 = keys.length; _l < _len3; _l++) { - name = keys[_l]; + for (_k = 0, _len2 = keys.length; _k < _len2; _k++) { + name = keys[_k]; if (!Conf["Deleted Mascots"].contains(name)) { continue; } @@ -14276,10 +14261,9 @@ innerHTML: "
" + (name.replace(/_/g, " ")) + "
" }); $.on(mascotEl, 'click', cb.restore); - nodes.push(mascotEl); + $.add(container, mascotEl); } - $.add(categories, nodes); - $.add(suboptions, categories); + $.add(suboptions, container); batchmascots = $.el('div', { id: "mascots_batch", innerHTML: "Return" @@ -14294,9 +14278,9 @@ return Settings.openSection.apply(mascots); }); } - _ref2 = [suboptions, batchmascots, mascotHide]; - for (_m = 0, _len4 = _ref2.length; _m < _len4; _m++) { - node = _ref2[_m]; + _ref1 = [suboptions, batchmascots, mascotHide]; + for (_l = 0, _len3 = _ref1.length; _l < _len3; _l++) { + node = _ref1[_l]; Rice.nodes(node); } return $.add(section, [suboptions, batchmascots, mascotHide]); diff --git a/builds/crx/script.js b/builds/crx/script.js index 458dce20b..4870c9925 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -7943,7 +7943,7 @@ if (response) { response = response.trim(); if (!/\s/.test(response)) { - response = "" + response + " " + response; + response += " " + response; } } return { @@ -10970,7 +10970,6 @@ editMascot = {}; } editMascot.name = key || ''; - MascotTools.init(editMascot); layout = { name: ["Mascot Name", "", "text"], image: ["Image", "", "text"], @@ -10990,6 +10989,7 @@ nodes = []; for (name in layout) { item = layout[name]; + value = editMascot[name] || (editMascot[name] = item[1]); switch (item[2]) { case "text": div = this.input(item, name); @@ -11039,14 +11039,13 @@ }); break; case "select": - value = editMascot[name] || item[1]; optionHTML = "
" + item[0] + "
"; + optionHTML += "
"; div = $.el('div', { className: "mascotvar", innerHTML: optionHTML @@ -11059,7 +11058,6 @@ }); break; case "checkbox": - value = editMascot[name] || item[1]; div = $.el("div", { className: "mascotvar", innerHTML: "" @@ -11071,6 +11069,7 @@ } nodes.push(div); } + MascotTools.init(editMascot); $.add($("#mascotcontent", dialog), nodes); $.on($('#save > a', dialog), 'click', function() { return MascotTools.save(editMascot); @@ -11089,7 +11088,7 @@ value = editMascot[name][0]; } } else { - value = editMascot[name] || item[1]; + value = editMascot[name]; } editMascot[name] = value; div = $.el("div", { @@ -14122,10 +14121,9 @@ }); }, mascots: function(section, mode) { - var addoptions, batchmascots, categories, cb, keys, mascot, mascotEl, mascotHide, mascotoptions, menu, name, node, nodes, option, suboptions, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _m, _ref, _ref1, _ref2; + var addoptions, batchmascots, categories, cb, container, div, keys, mascot, mascotEl, mascotHide, mascotoptions, menu, name, node, option, suboptions, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref, _ref1; categories = {}; - menu = []; cb = Settings.cb.mascot; if (typeof mode !== 'string') { mode = 'default'; @@ -14154,24 +14152,23 @@ } return $.add(this, mascotoptions); }; - nodes = {}; _ref = MascotTools.categories; for (_i = 0, _len = _ref.length; _i < _len; _i++) { name = _ref[_i]; - nodes[name] = []; - categories[name] = $.el("div", { - className: "mascots-container", + menu = $('div', mascotHide); + categories[name] = div = $.el("div", { id: name, - innerHTML: "

" + name + "

" + className: "mascots-container", + innerHTML: "

" + name + "

", + hidden: Conf["Hidden Categories"].contains(name) }); - if (Conf["Hidden Categories"].contains(name)) { - categories[name].hidden = true; - } - menu.push(option = $.el("label", { + option = $.el("label", { name: name, innerHTML: "" + name - })); + }); $.on($('input', option), 'change', cb.category); + $.add(suboptions, div); + $.add(menu, option); } for (_j = 0, _len1 = keys.length; _j < _len1; _j++) { name = keys[_j]; @@ -14180,35 +14177,24 @@ } mascot = Mascots[name]; mascotEl = $.el('div', { - className: Conf[g.MASCOTSTRING].contains(name) ? 'mascot enabled' : 'mascot', id: name, + className: Conf[g.MASCOTSTRING].contains(name) ? 'mascot enabled' : 'mascot', innerHTML: "
" + (name.replace(/_/g, " ")) + "
" }); $.on(mascotEl, 'click', cb.select); $.on(mascotEl, 'mouseover', addoptions); - if (MascotTools.categories.contains(mascot.category)) { - nodes[mascot.category].push(mascotEl); - } else { - nodes[MascotTools.categories[0]].push(mascotEl); - } + $.add(categories[mascot.category] || categories[MascotTools.categories[0]], mascotEl); } - _ref1 = MascotTools.categories; - for (_k = 0, _len2 = _ref1.length; _k < _len2; _k++) { - name = _ref1[_k]; - $.add(categories[name], nodes[name]); - $.add(suboptions, categories[name]); - } - $.add($('div', mascotHide), menu); batchmascots = $.el('div', { id: "mascots_batch", innerHTML: " Clear All\n/\nSelect All\n/\nAdd Mascot\n/\nImport Mascot\n/\nUndelete Mascots\n/\nGet More Mascots!" }); $.on($('#clear', batchmascots), 'click', function() { - var enabledMascots, _l, _len3; + var enabledMascots, _k, _len2; enabledMascots = JSON.parse(JSON.stringify(Conf[g.MASCOTSTRING])); - for (_l = 0, _len3 = enabledMascots.length; _l < _len3; _l++) { - name = enabledMascots[_l]; + for (_k = 0, _len2 = enabledMascots.length; _k < _len2; _k++) { + name = enabledMascots[_k]; $.rmClass($.id(name), 'enabled'); } return $.set(g.MASCOTSTRING, Conf[g.MASCOTSTRING] = []); @@ -14247,12 +14233,11 @@ return Settings.openSection.apply(mascots, ['restore']); }); } else { - nodes = []; - categories = $.el("div", { + container = $.el("div", { className: "mascots" }); - for (_l = 0, _len3 = keys.length; _l < _len3; _l++) { - name = keys[_l]; + for (_k = 0, _len2 = keys.length; _k < _len2; _k++) { + name = keys[_k]; if (!Conf["Deleted Mascots"].contains(name)) { continue; } @@ -14263,10 +14248,9 @@ innerHTML: "
" + (name.replace(/_/g, " ")) + "
" }); $.on(mascotEl, 'click', cb.restore); - nodes.push(mascotEl); + $.add(container, mascotEl); } - $.add(categories, nodes); - $.add(suboptions, categories); + $.add(suboptions, container); batchmascots = $.el('div', { id: "mascots_batch", innerHTML: "Return" @@ -14281,9 +14265,9 @@ return Settings.openSection.apply(mascots); }); } - _ref2 = [suboptions, batchmascots, mascotHide]; - for (_m = 0, _len4 = _ref2.length; _m < _len4; _m++) { - node = _ref2[_m]; + _ref1 = [suboptions, batchmascots, mascotHide]; + for (_l = 0, _len3 = _ref1.length; _l < _len3; _l++) { + node = _ref1[_l]; Rice.nodes(node); } return $.add(section, [suboptions, batchmascots, mascotHide]); diff --git a/src/General/Settings.coffee b/src/General/Settings.coffee index 325669856..ba214d8f8 100644 --- a/src/General/Settings.coffee +++ b/src/General/Settings.coffee @@ -645,7 +645,6 @@ Settings = mascots: (section, mode) -> categories = {} - menu = [] cb = Settings.cb.mascot if typeof mode isnt 'string' @@ -676,45 +675,35 @@ Settings = $.add @, mascotoptions # Create a keyed Unordered List Element and hide option for each mascot category. - nodes = {} for name in MascotTools.categories - nodes[name] = [] - categories[name] = $.el "div", + menu = $ 'div', mascotHide + categories[name] = div = $.el "div", + id: name className: "mascots-container" - id: name innerHTML: "

#{name}

" + hidden: Conf["Hidden Categories"].contains name - if Conf["Hidden Categories"].contains name - categories[name].hidden = true - - menu.push option = $.el "label", + option = $.el "label", name: name innerHTML: "#{name}" $.on $('input', option), 'change', cb.category - for name in keys + $.add suboptions, div + $.add menu, option + for name in keys continue if Conf["Deleted Mascots"].contains name mascot = Mascots[name] mascotEl = $.el 'div', + id: name className: if Conf[g.MASCOTSTRING].contains name then 'mascot enabled' else 'mascot' - id: name innerHTML: "<%= grunt.file.read('src/General/html/Settings/Mascot.html') %>" $.on mascotEl, 'click', cb.select $.on mascotEl, 'mouseover', addoptions - if MascotTools.categories.contains mascot.category - nodes[mascot.category].push mascotEl - else - nodes[MascotTools.categories[0]].push mascotEl - - for name in MascotTools.categories - $.add categories[name], nodes[name] - $.add suboptions, categories[name] - - $.add $('div', mascotHide), menu + $.add (categories[mascot.category] or categories[MascotTools.categories[0]]), mascotEl batchmascots = $.el 'div', id: "mascots_batch" @@ -753,8 +742,7 @@ Settings = Settings.openSection.apply mascots, ['restore'] else - nodes = [] - categories = $.el "div", + container = $.el "div", className: "mascots" for name in keys @@ -770,15 +758,13 @@ Settings = $.on mascotEl, 'click', cb.restore - nodes.push mascotEl + $.add container, mascotEl - $.add categories, nodes - - $.add suboptions, categories + $.add suboptions, container batchmascots = $.el 'div', id: "mascots_batch" - innerHTML: "Return" + innerHTML: """Return""" $.on $('#return', batchmascots), 'click', -> mascots = diff --git a/src/Posting/QuickReply.coffee b/src/Posting/QuickReply.coffee index 93549f1d1..2c7443bdf 100644 --- a/src/Posting/QuickReply.coffee +++ b/src/Posting/QuickReply.coffee @@ -827,7 +827,7 @@ QR = response = response.trim() # one-word-captcha: # If there's only one word, duplicate it. - response = "#{response} #{response}" unless /\s/.test response + response += " #{response}" unless /\s/.test response {challenge, response} save: -> diff --git a/src/Theming/Mascots.coffee b/src/Theming/Mascots.coffee index 4ab01c691..0a6acfc67 100644 --- a/src/Theming/Mascots.coffee +++ b/src/Theming/Mascots.coffee @@ -9,9 +9,6 @@ MascotTools = unless @el @el = $.el 'div', id: "mascot" - # > - # >not - # >HTML5 innerHTML: "" $.on @el, 'mousedown', MascotTools.click @@ -72,7 +69,6 @@ MascotTools = else editMascot = {} editMascot.name = key or '' - MascotTools.init editMascot layout = name: [ "Mascot Name" @@ -142,6 +138,7 @@ MascotTools = " nodes = [] for name, item of layout + value = editMascot[name] or= item[1] switch item[2] @@ -150,7 +147,6 @@ MascotTools = input = $ 'input', div if name is 'image' - $.on input, 'blur', -> editMascot[@name] = @value MascotTools.init editMascot @@ -192,11 +188,10 @@ MascotTools = MascotTools.init editMascot when "select" - value = editMascot[name] or item[1] optionHTML = "
#{item[0]}
" + optionHTML += "" + optionHTML += "
" div = $.el 'div', className: "mascotvar" innerHTML: optionHTML @@ -208,7 +203,6 @@ MascotTools = MascotTools.init editMascot when "checkbox" - value = editMascot[name] or item[1] div = $.el "div", className: "mascotvar" innerHTML: "" @@ -217,23 +211,26 @@ MascotTools = MascotTools.init editMascot nodes.push div + + MascotTools.init editMascot + $.add $("#mascotcontent", dialog), nodes $.on $('#save > a', dialog), 'click', -> MascotTools.save editMascot $.on $('#close > a', dialog), 'click', MascotTools.close - Rice.nodes(dialog) + Rice.nodes dialog $.add d.body, dialog input: (item, name) -> - if Array.isArray(editMascot[name]) + if Array.isArray editMascot[name] if Style.lightTheme value = editMascot[name][1] else value = editMascot[name][0] else - value = editMascot[name] or item[1] + value = editMascot[name] editMascot[name] = value