A lot of backpedaling here.
This commit is contained in:
parent
ebfaaaacc4
commit
283a33c443
@ -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 = "<div class=optionlabel>" + item[0] + "</div><div class=option><select name='" + name + "' value='" + value + "'><br>";
|
||||
_ref = item[3];
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
option = _ref[_i];
|
||||
optionHTML = optionHTML + ("<option value=\"" + option + "\">" + option + "</option>");
|
||||
optionHTML += "<option value=\"" + option + "\">" + option + "</option>";
|
||||
}
|
||||
optionHTML = optionHTML + "</select></div>";
|
||||
optionHTML += "</select></div>";
|
||||
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: "<label><input type=" + item[2] + " class=field name='" + name + "' " + (value ? 'checked' : void 0) + ">" + item[0] + "</label>"
|
||||
@ -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: "<h3 class=mascotHeader>" + name + "</h3>"
|
||||
className: "mascots-container",
|
||||
innerHTML: "<h3 class=mascotHeader>" + name + "</h3>",
|
||||
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: "<input name='" + name + "' type=checkbox " + (Conf["Hidden Categories"].contains(name) ? 'checked' : '') + ">" + 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: "<div class='mascotname'>" + (name.replace(/_/g, " ")) + "</div><div class='mascotcontainer'><div class='mAlign " + mascot.category + "'><img class=mascotimg src='" + (Array.isArray(mascot.image) ? (Style.lightTheme ? mascot.image[1] : mascot.image[0]) : mascot.image) + "'></div></div>"
|
||||
});
|
||||
$.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: " <a href=\"javascript:;\" id=clear>Clear All</a>\n/\n<a href=\"javascript:;\" id=selectAll>Select All</a>\n/\n<a href=\"javascript:;\" id=createNew>Add Mascot</a>\n/\n<a href=\"javascript:;\" id=importMascot>Import Mascot</a><input id=importMascotButton type=file hidden>\n/\n<a href=\"javascript:;\" id=undelete>Undelete Mascots</a>\n/\n<a href=\"http://appchan.booru.org/\" target=_blank>Get More Mascots!</a>"
|
||||
});
|
||||
$.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: "<div class='mascotname'>" + (name.replace(/_/g, " ")) + "</span><div class='container " + mascot.category + "'><img class=mascotimg src='" + (Array.isArray(mascot.image) ? (Style.lightTheme ? mascot.image[1] : mascot.image[0]) : mascot.image) + "'></div>"
|
||||
});
|
||||
$.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: "<a href=\"javascript:;\" id=\"return\">Return</a>"
|
||||
@ -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]);
|
||||
|
||||
@ -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 = "<div class=optionlabel>" + item[0] + "</div><div class=option><select name='" + name + "' value='" + value + "'><br>";
|
||||
_ref = item[3];
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
option = _ref[_i];
|
||||
optionHTML = optionHTML + ("<option value=\"" + option + "\">" + option + "</option>");
|
||||
optionHTML += "<option value=\"" + option + "\">" + option + "</option>";
|
||||
}
|
||||
optionHTML = optionHTML + "</select></div>";
|
||||
optionHTML += "</select></div>";
|
||||
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: "<label><input type=" + item[2] + " class=field name='" + name + "' " + (value ? 'checked' : void 0) + ">" + item[0] + "</label>"
|
||||
@ -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: "<h3 class=mascotHeader>" + name + "</h3>"
|
||||
className: "mascots-container",
|
||||
innerHTML: "<h3 class=mascotHeader>" + name + "</h3>",
|
||||
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: "<input name='" + name + "' type=checkbox " + (Conf["Hidden Categories"].contains(name) ? 'checked' : '') + ">" + 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: "<div class='mascotname'>" + (name.replace(/_/g, " ")) + "</div><div class='mascotcontainer'><div class='mAlign " + mascot.category + "'><img class=mascotimg src='" + (Array.isArray(mascot.image) ? (Style.lightTheme ? mascot.image[1] : mascot.image[0]) : mascot.image) + "'></div></div>"
|
||||
});
|
||||
$.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: " <a href=\"javascript:;\" id=clear>Clear All</a>\n/\n<a href=\"javascript:;\" id=selectAll>Select All</a>\n/\n<a href=\"javascript:;\" id=createNew>Add Mascot</a>\n/\n<a href=\"javascript:;\" id=importMascot>Import Mascot</a><input id=importMascotButton type=file hidden>\n/\n<a href=\"javascript:;\" id=undelete>Undelete Mascots</a>\n/\n<a href=\"http://appchan.booru.org/\" target=_blank>Get More Mascots!</a>"
|
||||
});
|
||||
$.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: "<div class='mascotname'>" + (name.replace(/_/g, " ")) + "</span><div class='container " + mascot.category + "'><img class=mascotimg src='" + (Array.isArray(mascot.image) ? (Style.lightTheme ? mascot.image[1] : mascot.image[0]) : mascot.image) + "'></div>"
|
||||
});
|
||||
$.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: "<a href=\"javascript:;\" id=\"return\">Return</a>"
|
||||
@ -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]);
|
||||
|
||||
@ -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: "<h3 class=mascotHeader>#{name}</h3>"
|
||||
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: "<input name='#{name}' type=checkbox #{if Conf["Hidden Categories"].contains(name) then 'checked' else ''}>#{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: "<a href=\"javascript:;\" id=\"return\">Return</a>"
|
||||
innerHTML: """<a href="javascript:;" id="return">Return</a>"""
|
||||
|
||||
$.on $('#return', batchmascots), 'click', ->
|
||||
mascots =
|
||||
|
||||
@ -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: ->
|
||||
|
||||
@ -9,9 +9,6 @@ MascotTools =
|
||||
unless @el
|
||||
@el = $.el 'div',
|
||||
id: "mascot"
|
||||
# ><img>
|
||||
# >not <img />
|
||||
# >HTML5
|
||||
innerHTML: "<img>"
|
||||
|
||||
$.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 = "<div class=optionlabel>#{item[0]}</div><div class=option><select name='#{name}' value='#{value}'><br>"
|
||||
for option in item[3]
|
||||
optionHTML = optionHTML + "<option value=\"#{option}\">#{option}</option>"
|
||||
optionHTML = optionHTML + "</select></div>"
|
||||
optionHTML += "<option value=\"#{option}\">#{option}</option>"
|
||||
optionHTML += "</select></div>"
|
||||
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: "<label><input type=#{item[2]} class=field name='#{name}' #{if value then 'checked'}>#{item[0]}</label>"
|
||||
@ -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
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user