Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Support github emoji

  • Loading branch information...
commit a2320e3651e19814f6778925b36d1623535ffba2 1 parent 3c254f8
@darashi darashi authored
View
1  Gemfile
@@ -13,6 +13,7 @@ gem "jquery-rails"
gem "configatron"
gem "pusher"
+gem "rails_emoji"
group :development do
gem "sqlite3"
View
3  Gemfile.lock
@@ -81,6 +81,8 @@ GEM
activesupport (= 3.2.8)
bundler (~> 1.0)
railties (= 3.2.8)
+ rails_emoji (1.6.1)
+ rails (>= 3.1.0)
railties (3.2.8)
actionpack (= 3.2.8)
activesupport (= 3.2.8)
@@ -132,6 +134,7 @@ DEPENDENCIES
pg
pusher
rails (= 3.2.8)
+ rails_emoji
sass-rails
sqlite3
twitter-stream
View
2  app/assets/javascripts/screens.js
@@ -47,7 +47,7 @@ var handlers = {
.append($("<p/>")
.append($("<span/>").addClass("screen_name")
.text(nick))
- .append($('<span/>').text(message)));
+ .append($('<span/>').html(message)));
prepend(div);
}
View
6 app/assets/stylesheets/screens.css.scss
@@ -93,6 +93,12 @@
padding: 0 5px;
}
+.irc .emoji {
+ vertical-align: middle;
+ width: 40px;
+ height: 40px;
+}
+
th {
font-weight: normal;
}
View
5 lib/passers/irc-passer.rb
@@ -1,4 +1,6 @@
require_relative "passer"
+require "bundler"
+Bundler.require
require "net/irc"
class Client < Net::IRC::Client
@@ -19,8 +21,9 @@ def on_rpl_welcome(m)
def on_privmsg(m)
channel, message = *m
nick = m.prefix.nick.to_s
+ html = RailsEmoji.render(CGI.escapeHTML(message), :class => :emoji)
- @passers[channel.sub(/^#/,"").downcase].pass(:nick => nick, :message => message, :usec => Time.now.usec)
+ @passers[channel.sub(/^#/,"").downcase].pass(:nick => nick, :message => html, :usec => Time.now.usec)
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.