diff --git a/www/assets/js/util.js b/www/assets/js/util.js
index fe08c592..9daee781 100644
--- a/www/assets/js/util.js
+++ b/www/assets/js/util.js
@@ -497,7 +497,9 @@ function rebuildPlaylist() {
}
/* menus */
-function showOpts() {
+
+/* user settings menu */
+function showOptionsMenu() {
hidePlayer();
var modal = $("
").addClass("modal hide fade")
.appendTo($("body"));
@@ -676,209 +678,39 @@ function showOpts() {
$("#uopt-btn-general").click();
$("#uopt-btn-save").click(function () {
+ USEROPTS.theme = gen_theme.val();
+ USEROPTS.layout = gen_layout.val();
+ USEROPTS.css = gen_css.val();
+ USEROPTS.ignore_channelcss = gen_nocss.prop("checked");
+ USEROPTS.ignore_channeljs = gen_nojs.prop("checked");
+ USEROPTS.altsocket = gen_altsocket.prop("checked");
+ USEROPTS.synch = pl_synch.prop("checked");
+ USEROPTS.sync_accuracy = parseFloat(pl_synchacc.val())||2;
+ USEROPTS.wmode_transparent = pl_wmode.prop("checked");
+ USEROPTS.hidevid = pl_hide.prop("checked");
+ USEROPTS.qbtn_hide = pl_hidebtn.prop("checked");
+ USEROPTS.qbtn_idontlikechange = pl_oldbtn.prop("checked");
+ USEROPTS.show_timestamps = chat_time.prop("checked");
+ USEROPTS.sort_rank = chat_sort_rank.prop("checked");
+ USEROPTS.sort_afk = chat_sort_afk.prop("checked");
+ USEROPTS.blink_title = chat_all.prop("checked");
+ USEROPTS.boop = chat_boop.prop("checked");
+ USEROPTS.chatbtn = chat_sendbtn.prop("checked");
+ if (CLIENT.rank >= 2) {
+ USEROPTS.modhat = mod_flair.prop("checked");
+ USEROPTS.joinmessage = mod_joinmsg.prop("checked");
+ }
+ saveOpts();
+ modal.modal("hide");
});
});
modal.on("hidden", function () {
- unhidePlayer();
- modal.remove();
- });
-
- modal.modal();
-}
-
-function showOptionsMenu() {
- hidePlayer();
- var modal = $("").addClass("modal hide fade")
- .appendTo($("body"));
- var head = $("").addClass("modal-header")
- .appendTo(modal);
- $("").addClass("close")
- .attr("data-dismiss", "modal")
- .attr("aria-hidden", "true")
- .appendTo(head)[0].innerHTML = "×";
- $("").text("User Options").appendTo(head);
- var body = $("").addClass("modal-body").appendTo(modal);
- var form = $("").addClass("form-horizontal")
- .appendTo(body);
-
- function addOption(lbl, thing) {
- var g = $("").addClass("control-group").appendTo(form);
- $("").addClass("control-label").text(lbl).appendTo(g);
- var c = $("").addClass("controls").appendTo(g);
- thing.appendTo(c);
- }
-
- var themeselect = $("");
- $("").attr("value", "default").text("Default").appendTo(themeselect);
- $("").attr("value", "assets/css/darkstrap.css").text("Dark").appendTo(themeselect);
- $("").attr("value", "assets/css/semidark.css").text("Semidark").appendTo(themeselect);
- themeselect.val(USEROPTS.theme);
- addOption("Theme", themeselect);
-
- var usercss = $("").attr("type", "text")
- .attr("placeholder", "Stylesheet URL");
- usercss.val(USEROPTS.css);
- addOption("User CSS", usercss);
-
- var layoutselect = $("");
- $("").attr("value", "default").text("Compact")
- .appendTo(layoutselect);
- $("").attr("value", "synchtube").text("Synchtube")
- .appendTo(layoutselect);
- $("").attr("value", "fluid").text("Fluid")
- .appendTo(layoutselect);
- layoutselect.val(USEROPTS.layout);
- addOption("Layout", layoutselect);
- var warn = $("").addClass("text-error")
- .text("Changing layouts may require a refresh")
- addOption("", warn);
- $("
").appendTo(form);
- var nocsscontainer = $("").addClass("checkbox")
- .text("Ignore channel CSS");
- var nocss = $("").attr("type", "checkbox").appendTo(nocsscontainer);
- nocss.prop("checked", USEROPTS.ignore_channelcss);
- addOption("Channel CSS", nocsscontainer);
- var nojscontainer = $("").addClass("checkbox")
- .text("Ignore channel JS");
- var nojs = $("").attr("type", "checkbox").appendTo(nojscontainer);
- nojs.prop("checked", USEROPTS.ignore_channeljs);
- addOption("Channel JS", nojscontainer);
- $("
").appendTo(form);
-
- var hqbtncontainer = $("").addClass("checkbox")
- .text("Hide playlist buttons by default");
- var hqbtn = $("").attr("type", "checkbox").appendTo(hqbtncontainer);
- hqbtn.prop("checked", USEROPTS.qbtn_hide);
- addOption("Playlist Buttons", hqbtncontainer);
-
- var oqbtncontainer = $("").addClass("checkbox")
- .text("Old style playlist buttons");
- var oqbtn = $("").attr("type", "checkbox").appendTo(oqbtncontainer);
- oqbtn.prop("checked", USEROPTS.qbtn_idontlikechange);
- addOption("Playlist Buttons (Old)", oqbtncontainer);
-
- var synchcontainer = $("").addClass("checkbox")
- .text("Synchronize Media");
- var synch = $("").attr("type", "checkbox").appendTo(synchcontainer);
- synch.prop("checked", USEROPTS.synch);
- addOption("Synch", synchcontainer);
-
- var syncacc = $("").attr("type", "text")
- .attr("placeholder", "Seconds");
- syncacc.val(USEROPTS.sync_accuracy);
- addOption("Synch Accuracy", syncacc);
-
- var wmcontainer = $("").addClass("checkbox")
- .text("Allow transparency over video");
- var wmodetrans = $("").attr("type", "checkbox")
- .appendTo(wmcontainer);
- wmodetrans.prop("checked", USEROPTS.wmode_transparent);
- addOption("Transparent wmode", wmcontainer);
-
- var vidcontainer = $("").addClass("checkbox")
- .text("Hide Video");
- var hidevid = $("").attr("type", "checkbox").appendTo(vidcontainer);
- hidevid.prop("checked", USEROPTS.hidevid);
- addOption("Hide Video", vidcontainer);
- $("
").appendTo(form);
-
- var tscontainer = $("").addClass("checkbox")
- .text("Show timestamps in chat");
- var showts = $("").attr("type", "checkbox").appendTo(tscontainer);
- showts.prop("checked", USEROPTS.show_timestamps);
- addOption("Show timestamps", tscontainer);
-
- var srcontainer = $("").addClass("checkbox")
- .text("Sort userlist by rank");
- var sr = $("").attr("type", "checkbox").appendTo(srcontainer);
- sr.prop("checked", USEROPTS.sort_rank);
- addOption("Userlist sort", srcontainer);
-
- var sacontainer = $("").addClass("checkbox")
- .text("AFKers at bottom of userlist");
- var sa = $("").attr("type", "checkbox").appendTo(sacontainer);
- sa.prop("checked", USEROPTS.sort_afk);
- addOption("Userlist sort", sacontainer);
-
- var blinkcontainer = $("").addClass("checkbox")
- .text("Flash title on every incoming message");
- var blink = $("").attr("type", "checkbox").appendTo(blinkcontainer);
- blink.prop("checked", USEROPTS.blink_title);
- addOption("Chat Notice", blinkcontainer);
-
- var boopcontainer = $("").addClass("checkbox")
- .text("Play a sound in addition to flashing the title");
- var boop = $("").attr("type", "checkbox").appendTo(boopcontainer);
- boop.prop("checked", USEROPTS.boop);
- addOption("Chat Sound", boopcontainer);
-
- var sendbtncontainer = $("").addClass("checkbox")
- .text("Add a send button to the chatbox");
- var sendbtn = $("").attr("type", "checkbox").appendTo(sendbtncontainer);
- sendbtn.prop("checked", USEROPTS.chatbtn);
- addOption("Send Button", sendbtncontainer);
-
- var altsocketcontainer = $("").addClass("checkbox")
- .text("Use alternative socket connection (requires refresh)");
- var altsocket = $("").attr("type", "checkbox")
- .appendTo(altsocketcontainer);
- altsocket.prop("checked", USEROPTS.altsocket);
- addOption("Alternate Socket", altsocketcontainer);
-
- if(CLIENT.rank >= Rank.Moderator) {
- $("
").appendTo(form);
- var modhatcontainer = $("").addClass("checkbox")
- .text("Show name color");
- var modhat = $("").attr("type", "checkbox").appendTo(modhatcontainer);
- modhat.prop("checked", USEROPTS.modhat);
- addOption("Modflair", modhatcontainer);
-
- var joincontainer = $("").addClass("checkbox")
- .text("Show join messages");
- var join = $("").attr("type", "checkbox").appendTo(joincontainer);
- join.prop("checked", USEROPTS.joinmessage);
- addOption("Join Messages", joincontainer);
- }
-
- var footer = $("").addClass("modal-footer").appendTo(modal);
- var submit = $("").addClass("btn btn-primary pull-right")
- .text("Save")
- .appendTo(footer);
-
- submit.click(function() {
- USEROPTS.theme = themeselect.val();
- USEROPTS.css = usercss.val();
- USEROPTS.layout = layoutselect.val();
- USEROPTS.synch = synch.prop("checked");
- USEROPTS.sync_accuracy = parseFloat(syncacc.val()) || 2;
- USEROPTS.wmode_transparent = wmodetrans.prop("checked");
- USEROPTS.hidevid = hidevid.prop("checked");
- USEROPTS.show_timestamps = showts.prop("checked");
- USEROPTS.blink_title = blink.prop("checked");
- USEROPTS.chatbtn = sendbtn.prop("checked");
- USEROPTS.altsocket = altsocket.prop("checked");
- USEROPTS.qbtn_hide = hqbtn.prop("checked");
- USEROPTS.qbtn_idontlikechange = oqbtn.prop("checked");
- USEROPTS.ignore_channelcss = nocss.prop("checked");
- USEROPTS.ignore_channeljs = nojs.prop("checked");
- USEROPTS.sort_rank = sr.prop("checked");
- USEROPTS.sort_afk = sa.prop("checked");
- USEROPTS.boop = boop.prop("checked");
- sortUserlist();
- if(CLIENT.rank >= Rank.Moderator) {
- USEROPTS.modhat = modhat.prop("checked");
- USEROPTS.joinmessage = join.prop("checked");
- }
- saveOpts();
- modal.modal("hide");
- });
-
- modal.on("hidden", function() {
unhidePlayer();
applyOpts();
modal.remove();
});
+
modal.modal();
}