init commit

This commit is contained in:
zino committed 2021-02-16 23:07:41 +01:00
1 parent ec3fc78e0f
commit 12b4ef5db4
5000 files changed
+2596132

No files matched your search

+17
View File
@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html>
<head>
<title>Config Page</title>
</head>
<body style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;">
<div id="app"></div>
<script src="https://extension-files.twitch.tv/helper/v1/twitch-ext.min.js"></script>
<!-- If you use any external libraries, such as jQuery, you must include
them as part of your extension. Twitch does not allow extensions to link
to external libraries. -->
<script src="jquery-3.3.1.min.js" type="text/javascript"></script>
<script src="config.js" type="text/javascript"></script>
<h2>Configure This</h2>
<p>Just kidding... hello world.</p>
</body>
</html>
+259
View File
@@ -0,0 +1,259 @@
.pp-offcanvas-body {
position: absolute !Important;
top: 50% !important;
-ms-transform: translateY(-50%) !important;
transform: translateY(-50%) !important;
}
.pp-offcanvas-content {
overflow: hidden !important;
width: 10vw !important;
}
.pp-offcanvas-custom-content {
margin-bottom: 2vw;
font-size: 1vw;
}
.pp-offcanvas-custom-content i {
font-size: 2vw;
}
img#sidebarLogo {
width: 6vw;
height: 6vw;
max-width: 512px;
max-height: 512px;
}
.pp-offcanvas-custom-content:hover i,
.pp-offcanvas-custom-content:hover p {
color: #00aedb;
}
.pp-offcanvas-custom-content i {
color: #ffffff;
}
#slideOut {
right: 0;
color: #ffffff;
background: #444;
}
.slideToggle {
width: .8vw;
height: 10vw;
}
.slideToggle i {
font-size: 1.4vw;
}
#slideIn {
left: 0;
width: .8vw;
height: 10vw;
background: black;
color: #ffffff;
}
#slideIn i {
position: relative !important;
}
.center {
margin: 0;
position: absolute;
top: 50%;
left: 50%;
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
.centerBoth {
margin: 0;
position: absolute;
top: 50%;
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
font-size: 1.4vw;
}
#modal-5fb29d747a583 .pp-modal.layout-standard {
width: 30vw !important;
height: 20vw !important;
}
.fl-node-5fb29d747a583 .pp-modal .pp-modal-title,
#modal-5fb29d747a583 .pp-modal .pp-modal-title {
padding: .5vw .5vw !important;
font-size: 1.2vw !important;
}
.pp-infobox-icon-inner span:before {
font-size: 2vw !important;
}
span.pp-infobox-title-prefix {
font-size: 1vw;
}
.pp-infobox-title {
font-size: 1vw;
}
.pp-infobox-description {
font-size: .8vw;
}
.modalClose {
right: -.5vw;
top: -.5vw;
position: absolute;
}
.pp-modal-close.box-top-right {
top: -.6vw !important;
right: -.6vw !important;
}
.pp-modal-close {
border-radius: 0 !important;
width: 1.2vw !important;
height: 1.2vw !important;
padding: .55vw !important;
}
.pp-modal-close .bar-wrap {
display: contents !important;
}
.pp-modal-close .bar-wrap .bar-1 {
top: .55vw !important;
}
.pp-modal-close .bar-wrap .bar-2 {
top: .55vw !important;
}
.pp-infobox-wrap {
margin-right: .1vw;
margin-left: .2vw;
margin-top: .1vw;
margin-bottom: .1vw;
}
.pp-modal {
margin: 0 !important;
}
.pp-modal-container {
overflow: hidden !important;
}
.pp-modal-wrap {
z-index: 99 !important;
}
.pp-modal-wrap {
overflow: hidden !important;
}
#slideInOverlay i {
color: white;
}
.vertical-center {
margin: 0;
position: absolute;
top: 50%;
-ms-transform: translateY(-50%);
transform: translateY(-50%);
}
.pp-accordion-item {
margin-bottom: .2vw !important;
}
.pp-accordion-button {
padding: 0 1vw 0 1vw !important;
}
.pp-accordion-item .pp-accordion-content {
padding: 0 1vw 0 1vw;
}
td.min {
width: 1%;
white-space: nowrap;
}
/*#afTable td {*/
/* width: 33%;*/
/* white-space: nowrap;*/
/* padding: .1vw;*/
/*}*/
/*#afTable td, .pp-modal p {*/
/* font-size: .7vw;*/
/* margin: 0;*/
/*}*/
.streamerInfoTable td {
width: 33%;
white-space: nowrap;
padding: .1vw;
}
.streamerInfoTable td, .pp-modal p {
font-size: .7vw;
margin: 0;
}
.streamerInfoTable {
margin: .5vw 0 0.5vw 0;
}
/*#afTable {*/
/* margin: .5vw 0 0.5vw 0;*/
/*}*/
.pp-accordion-item .pp-accordion-content {
padding: .5vw 1vw .5vw 1vw !important;
}
.pp-accordion-button-label {
font-size: .8vw;
}
.pp-modal .pp-modal-title,
#modal-5fb29d747a583 .pp-modal .pp-modal-title {
font-size: 1vw !important;
}
.pp-modal .pp-modal-content {
width: 30vw !important;
height: 17.5vw !important;
}
.mask {
display: none;
/*This hides the mask*/
}
.ajax {
background-position-x: left;
background-position-y: center;
position: relative;
background-image: url(https://zinomedia.de/wp_hq/pkrstarsbotextension/wp-content/uploads/sites/8/2020/11/ajax-loader-1.gif);
background-size: 1vw 1vw;
z-index: 1000;
background-repeat: no-repeat;
}
.pp-modal-header {
border-top-left-radius: 0;
border-top-right-radius: 0;
}
+55
View File
@@ -0,0 +1,55 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery load() Demo</title>
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script src="https://extension-files.twitch.tv/helper/v1/twitch-ext.min.js"></script>
</head>
<body>
<!--<div id="box">-->
<!-- <h2>Click button to load new content inside DIV box</h2>-->
<!--</div>-->
<!--<button type="button">Load Content</button>-->
<script>
$(document).ready(function() {
// $('html').load("https://zinomedia.de/wp_hq");
$('body').load("https://zinomedia.de/wp_hq/pkrstarsbotextension");
// $("button").click(function() {
// $('body').load('https://zinomedia.de/wp_hq/pkrstarsbot/index.php body');
// $('body').load("https://zinomedia.de/wp_hq/pkrstarsbotextension");
// $.get("https://zinomedia.de/wp_hq/pkrstarsbot body", function(data) {
// $("body").replaceWith(data);
// });
// $.ajax({
// url: "https://zinomedia.de/wp_hq/pkrstarsbot",
// success: function(data) {
// $(data).contents().appendTo("body");
// }
// });
// $.get('https://zinomedia.de/pokerstarsbot/', {}, function(data) {
// var data = data.replace('<body', '<body><div id="body"').replace('</body>', '</div></body>');
// var body = $(data).filter('#body');
// //... do what you want with body ...
// });
// });
});
</script>
</body>
</html>
+425
View File
@@ -0,0 +1,425 @@
"use strict";
var elements = new Object();
var modalActive = 0;
const wpjson = "https://zinomedia.de/wp_hq/pkrstarsbotextension/wp-json";
const production = 0;
document.addEventListener("DOMContentLoaded", function(event) {
defer(function() {
console.log("jQuery is now loaded");
init();
});
});
function init() {
// Append
jQuery(".pp-offcanvas-content").append('<div id="slideOut" class="slideToggle vertical-center pp-offcanvas-5fb1907e2d646-close"><i class="fas fa-caret-left center"></i></div>');
jQuery(".pp-modal-container").append('<div id="slideInOverlay" class="slideToggle vertical-center"><i class="fas fa-caret-right center"></i></div>');
// Draggable
jQuery(".pp-modal").draggable({
containment: "#main",
scroll: false,
});
elements = {
"sidebarLinks": {
"1": { obj: jQuery(".pp-offcanvas-1"), callback: openModalStreamerInfo, extraClass: "modal-5fb29d747a583" },
"2": { obj: jQuery(".pp-offcanvas-2"), callback: emptyCallback },
"3": { obj: jQuery(".pp-offcanvas-3"), callback: emptyCallback },
"4": { obj: jQuery(".pp-offcanvas-4"), callback: emptyCallback },
"5": { obj: jQuery(".pp-offcanvas-5"), callback: emptyCallback },
"6": { obj: jQuery(".pp-offcanvas-6"), callback: emptyCallback },
},
"sidebarToggles": {
"slideIn": { obj: jQuery("#slideIn"), callback: sidebarSlideIn },
"slideOut": { obj: jQuery("#slideOut"), callback: sidebarSlideOut },
"slideInOverlay": { obj: jQuery("#slideInOverlay"), callback: sidebarSlideInOverlay },
},
"buttons": {
"sample": { obj: jQuery("#sampleButton") },
},
"modals": {
"streamerInfo": {
"obj": jQuery("#modal-5fb29d747a583"),
"header": jQuery("#modal-5fb29d747a583 .pp-modal-body"),
"container": jQuery("#modal-5fb29d747a583 .pp-modal"),
"close": jQuery("#modal-5fb29d747a583 .pp-modal-close"),
"enabled": 0,
// "intervalDelay": 60000,
"callback": emptyCallback,
"values": {
"af": {
"header": jQuery("span").filter(function() { return (jQuery(this).text() === 'Aggression Factor AF') })[0],
"text": jQuery("span").filter(function() { return (jQuery(this).text() === 'Aggression Factor AF') }).parent()[0].nextElementSibling.children[0],
"overall": jQuery("#afOverall")[0],
"flop": jQuery("#afFlop")[0],
"turn": jQuery("#afTurn")[0],
"river": jQuery("#afRiver")[0],
"refresh": function() {
// loaderAF();
initLoader("af", ["flop", "turn", "river"]);
apirequest("/extension/v1/af", { "betrounds": ["flop", "turn", "river"] }, setAF, "overall");
apirequest("/extension/v1/af", { "betrounds": ["flop"] }, setAF, "flop");
apirequest("/extension/v1/af", { "betrounds": ["turn"] }, setAF, "turn");
apirequest("/extension/v1/af", { "betrounds": ["river"] }, setAF, "river");
},
"startInterval": function() {
startInterval("af");
},
"stopInterval": function() {
stopInterval("af");
},
"intervalID": 0,
"intervalDelay": 60000,
},
"threebet": {
"header": jQuery("span").filter(function() { return (jQuery(this).text() === '3Bet') })[0],
"text": jQuery("span").filter(function() { return (jQuery(this).text() === '3Bet') }).parent()[0].nextElementSibling.children[0],
"overall": jQuery("#3betOverall")[0],
"refresh": function() {
// loader3Bet();
initLoader("threebet", ["overall"]);
apirequest("/extension/v1/3bet", { "betrounds": ["holecards", "flop", "turn", "river"] }, set3Bet);
},
"startInterval": function() {
startInterval("threebet");
},
"stopInterval": function() {
stopInterval("threebet");
},
"intervalID": 0,
"intervalDelay": 60000,
},
"blinds": {
"header": jQuery("span").filter(function() { return (jQuery(this).text() === 'Cash Game Blinds Spent') })[0],
"text": jQuery("span").filter(function() { return (jQuery(this).text() === 'Cash Game Blinds Spent') }).parent()[0].nextElementSibling.children[0],
"big_blind_play": jQuery("#bigBlindSpentPlay")[0],
"small_blind_play": jQuery("#smallBlindSpentPlay")[0],
"total_blind_play": jQuery("#totalBlindSpentPlay")[0],
"big_blind_real": jQuery("#bigBlindSpentReal")[0],
"small_blind_real": jQuery("#smallBlindSpentReal")[0],
"total_blind_real": jQuery("#totalBlindSpentReal")[0],
"refresh": function() {
initLoader("blinds", ["big_blind_play", "small_blind_play", "total_blind_play", "big_blind_real", "small_blind_real", "total_blind_real"]);
apirequest("/extension/v1/blinds", {}, setBlinds);
},
"startInterval": function() {
startInterval("blinds");
},
"stopInterval": function() {
stopInterval("blinds");
},
"intervalID": 0,
"intervalDelay": 60000,
},
"tournamentwinnings": {
"header": jQuery("span").filter(function() { return (jQuery(this).text() === 'Tournament Winnings') })[0],
"text": jQuery("span").filter(function() { return (jQuery(this).text() === 'Tournament Winnings') }).parent()[0].nextElementSibling.children[0],
"winnings_realmoney": jQuery("#tournamentWinningsRealMoney")[0],
"winnings_playmoney": jQuery("#tournamentWinningsPlayMoney")[0],
"refresh": function() {
initLoader("tournamentwinnings", ["winnings_playmoney", "winnings_realmoney"]);
apirequest("/extension/v1/tournamentwinnings", {}, setTournamentWinnings);
},
"startInterval": function() {
startInterval("tournamentwinnings");
},
"stopInterval": function() {
stopInterval("tournamentwinnings");
},
"intervalID": 0,
"intervalDelay": 60000,
},
"bountywinnings": {
"header": jQuery("span").filter(function() { return (jQuery(this).text() === 'Bounty Winnings') })[0],
"text": jQuery("span").filter(function() { return (jQuery(this).text() === 'Bounty Winnings') }).parent()[0].nextElementSibling.children[0],
"winnings_realmoney": jQuery("#bountyWinningsRealMoney")[0],
"winnings_playmoney": jQuery("#bountyWinningsPlayMoney")[0],
"refresh": function() {
initLoader("bountywinnings", ["winnings_playmoney", "winnings_realmoney"]);
apirequest("/extension/v1/bountywinnings", {}, setBountyWinnings);
},
"startInterval": function() {
startInterval("bountywinnings");
},
"stopInterval": function() {
stopInterval("bountywinnings");
},
"intervalID": 0,
"intervalDelay": 60000,
},
}
},
},
};
// Center
elements.modals.streamerInfo.container.addClass("center");
sidebarClick();
eventListeners();
// Testing / Production
if (!production) {
let auth = {
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2MDU3MDUxNzEsIm9wYXF1ZV91c2VyX2lkIjoiVTE2MzUwMDkwIiwidXNlcl9pZCI6IjE2MzUwMDkwIiwiY2hhbm5lbF9pZCI6IjE2MzUwMDkwIiwicm9sZSI6ImJyb2FkY2FzdGVyIiwiaXNfdW5saW5rZWQiOmZhbHNlLCJwdWJzdWJfcGVybXMiOnsibGlzdGVuIjpbImJyb2FkY2FzdCIsIndoaXNwZXItVTE2MzUwMDkwIiwiZ2xvYmFsIl0sInNlbmQiOlsiYnJvYWRjYXN0Iiwid2hpc3Blci0qIl19fQ.AOmTlG4RoZhfm7YixnrgcTw_lhsOHCd-UwfM4QCBUGU",
"channelId": 16350090,
};
sessionStorage.setItem('auth', JSON.stringify(auth));
var obj = JSON.parse(sessionStorage.auth);
console.log(obj);
}
else {
window.Twitch.ext.onAuthorized(function(auth) {
console.log('The JWT that will be passed to the EBS is', auth.token);
console.log('The channel ID is', auth.channelId);
console.log('The client ID is', auth.clientId);
console.log('The userId ID is', auth.userId);
sessionStorage.setItem('auth', JSON.stringify(auth));
var obj = JSON.parse(sessionStorage.auth);
console.log(obj);
});
}
}
// function loaderAF() {
// let elem = elements.modals.streamerInfo.values.af;
// ["flop", "turn", "river", "overall"].forEach(function(entry) {
// let elem = elements.modals.streamerInfo.values.af[entry];
// elem.textContent = '';
// elem.nextSibling.nextSibling.textContent = '';
// jQuery(elem).addClass("ajax");
// jQuery(elem.nextSibling.nextSibling).addClass("ajax");
// });
// }
function initLoader(name, nodes) {
let elem = elements.modals.streamerInfo.values[name];
nodes.forEach(function(entry) {
let elem = elements.modals.streamerInfo.values[name][entry];
elem.textContent = '';
// if (typeof(elem.nextSibling.nextSibling.textContent) != 'undefined' && elem.nextSibling.nextSibling.textContent != null)
// elem.nextSibling.nextSibling.textContent = '';
if (elem.hasOwnProperty("nextSibling.nextSibling.textContent"))
elem.nextSibling.nextSibling.textContent = '';
jQuery(elem).addClass("ajax");
jQuery(elem.nextSibling.nextSibling).addClass("ajax");
});
}
function removeLoader(name, nodes) {
let elem = elements.modals.streamerInfo.values[name];
nodes.forEach(function(entry) {
let elem = elements.modals.streamerInfo.values[name][entry];
if (elem.hasOwnProperty("nextSibling.nextSibling.textContent"))
jQuery(elem.nextSibling.nextSibling).removeClass("ajax");
jQuery(elem).removeClass("ajax");
});
}
function startInterval(name) {
console.log("Interval " + name + " starting...");
if (!elements.modals.streamerInfo.values[name].intervalID) {
elements.modals.streamerInfo.values[name].intervalID = setInterval(async() => {
elements.modals.streamerInfo.values[name].refresh();
}, elements.modals.streamerInfo.values[name].intervalDelay);
}
}
function stopInterval(name) {
if (elements.modals.streamerInfo.values[name].intervalID) {
clearTimeout(elements.modals.streamerInfo.values[name].intervalID);
elements.modals.streamerInfo.values[name].intervalID = 0;
}
console.log("Interval " + name + " stopped.");
}
function setBountyWinnings(data) {
console.log(data);
let elem = elements.modals.streamerInfo.values.bountywinnings;
elem.header.textContent = "Bounty Winnings " + data.winnings_realmoney + " | " + data.winnings_playmoney; // header
elem.winnings_playmoney.textContent = data.winnings_playmoney;
elem.winnings_realmoney.textContent = data.winnings_realmoney;
removeLoader("bountywinnings", ["winnings_playmoney", "winnings_realmoney"]);
}
function setTournamentWinnings(data) {
console.log(data);
let elem = elements.modals.streamerInfo.values.tournamentwinnings;
elem.header.textContent = "Tournament Winnings " + data.winnings_realmoney + " | " + data.winnings_playmoney; // header
elem.winnings_playmoney.textContent = data.winnings_playmoney;
elem.winnings_realmoney.textContent = data.winnings_realmoney;
removeLoader("tournamentwinnings", ["winnings_playmoney", "winnings_realmoney"]);
}
function setBlinds(data) {
console.log(data);
let elem = elements.modals.streamerInfo.values.blinds;
elem.header.textContent = "Cash Game Blinds Spent " + data.total_real + " | " + data.total_play; // header
elem.big_blind_play.textContent = data.big_blind_play;
elem.small_blind_play.textContent = data.small_blind_play;
elem.total_blind_play.textContent = data.total_play;
elem.big_blind_real.textContent = data.big_blind_real;
elem.small_blind_real.textContent = data.small_blind_real;
elem.total_blind_real.textContent = data.total_real;
removeLoader("blinds", ["big_blind_play", "small_blind_play", "total_blind_play", "big_blind_real", "small_blind_real", "total_blind_real"]);
// ["big_blind", "small_blind", "total"].forEach(function(entry) {
// jQuery(elem.entry).removeClass("ajax");
// });
// jQuery(elem.nextSibling.nextSibling).removeClass("ajax");
}
function set3Bet(data) {
console.log(data);
let elem = elements.modals.streamerInfo.values.threebet.overall;
elem.textContent = data.threebet;
elem.nextSibling.nextSibling.textContent = "Based on " + data.unique_handids + " records"
elements.modals.streamerInfo.values.threebet.header.textContent = "3Bet " + data.threebet;
jQuery(elem).removeClass("ajax");
jQuery(elem.nextSibling.nextSibling).removeClass("ajax");
}
function setAF(data, args) {
console.log(data);
let elem = elements.modals.streamerInfo.values.af[args];
elem.textContent = data.af;
elem.nextSibling.nextSibling.textContent = "Based on " + data.unique_handids + " records"
if (args == "overall")
elements.modals.streamerInfo.values.af.header.textContent = "Aggression Factor (AF) " + data.af;
jQuery(elem).removeClass("ajax");
jQuery(elem.nextSibling.nextSibling).removeClass("ajax");
}
function eventListeners() {
elements.buttons.sample.obj.bind('click', function() {
// console.log("clicked");
// apirequest("/extension/v1/3bet", { "betrounds": ["holecards", "flop", "turn", "river"] }, set3Bet);
apirequest("/extension/v1/tournamentwinnings", {}, setTournamentWinnings);
// apirequest("/extension/v1/af", { "betrounds": ["flop", "turn", "river"] }, setAF, "overall");
// elements.modals.streamerInfo.values.af.refresh();
});
}
function apirequest(route, data, callback, args) {
let auth = JSON.parse(sessionStorage.auth);
// Add authentication
data["token"] = auth.token;
data["channelID"] = auth.channelId;
// console.log(data);
let url = wpjson + route;
jQuery.ajax({
method: 'POST',
url: url,
data: data,
dataType: 'json',
success: function(receivedData) {
callback(receivedData, args);
},
});
}
function sidebarSlideInOverlay() {
elements.sidebarToggles.slideIn.obj.click();
// elements.sidebarToggles.slideInOverlay.obj.hide();
}
function sidebarSlideIn() {
// elements.sidebarToggles["slideIn"].obj.hide();
}
function active_modal() {
// Check if a modal is active
let enabled;
for (const [key, node] of Object.entries(elements["modals"])) {
enabled = node.enabled;
}
console.log("enabled: " + enabled);
return enabled;
}
function sidebarSlideOut() {
// if (!active_modal()) {
// elements.sidebarToggles["slideIn"].obj.delay(450).show(0);
// }
// else {
// elements.sidebarToggles.slideInOverlay.obj.delay(450).show(0);
// }
}
function openModalStreamerInfo() {
elements.modals.streamerInfo.enabled = 1; // caution: never set back to 0, use?
for (const [key, node] of Object.entries(elements["modals"])) {
for (let [key, value] of Object.entries(node.values)) {
value.refresh();
value.startInterval();
}
}
// elements.modals.streamerInfo.values.af.refresh();
// elements.modals.streamerInfo.values.af.startInterval();
}
function modalStreamerInfo() {
console.log("clicked");
}
function emptyCallback() {
console.log("empty callback");
return;
}
function sidebarClick() {
for (const [key, node] of Object.entries(elements["sidebarLinks"])) {
node.obj.addClass(node.extraClass);
node.obj.click(function() {
node.callback(node);
});
}
for (const [key, node] of Object.entries(elements["sidebarToggles"])) {
node.obj.click(function() {
node.callback();
});
}
for (const [key, node] of Object.entries(elements["modals"])) {
node.close.click(function() {
node.enabled = 0;
for (let [key, value] of Object.entries(node.values)) {
value.stopInterval();
}
});
}
}
function defer(method) {
if (window.jQuery) {
method();
}
else {
setTimeout(function() { defer(method) }, 50);
}
}
@@ -0,0 +1,12 @@
let token, userId;
const twitch = window.Twitch.ext;
twitch.onContext((context) => {
twitch.rig.log(context);
});
twitch.onAuthorized((auth) => {
token = auth.token;
userId = auth.userId;
});
@@ -0,0 +1,9 @@
window.addEventListener('message', (event) => {
console.log(event);
});
//debugger;
//const local = window.frameElement.attributes.getNamedItem('helperUrl');
//const online = 'https://extension-files.twitch.tv/helper/v1/twitch-ext.min.js';
//const el = document.createElement('script');
//el.src = local ? local.value : online;
//document.head.appendChild(el);
@@ -0,0 +1,2 @@
/*! jQuery v3.3.1 | (c) JS Foundation and other contributors | jquery.org/license */
!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(e,t){"use strict";var n=[],r=e.document,i=Object.getPrototypeOf,o=n.slice,a=n.concat,s=n.push,u=n.indexOf,l={},c=l.toString,f=l.hasOwnProperty,p=f.toString,d=p.call(Object),h={},g=function e(t){return"function"==typeof t&&"number"!=typeof t.nodeType},y=function e(t){return null!=t&&t===t.window},v={type:!0,src:!0,noModule:!0};function m(e,t,n){var i,o=(t=t||r).createElement("script");if(o.text=e,n)for(i in v)n[i]&&(o[i]=n[i]);t.head.appendChild(o).parentNode.removeChild(o)}function x(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?l[c.call(e)]||"object":typeof e}var b="3.3.1",w=function(e,t){return new w.fn.init(e,t)},T=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;w.fn=w.prototype={jquery:"3.3.1",constructor:w,length:0,toArray:function(){return o.call(this)},get:function(e){return null==e?o.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=w.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return w.each(this,e)},map:function(e){return this.pushStack(w.map(this,function(t,n){return e.call(t,n,t)}))},slice:function(){return this.pushStack(o.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(n>=0&&n<t?[this[n]]:[])},end:function(){return this.prevObject||this.constructor()},push:s,sort:n.sort,splice:n.splice},w.extend=w.fn.extend=function(){var e,t,n,r,i,o,a=arguments[0]||{},s=1,u=arguments.length,l=!1;for("boolean"==typeof a&&(l=a,a=arguments[s]||{},s++),"object"==typeof a||g(a)||(a={}),s===u&&(a=this,s--);s<u;s++)if(null!=(e=arguments[s]))for(t in e)n=a[t],a!==(r=e[t])&&(l&&r&&(w.isPlainObject(r)||(i=Array.isArray(r)))?(i?(i=!1,o=n&&Array.isArray(n)?n:[]):o=n&&w.isPlainObject(n)?n:{},a[t]=w.extend(l,o,r)):void 0!==r&&(a[t]=r));return a},w.extend({expando:"jQuery"+("3.3.1"+Math.random()).replace(/\D/g,""),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isPlainObject:function(e){var t,n;return!(!e||"[object Object]"!==c.call(e))&&(!(t=i(e))||"function"==typeof(n=f.call(t,"constructor")&&t.constructor)&&p.call(n)===d)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},globalEval:function(e){m(e)},each:function(e,t){var n,r=0;if(C(e)){for(n=e.length;r<n;r++)if(!1===t.call(e[r],r,e[r]))break}else for(r in e)if(!1===t.call(e[r],r,e[r]))break;return e},trim:function(e){return null==e?"":(e+"").replace(T,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(C(Object(e))?w.merge(n,"string"==typeof e?[e]:e):s.call(n,e)),n},inArray:function(e,t,n){return null==t?-1:u.call(t,e,n)},merge:function(e,t){for(var n=+t.length,r=0,i=e.length;r<n;r++)e[i++]=t[r];return e.length=i,e},grep:function(e,t,n){for(var r,i=[],o=0,a=e.length,s=!n;o<a;o++)(r=!t(e[o],o))!==s&&i.push(e[o]);return i},map:function(e,t,n){var r,i,o=0,s=[];if(C(e))for(r=e.length;o<r;o++)null!=(i=t(e[o],o,n))&&s.push(i);else for(o in e)null!=(i=t(e[o],o,n))&&s.push(i);return a.apply([],s)},guid:1,support:h}),"function"==typeof Symbol&&(w.fn[Symbol.iterator]=n[Symbol.iterator]),w.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(e,t){l["[object "+t+"]"]=t.toLowerCase()});function C(e){var t=!!e&&"length"in e&&e.length,n=x(e);return!g(e)&&!y(e)&&("array"===n||0===t||"number"==typeof t&&t>0&&t-1 in e)}var E=function(e){var t,n,r,i,o,a,s,u,l,c,f,p,d,h,g,y,v,m,x,b="sizzle"+1*new Date,w=e.document,T=0,C=0,E=ae(),k=ae(),S=ae(),D=function(e,t){return e===t&&(f=!0),0},N={}.hasOwnProperty,A=[],j=A.pop,q=A.push,L=A.push,H=A.slice,O=function(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1},P="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",R="(?:\\\\.|[\\w-]|[^\0-\\xa0])+",I="\\["+M+"*("+R+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+R+"))|)"+M+"*\\]",W=":("+R+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+I+")*)|.*)\\)|)",$=new RegExp(M+"+","g"),B=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),F=new RegExp("^"+M+"*,"+M+"*"),_=new RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),z=new RegExp("="+M+"*([^\\]'\"]*?)"+M+"*\\]","g"),X=new RegExp(W),U=new RegExp("^"+R+"$"),V={ID:new RegExp("^#("+R+")"),CLASS:new RegExp("^\\.("+R+")"),TAG:new RegExp("^("+R+"|[*])"),ATTR:new RegExp("^"+I),PSEUDO:new RegExp("^"+W),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+P+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)Line truncated
@@ -0,0 +1,26 @@
<!DOCTYPE html>
<html>
<head>
<title>Live Config (Broadcaster) Page</title>
</head>
<body style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;">
<div id="app" class="full-height"></div>
<script src="https://extension-files.twitch.tv/helper/v1/twitch-ext.min.js"></script>
<!-- If you use any external libraries, such as jQuery, you must include
them as part of your extension. Twitch does not allow extensions to link
to external libraries. -->
<script src="jquery-3.3.1.min.js" type="text/javascript"></script>
<script src="viewer.js" type="text/javascript"></script>
<h2>And We're Live!</h2>
<p>Would you care to cycle a color?</p>
<div>
<input type="button" id="cycle" disabled="disabled" value="Yes, I would" />
</div>
<div style="float: left; position: relative; left: 50%">
<div id="color" style="border-radius: 50px; transition: background-color 0.5s ease; margin-top: 30px; width: 100px; height: 100px; background-color: #6441A4; float: left; position: relative; left: -50%">
</div>
</div>
<div id="list">
</div>
</body>
</html>
@@ -0,0 +1,26 @@
<!DOCTYPE html>
<html>
<head>
<title>Viewer Page</title>
</head>
<body style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;">
<div id="app" class="full-height"></div>
<script src="https://extension-files.twitch.tv/helper/v1/twitch-ext.min.js"></script>
<!-- If you use any external libraries, such as jQuery, you must include
them as part of your extension. Twitch does not allow extensions to link
to external libraries. -->
<script src="jquery-3.3.1.min.js" type="text/javascript"></script>
<script src="viewer.js" type="text/javascript"></script>
<h2>Hello, World!</h2>
<p>Would you care to cycle a color?</p>
<div>
<input type="button" id="cycle" disabled="disabled" value="Yes, I would" />
</div>
<div style="float: left; position: relative; left: 50%">
<div id="color" style="border-radius: 50px; transition: background-color 0.5s ease; margin-top: 30px; width: 100px; height: 100px; background-color: #6441A4; float: left; position: relative; left: -50%">
</div>
</div>
<div id="list">
</div>
</body>
</html>
@@ -0,0 +1,26 @@
<!DOCTYPE html>
<html>
<head>
<title>Viewer Page</title>
</head>
<body style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;">
<div id="app" class="full-height"></div>
<script src="https://extension-files.twitch.tv/helper/v1/twitch-ext.min.js"></script>
<!-- If you use any external libraries, such as jQuery, you must include
them as part of your extension. Twitch does not allow extensions to link
to external libraries. -->
<script src="jquery-3.3.1.min.js" type="text/javascript"></script>
<script src="viewer.js" type="text/javascript"></script>
<h2>Hello, World!</h2>
<p>Would you care to cycle a color?</p>
<div>
<input type="button" id="cycle" disabled="disabled" value="Yes, I would" />
</div>
<div style="float: left; position: relative; left: 50%">
<div id="color" style="border-radius: 50px; transition: background-color 0.5s ease; margin-top: 30px; width: 100px; height: 100px; background-color: #6441A4; float: left; position: relative; left: -50%">
</div>
</div>
<div id="list">
</div>
</body>
</html>
@@ -0,0 +1,94 @@
<!DOCTYPE html>
<html>
<head>
<title>Viewer Page</title>
</head>
<body>
<!--<script src="https://extension-files.twitch.tv/helper/v1/twitch-ext.min.js"></script>-->
<!-- If you use any external libraries, such as jQuery, you must include
them as part of your extension. Twitch does not allow extensions to link
to external libraries. -->
<!--<script src="jquery-3.3.1.min.js" type="text/javascript"></script>-->
<!--<script src="viewer.js" type="text/javascript"></script>-->
<!--<link rel="stylesheet" href="style.css">-->
<div id="playerContainer">
<div id="playerItem1" class="module">
<i class="fas fa-baseball-ball"></i>
<h1>12</h1>
<h5>Aggression Factor (AF)</h5>
</div>
<div id="playerItem2" class="module">
<i class="fas fa-baseball-ball"></i>
<h1>12%</h1>
<h5>Aggression Factor (AF)</h5>
</div>
<div id="playerItem3" class="module">
<i class="fas fa-baseball-ball"></i>
<h1>8</h1>
<h5>Aggression Factor (AF)</h5>
</div>
<div id="playerItem4" class="module">
<i class="fas fa-baseball-ball"></i>
<h1>7</h1>
<h5>Aggression Factor (AF)</h5>
</div>
<div id="playerItem5" class="module">
<i class="fas fa-baseball-ball"></i>
<h1>8</h1>
<h5>Aggression Factor (AF)</h5>
</div>
<div id="playerItem6" class="module">
<i class="fas fa-baseball-ball"></i>
<h1>22</h1>
<h5>Aggression Factor (AF)</h5>
</div>
</div>
<!-- <div class="grid">-->
<!-- <div class="module">1</div>-->
<!-- <div class="module">2</div>-->
<!-- <div class="module">3</div>-->
<!-- <div class="module">4</div>-->
<!-- <div class="module">5</div>-->
<!-- <div class="module">6</div>-->
<!-- <div class="module">7</div>-->
<!-- <div class="module">8</div>-->
<!-- <div class="module">9</div>-->
<!-- <div class="module">10</div>-->
<!-- <div class="module">11</div>-->
<!-- <div class="module">12</div>-->
<!-- <div class="module">13</div>-->
<!-- <div class="module">14</div>-->
<!-- <div class="module">15</div>-->
<!--</div>-->
<!--<h2>Hello, World!</h2>-->
<!--<p>Would you care to cycle a color?</p>-->
<!--<div>-->
<!-- <input type="button" id="cycle" disabled="disabled" value="Yes, I would" />-->
<!--</div>-->
<!--<div style="float: left; position: relative; left: 50%">-->
<!-- <div id="color" style="border-radius: 50px; transition: background-color 0.5s ease; margin-top: 30px; width: 100px; height: 100px; background-color: #6441A4; float: left; position: relative; left: -50%">-->
<!-- </div>-->
<!--</div>-->
<!--<div id="list">-->
<!--</div>-->
</body>
</html>
@@ -0,0 +1,145 @@
#container {
display: grid;
grid-template-columns: 500px;
grid-template-rows: 50px 400px 50px;
}
#item1 {
background: red;
}
#main {
background: blue;
}
#item3 {
background: yellow;
}
nav.primary-navigation {
margin: 0 auto;
display: block;
padding: 0;
text-align: center;
font-size: 16px;
}
nav.primary-navigation ul li {
list-style: none;
margin: 0 auto;
border-left: 2px solid #3ca0e7;
display: inline-block;
padding: 0 30px;
position: relative;
text-decoration: none;
text-align: center;
font-family: arvo;
}
nav.primary-navigation li a {
color: black;
}
nav.primary-navigation li a:hover {
color: #3ca0e7;
}
nav.primary-navigation li:hover {
cursor: pointer;
}
nav.primary-navigation ul li ul {
visibility: hidden;
opacity: 0;
position: absolute;
padding-left: 0;
left: 0;
display: none;
background: white;
}
nav.primary-navigation ul li:hover>ul,
nav.primary-navigation ul li ul:hover {
visibility: visible;
opacity: 1;
display: block;
min-width: 250px;
text-align: left;
padding-top: 20px;
box-shadow: 0px 3px 5px -1px #ccc;
}
nav.primary-navigation ul li ul li {
clear: both;
width: 100%;
text-align: left;
margin-bottom: 20px;
border-style: none;
}
nav.primary-navigation ul li ul li a:hover {
padding-left: 10px;
border-left: 2px solid #3ca0e7;
transition: all 0.3s ease;
}
a {
text-decoration: none;
}
a:hover {
color: #3ca0e7;
}
ul li ul li a {
transition: all 0.5s ease;
}
div#playerContainer {
width: 100%;
height: 100%;
display: grid;
grid-template-rows: 1fr 1fr;
grid-template-columns: 1fr 1fr 1fr;
grid-template-areas:
"playerItem1 playerItem2 playerItem3"
"playerItem4 playerItem5 playerItem6"
}
.module {
background: #ccc;
text-align: center;
font-size: 16px;
margin: 10px;
}
.module i {
font-size: 30px;
}
.blurred-box{
position: relative;
width: 250px;
height: 350px;
top: calc(50% - 175px);
left: calc(50% - 125px);
background: inherit;
border-radius: 2px;
overflow: hidden;
}
.blurred-box:after{
content: '';
width: 300px;
height: 300px;
background: inherit;
position: absolute;
left: -25px;
left position
right: 0;
top: -25px;
top position
bottom: 0;
box-shadow: inset 0 0 0 200px rgba(255,255,255,0.05);
filter: blur(10px);
}
@@ -0,0 +1,26 @@
<!DOCTYPE html>
<html>
<head>
<title>Viewer Page</title>
</head>
<body style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;">
<div id="app" class="full-height"></div>
<script src="https://extension-files.twitch.tv/helper/v1/twitch-ext.min.js"></script>
<!-- If you use any external libraries, such as jQuery, you must include
them as part of your extension. Twitch does not allow extensions to link
to external libraries. -->
<script src="jquery-3.3.1.min.js" type="text/javascript"></script>
<script src="viewer.js" type="text/javascript"></script>
<h2>Hello, World!</h2>
<p>Would you care to cycle a color?</p>
<div>
<input type="button" id="cycle" disabled="disabled" value="Yes, I would" />
</div>
<div style="float: left; position: relative; left: 50%">
<div id="color" style="border-radius: 50px; transition: background-color 0.5s ease; margin-top: 30px; width: 100px; height: 100px; background-color: #6441A4; float: left; position: relative; left: -50%">
</div>
</div>
<div id="list">
</div>
</body>
</html>
@@ -0,0 +1,61 @@
<!DOCTYPE html>
<html>
<head>
<title>Viewer Page</title>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.2/css/all.css" integrity="sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr" crossorigin="anonymous">
<link rel="stylesheet" href="style.css">
</head>
<body>
<script src="https://extension-files.twitch.tv/helper/v1/twitch-ext.min.js"></script>
<!-- If you use any external libraries, such as jQuery, you must include
them as part of your extension. Twitch does not allow extensions to link
to external libraries. -->
<script src="jquery-3.3.1.min.js" type="text/javascript"></script>
<script src="viewer.js" type="text/javascript"></script>
<div id="container">
<div id="item1">
<nav role="navigation" class="primary-navigation">
<ul>
<li><a href="#" id="player">player</a></li>
<li><a href="#">Work &dtrif;</a>
<ul class="dropdown">
<li><a href="#">Web Development</a></li>
<li><a href="#">Web Design</a></li>
<li><a href="#">Illustration</a></li>
<li><a href="#">Iconography</a></li>
</ul>
</li>
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
</ul>
</nav>
</div>
<div id="main">2</div>
<div id="item3">3</div>
</div>
<!--<h2>Hello, World!</h2>-->
<!--<p>Would you care to cycle a color?</p>-->
<!--<div>-->
<!-- <input type="button" id="cycle" disabled="disabled" value="Yes, I would" />-->
<!--</div>-->
<!--<div style="float: left; position: relative; left: 50%">-->
<!-- <div id="color" style="border-radius: 50px; transition: background-color 0.5s ease; margin-top: 30px; width: 100px; height: 100px; background-color: #6441A4; float: left; position: relative; left: -50%">-->
<!-- </div>-->
<!--</div>-->
<!--<div id="list">-->
<!--</div>-->
</body>
</html>
@@ -0,0 +1,26 @@
<!DOCTYPE html>
<html>
<head>
<title>Viewer Page</title>
</head>
<body style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;">
<div id="app" class="full-height"></div>
<script src="https://extension-files.twitch.tv/helper/v1/twitch-ext.min.js"></script>
<!-- If you use any external libraries, such as jQuery, you must include
them as part of your extension. Twitch does not allow extensions to link
to external libraries. -->
<script src="jquery-3.3.1.min.js" type="text/javascript"></script>
<script src="viewer.js" type="text/javascript"></script>
<h2>Hello, World!</h2>
<p>Would you care to cycle a color?</p>
<div>
<input type="button" id="cycle" disabled="disabled" value="Yes, I would" />
</div>
<div style="float: left; position: relative; left: 50%">
<div id="color" style="border-radius: 50px; transition: background-color 0.5s ease; margin-top: 30px; width: 100px; height: 100px; background-color: #6441A4; float: left; position: relative; left: -50%">
</div>
</div>
<div id="list">
</div>
</body>
</html>
@@ -0,0 +1,76 @@
var token = "";
var tuid = "";
var ebs = "";
// because who wants to type this every time?
var twitch = window.Twitch.ext;
// create the request options for our Twitch API calls
var requests = {
set: createRequest('POST', 'cycle'),
get: createRequest('GET', 'query')
};
function createRequest(type, method) {
return {
type: type,
url: location.protocol + '//localhost:8081/color/' + method,
success: updateBlock,
error: logError
}
}
function setAuth(token) {
Object.keys(requests).forEach((req) => {
twitch.rig.log('Setting auth headers');
requests[req].headers = { 'Authorization': 'Bearer ' + token }
});
}
twitch.onContext(function(context) {
twitch.rig.log(context);
});
twitch.onAuthorized(function(auth) {
// save our credentials
token = auth.token;
tuid = auth.userId;
// enable the button
$('#cycle').removeAttr('disabled');
setAuth(token);
$.ajax(requests.get);
});
function updateBlock(hex) {
twitch.rig.log('Updating block color');
$('#color').css('background-color', hex);
}
function logError(_, error, status) {
twitch.rig.log('EBS request returned '+status+' ('+error+')');
}
function logSuccess(hex, status) {
// we could also use the output to update the block synchronously here,
// but we want all views to get the same broadcast response at the same time.
twitch.rig.log('EBS request returned '+hex+' ('+status+')');
}
$(function() {
// when we click the cycle button
$('#cycle').click(function() {
if(!token) { return twitch.rig.log('Not authorized'); }
twitch.rig.log('Requesting a color cycle');
$.ajax(requests.set);
});
// listen for incoming broadcast message from our EBS
twitch.listen('broadcast', function (target, contentType, color) {
twitch.rig.log('Received broadcast color');
updateBlock(color);
});
});
@@ -0,0 +1,9 @@
$(document).ready(function() {
$("#player").click(function() {
console.log("loading into main");
$("#main").load("player.html");
});
});