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

@@ -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");
});
});