Additional Emoticons Greasemonkey script, V3.2!!!

Want to just shoot the breeze? Forum 42 is the place!

Moderator: Moderators

Electric Rain
Senior Member
Posts: 1911
Joined: Tue Mar 29, 2005 12:39 pm
PSN Username: Denki_no_Ame
Location: What's it to you? Stalker...

Additional Emoticons Greasemonkey script, V3.2!!!

Post by Electric Rain »

UPDATE: V3.2 Okay, this should be the last version. Hopefully the forums will stay as they are now, and the icons won't end up somewhere stupid again. :lol:

UPDATE: V3.1 I know they're misplaced... deal with it for a bit. :lol: Ben is surely going to put the ads back up, and when he does, the icons will be in yet a different location. Whether or not they end up in the proper location, I can not predict. If they're not, I'll release V3.2 with them properly placed once these server issues get worked out and everything isn't changing every couple of days.

UPDATE: V2.0
V2.0 (PMs)

UPDATE: V1.1
V1.1 (PM version)

UPDATE: PM script.

UPDATE: Uploaded to userscripts.org. Click here for script.


Great news! I've had Greasemonkey for a few months now... I got it for the Live Search Club script that removes the search frame. Understanding its endless possibilities, I figured I'd try to create my first script... and I did! :D

This is a very short script that replaces the :arrow: icon in the post view to a Image icon. Unfortunately, you can't just type Image and have it show up when you post. The characters that represent an emoticon in the post window are interpreted by a script in the depths of the phpBB folder on this website that I can't access. For example, when you type: :-lol-: (except without the hyphens), the server automatically replaces that with an image from the server; in this example, "http://forums.benheck.com/images/smiles/icon_lol.gif".

Since I can't add instructions to this script, all I can do is make it insert a URL in IMG tags when you click on the new icon... but it's still much quicker than typing the full path to a Image icon! :)

The good news is that, with some very simple editing, any icon can be replaced with any image. If I worked on it harder, I could create another row for additional emoticons, rather than replace the ones already there. But, I wanted to show this off as soon as possible. :P Besides, if I perfected the script right off the bat, there couldn't be a V1.1 release! :lol:

Alright, here's the script:

Code: Select all

// ==UserScript==
// @name           BenHeck  [img]http://www.tredonox.com/emoticons/icon_wtf.gif[/img]  Icon
// @namespace      Electric Rain
// @description    Inserts a  [img]http://www.tredonox.com/emoticons/icon_wtf.gif[/img]  Icon (or other icon of your choice with a little editing) overtop of the never-used "Arrow" icon (also, or other icon of your choice with a little editing) on the BenHeck forums!
// @include        http://forums.benheck.com/posting.php*
// ==/UserScript==

var allRows = document.getElementsByTagName('tr');
var theRowColumns = allRows[18].getElementsByTagName('td');

theRowColumns[3].innerHTML = "<a href='javascript:emoticon(\"[img]http://skytroniks.com/images/database/smilies/wtf.gif[/img]\")'><img src='http://skytroniks.com/images/database/smilies/wtf.gif' border='0' alt='WTF' title='WTF'></a>";
To replace the image, simply change the following URLs (it's in two spots... make sure you replace both) to the path of your new emoticon.
(

Code: Select all

http://skytroniks.com/images/database/smilies/wtf.gif
)

To change which emoticon is replaced, you need to change the following values:

Code: Select all

allrows[18]
and

Code: Select all

theRowColumns[3]
The emoticons are each in a separate cell (column) which are each inside separate rows.

So, if we wanted to replace the :idea: icon with the new icon instead (move it to the left one column), change theRowColumns[3] to theRowColumns[2]. To replace the :?: icon, change it to theRowColumns[1], and to replace the :!: icon, theRowColumns[0] (yes, it starts at 0).

This works the same for rows. If you wanted to move it up one and replace the :wink: icon with the new icon, you would change allrows[18] to allrows[17]. To replace... say... the :P icon, you would change allrows[18] to allrows[16] and theRowColumns[3] to theRowColumns[1]. Understand? ...Please? :lol:

Do as you wish with my script. All I ask is that if you improve it, please post the revised script here for all of us to benefit off of! :D

Also, I need people to test this script and make sure it works for you. It works for me, but that doesn't mean it will work for everyone...!

Also, this doesn't seem to work in preview mode... any insights as to why that might be, fellow coders? I also only made it to include this script on http://forums.benheck.com, since that's what we're supposed to be using now anyway. It will NOT work for http://benheck.com/phpBB.


To install the script (until someone hosts the script online for me somewhere):

1. Open Notepad.

2. Copy and paste the full script (posted above) into Notepad.

3. Save the Notepad document as benheckwtficon.user.js, making sure it ends in .js and not .txt.

4. Open the newly created file in Firefox, and from there, it's just like installing any other Greasemonkey script!


Enjoy! :)
Last edited by Electric Rain on Mon Apr 21, 2008 9:01 am, edited 13 times in total.
Image
Skyone
Moderator
Posts: 6390
Joined: Tue Nov 29, 2005 8:35 pm
Location: it is a mystery
Contact:

Post by Skyone »

Image
Electric Rain
Senior Member
Posts: 1911
Joined: Tue Mar 29, 2005 12:39 pm
PSN Username: Denki_no_Ame
Location: What's it to you? Stalker...

Post by Electric Rain »

Thank you, I was actually looking for that! :P Wait, did you post that with my script?

UPDATE: Original script changed to use Sky's :wtf: icon.

Edit: Uh... doesn't work now... working on it... >.>

Edit 2: Okay, should be good now. Just a small typo that must have slipped its way in while I was editing the script in my post.
Image
Skyone
Moderator
Posts: 6390
Joined: Tue Nov 29, 2005 8:35 pm
Location: it is a mystery
Contact:

Post by Skyone »

Yes, I did post it with your script. :P
Electric Rain
Senior Member
Posts: 1911
Joined: Tue Mar 29, 2005 12:39 pm
PSN Username: Denki_no_Ame
Location: What's it to you? Stalker...

Post by Electric Rain »

Cool, it works! :D

I hope it's helpful to you.
Image
nightwheel
Senior Member
Posts: 2018
Joined: Mon Mar 19, 2007 11:49 am
PSN Username: nightwheel
360 GamerTag: nightwheel94
Steam ID: nightwheel
Location: Kentucky, We are KFC
Contact:

Post by nightwheel »

Image<img src='http://skytroniks.com/images/database/smilies/wtf.gif' border='0' alt='WTF' title='WTF'></a>
Last edited by nightwheel on Mon Aug 27, 2007 11:26 pm, edited 5 times in total.
Image

Who knows if the Namco Portable will ever become a reality? :P
Dr. KillGood
Senior Member
Posts: 2209
Joined: Sat Jan 21, 2006 1:03 am
Location: Earth

Post by Dr. KillGood »

So WTF dose it do now?
Image
Electric Rain
Senior Member
Posts: 1911
Joined: Tue Mar 29, 2005 12:39 pm
PSN Username: Denki_no_Ame
Location: What's it to you? Stalker...

Post by Electric Rain »

KillGood, to you I say, Image . :P

What don't you understand? Basically, it replaces the :arrow: emoticon with a :wtf: emoticon. When you click it, it inserts the URL for the :wtf: icon in an IMG tag. Try quoting one of our posts so you can see the code. Notice the [-img]http://skytroniks.com/images/database/smilies/wtf.gif[/img-] ('cept without the hyphens)...

In case you didn't know, Greasemonkey is a Firefox extension that allows you to inject client-side Javascript into specific pages.
Last edited by Electric Rain on Mon Aug 27, 2007 11:54 pm, edited 2 times in total.
Image
Nonsense Man
Posts: 896
Joined: Wed Dec 28, 2005 10:03 am
Location: somewhere

Post by Nonsense Man »

:wtf: its not working i followed the instructions but nothing happened.
Electric Rain
Senior Member
Posts: 1911
Joined: Tue Mar 29, 2005 12:39 pm
PSN Username: Denki_no_Ame
Location: What's it to you? Stalker...

Post by Electric Rain »

...Huh... when you're posting, does the URL in your address bar start with http://forums.benheck.com?

Edit: Okay, I've uploaded it to userscripts.org. Try installing it from here.
Last edited by Electric Rain on Tue Aug 28, 2007 12:25 am, edited 1 time in total.
Image
Nonsense Man
Posts: 896
Joined: Wed Dec 28, 2005 10:03 am
Location: somewhere

Post by Nonsense Man »

Image And were back!!
Electric Rain
Senior Member
Posts: 1911
Joined: Tue Mar 29, 2005 12:39 pm
PSN Username: Denki_no_Ame
Location: What's it to you? Stalker...

Post by Electric Rain »

Sweet. 8)
Image
lifeisbetterwithketchup
Senior Member
Posts: 2180
Joined: Fri Jul 21, 2006 12:08 pm
Steam ID: lifeisbetterwithketchup
Location: Illinois. Whee.

Post by lifeisbetterwithketchup »

Image :P

Nice work, Electric Rain!
Rekarp wrote:
mako321 wrote:What makes you head ninja, anyways? :wink:
Cause I am Abe F#!@ing Lincoln. :mrgreen:
Electric Rain
Senior Member
Posts: 1911
Joined: Tue Mar 29, 2005 12:39 pm
PSN Username: Denki_no_Ame
Location: What's it to you? Stalker...

Post by Electric Rain »

Thank you! You're technically the first person to tell me that! :P
Image
blackbox_dev
Senior Member
Posts: 1906
Joined: Sun Jan 15, 2006 5:19 pm
Location: Formerly known as iam7805

Post by blackbox_dev »

Image

Sweet, it works now! Great work!

For anybody having problems with it, try restarting Firefox.
I'd imagine right now you wish you were a cuttlefish...
Post Reply