Skip to content

Instantly share code, notes, and snippets.

@Kowiz
Last active December 15, 2020 03:07
Show Gist options
  • Save Kowiz/43bcb25b8930f2fbabe917ccdc542e01 to your computer and use it in GitHub Desktop.
Save Kowiz/43bcb25b8930f2fbabe917ccdc542e01 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name TwitchEmotes Channel Point Emotes
// @namespace Kowiz
// @version 0.1
// @description Dropdown to display channel point twitch modified emotes
// @author Kowiz
// @match https://twitchemotes.com/*/*
// @grant none
// ==/UserScript==
var list = [
["Default",""],
["Greyscale","BW"],
["Horizontal Flip","HF"],
["Sunglasses","SG"],
["Squished","SQ"],
["Thinking","TK"],
["Pumpkin","PK"],
["Reindeer","RD"],
["Santa","SA"],
["Red Envelope","EV"],
["Rat","RA"],
["Heart Broken","HB"],
["Heart Eyes","HE"],
["Kiss","KI"],
["Beard","BE"],
["Must Have Clover","CL"],
["Lucky Hat","LH"],
["Rosie's Bandana","RB"],
["Women's Day","WD"],
["Bunny Ears","BN"],
["Easter Basket","EB"],
["Easter Eggs","EG"],
["Bubble Tea","BT"],
["Flower Crown","FC"],
["Sombrero","SO"],
["Feather Boa","FB"],
["Pride Fan","FF"],
["Unicorn","UN"],
["Pumpkin","PM"],
["Witch Hat","WH"],
["Snowflake","SF"],
["Snowman","SM"]
];
var select = document.createElement('select');
select.onchange=function(){
updateEmotes(this.value);
};
for(var i =0;i<list.length;i++){
var option = document.createElement('option');
option.value=list[i][1];
option.innerHTML=list[i][0];
select.appendChild(option);
}
var a = document.getElementsByClassName("container")
a[0].appendChild(select);
function updateEmotes(emote){
if(emote==undefined) emote="";
if(emote!="") emote="_"+emote;
var emotes = document.getElementsByTagName("img");
for(var i = 0; i<emotes.length;i++){
var split = emotes[i].src.split("/");
if(split[2]=="static-cdn.jtvnw.net" && split[3]=="emoticons"){
var ssplit = split[5].split("_");
split[5]=ssplit[0]+emote;
emotes[i].src=split.join("/");
}
}
}
var script = document.createElement('script');
script.appendChild(document.createTextNode(updateEmotes));
script.appendChild(document.createTextNode("window.addEventListener('load', function(){jQuery(document).off('contextmenu', 'img')})"));
(document.body).appendChild(script);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment