From a0d5e4484f156100ca2f85a50dde4e675f9b98ef Mon Sep 17 00:00:00 2001 From: 3xanax <34755589+anKordii@users.noreply.github.com> Date: Sun, 3 Jan 2021 22:45:54 +0100 Subject: [PATCH] Add files via upload --- assets/script.js | 182 ++++++++++++++++++++++++++++++++++++----------- 1 file changed, 139 insertions(+), 43 deletions(-) diff --git a/assets/script.js b/assets/script.js index 78d39f5..bf882b3 100644 --- a/assets/script.js +++ b/assets/script.js @@ -2,63 +2,143 @@ var jsonXD = ''; var scrollStatus = 1; var loaded = 0; var urlParams = parseURLParams(window.location.href); +var badgesList = {}; +//var ffzEmote = {}; +//var bttvEmoteG = {}; var a = ["PogChamp", "VisLaud", "BibleThump", "tf", "ResidentSleeper", "AYAYA"]; +$.getJSON( `https://raw.githubusercontent.com/anKordii/XayooIndustries-Czat/main/assets/emotes/badgesttv.json`, function( data ) { + badgesList = data +}); +/*$.getJSON( `https://api.betterttv.net/3/cached/frankerfacez/emotes/global`, function( data ) { + ffzEmote = data +}); +$.getJSON( `https://api.betterttv.net/3/cached/emotes/global`, function( data ) { + bttvEmoteG = data +});*/ + $("body").append(`

Zapis Czatu - ID: ${urlParams.chat}

`) $("body").append(`Auto Scroll 🖱️ ON`) -//$(".dis").append(``) - -if(!urlParams.full){ - $.getJSON( `https://ankordii.github.io/XayooIndustries-Czat/${urlParams.chat}.json`, function( data ) { - let msg = document.querySelector("#put-chat") - - let display = ([x, ...rest]) => { - if (!x) return - setTimeout(_ => { - msg.innerHTML += `

- ${x.time} - ${x.nickname}: - ${emotes(x.message)}

` - display(rest) - scrollChat() - }, 1000) - } - - display(data.messages) - }); -}else if(urlParams.full){ - $.getJSON( `https://ankordii.github.io/XayooIndustries-Czat/${urlParams.chat}.json`, function( data ) { - let msg = document.querySelector("#put-chat") - $("h1").append(`
-/${data.messages.length} wiadomości`) - - let display = ([x, ...rest]) => { - if (!x) return - setTimeout(_ => { - loaded++ - msg.innerHTML += `

- ${x.time} - ${x.nickname}: - ${emotes(x.message)}

` - display(rest) - scrollChat() - }, 1) - } - - display(data.messages) - }); - setInterval(() => { - $("#loadedDiv").text(loaded); - }, 3 * 1000); +if(urlParams.chat >= '860069762'){ + if(!urlParams.full){ + $.getJSON( `https://ankordii.github.io/XayooIndustries-Czat/${urlParams.chat}.json`, function( data ) { + let msg = document.querySelector("#put-chat") + + let display = ([x, ...rest]) => { + if (!x) return + setTimeout(_ => { + msg.innerHTML += `

+ ${x.time} + ${badges(x.user_badges)} + ${x.nickname}: + ${emotes(x.message)}

` + display(rest) + scrollChat() + }, 1000) + } + + display(data.messages) + }); + }else if(urlParams.full){ + $.getJSON( `https://ankordii.github.io/XayooIndustries-Czat/${urlParams.chat}.json`, function( data ) { + let msg = document.querySelector("#put-chat") + $("h1").append(`
-/${data.messages.length} wiadomości`) + + let display = ([x, ...rest]) => { + if (!x) return + setTimeout(_ => { + loaded++ + msg.innerHTML += `

+ ${x.time} + ${badges(x.user_badges)} + ${x.nickname}: + ${emotes(x.message)}

` + display(rest) + scrollChat() + }, 1) + } + + display(data.messages) + }); + + setInterval(() => { + $("#loadedDiv").text(loaded); + }, 3 * 1000); + } +}else{ + if(!urlParams.full){ + $.getJSON( `https://ankordii.github.io/XayooIndustries-Czat/${urlParams.chat}.json`, function( data ) { + let msg = document.querySelector("#put-chat") + + let display = ([x, ...rest]) => { + if (!x) return + setTimeout(_ => { + msg.innerHTML += `

+ ${x.time} + ${x.nickname}: + ${emotes(x.message)}

` + display(rest) + scrollChat() + }, 1000) + } + + display(data.messages) + }); + }else if(urlParams.full){ + $.getJSON( `https://ankordii.github.io/XayooIndustries-Czat/${urlParams.chat}.json`, function( data ) { + let msg = document.querySelector("#put-chat") + $("h1").append(`
-/${data.messages.length} wiadomości`) + + let display = ([x, ...rest]) => { + if (!x) return + setTimeout(_ => { + loaded++ + msg.innerHTML += `

+ ${x.time} + ${x.nickname}: + ${emotes(x.message)}

` + display(rest) + scrollChat() + }, 1) + } + + display(data.messages) + }); + + setInterval(() => { + $("#loadedDiv").text(loaded); + }, 3 * 1000); + } } +function checkvalidcolor(data){ + const months = ["#00ff7f", "#8a2be2", "#1e90ff", "#ff69b4", "#5f9ea0", "#d2691e", "#daa520", "#2e8b57", "#ff4500", "#9acd32", "#ff7f50", "#b22222", "#008000", "#0000ff", "#f00", "#fff"]; + const random = Math.floor(Math.random() * months.length); + if(data === 'undefined'){ + return months[random]; + }else{ + return data; + } +} function scrollChat(){ if(scrollStatus === 1){ var elem = document.getElementById('heheszki'); elem.scrollTop = elem.scrollHeight; } } +function badges(name){ + return name.map((item, i) => badgesImg(item.badge)); +} +function badgesImg(XDname){ + if(XDname === 'brak'){ + + }else{ + return ``; + } + +} function scrollChatStatus(a){ if(a === 1){ scrollStatus = 1; @@ -72,6 +152,22 @@ function scrollChatStatus(a){ $("body").append(`Auto Scroll 🖱️ OFF`); } } +/*function emotesXD(str){ + for (var i = 0; i < a.length; i++) { + + } + //return str; +}*/ +function httpRequest(str){ + const Http = new XMLHttpRequest(); + const url=`https://www.twitchmetrics.net/e/${str}`; + Http.open("GET", url); + Http.send(); + + Http.onreadystatechange = (e) => { + return Http.responseText; + } +} function emotes(str) { for (var i = 0; i < a.length; i++) { str = str.replace(new RegExp(a[i] + '( |$)', 'g'), `${a[i]}`);