Fix various settings tabs and dialogs
* Delete / Undelete Themes and Mascots * Themes only add [custom] if they're not already User Themes
This commit is contained in:
parent
7696301598
commit
6c4e4b6b9f
@ -11306,18 +11306,12 @@
|
||||
|
||||
ThemeTools = {
|
||||
init: function(key) {
|
||||
var colorInput, div, fileInput, header, input, item, layout, themecontent, _i, _j, _len, _len1, _ref;
|
||||
var colorInput, div, fileInput, header, input, item, layout, nodes, themeContent, _i, _j, _len, _len1, _ref;
|
||||
|
||||
Conf['editMode'] = "theme";
|
||||
if (Themes[key]) {
|
||||
if (key) {
|
||||
editTheme = JSON.parse(JSON.stringify(Themes[key]));
|
||||
$.get("userThemes", {}, function(items) {
|
||||
if (items[key]) {
|
||||
return editTheme["Theme"] = key;
|
||||
} else {
|
||||
return editTheme["Theme"] = key += " [custom]";
|
||||
}
|
||||
});
|
||||
editTheme["Theme"] = Conf['userThemes'][key] ? key : key += " [custom]";
|
||||
} else {
|
||||
editTheme = JSON.parse(JSON.stringify(Themes['Yotsuba B']));
|
||||
editTheme["Theme"] = "Untitled";
|
||||
@ -11341,7 +11335,8 @@
|
||||
});
|
||||
}
|
||||
$.add($("#themebar", ThemeTools.dialog), header);
|
||||
themecontent = $("#themecontent", ThemeTools.dialog);
|
||||
themeContent = $("#themecontent", ThemeTools.dialog);
|
||||
nodes = [];
|
||||
for (_j = 0, _len1 = layout.length; _j < _len1; _j++) {
|
||||
item = layout[_j];
|
||||
if (!editTheme[item]) {
|
||||
@ -11416,10 +11411,9 @@
|
||||
}
|
||||
return editTheme[this.name] = this.value;
|
||||
});
|
||||
Style.addStyle(editTheme);
|
||||
$.add(themecontent, div);
|
||||
nodes.push(div);
|
||||
}
|
||||
$.add(themecontent, div);
|
||||
Style.addStyle(editTheme);
|
||||
if (!editTheme["Custom CSS"]) {
|
||||
editTheme["Custom CSS"] = "";
|
||||
}
|
||||
@ -11431,11 +11425,12 @@
|
||||
editTheme["Custom CSS"] = this.value;
|
||||
return Style.themeCSS.textContent = Style.theme(editTheme);
|
||||
});
|
||||
$.add(themecontent, div);
|
||||
nodes.push(div);
|
||||
$.on($('#save > a', ThemeTools.dialog), 'click', function() {
|
||||
return ThemeTools.save(editTheme);
|
||||
});
|
||||
$.on($('#close > a', ThemeTools.dialog), 'click', ThemeTools.close);
|
||||
$.add(themeContent, nodes);
|
||||
$.add(d.body, ThemeTools.dialog);
|
||||
return Style.themeCSS.textContent = Style.theme(editTheme);
|
||||
},
|
||||
@ -13694,7 +13689,9 @@
|
||||
for (_i = 0, _len = keys.length; _i < _len; _i++) {
|
||||
name = keys[_i];
|
||||
theme = Themes[name];
|
||||
if (!theme["Deleted"]) {
|
||||
if (theme["Deleted"]) {
|
||||
continue;
|
||||
}
|
||||
div = $.el('div', {
|
||||
className: "theme " + (name === Conf['theme'] ? 'selectedtheme' : ''),
|
||||
id: name,
|
||||
@ -13707,7 +13704,6 @@
|
||||
$.on(div, 'click', cb.select);
|
||||
$.add(suboptions, div);
|
||||
}
|
||||
}
|
||||
div = $.el('div', {
|
||||
id: 'addthemes',
|
||||
innerHTML: "<a id=newtheme href='javascript:;'>New Theme</a> / <a id=import href='javascript:;'>Import Theme</a><input id=importbutton type=file hidden> / <a id=SSimport href='javascript:;'>Import from 4chan SS</a><input id=SSimportbutton type=file hidden> / <a id=OCimport href='javascript:;'>Import from Oneechan</a><input id=OCimportbutton type=file hidden> / <a id=tUndelete href='javascript:;'>Undelete Theme</a>"
|
||||
@ -13735,14 +13731,22 @@
|
||||
return this.nextSibling.click();
|
||||
});
|
||||
$.on($('#tUndelete', div), 'click', function() {
|
||||
var themes;
|
||||
|
||||
$.rm($.id("themeContainer"));
|
||||
return Settings.openSection(themes, 'undelete');
|
||||
themes = {
|
||||
open: Settings.themes,
|
||||
hyphenatedTitle: 'themes'
|
||||
};
|
||||
return Settings.openSection.apply(themes, ['undelete']);
|
||||
});
|
||||
} else {
|
||||
for (_j = 0, _len1 = keys.length; _j < _len1; _j++) {
|
||||
name = keys[_j];
|
||||
theme = Themes[name];
|
||||
if (theme["Deleted"]) {
|
||||
if (!theme["Deleted"]) {
|
||||
continue;
|
||||
}
|
||||
div = $.el('div', {
|
||||
id: name,
|
||||
className: theme,
|
||||
@ -13751,14 +13755,19 @@
|
||||
$.on(div, 'click', cb.restore);
|
||||
$.add(suboptions, div);
|
||||
}
|
||||
}
|
||||
div = $.el('div', {
|
||||
id: 'addthemes',
|
||||
innerHTML: "<a href='javascript:;'>Return</a>"
|
||||
});
|
||||
$.on($('a', div), 'click', function() {
|
||||
var themes;
|
||||
|
||||
themes = {
|
||||
open: Settings.themes,
|
||||
hyphenatedTitle: 'themes'
|
||||
};
|
||||
$.rm($.id("themeContainer"));
|
||||
return Settings.openSection(themes);
|
||||
return Settings.openSection.call(themes);
|
||||
});
|
||||
}
|
||||
$.add(parentdiv, suboptions);
|
||||
@ -13890,12 +13899,17 @@
|
||||
return MascotTools.importMascot(e);
|
||||
});
|
||||
$.on($('#undelete', batchmascots), 'click', function() {
|
||||
var mascots;
|
||||
|
||||
if (!(Conf["Deleted Mascots"].length > 0)) {
|
||||
alert("No mascots have been deleted.");
|
||||
return;
|
||||
}
|
||||
$.rm($.id("mascotContainer"));
|
||||
return Settings.mascotTab.dialog(Settings.el, 'undelete');
|
||||
mascots = {
|
||||
open: Settings.mascots,
|
||||
hyphenatedTitle: 'mascots'
|
||||
};
|
||||
return Settings.openSection.apply(mascots, ['restore']);
|
||||
});
|
||||
} else {
|
||||
categories = $.el("div", {
|
||||
@ -13922,8 +13936,13 @@
|
||||
innerHTML: "<a href=\"javascript:;\" id=\"return\">Return</a>"
|
||||
});
|
||||
$.on($('#return', batchmascots), 'click', function() {
|
||||
$.rm($.id("mascotContainer"));
|
||||
return Settings.section('mascots');
|
||||
var mascots;
|
||||
|
||||
mascots = {
|
||||
open: Settings.mascots,
|
||||
hyphenatedTitle: 'mascots'
|
||||
};
|
||||
return Settings.openSection.apply(mascots);
|
||||
});
|
||||
}
|
||||
$.add(parentdiv, [suboptions, batchmascots, mascotHide]);
|
||||
@ -14055,7 +14074,8 @@
|
||||
}
|
||||
},
|
||||
"delete": function(e) {
|
||||
var container, settheme;
|
||||
var container, settheme,
|
||||
_this = this;
|
||||
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
@ -14073,26 +14093,28 @@
|
||||
}
|
||||
}
|
||||
Themes[this.name]["Deleted"] = true;
|
||||
return $.get("userThemes", {}, function() {
|
||||
return $.get("userThemes", {}, function(_arg) {
|
||||
var userThemes;
|
||||
|
||||
userThemes = items['userThemes'];
|
||||
userThemes[this.name] = Themes[this.name];
|
||||
userThemes = _arg.userThemes;
|
||||
userThemes[_this.name] = Themes[_this.name];
|
||||
$.set('userThemes', userThemes);
|
||||
return $.rm(container);
|
||||
});
|
||||
}
|
||||
},
|
||||
restore: function() {
|
||||
var _this = this;
|
||||
|
||||
if (confirm("Are you sure you want to restore \"" + this.id + "\"?")) {
|
||||
Themes[this.id]["Deleted"] = false;
|
||||
return $.get("userThemes", {}, function(item) {
|
||||
return $.get("userThemes", {}, function(_arg) {
|
||||
var userThemes;
|
||||
|
||||
userThemes = item["userThemes"];
|
||||
userThemes[this.id] = Themes[this.id];
|
||||
userThemes = _arg.userThemes;
|
||||
userThemes[_this.id] = Themes[_this.id];
|
||||
$.set('userThemes', userThemes);
|
||||
return $.rm(this);
|
||||
return $.rm(_this);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -11327,18 +11327,12 @@
|
||||
|
||||
ThemeTools = {
|
||||
init: function(key) {
|
||||
var colorInput, div, fileInput, header, input, item, layout, themecontent, _i, _j, _len, _len1, _ref;
|
||||
var colorInput, div, fileInput, header, input, item, layout, nodes, themeContent, _i, _j, _len, _len1, _ref;
|
||||
|
||||
Conf['editMode'] = "theme";
|
||||
if (Themes[key]) {
|
||||
if (key) {
|
||||
editTheme = JSON.parse(JSON.stringify(Themes[key]));
|
||||
$.get("userThemes", {}, function(items) {
|
||||
if (items[key]) {
|
||||
return editTheme["Theme"] = key;
|
||||
} else {
|
||||
return editTheme["Theme"] = key += " [custom]";
|
||||
}
|
||||
});
|
||||
editTheme["Theme"] = Conf['userThemes'][key] ? key : key += " [custom]";
|
||||
} else {
|
||||
editTheme = JSON.parse(JSON.stringify(Themes['Yotsuba B']));
|
||||
editTheme["Theme"] = "Untitled";
|
||||
@ -11362,7 +11356,8 @@
|
||||
});
|
||||
}
|
||||
$.add($("#themebar", ThemeTools.dialog), header);
|
||||
themecontent = $("#themecontent", ThemeTools.dialog);
|
||||
themeContent = $("#themecontent", ThemeTools.dialog);
|
||||
nodes = [];
|
||||
for (_j = 0, _len1 = layout.length; _j < _len1; _j++) {
|
||||
item = layout[_j];
|
||||
if (!editTheme[item]) {
|
||||
@ -11437,10 +11432,9 @@
|
||||
}
|
||||
return editTheme[this.name] = this.value;
|
||||
});
|
||||
Style.addStyle(editTheme);
|
||||
$.add(themecontent, div);
|
||||
nodes.push(div);
|
||||
}
|
||||
$.add(themecontent, div);
|
||||
Style.addStyle(editTheme);
|
||||
if (!editTheme["Custom CSS"]) {
|
||||
editTheme["Custom CSS"] = "";
|
||||
}
|
||||
@ -11452,11 +11446,12 @@
|
||||
editTheme["Custom CSS"] = this.value;
|
||||
return Style.themeCSS.textContent = Style.theme(editTheme);
|
||||
});
|
||||
$.add(themecontent, div);
|
||||
nodes.push(div);
|
||||
$.on($('#save > a', ThemeTools.dialog), 'click', function() {
|
||||
return ThemeTools.save(editTheme);
|
||||
});
|
||||
$.on($('#close > a', ThemeTools.dialog), 'click', ThemeTools.close);
|
||||
$.add(themeContent, nodes);
|
||||
$.add(d.body, ThemeTools.dialog);
|
||||
return Style.themeCSS.textContent = Style.theme(editTheme);
|
||||
},
|
||||
@ -13713,7 +13708,9 @@
|
||||
for (_i = 0, _len = keys.length; _i < _len; _i++) {
|
||||
name = keys[_i];
|
||||
theme = Themes[name];
|
||||
if (!theme["Deleted"]) {
|
||||
if (theme["Deleted"]) {
|
||||
continue;
|
||||
}
|
||||
div = $.el('div', {
|
||||
className: "theme " + (name === Conf['theme'] ? 'selectedtheme' : ''),
|
||||
id: name,
|
||||
@ -13726,7 +13723,6 @@
|
||||
$.on(div, 'click', cb.select);
|
||||
$.add(suboptions, div);
|
||||
}
|
||||
}
|
||||
div = $.el('div', {
|
||||
id: 'addthemes',
|
||||
innerHTML: "<a id=newtheme href='javascript:;'>New Theme</a> / <a id=import href='javascript:;'>Import Theme</a><input id=importbutton type=file hidden> / <a id=SSimport href='javascript:;'>Import from 4chan SS</a><input id=SSimportbutton type=file hidden> / <a id=OCimport href='javascript:;'>Import from Oneechan</a><input id=OCimportbutton type=file hidden> / <a id=tUndelete href='javascript:;'>Undelete Theme</a>"
|
||||
@ -13754,14 +13750,22 @@
|
||||
return this.nextSibling.click();
|
||||
});
|
||||
$.on($('#tUndelete', div), 'click', function() {
|
||||
var themes;
|
||||
|
||||
$.rm($.id("themeContainer"));
|
||||
return Settings.openSection(themes, 'undelete');
|
||||
themes = {
|
||||
open: Settings.themes,
|
||||
hyphenatedTitle: 'themes'
|
||||
};
|
||||
return Settings.openSection.apply(themes, ['undelete']);
|
||||
});
|
||||
} else {
|
||||
for (_j = 0, _len1 = keys.length; _j < _len1; _j++) {
|
||||
name = keys[_j];
|
||||
theme = Themes[name];
|
||||
if (theme["Deleted"]) {
|
||||
if (!theme["Deleted"]) {
|
||||
continue;
|
||||
}
|
||||
div = $.el('div', {
|
||||
id: name,
|
||||
className: theme,
|
||||
@ -13770,14 +13774,19 @@
|
||||
$.on(div, 'click', cb.restore);
|
||||
$.add(suboptions, div);
|
||||
}
|
||||
}
|
||||
div = $.el('div', {
|
||||
id: 'addthemes',
|
||||
innerHTML: "<a href='javascript:;'>Return</a>"
|
||||
});
|
||||
$.on($('a', div), 'click', function() {
|
||||
var themes;
|
||||
|
||||
themes = {
|
||||
open: Settings.themes,
|
||||
hyphenatedTitle: 'themes'
|
||||
};
|
||||
$.rm($.id("themeContainer"));
|
||||
return Settings.openSection(themes);
|
||||
return Settings.openSection.call(themes);
|
||||
});
|
||||
}
|
||||
$.add(parentdiv, suboptions);
|
||||
@ -13909,12 +13918,17 @@
|
||||
return MascotTools.importMascot(e);
|
||||
});
|
||||
$.on($('#undelete', batchmascots), 'click', function() {
|
||||
var mascots;
|
||||
|
||||
if (!(Conf["Deleted Mascots"].length > 0)) {
|
||||
alert("No mascots have been deleted.");
|
||||
return;
|
||||
}
|
||||
$.rm($.id("mascotContainer"));
|
||||
return Settings.mascotTab.dialog(Settings.el, 'undelete');
|
||||
mascots = {
|
||||
open: Settings.mascots,
|
||||
hyphenatedTitle: 'mascots'
|
||||
};
|
||||
return Settings.openSection.apply(mascots, ['restore']);
|
||||
});
|
||||
} else {
|
||||
categories = $.el("div", {
|
||||
@ -13941,8 +13955,13 @@
|
||||
innerHTML: "<a href=\"javascript:;\" id=\"return\">Return</a>"
|
||||
});
|
||||
$.on($('#return', batchmascots), 'click', function() {
|
||||
$.rm($.id("mascotContainer"));
|
||||
return Settings.section('mascots');
|
||||
var mascots;
|
||||
|
||||
mascots = {
|
||||
open: Settings.mascots,
|
||||
hyphenatedTitle: 'mascots'
|
||||
};
|
||||
return Settings.openSection.apply(mascots);
|
||||
});
|
||||
}
|
||||
$.add(parentdiv, [suboptions, batchmascots, mascotHide]);
|
||||
@ -14074,7 +14093,8 @@
|
||||
}
|
||||
},
|
||||
"delete": function(e) {
|
||||
var container, settheme;
|
||||
var container, settheme,
|
||||
_this = this;
|
||||
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
@ -14092,26 +14112,28 @@
|
||||
}
|
||||
}
|
||||
Themes[this.name]["Deleted"] = true;
|
||||
return $.get("userThemes", {}, function() {
|
||||
return $.get("userThemes", {}, function(_arg) {
|
||||
var userThemes;
|
||||
|
||||
userThemes = items['userThemes'];
|
||||
userThemes[this.name] = Themes[this.name];
|
||||
userThemes = _arg.userThemes;
|
||||
userThemes[_this.name] = Themes[_this.name];
|
||||
$.set('userThemes', userThemes);
|
||||
return $.rm(container);
|
||||
});
|
||||
}
|
||||
},
|
||||
restore: function() {
|
||||
var _this = this;
|
||||
|
||||
if (confirm("Are you sure you want to restore \"" + this.id + "\"?")) {
|
||||
Themes[this.id]["Deleted"] = false;
|
||||
return $.get("userThemes", {}, function(item) {
|
||||
return $.get("userThemes", {}, function(_arg) {
|
||||
var userThemes;
|
||||
|
||||
userThemes = item["userThemes"];
|
||||
userThemes[this.id] = Themes[this.id];
|
||||
userThemes = _arg.userThemes;
|
||||
userThemes[_this.id] = Themes[_this.id];
|
||||
$.set('userThemes', userThemes);
|
||||
return $.rm(this);
|
||||
return $.rm(_this);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
BIN
builds/crx.crx
BIN
builds/crx.crx
Binary file not shown.
@ -11310,18 +11310,12 @@
|
||||
|
||||
ThemeTools = {
|
||||
init: function(key) {
|
||||
var colorInput, div, fileInput, header, input, item, layout, themecontent, _i, _j, _len, _len1, _ref;
|
||||
var colorInput, div, fileInput, header, input, item, layout, nodes, themeContent, _i, _j, _len, _len1, _ref;
|
||||
|
||||
Conf['editMode'] = "theme";
|
||||
if (Themes[key]) {
|
||||
if (key) {
|
||||
editTheme = JSON.parse(JSON.stringify(Themes[key]));
|
||||
$.get("userThemes", {}, function(items) {
|
||||
if (items[key]) {
|
||||
return editTheme["Theme"] = key;
|
||||
} else {
|
||||
return editTheme["Theme"] = key += " [custom]";
|
||||
}
|
||||
});
|
||||
editTheme["Theme"] = Conf['userThemes'][key] ? key : key += " [custom]";
|
||||
} else {
|
||||
editTheme = JSON.parse(JSON.stringify(Themes['Yotsuba B']));
|
||||
editTheme["Theme"] = "Untitled";
|
||||
@ -11345,7 +11339,8 @@
|
||||
});
|
||||
}
|
||||
$.add($("#themebar", ThemeTools.dialog), header);
|
||||
themecontent = $("#themecontent", ThemeTools.dialog);
|
||||
themeContent = $("#themecontent", ThemeTools.dialog);
|
||||
nodes = [];
|
||||
for (_j = 0, _len1 = layout.length; _j < _len1; _j++) {
|
||||
item = layout[_j];
|
||||
if (!editTheme[item]) {
|
||||
@ -11420,10 +11415,9 @@
|
||||
}
|
||||
return editTheme[this.name] = this.value;
|
||||
});
|
||||
Style.addStyle(editTheme);
|
||||
$.add(themecontent, div);
|
||||
nodes.push(div);
|
||||
}
|
||||
$.add(themecontent, div);
|
||||
Style.addStyle(editTheme);
|
||||
if (!editTheme["Custom CSS"]) {
|
||||
editTheme["Custom CSS"] = "";
|
||||
}
|
||||
@ -11435,11 +11429,12 @@
|
||||
editTheme["Custom CSS"] = this.value;
|
||||
return Style.themeCSS.textContent = Style.theme(editTheme);
|
||||
});
|
||||
$.add(themecontent, div);
|
||||
nodes.push(div);
|
||||
$.on($('#save > a', ThemeTools.dialog), 'click', function() {
|
||||
return ThemeTools.save(editTheme);
|
||||
});
|
||||
$.on($('#close > a', ThemeTools.dialog), 'click', ThemeTools.close);
|
||||
$.add(themeContent, nodes);
|
||||
$.add(d.body, ThemeTools.dialog);
|
||||
return Style.themeCSS.textContent = Style.theme(editTheme);
|
||||
},
|
||||
@ -13698,7 +13693,9 @@
|
||||
for (_i = 0, _len = keys.length; _i < _len; _i++) {
|
||||
name = keys[_i];
|
||||
theme = Themes[name];
|
||||
if (!theme["Deleted"]) {
|
||||
if (theme["Deleted"]) {
|
||||
continue;
|
||||
}
|
||||
div = $.el('div', {
|
||||
className: "theme " + (name === Conf['theme'] ? 'selectedtheme' : ''),
|
||||
id: name,
|
||||
@ -13711,7 +13708,6 @@
|
||||
$.on(div, 'click', cb.select);
|
||||
$.add(suboptions, div);
|
||||
}
|
||||
}
|
||||
div = $.el('div', {
|
||||
id: 'addthemes',
|
||||
innerHTML: "<a id=newtheme href='javascript:;'>New Theme</a> / <a id=import href='javascript:;'>Import Theme</a><input id=importbutton type=file hidden> / <a id=SSimport href='javascript:;'>Import from 4chan SS</a><input id=SSimportbutton type=file hidden> / <a id=OCimport href='javascript:;'>Import from Oneechan</a><input id=OCimportbutton type=file hidden> / <a id=tUndelete href='javascript:;'>Undelete Theme</a>"
|
||||
@ -13739,14 +13735,22 @@
|
||||
return this.nextSibling.click();
|
||||
});
|
||||
$.on($('#tUndelete', div), 'click', function() {
|
||||
var themes;
|
||||
|
||||
$.rm($.id("themeContainer"));
|
||||
return Settings.openSection(themes, 'undelete');
|
||||
themes = {
|
||||
open: Settings.themes,
|
||||
hyphenatedTitle: 'themes'
|
||||
};
|
||||
return Settings.openSection.apply(themes, ['undelete']);
|
||||
});
|
||||
} else {
|
||||
for (_j = 0, _len1 = keys.length; _j < _len1; _j++) {
|
||||
name = keys[_j];
|
||||
theme = Themes[name];
|
||||
if (theme["Deleted"]) {
|
||||
if (!theme["Deleted"]) {
|
||||
continue;
|
||||
}
|
||||
div = $.el('div', {
|
||||
id: name,
|
||||
className: theme,
|
||||
@ -13755,14 +13759,19 @@
|
||||
$.on(div, 'click', cb.restore);
|
||||
$.add(suboptions, div);
|
||||
}
|
||||
}
|
||||
div = $.el('div', {
|
||||
id: 'addthemes',
|
||||
innerHTML: "<a href='javascript:;'>Return</a>"
|
||||
});
|
||||
$.on($('a', div), 'click', function() {
|
||||
var themes;
|
||||
|
||||
themes = {
|
||||
open: Settings.themes,
|
||||
hyphenatedTitle: 'themes'
|
||||
};
|
||||
$.rm($.id("themeContainer"));
|
||||
return Settings.openSection(themes);
|
||||
return Settings.openSection.call(themes);
|
||||
});
|
||||
}
|
||||
$.add(parentdiv, suboptions);
|
||||
@ -13894,12 +13903,17 @@
|
||||
return MascotTools.importMascot(e);
|
||||
});
|
||||
$.on($('#undelete', batchmascots), 'click', function() {
|
||||
var mascots;
|
||||
|
||||
if (!(Conf["Deleted Mascots"].length > 0)) {
|
||||
alert("No mascots have been deleted.");
|
||||
return;
|
||||
}
|
||||
$.rm($.id("mascotContainer"));
|
||||
return Settings.mascotTab.dialog(Settings.el, 'undelete');
|
||||
mascots = {
|
||||
open: Settings.mascots,
|
||||
hyphenatedTitle: 'mascots'
|
||||
};
|
||||
return Settings.openSection.apply(mascots, ['restore']);
|
||||
});
|
||||
} else {
|
||||
categories = $.el("div", {
|
||||
@ -13926,8 +13940,13 @@
|
||||
innerHTML: "<a href=\"javascript:;\" id=\"return\">Return</a>"
|
||||
});
|
||||
$.on($('#return', batchmascots), 'click', function() {
|
||||
$.rm($.id("mascotContainer"));
|
||||
return Settings.section('mascots');
|
||||
var mascots;
|
||||
|
||||
mascots = {
|
||||
open: Settings.mascots,
|
||||
hyphenatedTitle: 'mascots'
|
||||
};
|
||||
return Settings.openSection.apply(mascots);
|
||||
});
|
||||
}
|
||||
$.add(parentdiv, [suboptions, batchmascots, mascotHide]);
|
||||
@ -14059,7 +14078,8 @@
|
||||
}
|
||||
},
|
||||
"delete": function(e) {
|
||||
var container, settheme;
|
||||
var container, settheme,
|
||||
_this = this;
|
||||
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
@ -14077,26 +14097,28 @@
|
||||
}
|
||||
}
|
||||
Themes[this.name]["Deleted"] = true;
|
||||
return $.get("userThemes", {}, function() {
|
||||
return $.get("userThemes", {}, function(_arg) {
|
||||
var userThemes;
|
||||
|
||||
userThemes = items['userThemes'];
|
||||
userThemes[this.name] = Themes[this.name];
|
||||
userThemes = _arg.userThemes;
|
||||
userThemes[_this.name] = Themes[_this.name];
|
||||
$.set('userThemes', userThemes);
|
||||
return $.rm(container);
|
||||
});
|
||||
}
|
||||
},
|
||||
restore: function() {
|
||||
var _this = this;
|
||||
|
||||
if (confirm("Are you sure you want to restore \"" + this.id + "\"?")) {
|
||||
Themes[this.id]["Deleted"] = false;
|
||||
return $.get("userThemes", {}, function(item) {
|
||||
return $.get("userThemes", {}, function(_arg) {
|
||||
var userThemes;
|
||||
|
||||
userThemes = item["userThemes"];
|
||||
userThemes[this.id] = Themes[this.id];
|
||||
userThemes = _arg.userThemes;
|
||||
userThemes[_this.id] = Themes[_this.id];
|
||||
$.set('userThemes', userThemes);
|
||||
return $.rm(this);
|
||||
return $.rm(_this);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -107,7 +107,7 @@ Settings =
|
||||
hyphenatedTitle = title.toLowerCase().replace /\s+/g, '-'
|
||||
Settings.sections.push {title, hyphenatedTitle, open}
|
||||
|
||||
openSection: (mode)->
|
||||
openSection: (mode) ->
|
||||
if selected = $ '.tab-selected', Settings.dialog
|
||||
$.rmClass selected, 'tab-selected'
|
||||
$.addClass $(".tab-#{@hyphenatedTitle}", Settings.dialog), 'tab-selected'
|
||||
@ -549,7 +549,7 @@ Settings =
|
||||
for name in keys
|
||||
theme = Themes[name]
|
||||
|
||||
unless theme["Deleted"]
|
||||
continue if theme["Deleted"]
|
||||
|
||||
div = $.el 'div',
|
||||
className: "theme #{if name is Conf['theme'] then 'selectedtheme' else ''}"
|
||||
@ -639,14 +639,19 @@ Settings =
|
||||
|
||||
$.on $('#tUndelete', div), 'click', ->
|
||||
$.rm $.id "themeContainer"
|
||||
Settings.openSection themes, 'undelete'
|
||||
|
||||
themes =
|
||||
open: Settings.themes
|
||||
hyphenatedTitle: 'themes'
|
||||
|
||||
Settings.openSection.apply themes, ['undelete']
|
||||
|
||||
else
|
||||
|
||||
for name in keys
|
||||
theme = Themes[name]
|
||||
|
||||
if theme["Deleted"]
|
||||
continue unless theme["Deleted"]
|
||||
|
||||
div = $.el 'div',
|
||||
id: name
|
||||
@ -679,8 +684,12 @@ Settings =
|
||||
innerHTML: "<a href='javascript:;'>Return</a>"
|
||||
|
||||
$.on $('a', div), 'click', ->
|
||||
themes =
|
||||
open: Settings.themes
|
||||
hyphenatedTitle: 'themes'
|
||||
|
||||
$.rm $.id "themeContainer"
|
||||
Settings.openSection themes
|
||||
Settings.openSection.call themes
|
||||
|
||||
$.add parentdiv, suboptions
|
||||
$.add parentdiv, div
|
||||
@ -815,8 +824,10 @@ Settings =
|
||||
unless Conf["Deleted Mascots"].length > 0
|
||||
alert "No mascots have been deleted."
|
||||
return
|
||||
$.rm $.id "mascotContainer"
|
||||
Settings.mascotTab.dialog Settings.el, 'undelete'
|
||||
mascots =
|
||||
open: Settings.mascots
|
||||
hyphenatedTitle: 'mascots'
|
||||
Settings.openSection.apply mascots, ['restore']
|
||||
|
||||
else
|
||||
categories = $.el "div",
|
||||
@ -845,8 +856,10 @@ Settings =
|
||||
innerHTML: "<a href=\"javascript:;\" id=\"return\">Return</a>"
|
||||
|
||||
$.on $('#return', batchmascots), 'click', ->
|
||||
$.rm $.id "mascotContainer"
|
||||
Settings.section 'mascots'
|
||||
mascots =
|
||||
open: Settings.mascots
|
||||
hyphenatedTitle: 'mascots'
|
||||
Settings.openSection.apply mascots
|
||||
|
||||
$.add parentdiv, [suboptions, batchmascots, mascotHide]
|
||||
|
||||
@ -973,8 +986,7 @@ Settings =
|
||||
$.set 'theme', Conf['theme']
|
||||
Themes[@name]["Deleted"] = true
|
||||
|
||||
$.get "userThemes", {}, ->
|
||||
userThemes = items['userThemes']
|
||||
$.get "userThemes", {}, ({userThemes}) =>
|
||||
userThemes[@name] = Themes[@name]
|
||||
$.set 'userThemes', userThemes
|
||||
$.rm container
|
||||
@ -982,8 +994,8 @@ Settings =
|
||||
restore: ->
|
||||
if confirm "Are you sure you want to restore \"#{@id}\"?"
|
||||
Themes[@id]["Deleted"] = false
|
||||
$.get "userThemes", {}, (item) ->
|
||||
userThemes = item["userThemes"]
|
||||
|
||||
$.get "userThemes", {}, ({userThemes}) =>
|
||||
userThemes[@id] = Themes[@id]
|
||||
$.set 'userThemes', userThemes
|
||||
$.rm @
|
||||
|
||||
@ -6,13 +6,12 @@ ThemeTools =
|
||||
init: (key) ->
|
||||
Conf['editMode'] = "theme"
|
||||
|
||||
if Themes[key]
|
||||
if key
|
||||
editTheme = JSON.parse(JSON.stringify(Themes[key]))
|
||||
$.get "userThemes", {}, (items) ->
|
||||
if items[key]
|
||||
editTheme["Theme"] = key
|
||||
editTheme["Theme"] = if Conf['userThemes'][key]
|
||||
key
|
||||
else
|
||||
editTheme["Theme"] = key += " [custom]"
|
||||
key += " [custom]"
|
||||
else
|
||||
editTheme = JSON.parse(JSON.stringify(Themes['Yotsuba B']))
|
||||
editTheme["Theme"] = "Untitled"
|
||||
@ -102,7 +101,9 @@ ThemeTools =
|
||||
$.on input, 'blur', ->
|
||||
editTheme[@name] = @value
|
||||
$.add $("#themebar", ThemeTools.dialog), header
|
||||
themecontent = $("#themecontent", ThemeTools.dialog)
|
||||
themeContent = $("#themecontent", ThemeTools.dialog)
|
||||
|
||||
nodes = []
|
||||
|
||||
for item in layout
|
||||
unless editTheme[item]
|
||||
@ -168,12 +169,10 @@ ThemeTools =
|
||||
|
||||
editTheme[@name] = @value
|
||||
|
||||
nodes.push div
|
||||
|
||||
Style.addStyle(editTheme)
|
||||
|
||||
$.add themecontent, div
|
||||
|
||||
$.add themecontent, div
|
||||
|
||||
unless editTheme["Custom CSS"]
|
||||
editTheme["Custom CSS"] = ""
|
||||
|
||||
@ -185,12 +184,15 @@ ThemeTools =
|
||||
editTheme["Custom CSS"] = @value
|
||||
Style.themeCSS.textContent = Style.theme editTheme
|
||||
|
||||
$.add themecontent, div
|
||||
nodes.push div
|
||||
|
||||
$.on $('#save > a', ThemeTools.dialog), 'click', ->
|
||||
ThemeTools.save editTheme
|
||||
|
||||
$.on $('#close > a', ThemeTools.dialog), 'click', ThemeTools.close
|
||||
|
||||
$.add themeContent, nodes
|
||||
|
||||
$.add d.body, ThemeTools.dialog
|
||||
Style.themeCSS.textContent = Style.theme editTheme
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user