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`.
## 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
These are the commands currently implemented:
- [x] /clear
- [x] /close
- [x] /connect
- [x] /deop

View File

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

View File

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

View File

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