Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Added a btn to hide/show extras: motd, topic, server (re)connecting messages... #50

Merged
merged 1 commit into from

2 participants

@microp11
Collaborator

No description provided.

@chrismatthieu chrismatthieu merged commit f188cf3 into from
@chrismatthieu
Collaborator

merged and deployed.

@microp11
Collaborator

thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 38 additions and 8 deletions.
  1. +5 −2 public/css/irc.css
  2. +2 −1  public/index.html
  3. +31 −5 public/js/app.js
View
7 public/css/irc.css
@@ -90,12 +90,15 @@ a {
right: 30px;
}
.stats {
- right: 150px;
+ right: 140px;
+}
+.extras {
+ right: 236px;
}
#nickLabel {
margin-top: 9px;
position: absolute;
- right: 270px;
+ right: 346px;
text-align: right;
}
.line-stats {
View
3  public/index.html
@@ -34,6 +34,7 @@
<img src="/rocket-md-right-small.png">
<span> IRC #nodester </span>
<span id="nickLabel">nick</span>
+ <button type="button" class="btn btn-settings extras" id="btnExtras">Hide extras</button>
<button type="button" class="btn btn-settings stats" id="btnStats">Show stats</button>
<button type="button" class="btn btn-settings tones" id="btnTones">Disable tones</button>
</div>
@@ -49,7 +50,7 @@
</div>
<div id="chat_bar">
<form id="chat-form">
- <input type="text" id="text_input" class="btn" placeholder="send a message" size="80" />
+ <input type="text" id="text_input" class="btn" placeholder="send a message" size="80" autocomplete="off" />
<button type="submit" class="btn btn-info clic" id="sendMessage">Send</button>
</form>
</div>
View
36 public/js/app.js
@@ -46,6 +46,7 @@ $(document).ready(function() {
bAutoScrollEnabled = true, //allow chat page scroll, default true
bTonesEnabled = true, //allow tones on pm (yellow) messages, default true
bStatsEnabled = false, //display statistics
+ bExtrasEnabled = true, //display extras
opts = {
lines : 12,
length : 7,
@@ -111,6 +112,12 @@ $(document).ready(function() {
this.getStatsEnabled = function() {
return bStatsEnabled;
};
+ this.setExtrasEnabled = function(enabled) {
+ bExtrasEnabled = enabled;
+ };
+ this.getExtrasEnabled = function() {
+ return bExtrasEnabled;
+ };
};
var c = new Container();
@@ -150,14 +157,19 @@ $(document).ready(function() {
return name;
};
- var appendMessage = function (from, message, isSelf) {
+ var appendMessage = function (from, message, isSelf, extra) {
var row = $('<tr/>');
if (typeof isSelf !== 'undefined' && isSelf === true) {
row.addClass('me btn btn-info');
} else {
row.addClass('btn');
}
-
+ if (extra) {
+ row.addClass('extra');
+ if (!c.getExtrasEnabled())
+ row.addClass('off');
+ }
+
var row_class = '';
if (window.nick){
var reg = window.nick.replace(/\s+/, "|");
@@ -269,7 +281,9 @@ $(document).ready(function() {
if (extraText.text() == "") {
//we arrived here for the first time
var row = $('<tr/>');
- row.addClass('btn');
+ row.addClass('btn extra');
+ if (!c.getExtrasEnabled())
+ row.addClass('off');
row.html(
'<td><p class="author">' + from + '</p></td>'
+ '<td class="msg" id="extra">' + message +'</td>');
@@ -328,7 +342,7 @@ $(document).ready(function() {
case "notice-err":
case "notice-msg":
if (c.getIrcNoticesEnabled() == true) {
- appendMessage(obj.from, obj.message, false);
+ appendMessage(obj.from, obj.message, false, true);
} else {
//redirect to login screen
var html = loginStatus.html();
@@ -350,7 +364,7 @@ $(document).ready(function() {
ircClient.requestStatistics();
break;
case "topic":
- appendMessage("Topic", obj.message, false);
+ appendMessage("Topic", obj.message, false, true);
break;
case "names":
for (var i = 0; i < obj.users.length; i++) {
@@ -620,6 +634,18 @@ $(document).ready(function() {
}
});
+ $('#btnExtras').on('click', function () {
+ //will not remember the extras status yet :), cookies, mmm
+ c.setExtrasEnabled(!c.getExtrasEnabled());
+ if (c.getExtrasEnabled() == true) {
+ $('#btnExtras').text("Hide extras");
+ $('.extra').removeClass('off');
+ } else {
+ $('#btnExtras').text("Show extras");
+ $('.extra').addClass('off');
+ }
+ });
+
textInput.keydown( function (event) {
if (source.length == 0) {
source = nicks; //initialization in case we press Tab with no prior input
Something went wrong with that request. Please try again.