Sha256: 53d567b87be103fa0e0b35de1366b1336e0251be928a370ec009b8eeece4f1f8

Contents?: true

Size: 1.23 KB

Versions: 26

Compression:

Stored size: 1.23 KB

Contents

module ForumRedCloth4
  
  def self.included(base)
    # base.extend ClassMethods
    base.class_eval do
      def to_html_with_smilies(*rules)
        rules.push(:smilies) unless rules.include?(:smilies)
        to_html_without_smilies(*rules)
      end
      alias_method_chain :to_html, :smilies unless self.instance_methods.include?("to_html_without_smilies")
    end
  end
  
  def smilies(text)
    emoticons = {
			':)' => 'happy',
			':|' => 'neutral',
			':(' => 'sad',
			':D' => 'grin',
			':O' => 'surprised',
			';)' => 'wink',
			'}:)' => 'devil',
			':P' => 'tongue',
			':[' => 'mad',
			'8|' => 'shocked',
			':@' => 'lol',
			'B]' => 'cool'
		}

    # old syntax carried over from vanilla
    text.gsub!(/\:(angry|smile|bigsmile|confused|cool|cry|devil|neutral|sad|shamed|shocked|surprised|tongue|wink)\:/) do |w| 
      %{<img src="/images/emoticons/#{$1}.gif" alt="(#{$1})" title="#{$1}" class="smiley" />} 
    end

    # these are generally put in by the punymce toolbar, so we use their nasty but effective combination of blank image with sprite background
		text.gsub!(/(\}\:\)|\:\)|\:\||\:\(|\:D|\:O|\;\)|\:P|\:\@|8\||\:\[|B\])/) do |w| 
		  %{<img src="/images/furniture/blank.png" class="emoticon #{emoticons[w]}" />}; 
		end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
radiant-forum-extension-3.0.7 lib/forum_red_cloth4.rb
radiant-forum-extension-3.0.6 lib/forum_red_cloth4.rb
radiant-forum-extension-3.0.5 lib/forum_red_cloth4.rb
radiant-forum-extension-3.0.4 lib/forum_red_cloth4.rb
radiant-forum-extension-3.0.3 lib/forum_red_cloth4.rb
radiant-forum-extension-3.0.2 lib/forum_red_cloth4.rb
radiant-forum-extension-3.0.1 lib/forum_red_cloth4.rb
radiant-forum-extension-3.0.0 lib/forum_red_cloth4.rb
radiant-forum-extension-3.0.0.rc6 lib/forum_red_cloth4.rb
radiant-forum-extension-3.0.0.rc4 lib/forum_red_cloth4.rb
radiant-forum-extension-3.0.0.rc3 lib/forum_red_cloth4.rb
radiant-forum-extension-2.1.6 lib/forum_red_cloth4.rb
radiant-forum-extension-2.1.4 lib/forum_red_cloth4.rb
radiant-forum-extension-2.1.3 lib/forum_red_cloth4.rb
radiant-forum-extension-2.1.2 lib/forum_red_cloth4.rb
radiant-forum-extension-2.1.1 lib/forum_red_cloth4.rb
radiant-forum-extension-2.0.9 lib/forum_red_cloth4.rb
radiant-forum-extension-2.0.8 lib/forum_red_cloth4.rb
radiant-forum-extension-2.0.7 lib/forum_red_cloth4.rb
radiant-forum-extension-2.0.6 lib/forum_red_cloth4.rb