Initial commit

This commit is contained in:
Shane Lindsay 2021-04-08 03:43:22 -07:00
commit b67a9ebbdf
8 changed files with 197 additions and 0 deletions

2
.gitattributes vendored Normal file
View File

@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto

68
common/css/styles.css Normal file
View File

@ -0,0 +1,68 @@
html {
width: 300px;
height: 100px;
background: #151619;
color: #c9cbcd;
font-family: Open Sans,Segoe UI,sans-serif;
-webkit-font-smoothing: antialiased;
text-rendering: optimizeLegibility;
}
.container {
text-align: center;
padding-bottom: 10px;
}
.button-group {
display: flex;
justify-content: center;
}
.button {
border-radius: 6px;
color: #c3c4ca;
font-weight: bold;
padding: 10px 20px;
text-decoration: none;
transition: all 150ms ease-in-out;
}
.button:hover {
background-color: #1d1f23;
}
.button:not(:first-of-type) {
margin-left: 15px;
}
.button.bg-blue {
background-color: #202127;
color: #c3c4ca;
}
.button.bg-blue:hover {
background-color: #452e7c;
}
.discord {
overflow: visible;
margin-right: 3px;
display: inline-block;
}
.button-arrow .arrow-icon {
overflow: visible;
margin-left: 3px;
width: 8px;
}
.button-arrow .arrow-head {
transform: translateX(0);
transition: transform 150ms ease-in-out;
}
.button-arrow .arrow-body {
opacity: 0;
transform: scaleX(1);
transition: transform 150ms ease-in-out, opacity 150ms ease-in-out;
}
.button-arrow:hover .arrow-head {
transform: translateX(3px);
}
.button-arrow:hover .arrow-body {
opacity: 1;
transform: scaleX(2);
}

73
common/html/popup.html Normal file
View File

@ -0,0 +1,73 @@
<html>
<head>
<link rel="stylesheet" href="../css/styles.css" />
</head>
<!-- <body>
<header class="Copy__header">
<h1 class="Copy__title">TTV LOL</h1>
</header>
<div class="body">
<p>
Explore
<a
class="Link"
href="/payments"
data-js-controller="AnalyticsButton"
data-analytics-category="Links"
data-analytics-action="Clicked"
data-analytics-label="Payments features CTA"
>Stripe Payments</a
>, or create an account instantly and start accepting payments. You
can also contact us to design a custom package for your business.
</p>
</div>
<div class='container'>
<a class='button--inverse'>Create Stripe Account</a>
<a class='button'>Contact Sales</a>
</div>
</body> -->
<body>
<div class="container">
<div style="background-color: #202127; border-radius: 8px; margin: 30px;">
<img width="60%" src="../img/ttvlol.png">
</div>
<div class="button-group">
<a href="#/" class="button button-arrow bg-blue">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 20 20" fill="currentColor">
<path fill-rule="evenodd" d="M3.172 5.172a4 4 0 015.656 0L10 6.343l1.172-1.171a4 4 0 115.656 5.656L10 17.657l-6.828-6.829a4 4 0 010-5.656z" clip-rule="evenodd" />
</svg>
Donate
<svg viewBox="0 0 6 9" fill="none" xmlns="http://www.w3.org/2000/svg" class="arrow-icon">
<g class="arrow-head">
<path d="M1 1C4.5 4 5 4.38484 5 4.5C5 4.61516 4.5 5 1 8" stroke="currentColor" stroke-width="2"/>
</g>
<g class="arrow-body">
<path d="M3.5 4.5H0" stroke="currentColor" stroke-width="2"/>
</g>
</svg>
</a>
<a href="#/" class="button button-arrow">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-discord" viewBox="0 0 16 16">
<path d="M6.552 6.712c-.456 0-.816.4-.816.888s.368.888.816.888c.456 0 .816-.4.816-.888.008-.488-.36-.888-.816-.888zm2.92 0c-.456 0-.816.4-.816.888s.368.888.816.888c.456 0 .816-.4.816-.888s-.36-.888-.816-.888z"/>
<path d="M13.36 0H2.64C1.736 0 1 .736 1 1.648v10.816c0 .912.736 1.648 1.64 1.648h9.072l-.424-1.48 1.024.952.968.896L15 16V1.648C15 .736 14.264 0 13.36 0zm-3.088 10.448s-.288-.344-.528-.648c1.048-.296 1.448-.952 1.448-.952-.328.216-.64.368-.92.472-.4.168-.784.28-1.16.344a5.604 5.604 0 0 1-2.072-.008 6.716 6.716 0 0 1-1.176-.344 4.688 4.688 0 0 1-.584-.272c-.024-.016-.048-.024-.072-.04-.016-.008-.024-.016-.032-.024-.144-.08-.224-.136-.224-.136s.384.64 1.4.944c-.24.304-.536.664-.536.664-1.768-.056-2.44-1.216-2.44-1.216 0-2.576 1.152-4.664 1.152-4.664 1.152-.864 2.248-.84 2.248-.84l.08.096c-1.44.416-2.104 1.048-2.104 1.048s.176-.096.472-.232c.856-.376 1.536-.48 1.816-.504.048-.008.088-.016.136-.016a6.521 6.521 0 0 1 4.024.752s-.632-.6-1.992-1.016l.112-.128s1.096-.024 2.248.84c0 0 1.152 2.088 1.152 4.664 0 0-.68 1.16-2.448 1.216z"/>
</svg>
Discord
<svg viewBox="0 0 6 9" fill="none" xmlns="http://www.w3.org/2000/svg" class="arrow-icon">
<g class="arrow-head">
<path d="M1 1C4.5 4 5 4.38484 5 4.5C5 4.61516 4.5 5 1 8" stroke="currentColor" stroke-width="2"/>
</g>
<g class="arrow-body">
<path d="M3.5 4.5H0" stroke="currentColor" stroke-width="2"/>
</g>
</svg>
</a>
</div>
</div>
</body>
</html>

BIN
common/img/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

BIN
common/img/ttvlol.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

BIN
images/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

31
js/background.js Normal file
View File

@ -0,0 +1,31 @@
function onBeforeRequest(details) {
const match = /hls\/(.+?)$/gim.exec(details.url);
console.log("details:", details);
if (match !== null && match.length > 1) {
return {
redirectUrl: `https://api.ttv.lol/playlist/${encodeURIComponent(match[1])}`,
};
}
}
chrome.webRequest.onBeforeRequest.addListener(
onBeforeRequest,
{ urls: ["https://usher.ttvnw.net/api/channel/hls/*"] },
["blocking", "extraHeaders"]
);
function onBeforeSendHeaders(req) {
console.log("onBeforeSendHeaders:", req.requestHeaders);
req.requestHeaders.push({name:'X-Donate-To', value:"http://bowlcuts-r-us.com"})
return {
requestHeaders: req.requestHeaders
}
}
chrome.webRequest.onBeforeSendHeaders.addListener(
onBeforeSendHeaders,
{ urls: ["https://api.ttv.lol/playlist/*"] },
["blocking","requestHeaders"]
);

23
manifest.json Normal file
View File

@ -0,0 +1,23 @@
{
"background": {
"persistent": true,
"scripts": [ "js/background.js" ]
},
"browser_action": {
"default_icon": {
"128": "images/icon.png"
},
"default_popup": "common/html/popup.html",
"default_title": "TTV LOL"
},
"description": "TTV LOL",
"icons": {
"128": "images/icon.png"
},
"key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAx5wGmUxlKN2dFl5GB7BiqcDOrJhuFc6OAeuHhXsXRz8nBzETBDrDBaGrhHe/YDKUaEKA2rq2hGpXCuIa6/jHAnlYeeF0bnguOr13l+w3pFeVtp6VYEpZx0ZjegyVkhh4Dks6zdN7lrNUHM6nItS8Oa1n2YULE2r7aSiLFVT2MHBrVzPTUJHyqTnQkhga0UeIC60fJsJPwIEfSwi+xML97cOpEAlbtJTp/QLPaggh/5Iyfc92/pG2Yv5EhtqUWMpH+YviWF7WGosdxY0Z/b7gG0uE9HOLCq9Ism8CbP3VnW+8fz+iJiVVdyf2Nw3mt3jxr3jwfehfW6FwEzLmfDLFKwIDAQAB",
"manifest_version": 2,
"name": "TTV LOL",
"permissions": [ "webRequest", "webRequestBlocking", "https://*.twitch.tv/*", "https://usher.ttvnw.net/*", "cookies", "https://api.ttv.lol/playlist/*" ],
"update_url": "https://clients2.google.com/service/update2/crx",
"version": "2.2"
}