diff --git a/client/index.html b/client/index.html
index 10f58407..0a634917 100644
--- a/client/index.html
+++ b/client/index.html
@@ -15,6 +15,7 @@
+
@@ -289,6 +290,12 @@
<% } %>
+
+
Custom Stylesheet
+
+
+
+
About The Lounge
diff --git a/client/js/lounge.js b/client/js/lounge.js
index 2bd7f7dd..d62c2b02 100644
--- a/client/js/lounge.js
+++ b/client/js/lounge.js
@@ -424,6 +424,7 @@ $(function() {
users.data("nicks", nicks);
});
+ var userStyles = $("#user-specified-css");
var settings = $("#settings");
var options = $.extend({
badge: false,
@@ -438,19 +439,34 @@ $(function() {
thumbnails: true,
quit: true,
notifyAllMessages: false,
+ userStyles: userStyles.text(),
}, JSON.parse(window.localStorage.getItem("settings")));
for (var i in options) {
+ if (i === "userStyles") {
+ if (!/[\?&]nocss/.test(window.location.search)) {
+ $(document.head).find("#user-specified-css").html(options[i]);
+ }
+ settings.find("#user-specified-css-input").val(options[i]);
+ continue;
+ }
if (options[i]) {
settings.find("input[name=" + i + "]").prop("checked", true);
}
}
- settings.on("change", "input", function() {
+ settings.on("change", "input, textarea", function() {
var self = $(this);
var name = self.attr("name");
- options[name] = self.prop("checked");
+
+ if (self.attr("type") === "checkbox") {
+ options[name] = self.prop("checked");
+ } else {
+ options[name] = self.val();
+ }
+
window.localStorage.setItem("settings", JSON.stringify(options));
+
if ([
"join",
"mode",
@@ -465,6 +481,9 @@ $(function() {
if (name === "colors") {
chat.toggleClass("no-colors", !self.prop("checked"));
}
+ if (name === "userStyles") {
+ $(document.head).find("#user-specified-css").html(options[name]);
+ }
}).find("input")
.trigger("change");