• This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.

The Happy Place - Clickable Smilies Under Editor Control

yeah... It actually was a pain.. I messed up on a edit and lost my entire editor box at one point.
lol
I fixed it though..
 
This is how I configured it on my forum:
smilies.webp

I removed the default smiley icon from the top of the editor (to avoid the huge list with a lot of smileys that goes down 4584794378 lines and which is a bug) and added a small smiley icon to the drop-down tab.

Instructions:

1. Upload the small attached to this message smiley somewhere on your server.

2. Open the template editor_happyplace and insert the following code after this line <a href="#">
Code:
<img src="http://www.source_to_small_smiley_you_uploaded_to_your_site/small.gif" alt="smilies">
- Save

3. Open the template editor_happyplace_quick_reply and insert the following code after this line <a href="#">
Code:
<img src="http://www.source_to_small_smiley_you_uploaded_to_your_site/small.gif" alt="smilies">
- Save

4. In order to remove the smiley icon from the editor (default location: top of the editor) - open the editor_js_setup template and find this line of code:
Code:
xenforo_smilies_menu_image: '@imagePath/xenforo/editor/smilie.png',

Comment it out with //

It should look like this:
Code:
//xenforo_smilies_menu_image: '@imagePath/xenforo/editor/smilie.png',

That should do it :)
 

Attachments

  • small.gif
    small.gif
    872 bytes · Views: 14
Commenting that smilie image out doesn't work, because that little arrow is still there, and you can still click on it, and still get the drop down menu. So all you've really done is just remove the smilie image.
 
Wouldn't you be best just not clicking the dropdown smiley menu? I can't see what all the fuss is about, if your not wanting to use the dropdown menu (which god help us, I won't be) best leaving it as is.
 
You can't tell all your members not to click it though and if you have upwards of 50 smilies.....

Just removing the smilie button from the menu worked for me.
 
You can't tell all your members not to click it though and if you have upwards of 50 smilies.....

Just removing the smilie button from the menu worked for me.

They'll eventually find out for themselves. Like with everything, if you don't like a feature after the first initial use of using it you won't return to it.
 
You can't tell all your members not to click it though and if you have upwards of 50 smilies.....

Just removing the smilie button from the menu worked for me.

I can't remove it because I need the stupid dropdown in for developing purposes. Have you posted a how to? how you did it paul as some are having trouble removing it.
 
I think it's already been posted but I'll post it here again anyway.

Open /js/tinymce/themes/xenforo/editor_template.js

Find:
Code:
    tinymce.create('tinymce.plugins.XenForoSmilies', {
        addButtons : function (theme, tb)
        {
            var smilies = theme.settings.xenforo_smilies,
                controlManager = theme.editor.controlManager,
                editor = theme.editor,
                button, DOM = tinymce.DOM;

            if (typeof smilies === 'undefined' || smilies.length === 0 || smilies === {})
            {
                return;
            }

            button = controlManager.createSplitButton('xenforo_smilies', {
                title : 'xenforo.smilies_desc',
                image : theme.settings.xenforo_smilies_menu_image,
                icons : false,
                onclick : function() { button.showMenu(); }
            });
            button.onRenderMenu.add(function(menubutton, menu)
            {
                tinymce.each(smilies, function(smilie, smilieName)
                {
                    menu.add({
                        title : '<img src="' + DOM.encode(smilie[1]) + '" /> ' + DOM.encode(smilie[0]),
                        onclick : function()
                        {
                            editor.execCommand('mceInsertContent', false,
                                '<img src="' + DOM.encode(smilie[1]) + '" alt="' + DOM.encode(smilieName) + '" class="smilie" data-smilie="yes" />'
                            );
                        }
                    });
                });

                // need this to run after the render has happend
                setTimeout(function()
                {
                    var menuNode = DOM.get('menu_' + menu.id);
                    if (menuNode)
                    {
                        $('.mceText[title]', menuNode).each(function()
                        {
                            $(this).attr('title', '');
                        });
                    }
                }, 50);
            });
            tb.add(button);
        },

        getInfo : function()
        {
            return {
                longname : 'XenForo Smilies',
                author : '',
                version : '1.0'
            };
        }
    });


Replace with:
Code:
/*
    tinymce.create('tinymce.plugins.XenForoSmilies', {
        addButtons : function (theme, tb)
        {
            var smilies = theme.settings.xenforo_smilies,
                controlManager = theme.editor.controlManager,
                editor = theme.editor,
                button, DOM = tinymce.DOM;

            if (typeof smilies === 'undefined' || smilies.length === 0 || smilies === {})
            {
                return;
            }

            button = controlManager.createSplitButton('xenforo_smilies', {
                title : 'xenforo.smilies_desc',
                image : theme.settings.xenforo_smilies_menu_image,
                icons : false,
                onclick : function() { button.showMenu(); }
            });
            button.onRenderMenu.add(function(menubutton, menu)
            {
                tinymce.each(smilies, function(smilie, smilieName)
                {
                    menu.add({
                        title : '<img src="' + DOM.encode(smilie[1]) + '" /> ' + DOM.encode(smilie[0]),
                        onclick : function()
                        {
                            editor.execCommand('mceInsertContent', false,
                                '<img src="' + DOM.encode(smilie[1]) + '" alt="' + DOM.encode(smilieName) + '" class="smilie" data-smilie="yes" />'
                            );
                        }
                    });
                });

                // need this to run after the render has happend
                setTimeout(function()
                {
                    var menuNode = DOM.get('menu_' + menu.id);
                    if (menuNode)
                    {
                        $('.mceText[title]', menuNode).each(function()
                        {
                            $(this).attr('title', '');
                        });
                    }
                }, 50);
            });
            tb.add(button);
        },

        getInfo : function()
        {
            return {
                longname : 'XenForo Smilies',
                author : '',
                version : '1.0'
            };
        }
    });
*/

Essentially you're just commenting out the code using /* ... */

The result is as shown below.
editor.webp
 
Its a great edit. Thanks Paul. Anyone figure out how to keep the edits each time a new beta upgrade is loaded?
The odd thing is after the 4.0 to beta 5.0 upgrade I did not notice a change to editor_template.js but yet the smilie drop down link from hell showed back up again.
 
That's because the .js files are overwritten when you upload the upgrade package.

There really is no other feasible way but to make a note of any edits to the files and reapply them after an upgrade.

Or you could compare the new files with the old files and only upload those which are different, but that would be a lot of work and it would be much simpler to just overwrite and reapply edits.
 
A small suggestion: Having more than 100 smilies it is very hard for users to scroll to the bottom even of this wonderful mod to close the smiliey tab. Maybe create a small link inside an opened tab to close it? Just a suggestion :)
 
A small suggestion: Having more than 100 smilies it is very hard for users to scroll to the bottom even of this wonderful mod to close the smiliey tab. Maybe create a small link inside an opened tab to close it? Just a suggestion :)
They don't have to close the smiley tab. Once they've selected their smilies, and posted their reply, it closes on its own. :)
 
Its a great edit. Thanks Paul. Anyone figure out how to keep the edits each time a new beta upgrade is loaded?
The odd thing is after the 4.0 to beta 5.0 upgrade I did not notice a change to editor_template.js but yet the smilie drop down link from hell showed back up again.
Nope, most edits have to be re-applied. Especially template edits.
 
They don't have to close the smiley tab. Once they've selected their smilies, and posted their reply, it closes on its own. :)
Yes, but they have to scroll down some in order to get to the "POST REPLY" button. In some cases users will get annoyed doing that...
 
  • Like
Reactions: Jo.
Why don't you edit the template to move the "Post Reply" and other buttons above the editor then?

You must have a significant number of smilies to have to scroll down to reach the end of the container.
 
Yes, but they have to scroll down some in order to get to the "POST REPLY" button. In some cases users will get annoyed doing that...
Yeah, they have to scroll down some to do anything on a forum. Like Brogan said, edit the template and move the button. But tbh, 100 smilies isn't all that many to have to scroll past.
 
Yeah, they have to scroll down some to do anything on a forum. Like Brogan said, edit the template and move the button. But tbh, 100 smilies isn't all that many to have to scroll past.

Depends on the size. If we're talking the default sizes (18px by 18px) on a 1280 x 1024 display I can fit 100 on two lines and even then you can further reduce this by altering the padding/margin.

Edit: Just re-installed this and I was a bit generous in saying 100 on each line. Nowhere near.
 
would it be possible to add the tab button that says 'smilies', to the top of the expanded view of smilies - so that if you've got a zillion smilies you don't have to scroll down to close the smilie box again? (would make it quicker and easier to hit 'post reply' if you just click on the 'smilies tab to close the box again... :)
That would take quite a bit of re-coding on this add-on, I think.
 
Top Bottom