Skip to content

Commit

Permalink
Merge pull request thedjpetersen#259 from badosu/add-color-support
Browse files Browse the repository at this point in the history
Add color support
  • Loading branch information
ericbarch committed Aug 13, 2013
2 parents 3a7ac1c + 66f7aef commit 5b87fa9
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 2 deletions.
33 changes: 33 additions & 0 deletions assets/css/irc-colors.css
@@ -0,0 +1,33 @@
.irc-00 { color: white }
.irc-01 { color: black }
.irc-02 { color: navy }
.irc-03 { color: green }
.irc-04 { color: red }
.irc-05 { color: brown }
.irc-06 { color: purple }
.irc-07 { color: olive }
.irc-08 { color: #C8C800 }
.irc-09 { color: #00C800 }
.irc-10 { color: teal }
.irc-11 { color: #00C3C3 }
.irc-12 { color: blue }
.irc-13 { color: #FF4D6C }
.irc-14 { color: #555 }
.irc-15 { color: #777 }

.irc-bg00 { border: 1px dotted white }
.irc-bg01 { border: 1px dotted black }
.irc-bg02 { border: 1px dotted navy }
.irc-bg03 { border: 1px dotted green }
.irc-bg04 { border: 1px dotted red }
.irc-bg05 { border: 1px dotted brown }
.irc-bg06 { border: 1px dotted purple }
.irc-bg07 { border: 1px dotted olive }
.irc-bg08 { border: 1px dotted #C8C800 }
.irc-bg09 { border: 1px dotted #00C800 }
.irc-bg10 { border: 1px dotted teal }
.irc-bg11 { border: 1px dotted #00C3C3 }
.irc-bg12 { border: 1px dotted blue }
.irc-bg13 { border: 1px dotted #FF4D6C }
.irc-bg14 { border: 1px dotted #555 }
.irc-bg15 { border: 1px dotted #777 }
2 changes: 2 additions & 0 deletions assets/js/client.js
Expand Up @@ -3,6 +3,7 @@
//= require 'libs/backbone-min.js'
//= require 'libs/ICanHaz.min.js'
//= require 'libs/bootstrap.min.js'
//= require 'libs/ircparser.min.js'
//= require 'utils.js'
//= require 'models.js'
//= require 'collections.js'
Expand All @@ -24,6 +25,7 @@ window.unity = {
$(function() {
// window.app = new ChatApplicationRouter;
irc.appView = new ChatApplicationView();
irc.parser = new IrcParser();

try {
window.unity.api = external.getUnityObject(1.0);
Expand Down
2 changes: 2 additions & 0 deletions assets/js/libs/ircparser.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions assets/js/views/message.js
Expand Up @@ -26,6 +26,11 @@ var MessageView = Backbone.View.extend({
content: this.model.get('text'),
renderedTime: utils.formatDate(Date.now())
}, true);

if (!irc.me.get('stripColors')) {
html = irc.parser.parse(html);
}

html = this.model.parse(html);
}

Expand Down
2 changes: 2 additions & 0 deletions assets/js/views/overview.js
Expand Up @@ -72,6 +72,7 @@ var OverviewView = Backbone.View.extend({
selfSigned = $('#connect-selfSigned').is(':checked'),
password = $('#connect-password').val(),
encoding = $('#connect-encoding').val(),
stripColors = $('#connect-stripColors').is(':checked'),
keepAlive = false;

if (!server) {
Expand Down Expand Up @@ -100,6 +101,7 @@ var OverviewView = Backbone.View.extend({
realName: realName,
password: password,
encoding: encoding,
stripColors: stripColors,
keepAlive: keepAlive
};

Expand Down
2 changes: 1 addition & 1 deletion lib/irclink.js
Expand Up @@ -63,7 +63,7 @@ module.exports = function IRCLink(connID, app) {
selfSigned: userConn.selfSigned,
encoding: userConn.encoding,
certExpired: false,
stripColors: true
stripColors: userConn.stripColors
});

// add ourself as a connection
Expand Down
3 changes: 2 additions & 1 deletion lib/models.js
Expand Up @@ -26,6 +26,7 @@ module.exports = function (schema) {
, disabled_timeout: { type: Date } // do not allow the user to re-enable this connection until this date
, disabled_reason: { type: String } // why is this connection disabled? (could be user-initiated)
, keep_alive: { type: Boolean } // keep this connection active even if the user is disconnected
, stripColors: { type: Boolean } // Do not highlight colors
, temporary: { type: Boolean } // this was created for a guest (no account)
});

Expand Down Expand Up @@ -54,4 +55,4 @@ module.exports = function (schema) {
schema.autoupdate();

return schema;
};
};
1 change: 1 addition & 0 deletions lib/socket.js
Expand Up @@ -149,6 +149,7 @@ module.exports = function(socket, app) {
, disabled_timeout: Date.now()
, disabled_reason: ''
, keep_alive: keepAlive
, stripColors: data.stripColors
, temporary: temp
}, function (err, item) {
if (!err) {
Expand Down
1 change: 1 addition & 0 deletions views/layout.jade
Expand Up @@ -6,6 +6,7 @@ html
!= css('bootstrap.min')
!= css('subway')
!= css('subway-mobile')
!= css('irc-colors')

script
var ENV = '#{env}',
Expand Down
3 changes: 3 additions & 0 deletions views/templates.jade
Expand Up @@ -89,6 +89,9 @@ script(id="overview_connection", type="text/html")
option(value="CP1251") CP1251 (Cyrillic)
option(value="CP1256") CP1256 (Arabic)
option(value="CP1257") CP1257 (baltic)
.control-group
label(for="connect-stripColors") No Colors
input#connect-stripColors(type="checkbox")
.control-group
{{#loggedIn}}
label.checkbox(for="connect-keep-alive", style="width:100%") Keep connection alive after browser closed
Expand Down

0 comments on commit 5b87fa9

Please sign in to comment.