Skip to content

Commit

Permalink
Merge pull request #12 from dnorhoj/Qeolvdxu/main
Browse files Browse the repository at this point in the history
Qeolvdxu/main
  • Loading branch information
dnorhoj authored Oct 18, 2021
2 parents 3a66b50 + 67bf478 commit 1125e5b
Show file tree
Hide file tree
Showing 6 changed files with 256 additions and 177 deletions.
11 changes: 5 additions & 6 deletions AntiRickRoll/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@
"HPk-VhRjNI8"
];

if(blocked_ids.find(i => location.href.includes(i))) {
chrome.storage.local.get('bypassed', result => {
console.log(result)
if(result['bypassed'] !== true) {
chrome.storage.local.get(['disabled', 'bypassed'], res => {
if(!res.disabled && blocked_ids.find(i => location.href.includes(i))) {
if(!res.bypassed) {
location = chrome.runtime.getURL("warn/warn.html")+"?"+location.href;
} else {
chrome.storage.local.set({"bypassed": false})
}
});
}
}
});
})();
52 changes: 29 additions & 23 deletions AntiRickRoll/manifest.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,30 @@
{
"content_scripts": [
{
"js": ["content.js"],
"matches": ["https://*.youtube.com/*"],
"run_at": "document_start"
}
],
"name": "AntiRickRoll",
"version": "1.3",
"description": "Never gonna rickroll you, never gonna let you get rickrolled.",
"manifest_version": 2,
"web_accessible_resources": [
"warn/warn.html"
],
"permissions": [
"storage"
],
"icons": {
"16": "icons/icon16.png",
"48": "icons/icon48.png",
"128": "icons/icon128.png"
}
}
"content_scripts": [
{
"js": ["content.js"],
"matches": ["https://*.youtube.com/*"],
"run_at": "document_start"
}
],
"name": "AntiRickRoll",
"version": "1.4",
"description": "Never gonna rickroll you, never gonna let you get rickrolled.",
"manifest_version": 3,
"web_accessible_resources": [
{
"resources": ["warn/warn.html"],
"matches": ["<all_urls>"]
}
],
"permissions": [
"storage"
],
"action": {
"default_popup": "popup/popup.html"
},
"icons": {
"16": "icons/icon16.png",
"48": "icons/icon48.png",
"128": "icons/icon128.png"
}
}
56 changes: 56 additions & 0 deletions AntiRickRoll/popup/popup.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style>
body {
--google-gray-700: rgb(95, 99, 104);
background: #fff;
color: var(--google-gray-700);
font-family: 'Segoe UI', Tahoma, sans-serif;
font-size: 75%;
}

.brand {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
padding-top: .3125rem;
padding-bottom: 1rem;
font-size: 1rem;
text-decoration: none;
white-space: nowrap;
font-weight: bold;
color: rgb(51, 51, 51);
}

.brand img {
height: 32px;
width: 32px;
vertical-align: middle;
}

#toggler {
transition: ease 100ms;
width: 100%;
font-weight: bold;
background: #fff;
border: solid 1px;
border-radius: 10px;
padding: 10px;
cursor: pointer;
}

#toggler:hover {
transition: ease 100ms;
background-color: #aaa;
}
</style>
</head>
<body>
<div class="brand">
<img src="/icons/icon48.png" alt="Logo">&nbsp; AntiRickRoll
</div>
<button id="toggler"></button>

<script src="popup.js"></script>
</body>
</html>
16 changes: 16 additions & 0 deletions AntiRickRoll/popup/popup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
(() => {
let toggler = document.querySelector('#toggler')
let update = () => {
chrome.storage.local.get(['disabled'], (result) => {
toggler.innerHTML = !result.disabled ? "Disable" : "Enable"
});
}

update()

toggler.addEventListener('click', () => {
chrome.storage.local.get(['disabled'], (res) => {
chrome.storage.local.set({"disabled": !res.disabled}, update)
});
})
})();
Loading

0 comments on commit 1125e5b

Please sign in to comment.