-
Notifications
You must be signed in to change notification settings - Fork 0
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
14 changed files
with
5,490 additions
and
0 deletions.
There are no files selected for viewing
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,3 @@ | ||
node_modules/ | ||
dist/ | ||
packages/ |
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,14 @@ | ||
{ | ||
"appName": { | ||
"message": "Letterblockd", | ||
"description": "The name of the application" | ||
}, | ||
"appShortName": { | ||
"message": "lboxd user block", | ||
"description": "The short_name (maximum of 12 characters recommended) is a short version of the app's name." | ||
}, | ||
"appDescription": { | ||
"message": "Block Letterboxd users that you don't want to see reviews from", | ||
"description": "If you don't want to see content by some user on Letterboxd, then just add them to the list in the options. 馃" | ||
} | ||
} |
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,32 @@ | ||
{ | ||
"name": "__MSG_appName__", | ||
"short_name": "__MSG_appShortName__", | ||
"description": "__MSG_appDescription__", | ||
"version": "0.0.0.1", | ||
"manifest_version": 2, | ||
"default_locale": "en", | ||
"icons": { | ||
"16": "images/icon-16.png", | ||
"128": "images/icon-128.png" | ||
}, | ||
"options_page": "pages/options.html", | ||
"storage": { | ||
"managed_schema": "schema.json" | ||
}, | ||
"content_scripts": [ | ||
{ | ||
"matches": [ | ||
"http://letterboxd.com/*", | ||
"https://letterboxd.com/*" | ||
], | ||
"css": [ | ||
"styles/contentscript.css" | ||
], | ||
"js": [ | ||
"scripts/contentscript.js" | ||
], | ||
"run_at": "document_start", | ||
"all_frames": false | ||
} | ||
] | ||
} |
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,24 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title>Options</title> | ||
<link rel="stylesheet" type="text/css" href="../styles/options.css"> | ||
</head> | ||
<body> | ||
|
||
<div id="options-container"> | ||
<h1>Blocked users</h1> | ||
<p>Put one username per line. This should be the username that is in the URL when you view their profile.</p> | ||
<p>For example: If the URL of their profile looks like this "letterboxd.com/sickhornybeaver", | ||
then you would type "sickhornybeaver" in the text box below.</p> | ||
<textarea id="block-list" rows="10"></textarea> | ||
<div id="save-container"> | ||
<button id="save">Save changes</button> | ||
<div id="status"></div> | ||
</div> | ||
</div> | ||
|
||
<script src="../scripts/options.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,6 @@ | ||
{ | ||
"type": "object", | ||
"blockedUsers": { | ||
"type": "string" | ||
} | ||
} |
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,5 @@ | ||
browser.runtime.onInstalled.addListener((details) => { | ||
console.log('previousVersion', details.previousVersion) | ||
}) | ||
|
||
console.log(`'Allo 'Allo! Event Page`) |
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,40 @@ | ||
// identifier is a selector used to find the links | ||
// list is an array of blocked users | ||
// container is a selector to select which ancenstral element should be removed from the DOM | ||
function remove(identifier, list, container = identifier) { | ||
let els = document.querySelectorAll(`${identifier} a`); | ||
if (els.length === 0) return; | ||
let users = [...list]; | ||
for (let i = 0; i < els.length; i++) { | ||
for (let j = users.length - 1; j >= 0; j--) { | ||
if (els[i].getAttribute('href').indexOf('/' + users[j] + '/') !== -1) { | ||
console.log('Removed content by', users[j]); | ||
els[i].closest(container).remove(); | ||
users.splice(j, 1); | ||
} | ||
} | ||
} | ||
} | ||
|
||
function removeAll() { | ||
chrome.storage.sync.get({ | ||
blockedUsers: '[]', | ||
}, items => { | ||
if (items.blockedUsers.length > 0) { | ||
let wait = [50, 100, 200, 500, 1000, 1500, 2500, 5000]; | ||
for (let i = 0; i < 8; i++) { | ||
setTimeout(() => { | ||
var users = JSON.parse(items.blockedUsers); | ||
remove('.review-tile', users); | ||
remove('.film-detail', users); | ||
remove('.list', users); | ||
remove('.poster-container', users); | ||
remove('.people-shortlist', users, 'li'); | ||
remove('.person-summary', users, 'tr'); | ||
remove('.featured-person', users); | ||
}, wait[i]); | ||
} | ||
} | ||
}); | ||
} | ||
document.addEventListener('DOMContentLoaded', removeAll); |
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,33 @@ | ||
function saveOptions() { | ||
var userList = document.getElementById('block-list').value.split('\n'); | ||
for (let i = userList.length - 1; i >= 0; i--) { | ||
if (!userList[i]) userList.splice(i, 1); | ||
} | ||
chrome.storage.sync.set({ | ||
blockedUsers: JSON.stringify(userList), | ||
}, function() { | ||
// Update status to let user know options were saved. | ||
var status = document.getElementById('status'); | ||
status.textContent = 'Changes saved!'; | ||
setTimeout(function() { | ||
status.textContent = ''; | ||
}, 2000); | ||
}); | ||
} | ||
|
||
function restoreOptions() { | ||
// Use default value color = 'red' and likesColor = true. | ||
chrome.storage.sync.get({ | ||
blockedUsers: '[]', | ||
}, function(items) { | ||
console.log(items); | ||
console.log('options restored, bitch'); | ||
if (items.blockedUsers.length > 0) { | ||
var formatted = JSON.parse(items.blockedUsers).join('\n'); | ||
document.getElementById('block-list').value = formatted; | ||
} | ||
}); | ||
} | ||
document.addEventListener('DOMContentLoaded', restoreOptions); | ||
|
||
document.getElementById('save').addEventListener('click', saveOptions); |
Empty file.
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 @@ | ||
#options-container { | ||
display: flex; | ||
max-width: 500px; | ||
font-size: 20px; | ||
line-height: 1.5; | ||
color: #222; | ||
margin: 2rem auto; | ||
flex-direction: column; | ||
padding: 1rem; | ||
} | ||
|
||
p:first-of-type { | ||
margin-top: 0; | ||
} | ||
|
||
p { | ||
text-align: justify; | ||
} | ||
|
||
textarea { | ||
font-size: 20px; | ||
font-family: "Segoe UI", Tahoma, sans-serif; | ||
line-height: 1.5; | ||
margin-top: 1.5rem; | ||
border: 1px solid #ddd; | ||
border-radius: 4px; | ||
padding: .5rem 1rem; | ||
} | ||
|
||
button { | ||
width: 165px; | ||
font-size: 15px; | ||
letter-spacing: 1px; | ||
font-weight: 700; | ||
line-height: 1.5; | ||
margin: 1rem 0 0 0; | ||
padding: .5rem; | ||
border-radius: 100rem; | ||
text-transform: uppercase; | ||
background-color: #03cc8b; | ||
border: none; | ||
color: white; | ||
} | ||
|
||
#save-container { | ||
display: flex; | ||
margin-top: 1.75rem; | ||
} | ||
|
||
#status { | ||
margin-top: 1.1rem; | ||
margin-left: 2rem; | ||
color: #222; | ||
} |
Oops, something went wrong.