changelist: -pseudo-random name colors -layout fixes(moved chat after the video on the .pug. also disabled said feature in fcyp.js) -theme updates(tokebot flair, changed modflair, more compact layout, unfucked cytube provided css (srsly, WTF calzoneman? Why?) link decorations, made things moar unified) -added image embedding, disabling fcyp image embed (nothing new from a user standpoint, simply slowly stripping fcyp.js out) -moved emote button to chatbar, added send button as well -chatpaste & chatsmack functions allowing clickable usernames/ -fixed raw video controls -ripped out chat processing logic from fcyp.js, it was breaking a lot of shit and everything it did has been implemented by this update and moar devnotes: Biggest update yet, also made some good steps towards fully ripping fcyp.js out completely. Played around with an image upload button. I might have to setup a cors relay to get that working, I'll have to play around more :p
75 lines
2 KiB
JavaScript
75 lines
2 KiB
JavaScript
//var colorList = ["#ff2e2e", "#5f5cff", "#4de024", "#f4861f", "##b88e8e", "#8f8eb8", "#8eb1b8", "#8eb897", "#abb88e"];
|
|
var colorList = ["userlist_color0", "userlist_color1", "userlist_color2", "userlist_color3", "userlist_color4", "userlist_color5", "userlist_color6"];
|
|
|
|
var usrColors = ([[],[]]);
|
|
|
|
function assignColors(name){
|
|
if(!usrColors[0].includes(name)){
|
|
color = colorList[Math.floor(Math.random()*colorList.length)];
|
|
usrColors[0].push(name);
|
|
usrColors[1].push(color);
|
|
}
|
|
}
|
|
|
|
function freeColor(name){
|
|
if(usrColors[0].includes(name)){
|
|
let itemi = usrColors[0].indexOf(name);
|
|
usrColors[0].splice(itemi, 1);
|
|
usrColors[1].splice(itemi, 1);
|
|
}
|
|
}
|
|
|
|
function getColor(name){
|
|
if((usrColors[0].indexOf(name)) != null){
|
|
return usrColors[1][usrColors[0].indexOf(name)];
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
|
|
function chatpaste(str){
|
|
var chatline = $("#chatline")[0];
|
|
if(chatline.value === ''){
|
|
chatline.value = str;
|
|
}else{
|
|
chatline.value += ' ' + str;
|
|
}
|
|
}
|
|
|
|
function storeToke(toke){//process and store chats that start with ! for local toke tab completion dictionary
|
|
//let temptoke = JSON.parse(localStorage.getItem("localTokes"));
|
|
let temptoke = loadTokes();//load current toaks into temp var
|
|
if(temptoke === null || temptoke === undefined){//if its babbies first tokem
|
|
temptoke = [];//create var
|
|
if(toke != "!toke"){
|
|
temptoke.push("!toke");//push that shit
|
|
}
|
|
temptoke.push(toke);//push that shit
|
|
}else{//otherwise
|
|
if(!temptoke.includes(toke)){//if it isn't there
|
|
temptoke.push(toke);//add it my d00d
|
|
}
|
|
}
|
|
|
|
localStorage.setItem("localTokes", JSON.stringify(temptoke));//slap that sum' bitch back inta the closet
|
|
}
|
|
|
|
function loadTokes(){
|
|
return JSON.parse(localStorage.getItem("localTokes"));//load current toaks into temp var
|
|
}
|
|
|
|
function chatsmack(str){
|
|
var chatline = $("#chatline")[0];
|
|
let buf = chatline.value;
|
|
chatline.value = str;
|
|
callChat();
|
|
chatline.value = buf;
|
|
}
|
|
|
|
Storage.prototype.setObj = function(key, obj) {
|
|
return this.setItem(key, JSON.stringify(obj))
|
|
}
|
|
Storage.prototype.getObj = function(key) {
|
|
return JSON.parse(this.getItem(key))
|
|
}
|