Clean up redundant code
This commit is contained in:
parent
cb1effa375
commit
8fe9f86423
|
@ -224,15 +224,9 @@ $(function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
$.cookie.json = true;
|
$.cookie.json = true;
|
||||||
|
|
||||||
var settings = $("#settings");
|
var settings = $("#settings");
|
||||||
var options = $.extend({
|
var options = $.extend({notification: true}, $.cookie("settings"));
|
||||||
join: true,
|
|
||||||
mode: true,
|
|
||||||
nick: true,
|
|
||||||
notification: true,
|
|
||||||
part: true,
|
|
||||||
quit: true,
|
|
||||||
}, $.cookie("settings"));
|
|
||||||
|
|
||||||
for (var i in options) {
|
for (var i in options) {
|
||||||
if (options[i]) {
|
if (options[i]) {
|
||||||
|
@ -242,18 +236,8 @@ $(function() {
|
||||||
|
|
||||||
settings.on("change", "input", function() {
|
settings.on("change", "input", function() {
|
||||||
var self = $(this);
|
var self = $(this);
|
||||||
var name = self.attr("name");
|
options[self.attr("name")] = self.prop("checked");
|
||||||
options[name] = self.prop("checked");
|
|
||||||
$.cookie("settings", options);
|
$.cookie("settings", options);
|
||||||
if ([
|
|
||||||
"join",
|
|
||||||
"nick",
|
|
||||||
"part",
|
|
||||||
"mode",
|
|
||||||
"quit",
|
|
||||||
].indexOf(name) !== -1) {
|
|
||||||
chat.toggleClass("hide-" + name, !self.prop("checked"));
|
|
||||||
}
|
|
||||||
}).find("input")
|
}).find("input")
|
||||||
.eq(0)
|
.eq(0)
|
||||||
.trigger("change");
|
.trigger("change");
|
||||||
|
|
Loading…
Reference in New Issue