diff --git a/client/index.html b/client/index.html index 841a8174..ff2e2844 100644 --- a/client/index.html +++ b/client/index.html @@ -15,6 +15,7 @@ + @@ -290,6 +291,12 @@ <% } %> +
+

Custom Stylesheet

+
+
+ +

About The Lounge

diff --git a/client/js/lounge.js b/client/js/lounge.js index 4f8273c6..ed1397b7 100644 --- a/client/js/lounge.js +++ b/client/js/lounge.js @@ -426,6 +426,7 @@ $(function() { users.data("nicks", nicks); }); + var userStyles = $("#user-specified-css"); var settings = $("#settings"); var options = $.extend({ badge: false, @@ -440,19 +441,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", @@ -467,6 +483,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");