Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name GMCLAN Emoticon Fix
- // @namespace mailto:korodzik@poczta.onet.pl
- // @description Inserts emoticons properly into old GMCLAN forum posts. [After an update of the Invision forum software, old posts have lost their smileys, leaving just their names behind; this script inserts the smiley images again where needed.]. Rewritten by adam014 ;)
- // @include *forum.gmclan.org*
- // @version 1.1 (2021.11.17)
- // @grant none
- // ==/UserScript==
- //thanks to http://greasemonkey.win-start.de/patterns/match-attribute.html for help
- const customEmoticons = {
- '-_-': 'sleep.gif',
- ':(': 'sad.gif',
- ':)': 'smile.gif',
- ':D': 'biggrin.gif',
- ':P': 'tongue2.gif',
- ':]': 'emot11.gif',
- ':alien:': 'alien.gif',
- ':angel_not:': 'angel_not.gif',
- ':angry1:': 'angry1.gif',
- ':angry:': 'angry.gif',
- ':ban:': 'ban.gif',
- ':bann:': 'bann.gif',
- ':bash:': 'bash.gif',
- ':beer:': 'beer.gif',
- ':beta:': 'beta.gif',
- ':blink:': 'blink.gif',
- ':blush:': 'blush.gif',
- ':book:': 'book.gif',
- ':borek:': 'emot_borek.png',
- ':boxed:': 'boxed.gif',
- ':bye1:': 'bye1.gif',
- ':cat:': 'cat.gif',
- ':censored:': 'censored.gif',
- ':cheers:': 'cheers.gif',
- ':chris:': 'chris.gif',
- ':closedeyes:': 'closedeyes.gif',
- ':clover:': 'clover.gif',
- ':cold2:': 'cold2.gif',
- ':confused:': 'confused.gif',
- ':construction:': 'construction.gif',
- ':cool2:': 'cool2.gif',
- ':crosseyed:': 'crosseyed.gif',
- ':crying:': 'crying.gif',
- ':death:': 'death.gif',
- ':devil2:': 'devil2.gif',
- ':devil:': 'devil.gif',
- ':dots:': 'dots.gif',
- ':excl:': 'excl.gif',
- ':frusty:': 'frusty.gif',
- ':glare:': 'glare.gif',
- ':gnysek:': 'emot_gnysek.png',
- ':greedy:': 'greedy.gif',
- ':hammer:': 'hammer.gif',
- ':helpsmilie:': 'helpsmilie.gif',
- ':hitler:': 'hitler.gif',
- ':hmmm:': 'hmmm.gif',
- ':huh:': 'huh.gif',
- ':innocent:': 'innocent.gif',
- ':jason:': 'jason.gif',
- ':kicking:': 'kicking.gif',
- ':krider:': 'krider.gif',
- ':laugh:': 'laugh.gif',
- ':like:': 'like.png',
- ':lol:': 'lol.gif',
- ':lubieto:': 'lubieto.png',
- ':mad:': 'mad.gif',
- ':mellow:': 'mellow.gif',
- ':ninja:': 'ninja.gif',
- ':nuke:': 'nuke.gif',
- ':o': 'ohmy.gif',
- ':offtopic:': 'offtopic.gif',
- ':online2long:': 'online2long.gif',
- ':oops:': 'oops.gif',
- ':paperbag3:': 'paperbag3.gif',
- ':ph34r:': 'ph34r.gif',
- ':play_ball:': 'play_ball.gif',
- ':poster_oops:': 'poster_oops.gif',
- ':prop:': 'prop.gif',
- ':psichix:': 'emot_psichix.png',
- ':ranmus:': 'emot_ranmus.png',
- ':ranting2:': 'ranting2.gif',
- ':red_bandana:': 'red_bandana.gif',
- ':red_indian:': 'red_indian.gif',
- ':rip:': 'rip.gif',
- ':rockon:': 'rockon.gif',
- ':rolleyes:': 'rolleyes.gif',
- ':santa:': 'santa.gif',
- ':shuriken:': 'shuriken.gif',
- ':sick:': 'sick.gif',
- ':sleep1:': 'sleep1.gif',
- ':sleeping:': 'sleeping.gif',
- ':smartass:': 'smartass.gif',
- ':smile3:': 'smile3.gif',
- ':sp_ike:': 'sp_ike.gif',
- ':spam:': 'spam.gif',
- ':stupid:': 'stupid.gif',
- ':thumbsup:': 'thumbsup.gif',
- ':tongue:': 'tongue.gif',
- ':tv_happy:': 'tv_happy.gif',
- ':tv_horror:': 'tv_horror.gif',
- ':twisted:': 'twisted.gif',
- ':unsure:': 'unsure.gif',
- ':uzjel:': 'uzjel.png',
- ':w00t2:': 'w00t2.gif',
- ':w00t:': 'w00t.gif',
- ':wacko:': 'wacko.gif',
- ':weight_lift2:': 'weight_lift2.gif',
- ':weight_lift:': 'weight_lift.gif',
- ':wheelchair:': 'wheelchair.gif',
- ':whip:': 'whip.gif',
- ':whistling:': 'whistling.gif',
- ':wink:': 'wink.gif',
- ':wub:': 'wub.gif',
- ';)': 'smile2.gif',
- '<_<': 'dry.gif',
- 'B)': 'cool.gif',
- '^_^': 'happy.gif'
- }
- var paragraphs = document.evaluate(
- "//div[@data-role='commentContent']",
- document,
- null,
- XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
- null);
- for (var i = 0; i < paragraphs.snapshotLength; i++) {
- var currentElement = paragraphs.snapshotItem(i);
- for (var text in customEmoticons) {
- var emotFile = customEmoticons[text];
- currentElement.innerHTML = currentElement.innerHTML.replaceAll(text,`<img src="https://forum.gmclan.org/uploads/emoticons/${emotFile}">`);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement