Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

Emotify from Vanilla Plugin Bundle vs. Emotify Plugin Download

vrijvlindervrijvlinder Papillon-Sauvage MVP

I have found that there is a discrepancy in the javascript that comes with the Plugin Bundle and the stand alone download.

After installing 6 forums. I had the same problem initially with all of them with Emotify not working. Searching for the problem I compared the versions that worked with the one that comes with Vanilla.

this is the one that comes with Vanilla in the bundle which does not work

$(function(){
  
  // Insert a clickable icon list after the textbox
  $('textarea#Form_Body').livequery(function() {
     // Pick up the emoticons from the def list
    var emoticons = gdn.definition('Emoticons', false);

    if (emoticons)
        emoticons = eval("("+$.base64Decode(emoticons)+")");
     
    var buts = '';
     var last = '';
    for (e in emoticons) {
        // no duplicates
        if (last != emoticons[e]) {
          last = emoticons[e];
          buts += ''+e+'';
        }
    }
    $(this).before("\
      Emoticons \
      "+buts+" \
    ");
    
    $('.EmotifyDropdown').live('click', function() {
      if ($(this).hasClass('EmotifyDropdownActive'))
        $(this).removeClass('EmotifyDropdownActive');
      else
        $(this).addClass('EmotifyDropdownActive');

      $(this).next().toggle();
      return false;
    });
    
    // Hide emotify options when previewing
    $('form#Form_Comment').bind("PreviewLoaded", function(e, frm) {
      frm.find('.EmotifyDropdown').removeClass('EmotifyDropdownActive');
      frm.find('.EmotifyDropdown').hide();
      frm.find('.EmoticonContainer').hide();
    });
    
    // Reveal emotify dropdowner when write button clicked
    $('form#Form_Comment').bind('WriteButtonClick', function(e, frm) {
      frm.find('.EmotifyDropdown').show();
    });
    
    // Hide emoticon box when textarea is focused
    $('textarea#Form_Body').live('focus', function() {
      var frm = $(this).parents('form');
      frm.find('.EmotifyDropdown').removeClass('EmotifyDropdownActive');
      frm.find('.EmoticonContainer').hide();
    });

    // Put the clicked emoticon into the textarea
    $('.EmoticonBox').live('click', function() {
      var emoticon = $(this).find('span').text();
      var textbox = $(this).parents('form').find('textarea#Form_Body');
      var txt = $(textbox).val();
      if (txt != '')
        txt += ' ';
      $(textbox).val(txt + emoticon + ' ');
      var container = $(this).parents('.EmoticonContainer');
      $(container).hide();
      $(container).prev().removeClass('EmotifyDropdownActive');
      
      // If cleditor is running, update it's contents
      var ed = $(textbox).get(0).editor;
      if (ed) {
        // Update the frame to match the contents of textarea
        ed.updateFrame();
        // Run emotify on the frame contents
        var Frame = $(ed.$frame).get(0);
        var FrameBody = null;
        var FrameDocument = null;
        
        // DOM
        if (Frame.contentDocument) {
           FrameDocument = Frame.contentDocument;
           FrameBody = FrameDocument.body;
        // IE
        } else if (Frame.contentWindow) {
           FrameDocument = Frame.contentWindow.document;
           FrameBody = FrameDocument.body;
        }
        $(FrameBody).html(emotify($(FrameBody).html()));
        var webRoot = gdn.definition('WebRoot', '');
        var ss = document.createElement("link");
        ss.type = "text/css";
        ss.rel = "stylesheet";
        ss.href = gdn.combinePaths(webRoot, 'plugins/Emotify/emotify.css');
        if (document.all)
           FrameDocument.createStyleSheet(ss.href);
        else
           FrameDocument.getElementsByTagName("head")[0].appendChild(ss);
      }

      return false;
    });
  });
  
});

please advise people of this problem, or if you have this problem you know how to fix it.

Comments

  • Options
    vrijvlindervrijvlinder Papillon-Sauvage MVP

    This is the good one !!

    and this is the one from the download which does work

    /**
     * This is a modified version of Ben Alman's dual GPL/MIT licensed "Javascript
     * Emotify" jQuery plugin.
     */
    
    // About: License
    // Copyright (c) 2009 "Cowboy" Ben Alman,
    // Dual licensed under the MIT and GPL licenses.
    // http://benalman.com/about/license/
    
    window.emotify = (function(){
      var emotify,
        EMOTICON_RE,
        emoticons = {},
        lookup = [];
        
      emotify = function(txt, callback) {
        callback = callback || function(cssSuffix, smiley) {
          return '' + smiley + '';
        };
        
       Too long to post the whole thing just download it......
  • Options

    Emotification is a legacy techonology. The way forward is using emoji characters.

  • Options

    just for the record the emotify with the vanilla download - does indeed work.
    At least it does on my server. I haven't tested the plugin since the emotify with the vanilla bundle is a newer version.

    http://vanillaforums.org/discussion/comment/168418/#Comment_168418

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options

    @peregrine said:
    just for the record the emotify with the vanilla download - does indeed work.
    At least it does on my server. I haven't tested the plugin since the emotify with the vanilla bundle is a newer version.

    on vanilla 2.0.18.4

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options
    vrijvlindervrijvlinder Papillon-Sauvage MVP

    Yea that is what I thought too but I compared the one that works with the one that comes with Vanilla bundle, the one with Vanilla does not work because it is missing the entire code almost.

    I am sure it can be fixed. But I would recommend that if the Emotify do not workk after installing Vanilla, to delete it and install the stand alone plugin Emotify.

    Sorry about the double post you guys, :)

  • Options
    vrijvlindervrijvlinder Papillon-Sauvage MVP

    @Anonymoose yea it may be legacy but I like them over Emoji. I tried it but did not like it too much. Facebook is using emoji types now . Not as emotifying ;)

Sign In or Register to comment.