1 (edited by elbekko 2006-05-10 17:30)

Topic: Smiley Menu 0.7

This mod adds the possibility to easily add smilies to posts by clicking on them from a small menu next to the message textbox. (much like in phpBB)

##
##
##        Mod title:  Smiley Menu
##
##      Mod version:  0.7
##   Works on PunBB:  Should work on every version
##     Release date:  2006-05-10
##           Author:  El Bekko (elbekko@gmail.com)
##
##      Description:  This tool adds the possibility to 
##                      easily add smileys to posts by
##                      clicking on them in a small menu.
##
##     Difference with  
## previous version:  Quick Post bug fixed. See step 16 & 17 for fix.
##
##   Affected files:  post.php, viewtopic.php
##                    
##       Affects DB:  No
##
##            Notes:  Changed the check for duplicate entries in 0.5
##
##       DISCLAIMER:  Please note that "mods" are not officially supported by
##                    PunBB. Installation of this modification is done at your
##                    own risk. Backup your forum database and any and all
##                    applicable files before proceeding.
##
##

[url=http://www.punres.org/files.php?pid=174]Download Here[/url

2 (edited by Smartys 2006-02-04 22:57)

Re: Smiley Menu 0.7

Is this similar to the functionality of the Easy BBCode mod (except with just the smileys)?

Re: Smiley Menu 0.7

Probably.

This is a screenshot (yes, I know, I have a large screen tongue):
http://icstrategy.midgetforhire.com/Images/SCREEN0001.JPG

Re: Smiley Menu 0.7

How come your subject says Smiley Menu, but the readme says Smiley View?

Looking for a certain modification for your forum? Please take a look here before posting.

Re: Smiley Menu 0.7

Good question tongue Changed smile

Re: Smiley Menu 0.7

I've just added this, and it works like a charm - that's a big compliment, as I'm not exactly Mrs Code Queen!
Apart from a big THANK YOU, I have these 3 comments:

1] You didn't add your license disclaimer thingy, so I've written one in wink
2] I moved the position to after the ul.bblinks and took the width&margin properties off - as I don't have a mile-wide screen (and nor do most users), that looks neater.
3] As a good webaunty, I need/want to add alt tags to the smilies. Where do I put them?

Just seen that you've released another update, so maybe you've answered the above.
Thanks for the smilies! big_smile

Cx

7 (edited by elbekko 2006-02-06 16:49)

Re: Smiley Menu 0.7

Cherry wrote:

I've just added this, and it works like a charm - that's a big compliment, as I'm not exactly Mrs Code Queen!
Apart from a big THANK YOU, I have these 3 comments:

1] You didn't add your license disclaimer thingy, so I've written one in wink
2] I moved the position to after the ul.bblinks and took the width&margin properties off - as I don't have a mile-wide screen (and nor do most users), that looks neater.
3] As a good webaunty, I need/want to add alt tags to the smilies. Where do I put them?

Just seen that you've released another update, so maybe you've answered the above.
Thanks for the smilies! big_smile

Cx

Well, first of all, thx smile

Then for the comments:

1) Yea, I always forget that tongue When my comp's fixed, I'll add it smile
2) The position is your choice ofcourse smile I originally made it for a friend of mine, who wanted it in there tongue.
-- The width setting is set to 20%, which auto-resizes to your screen wink I tested it on a 1024x768 and it looked quite well. The (top)margin is set to correct the difference between the position of the menu and the message txtbox smile The right-margin is removed in 0.4 smile
3) I'm pretty sure the images have alt tags wink But if you want to set them, it's in the do_smilies function in parser.php. Lemme check if it's set smile

-- Bekko


EDIT: Yeps, I was right tongue

$text = preg_replace("#(?<=.\W|\W.|^\W)".preg_quote($smiley_text[$i], '#')."(?=.\W|\W.|\W$)#m", '$1<img src="img/smilies/'.$smiley_img[$i].'" width="15" height="15" alt="'.substr($smiley_img[$i], 0, strrpos($smiley_img[$i], '.')).'" />$2', $text);

As you can see, the alt tag is set to show the image name smile (I think, it's rather messy to me :S) But of course, you can easily change that.

Re: Smiley Menu 0.7

elbekko wrote:

3) I'm pretty sure the images have alt tags wink But if you want to set them, it's in the do_smilies function in parser.php. Lemme check if it's set
-- Bekko


EDIT: Yeps, I was right
Code:

$text = preg_replace("#(?<=.\W|\W.|^\W)".preg_quote($smiley_text[$i], '#')."(?=.\W|\W.|\W$)#m", '$1<img src="img/smilies/'.$smiley_img[$i].'" width="15" height="15" alt="'.substr($smiley_img[$i], 0, strrpos($smiley_img[$i], '.')).'" />$2', $text);

As you can see, the alt tag is set to show the image name smile (I think, it's rather messy to me :S) But of course, you can easily change that.

Doh, silly me, I was using Mozilla so I didn't see them! yikes

I copied the alt part of your line, changed it to title and now I got 'em in both browsers smile
Thanks, Bekko.

Cherry

Re: Smiley Menu 0.7

Nice! smile

hej!

10

Re: Smiley Menu 0.7

Works almost perfect. Except that it's still showing duplicate smileys on my forum.

http://www.jasoco.net/geekpub/index.php

It's a real bugger. Yes, I installed the .4 version.

Re: Smiley Menu 0.7

Well, that's odd, but make sure you have this code in post.php:

if(substr_count($smilies,parse_message($smiley_text[$key],0)) > 0)
        {
        continue;
        }

12

Re: Smiley Menu 0.7

Yep. It's there.

Re: Smiley Menu 0.7

I'll see what I can do to solve it.

Re: Smiley Menu 0.7

Ok, try replacing if(substr_count($smilies,parse_message($smiley_text[$key],0)) > 0) with if(strpos($smilies,parse_message($smiley_text[$key],0))

15

Re: Smiley Menu 0.7

Nope. That doesn't work either. sad

I can't see what could be wrong. And I've been trying everything.

I even rechecked the code I inserted.

Wait! I think I got it. I replaced that whole If section with this instead:

if(substr_count($smilies,$smiley_img[$key]) > 0)
    {
    continue;
    }

I don't know if removing the parse_message part is going to screw it up though. But for some reason, if I put the parse_message back, it doesn't work. Only removing parse_message part and changing the smiley_text to smiley_img it works. I noticed that using smiley_text is only going to check an array that will never have duplicate entries. It's smiley_img that has all the duplicate entries in it. I thought this was weird so I tried it out. And now it works.

16 (edited by elbekko 2006-03-06 18:36)

Re: Smiley Menu 0.7

:S parse_message() converts the smiley_text entry to the full image links, which should be stored in the smilies array... And so you code is very, very odd tongue As it shouldn't work at all. I'll run some checks, but yah...

EDIT: As it should work, but it doesn't with you, I developed a new way that should do the trick even better smile I'll release 0.5 now.

EDIT2: You can download at http://www.punres.org/viewtopic.php?id=1184

17

Re: Smiley Menu 0.7

I dunno. My modification is working 100% perfectly. Click the image, the code shows up.

I'll check out your new code just to see if that works too.

18

Re: Smiley Menu 0.7

You have to update the readme file for the newest version (0.6).
The Quick box is not working with the codes you said, but it works with this codes: http://www.punres.org/viewtopic.php?pid=6223#p6223

19

Re: Smiley Menu 0.7

Hi there, elbekko!

First, I'd like to say that I love the mod!  I had been thinking that someone should stick the smilies in the unused area to the right of the text entry box. =o)

I have two questions for you:

1) May I ask how I can add this to edit.php?

2) How can I change the code so that it inserts the clicked smiley where the cursor is?  Right now it always inserts at the end of the message.  I had been using Rickard's Easy BBCode Mod, which I just replaced with Pun ToolBar.  The Easy BBCode mod would insert at the current cursor possition.  Is this difference due to the fact that your mod technically sits below the code that contains the textarea?  Can this change be done?

Thanks so much for any help!

Re: Smiley Menu 0.7

nrwilk wrote:

1) May I ask how I can add this to edit.php?

I guess it'd be about the same as on post.php. Find all forms not having a name/id and give them the right one.


2) How can I change the code so that it inserts the clicked smiley where the cursor is?  Right now it always inserts at the end of the message.  I had been using Rickard's Easy BBCode Mod, which I just replaced with Pun ToolBar.  The Easy BBCode mod would insert at the current cursor possition.  Is this difference due to the fact that your mod technically sits below the code that contains the textarea? Can this change be done?

I modified this bit of code, which I found somewhere. I'm not good at all with JavaScript, so I can't really help you out there sad

21 (edited by HaVoC 2006-05-07 23:31)

Re: Smiley Menu 0.7

It's not letting me post smilies by clicking on them, either. Same applies for the quick reply or standard reply methods.

The box appears fine, but they're not clickable.


EDIT: Forum link in my profile smile

22 (edited by HaVoC 2006-05-14 21:32)

Re: Smiley Menu 0.7

Ah hah, version update to 0.7 sorted the problem - thanks big_smile

The one problem I had then was that it wasn't changing the cursor on mouse-over. I sorted that by changing the lines (in both files):

$smilies .= "<tt OnClick=\"javascript:AddSmiley('".$smiley_text[$key]."')\">" . parse_message($smiley_text[$key],0) . "</tt>";

...to...

$smilies .= "<a href=\"javascript:AddSmiley('".$smiley_text[$key]."')\">" . parse_message($smiley_text[$key],0) . "</a>";

It now recognises the rollover and displays the little hand cursor smile

This works for me in Firefox, by the way smile

Re: Smiley Menu 0.7

Yes, well, the reason I didn't make it a link because if your style is set to underline links, you'd have small lines under your smilies wink
Naturally, this works too, and I could eliminate the underlining with CSS, but if you have a bunch of smilies that would really increase page size =/

24

Re: Smiley Menu 0.7

elbekko wrote:

Yes, well, the reason I didn't make it a link because if your style is set to underline links, you'd have small lines under your smilies wink
Naturally, this works too, and I could eliminate the underlining with CSS, but if you have a bunch of smilies that would really increase page size =/

Not if you do this...

http://www.jasoco.net/data/files/images/Smiley%20Example.jpg

No, it's not an IFrame or a Frame of any sort.

It's all CSS, baby.

<fieldset style="margin-left:4px; line-height:1.5em; width:22%; float:right; margin-top:16px; text-align:left; text-decoration:none;BORDER-STYLE: solid;BORDER-WIDTH: 1px;padding: 0 0 0 10px;">
<legend>Smilies</legend><div style="overflow:auto; height:300px; padding: 2px;">

...

</div></fieldset>

An extra DIV can do wonders. And Overflow is just awesome.

Also, no pilfering my custom "character" smileys, please. Make your own.

Re: Smiley Menu 0.7

I run punbb1.2.12 an djust tried to use this smiley menu but i can only see the standard smileys in the menu...
can anybody of you help me?

I'm from Germany, so my english might be wrong sometimes. Sorry!