-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
1,203 additions
and
0 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
//Show options and install message on first install only. | ||
function handleInstalled(details) { | ||
if (details.reason == 'install') { | ||
let createData = { | ||
focused: true, | ||
type: "popup", | ||
url: "popup/install.html", | ||
width: 365, | ||
height: 750, | ||
}; | ||
let creating = chrome.windows.create(createData); | ||
} | ||
} | ||
|
||
chrome.runtime.onInstalled.addListener(handleInstalled); | ||
|
||
//Block ad trackers and ad serving scripts. | ||
function blockURL(requestDetails) { | ||
return { | ||
cancel: true | ||
}; | ||
} | ||
|
||
//These are the Twitch ad trackers and ad serving script URLs. | ||
chrome.webRequest.onBeforeRequest.addListener( | ||
blockURL, | ||
{urls: ["https://*.amazon-adsystem.com/*","https://cdn.krxd.net/*","https://script.ioam.de/iam.js","https://edge.quantserve.com/quant.js","https://ddacn6pr5v0tl.cloudfront.net/*","https://ddacn6pr5v0tl.cloudfront.net/custom-moat-video-native.min.js","https://d2v02itv0y9u9t.cloudfront.net/dist/1.0.5/v6s.js","https://d2v02itv0y9u9t.cloudfront.net/dist/1.0.8/v6s.js","https://d2v02itv0y9u9t.cloudfront.net/*","https://*.imrworldwide.com/*","https://countess.twitch.tv/*","https://*.scorecardresearch.com/*","https://www.googletagservices.com/tag/js/gpt.js","*://*.branch.io/*","*://comscore.com/*"]}, | ||
["blocking"] | ||
); |
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"description": "Blocks Ads on Twitch.tv.", | ||
"manifest_version": 2, | ||
"name": "Twitch Adblock", | ||
"version": "5.3.7", | ||
"icons": { | ||
"48": "icons/twitch-adblock-48x48.png", | ||
"96": "icons/twitch-adblock-96x96.png" | ||
}, | ||
"browser_action": { | ||
"default_icon": "icons/twitch-adblock-32x32.png", | ||
"default_title": "Twitch Adblock", | ||
"default_popup": "popup/index.html" | ||
}, | ||
"options_ui": { | ||
"page": "popup/index.html", | ||
"browser_style": false, | ||
"chrome_style": false | ||
}, | ||
"permissions": [ | ||
"webRequest", | ||
"webRequestBlocking", | ||
"storage", | ||
"https://*.twitch.tv/*", | ||
"https://*.amazon-adsystem.com/*","https://cdn.krxd.net/*","https://script.ioam.de/iam.js","https://edge.quantserve.com/quant.js","https://ddacn6pr5v0tl.cloudfront.net/custom-moat-video-native.min.js","https://d2v02itv0y9u9t.cloudfront.net/dist/1.0.5/v6s.js","https://*.imrworldwide.com/*","https://countess.twitch.tv/*","https://*.scorecardresearch.com/*","https://www.googletagservices.com/tag/js/gpt.js","*://*.branch.io/*","*://comscore.com/*" | ||
], | ||
"browser_specific_settings": { | ||
"gecko": { | ||
"id": "{3385c2d8-dcfd-4f92-adb7-5d8429dee164}", | ||
"strict_min_version": "57.0" | ||
} | ||
}, | ||
"background": { | ||
"scripts": ["background.js"] | ||
}, | ||
"content_scripts": [{ | ||
"matches": ["https://*.twitch.tv/*"], | ||
"run_at": "document_start", | ||
"js": ["content.js"] | ||
}] | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
<!-- This HTML will be shown when clicked on Extension Icon--> | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title>Twitch Adblock</title> | ||
<style> | ||
html, | ||
body { | ||
width: 340px; | ||
background-color: #2a2a2a; | ||
} | ||
.p1 { | ||
font-family: Arial, sans-serif; | ||
font-size: 14px; | ||
font-weight: bold; | ||
color: #fff; | ||
text-align: center; | ||
padding-top: 0px; | ||
padding-right: 30px; | ||
padding-bottom: 0px; | ||
padding-left: 30px; | ||
} | ||
.p2 { | ||
font-family: Arial, sans-serif; | ||
font-size: 14px; | ||
font-weight: bold; | ||
color: #fff; | ||
text-align: left; | ||
padding-top: 5px; | ||
padding-right: 30px; | ||
padding-bottom: 5px; | ||
padding-left: 30px; | ||
} | ||
.switch { | ||
float: right; | ||
position: relative; | ||
display: inline-block; | ||
width: 40px; | ||
height: 20px; | ||
} | ||
.switch input { | ||
opacity: 0; | ||
width: 0; | ||
height: 0; | ||
} | ||
.slider { | ||
position: absolute; | ||
cursor: pointer; | ||
top: 0; | ||
left: 0; | ||
right: 0; | ||
bottom: 0; | ||
background-color: #ff5c5c; | ||
-webkit-transition: 0.4s; | ||
transition: 0.4s; | ||
} | ||
.slider:before { | ||
position: absolute; | ||
content: ""; | ||
height: 14px; | ||
width: 14px; | ||
left: 5px; | ||
bottom: 3px; | ||
background-color: #fff; | ||
-webkit-transition: 0.4s; | ||
transition: 0.4s; | ||
} | ||
input:checked + .slider { | ||
background-color: #4cac74; | ||
} | ||
input:focus + .slider { | ||
box-shadow: 0 0 1px #4cac74; | ||
} | ||
input:checked + .slider:before { | ||
-webkit-transform: translateX(18px); | ||
-ms-transform: translateX(18px); | ||
transform: translateX(18px); | ||
} | ||
.slider.round { | ||
border-radius: 40px; | ||
} | ||
|
||
.slider.round:before { | ||
border-radius: 50%; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div id="popup-content"> | ||
<img src="logo.png" height="100%" width="100%" alt="Twitch Adblock" /> | ||
<p class="p2"> | ||
Twitch Adblocker Off / On | ||
<label class="switch"> | ||
<input type="checkbox" name="checkbox1" checked /> | ||
<span class="slider round"></span> | ||
</label> | ||
</p> | ||
<p class="p2"> | ||
"Blocking Ads" message Off / On | ||
<label class="switch"> | ||
<input type="checkbox" name="checkbox2" /> | ||
<span class="slider round"></span> | ||
</label> | ||
</p> | ||
<p class="p2">Whenever you change a setting, you have to reload the Twitch tab(s).</p> | ||
<p class="p2" style="text-align: center;"> | ||
<a href="https://github.com/cleanlock/VideoAdBlockForTwitch" target="_blank"><img src="github.png" alt="Github" height="42px" width="42px"></a> | ||
<a href="https://discord.gg/PSgWqf3v8V" target="_blank"><img src="discord.png" alt="Discord" height="42px" width="42px" style="margin-left: 10px;"></a> | ||
</p> | ||
</div> | ||
<script src="popupjs.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
<!-- This HTML will be shown on first installation --> | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title>Twitch Adblock</title> | ||
<style> | ||
html, | ||
body { | ||
width: 340px; | ||
background-color: #2a2a2a; | ||
} | ||
.p1 { | ||
font-family: Arial, sans-serif; | ||
font-size: 14px; | ||
font-weight: bold; | ||
color: #fff; | ||
text-align: center; | ||
padding-top: 0px; | ||
padding-right: 30px; | ||
padding-bottom: 0px; | ||
padding-left: 30px; | ||
} | ||
.p2 { | ||
font-family: Arial, sans-serif; | ||
font-size: 14px; | ||
font-weight: bold; | ||
color: #fff; | ||
text-align: left; | ||
padding-top: 5px; | ||
padding-right: 30px; | ||
padding-bottom: 5px; | ||
padding-left: 30px; | ||
} | ||
.switch { | ||
float: right; | ||
position: relative; | ||
display: inline-block; | ||
width: 40px; | ||
height: 20px; | ||
} | ||
.switch input { | ||
opacity: 0; | ||
width: 0; | ||
height: 0; | ||
} | ||
.slider { | ||
position: absolute; | ||
cursor: pointer; | ||
top: 0; | ||
left: 0; | ||
right: 0; | ||
bottom: 0; | ||
background-color: #ff5c5c; | ||
-webkit-transition: 0.4s; | ||
transition: 0.4s; | ||
} | ||
.slider:before { | ||
position: absolute; | ||
content: ""; | ||
height: 14px; | ||
width: 14px; | ||
left: 5px; | ||
bottom: 3px; | ||
background-color: #fff; | ||
-webkit-transition: 0.4s; | ||
transition: 0.4s; | ||
} | ||
input:checked + .slider { | ||
background-color: #4cac74; | ||
} | ||
input:focus + .slider { | ||
box-shadow: 0 0 1px #4cac74; | ||
} | ||
input:checked + .slider:before { | ||
-webkit-transform: translateX(18px); | ||
-ms-transform: translateX(18px); | ||
transform: translateX(18px); | ||
} | ||
.slider.round { | ||
border-radius: 40px; | ||
} | ||
|
||
.slider.round:before { | ||
border-radius: 50%; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div id="popup-content"> | ||
<img src="logo.png" height="100%" width="100%" alt="Twitch Adblock" /> | ||
<p class="p1">Thank you for installing Twitch Adblock!</p> | ||
<p class="p1">In order to provide full functionality, please make sure that you disable any other Adblocker for Twitch.</p> | ||
<p class="p2"> | ||
Twitch Adblocker Off / On | ||
<label class="switch"> | ||
<input type="checkbox" name="checkbox1" checked /> | ||
<span class="slider round"></span> | ||
</label> | ||
</p> | ||
<p class="p2"> | ||
"Blocking Ads" message Off / On | ||
<label class="switch"> | ||
<input type="checkbox" name="checkbox2" /> | ||
<span class="slider round"></span> | ||
</label> | ||
</p> | ||
<p class="p1">You can access these settings at any time by clicking on the extension icon.</p> | ||
<p class="p2" style="text-align: center;"> | ||
<a href="https://github.com/cleanlock/VideoAdBlockForTwitch" target="_blank"><img src="github.png" alt="Github" height="42px" width="42px"></a> | ||
<a href="https://discord.gg/PSgWqf3v8V" target="_blank"><img src="discord.png" alt="Discord" height="42px" width="42px" style="margin-left: 10px;"></a> | ||
</p> | ||
</div> | ||
<script src="popupjs.js"></script> | ||
</body> | ||
</html> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
"use strict"; | ||
|
||
var onOff = document.querySelector("input[name=checkbox1]"); | ||
var blockingMessage = document.querySelector("input[name=checkbox2]"); | ||
|
||
onOff.addEventListener('change', function() { | ||
saveOptions(); | ||
}); | ||
|
||
blockingMessage.addEventListener('change', function() { | ||
saveOptions(); | ||
}); | ||
|
||
function saveOptions() { | ||
if (document.querySelector("input[name=checkbox1]").checked) { | ||
browser.storage.sync.set({ | ||
onOffTTV: "true" | ||
}); | ||
} else { | ||
browser.storage.sync.set({ | ||
onOffTTV: "false" | ||
}); | ||
} | ||
if (document.querySelector("input[name=checkbox2]").checked) { | ||
browser.storage.sync.set({ | ||
blockingMessageTTV: "true" | ||
}); | ||
} else { | ||
browser.storage.sync.set({ | ||
blockingMessageTTV: "false" | ||
}); | ||
} | ||
} | ||
|
||
function restoreOptions() { | ||
var onOff = browser.storage.sync.get('onOffTTV'); | ||
onOff.then((res) => { | ||
if (res.onOffTTV == "true") { | ||
document.querySelector("input[name=checkbox1]").checked = true; | ||
} else if (res.onOffTTV == "false") { | ||
document.querySelector("input[name=checkbox1]").checked = false; | ||
} | ||
}); | ||
var blockingMessage = browser.storage.sync.get('blockingMessageTTV'); | ||
blockingMessage.then((res) => { | ||
if (res.blockingMessageTTV == "true") { | ||
document.querySelector("input[name=checkbox2]").checked = true; | ||
} else if (res.blockingMessageTTV == "false") { | ||
document.querySelector("input[name=checkbox2]").checked = false; | ||
} | ||
}); | ||
} | ||
|
||
document.addEventListener('DOMContentLoaded', restoreOptions); |