Added '/clear' command

This commit is contained in:
Mattias Erming 2014-09-19 13:24:11 -07:00
parent 452c4ecc88
commit 695fd35797
5 changed files with 24 additions and 15 deletions

View file

@ -104,18 +104,11 @@ Pretty simple, huh?
If you want to edit users manually, see `users/example/user.json`. If you want to edit users manually, see `users/example/user.json`.
## Custom paths
You can define Shout's file storage path via the following options:
- Add an entry called `home` to the `config.json` file.
- Set the environment variable `SHOUT_HOME` before calling the shout executable.
- Use the default of `$HOME/.shout`.
## Commands ## Commands
These are the commands currently implemented: These are the commands currently implemented:
- [x] /clear
- [x] /close - [x] /close
- [x] /connect - [x] /connect
- [x] /deop - [x] /deop

View file

@ -446,8 +446,8 @@ button {
position: absolute; position: absolute;
width: 100%; width: 100%;
} }
#chat .show-more + .messages .msg:first-child span { #chat .show-more:hover {
padding-top: 54px; opacity: 1;
} }
#chat .messages { #chat .messages {
display: table; display: table;

View file

@ -190,7 +190,7 @@ $(function() {
if (data.messages.length != 100) { if (data.messages.length != 100) {
var more = chan var more = chan
.find(".show-more") .find(".show-more")
.remove(); .addClass("hidden");
} }
}); });
@ -317,6 +317,9 @@ $(function() {
e.preventDefault(); e.preventDefault();
var text = input.val(); var text = input.val();
input.val(""); input.val("");
if (text.indexOf("/clear") === 0) {
return clear();
}
socket.emit("input", { socket.emit("input", {
target: chat.data("id"), target: chat.data("id"),
text: text text: text
@ -572,12 +575,16 @@ $(function() {
"ctrl+l", "ctrl+l",
"ctrl+shift+l" "ctrl+shift+l"
], function (e) { ], function (e) {
// Only clear the chat if the main input is focused. if(e.target === input[0]) {
if( e.target === input[0] ) { clear();
chat.find(".active .chat .messages").empty();
} }
}); });
function clear() {
chat.find(".active .messages").empty();
chat.find(".active .show-more").removeClass("hidden");
}
function complete(word) { function complete(word) {
var words = commands.slice(); var words = commands.slice();
var users = chat.find(".active") var users = chat.find(".active")

View file

@ -33,7 +33,7 @@ templates['chat'] = template({"1":function(depth0,helpers,partials,data) {
+ "</span>\n <span class=\"topic\">" + "</span>\n <span class=\"topic\">"
+ escapeExpression(((helper = (helper = helpers.type || (depth0 != null ? depth0.type : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"type","hash":{},"data":data}) : helper))) + escapeExpression(((helper = (helper = helpers.type || (depth0 != null ? depth0.type : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"type","hash":{},"data":data}) : helper)))
+ " </span>\n </div>\n <div class=\"chat\">\n"; + " </span>\n </div>\n <div class=\"chat\">\n";
stack1 = ((helpers.equal || (depth0 && depth0.equal) || helperMissing).call(depth0, 100, ((stack1 = (depth0 != null ? depth0.messages : depth0)) != null ? stack1.length : stack1), {"name":"equal","hash":{},"fn":this.program(2, data),"inverse":this.noop,"data":data})); stack1 = ((helpers.equal || (depth0 && depth0.equal) || helperMissing).call(depth0, 100, ((stack1 = (depth0 != null ? depth0.messages : depth0)) != null ? stack1.length : stack1), {"name":"equal","hash":{},"fn":this.program(2, data),"inverse":this.program(4, data),"data":data}));
if (stack1 != null) { buffer += stack1; } if (stack1 != null) { buffer += stack1; }
return buffer + " <div class=\"messages\">\n " return buffer + " <div class=\"messages\">\n "
+ escapeExpression(((helpers.partial || (depth0 && depth0.partial) || helperMissing).call(depth0, "msg", {"name":"partial","hash":{},"data":data}))) + escapeExpression(((helpers.partial || (depth0 && depth0.partial) || helperMissing).call(depth0, "msg", {"name":"partial","hash":{},"data":data})))
@ -45,6 +45,11 @@ templates['chat'] = template({"1":function(depth0,helpers,partials,data) {
return " <button class=\"show-more\" data-id=\"" return " <button class=\"show-more\" data-id=\""
+ escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper))) + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
+ "\">\n Show more\n </button>\n"; + "\">\n Show more\n </button>\n";
},"4":function(depth0,helpers,partials,data) {
var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
return " <button class=\"show-more hidden\" data-id=\""
+ escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
+ "\">\n Show more\n </button>\n";
},"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) { },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
var stack1, buffer = ""; var stack1, buffer = "";
stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.channels : depth0), {"name":"each","hash":{},"fn":this.program(1, data),"inverse":this.noop,"data":data}); stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.channels : depth0), {"name":"each","hash":{},"fn":this.program(1, data),"inverse":this.noop,"data":data});

View file

@ -11,6 +11,10 @@
<button class="show-more" data-id="{{id}}"> <button class="show-more" data-id="{{id}}">
Show more Show more
</button> </button>
{{else}}
<button class="show-more hidden" data-id="{{id}}">
Show more
</button>
{{/equal}} {{/equal}}
<div class="messages"> <div class="messages">
{{partial "msg"}} {{partial "msg"}}