Closed Poll: Use Google Hangout Emojis instead

I just wish I could disable smileys altogether, or maybe I just missed some option?

1 Like

Added option to original post. Thanks for the idea @Magnus

EDIT: Fixed the typo :stuck_out_tongue:

2 Likes
// ==UserScript==
// @name         Sponge Emoji
// @namespace    http://your.homepage/
// @version      0.1
// @description  enter something useful
// @author       You
// @match        https://forums.spongepowered.org/*
// @grant        none
// ==/UserScript==
var a=["apple","google","twitter","emoji_one"," "],b=4,c=a[b],d=document.getElementsByClassName("emoji"),i=0;for(i in d.length){var e=d[i],f=e.getAttribute("src")f=f.replace("emoji_one",c);f.setAttribute("src",a);if(c==""){e.setAttribute("style","visibility:hidden;width:0px;")}}

I made a minified version. :smiley:

1 Like

Simplified, but painfully hard to read now. :trollface:

There is some glaring bugs that exist. v2 coming out soon! Gotta find a non laggy way to handle this.

Wouldn’t jQuery make things easier?

1 Like

Yes, that is exactly what I have been playing with :slight_smile:

1 Like

Ok, version two here! Always open to suggestions. I actually used a setInterval here and optimized the original method to reduce lag. If anyone has any ideas how I could do this easily with jQuery please speak up.

// ==UserScript==
// @name         Sponge Emoji
// @namespace    http://altechcode.com
// @version      1.2
// @description  Personalize Emojis on Sponge Forums
// @author       Alexander Allen (RobodudeMC)
// @match        https://forums.spongepowered.org/*
// @grant        none
// ==/UserScript==

var types = ["apple","google","twitter","emoji_one","none"];

//CONFIGURATION

//Sets emoji type set number of emoji type you want.
// 0 - Apple
// 1 - Google
// 2 - Twitter
// 3 - Emoji One
// 4 - Remove Them!
var select = 1;

//DO NOT MODIFY VALUES PAST THIS POINT

var em = types[select];


function memoji(emoji){
    var all = document.getElementsByClassName("emoji");
    for (var i=0, max=all.length; i < max; i++) {
        var e = all[i];
        var a = e.getAttribute("src");
        var b = a.replace("emoji_one", emoji);
        
        if(a != b){
            e.setAttribute("src", b);
        }

        if(emoji == "none"){
            e.setAttribute("style","visibility:hidden;width:0px;")
        }
    }
}

memoji(em);

setInterval(function(){
    memoji(em);
}, 10);


EDIT: After some trial usage I have yet to discover any significant performance decrease or any bugs. woot!

1 Like

Now to minify that! :trollface:

Remember to keep the comments at the top when minifying it. Also, with JS such as this minification is really not going to give a performance increase. Especially with the way I designed it so you can select your own emoji type.


// ==UserScript==
// @name         Sponge Emoji
// @namespace    http://altechcode.com
// @version      1.2
// @description  Personalize Emojis on Sponge Forums
// @author       Alexander Allen (RobodudeMC)
// @match        https://forums.spongepowered.org/*
// @grant        none
// ==/UserScript==

var types = ["apple","google","twitter","emoji_one","none"];

//CONFIGURATION

//Sets emoji type set number of emoji type you want.
// 0 - Apple
// 1 - Google
// 2 - Twitter
// 3 - Emoji One
// 4 - Remove Them!
var select = 1;

var em=types[select];function memoji(emoji){var all=document.getElementsByClassName("emoji");for(var i=0,max=all.length;i<max;i++){var e=all[i];var a=e.getAttribute("src");var b=a.replace("emoji_one",emoji);if(a!=b){e.setAttribute("src",b)}if(emoji=="none"){e.setAttribute("style","visibility:hidden;width:0px;")}}}memoji(em);setInterval(function(){memoji(em)},10);

Didn’t test BTW

Profit??? Minifying JS usually serves only the purpose of saving bandwidth. And as this is a Userscript minifying it is unnecessary and only harms readability.

1 Like

You should probably create a separate thread for this thingy of yours :stuck_out_tongue:

I believe I will, good idea :slight_smile: