diff --git a/builds/appchan-x.user.js b/builds/appchan-x.user.js
index bf9586f63..6e45e46e3 100644
--- a/builds/appchan-x.user.js
+++ b/builds/appchan-x.user.js
@@ -12717,7 +12717,7 @@
},
categories: ['Anime', 'Ponies', 'Questionable', 'Silhouette', 'Western'],
dialog: function(key) {
- var container, dialog, div, fileInput, input, item, layout, name, option, optionHTML, setting, value, _i, _len, _ref;
+ var container, dialog, div, fileInput, fileRice, imageFn, input, item, layout, name, nameFn, option, optionHTML, saveCheck, saveVal, setting, updateMascot, value, _i, _len, _ref;
Conf['editMode'] = 'mascot';
if (Mascots[key]) {
editMascot = JSON.parse(JSON.stringify(Mascots[key]));
@@ -12743,6 +12743,38 @@
innerHTML: "
\nPROTIP: Shift-Click the Mascot Image field to upload your own images!\n
This may have some caveats. "
});
container = $("#mascotcontent", dialog);
+ fileRice = function(e) {
+ if (e.shiftKey) {
+ return this.nextSibling.click();
+ }
+ };
+ updateMascot = function() {
+ return MascotTools.change(editMascot);
+ };
+ saveVal = function() {
+ editMascot[this.name] = this.value;
+ return updateMascot();
+ };
+ imageFn = function() {
+ if (MascotTools.URL === this.value) {
+ return MascotTools.change(editMascot);
+ } else if (MascotTools.URL) {
+ URL.revokeObjectURL(MascotTools.URL);
+ delete MascotTools.URL;
+ }
+ return saveVal.call(this);
+ };
+ nameFn = function() {
+ this.value = this.value.replace(/[^a-z-_0-9]/ig, "_");
+ if ((this.value !== "") && !/^[a-z]/i.test(this.value)) {
+ return alert("Mascot names must start with a letter.");
+ }
+ return saveVal.call(this);
+ };
+ saveCheck = function() {
+ editMascot[this.name] = this.checked ? true : false;
+ return updateMascot();
+ };
for (name in layout) {
item = layout[name];
value = editMascot[name] || (editMascot[name] = item[1]);
@@ -12752,53 +12784,27 @@
input = $('input', div);
switch (name) {
case 'image':
- $.on(input, 'blur', function() {
- if (MascotTools.URL === this.value) {
- return MascotTools.change(editMascot);
- } else if (MascotTools.URL) {
- URL.revokeObjectURL(MascotTools.URL);
- delete MascotTools.URL;
- }
- editMascot[this.name] = this.value;
- return MascotTools.change(editMascot);
- });
+ $.on(input, 'blur', imageFn);
fileInput = $.el('input', {
type: "file",
accept: "image/*",
title: "imagefile",
hidden: "hidden"
});
- $.on(input, 'click', function(e) {
- if (e.shiftKey) {
- return this.nextSibling.click();
- }
- });
+ $.on(input, 'click', FileRice);
$.on(fileInput, 'change', MascotTools.uploadImage);
$.after(input, fileInput);
break;
case 'name':
- $.on(input, 'blur', function() {
- this.value = this.value.replace(/[^a-z-_0-9]/ig, "_");
- if ((this.value !== "") && !/^[a-z]/i.test(this.value)) {
- return alert("Mascot names must start with a letter.");
- }
- editMascot[this.name] = this.value;
- return MascotTools.change(editMascot);
- });
+ $.on(input, 'blur', nameFn);
break;
default:
- $.on(input, 'blur', function() {
- editMascot[this.name] = this.value;
- return MascotTools.change(editMascot);
- });
+ $.on(input, 'blur', saveVal);
}
break;
case "number":
div = this.input(item, name);
- $.on($('input', div), 'blur', function() {
- editMascot[this.name] = parseInt(this.value);
- return MascotTools.change(editMascot);
- });
+ $.on($('input', div), 'blur', saveVal);
break;
case "select":
optionHTML = "" + item[0] + "