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.

Emotify from Vanilla Plugin Bundle vs. Emotify Plugin Download

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

Sign In or Register to comment.