Added messages show/hide toggles

This commit is contained in:
Mattias Erming 2014-09-10 13:08:32 -07:00
parent 38397248c6
commit 4ef468bd32
5 changed files with 62 additions and 5 deletions

File diff suppressed because one or more lines are too long

View File

@ -509,6 +509,13 @@ button {
#chat .highlight .from { #chat .highlight .from {
color: #f00; color: #f00;
} }
#chat.hide-join .join span,
#chat.hide-nick .nick span,
#chat.hide-part .part span,
#chat.hide-mode .mode span,
#chat.hide-quit .quit span {
display: none !important;
}
#chat .notice .type { #chat .notice .type {
display: none; display: none;
} }

View File

@ -123,6 +123,39 @@
<div class="col-sm-12"> <div class="col-sm-12">
<h1 class="title">Settings</h1> <h1 class="title">Settings</h1>
</div> </div>
<div class="col-sm-12">
<h2>Messages</h2>
</div>
<div class="col-sm-6">
<label class="opt">
<input type="checkbox" name="join">
Show joins
</label>
</div>
<div class="col-sm-6">
<label class="opt">
<input type="checkbox" name="nick">
Show nick changes
</label>
</div>
<div class="col-sm-6">
<label class="opt">
<input type="checkbox" name="part">
Show parts
</label>
</div>
<div class="col-sm-6">
<label class="opt">
<input type="checkbox" name="mode">
Show mode
</label>
</div>
<div class="col-sm-6">
<label class="opt">
<input type="checkbox" name="quit">
Show quits
</label>
</div>
<div class="col-sm-12"> <div class="col-sm-12">
<h2>Sound</h2> <h2>Sound</h2>
</div> </div>

View File

@ -238,7 +238,14 @@ $(function() {
$.cookie.json = true; $.cookie.json = true;
var settings = $("#settings"); var settings = $("#settings");
var options = $.extend({notification: true}, $.cookie("settings")); var options = $.extend({
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]) {
@ -248,10 +255,20 @@ $(function() {
settings.on("change", "input", function() { settings.on("change", "input", function() {
var self = $(this); var self = $(this);
options[self.attr("name")] = self.prop("checked"); var name = self.attr("name");
options[name] = self.prop("checked");
$.cookie("settings", options); $.cookie("settings", options);
if ([
"join",
"nick",
"part",
"mode",
"quit",
].indexOf(name) !== -1) {
console.log("toggle " + name);
chat.toggleClass("hide-" + name, !self.prop("checked"));
}
}).find("input") }).find("input")
.eq(0)
.trigger("change"); .trigger("change");
var viewport = $("#viewport"); var viewport = $("#viewport");

View File

@ -1,7 +1,7 @@
{ {
"name": "shout", "name": "shout",
"description": "A web IRC client", "description": "A web IRC client",
"version": "0.21.4", "version": "0.22.0",
"author": "Mattias Erming", "author": "Mattias Erming",
"preferGlobal": true, "preferGlobal": true,
"bin": { "bin": {