Alphabetically order default user settings, remove unnecessary continue statement, transform ifs into else-ifs

This commit is contained in:
Jérémie Astori 2016-08-17 01:46:26 -04:00
parent 34036a4b7a
commit c4cfd7e4b5
1 changed files with 7 additions and 11 deletions

View File

@ -462,18 +462,18 @@ $(function() {
var userStyles = $("#user-specified-css"); var userStyles = $("#user-specified-css");
var settings = $("#settings"); var settings = $("#settings");
var options = $.extend({ var options = $.extend({
desktopNotifications: false,
coloredNicks: true, coloredNicks: true,
desktopNotifications: false,
join: true, join: true,
links: true, links: true,
mode: true, mode: true,
motd: false, motd: false,
nick: true, nick: true,
notification: true, notification: true,
part: true,
thumbnails: true,
quit: true,
notifyAllMessages: false, notifyAllMessages: false,
part: true,
quit: true,
thumbnails: true,
userStyles: userStyles.text(), userStyles: userStyles.text(),
}, JSON.parse(window.localStorage.getItem("settings"))); }, JSON.parse(window.localStorage.getItem("settings")));
@ -483,7 +483,6 @@ $(function() {
$(document.head).find("#user-specified-css").html(options[i]); $(document.head).find("#user-specified-css").html(options[i]);
} }
settings.find("#user-specified-css-input").val(options[i]); settings.find("#user-specified-css-input").val(options[i]);
continue;
} else if (i === "highlights") { } else if (i === "highlights") {
settings.find("input[name=" + i + "]").val(options[i]); settings.find("input[name=" + i + "]").val(options[i]);
} else if (options[i]) { } else if (options[i]) {
@ -515,14 +514,11 @@ $(function() {
"notifyAllMessages", "notifyAllMessages",
].indexOf(name) !== -1) { ].indexOf(name) !== -1) {
chat.toggleClass("hide-" + name, !self.prop("checked")); chat.toggleClass("hide-" + name, !self.prop("checked"));
} } else if (name === "coloredNicks") {
if (name === "coloredNicks") {
chat.toggleClass("colored-nicks", self.prop("checked")); chat.toggleClass("colored-nicks", self.prop("checked"));
} } else if (name === "userStyles") {
if (name === "userStyles") {
$(document.head).find("#user-specified-css").html(options[name]); $(document.head).find("#user-specified-css").html(options[name]);
} } else if (name === "highlights") {
if (name === "highlights") {
var highlightString = options[name]; var highlightString = options[name];
highlights = highlightString.split(",").map(function(h) { highlights = highlightString.split(",").map(function(h) {
return h.trim(); return h.trim();