diff --git a/blocker.js b/blocker.js
index 03bd9c4..365c807 100644
--- a/blocker.js
+++ b/blocker.js
@@ -12,6 +12,12 @@ function Flatten(str) {
return str.toLowerCase().replace(/\s/g, '')
}
+function GetConfigSettings() {
+ chrome.storage.local.get(['blockSelfPromotion'], function (result) {
+ blockSelfPromotion = result.blockSelfPromotion || false;
+ });
+}
+
async function LoadJSON() { // Fetch the embedded JSON files
try {
const [stringsData, selectorsData] = await Promise.all([
@@ -65,9 +71,6 @@ function SearchAndDestroySponsors() {
let newText = sentences
.filter(sentence => !Flatten(sentence).includes(str))
.join("");
-
- // Preserve the original line breaks
- newText = newText.replace(/\n/g, '
');
contentElement.innerHTML = newText;
}
}
@@ -99,10 +102,17 @@ function splitKeepDelimiter(input, regex) {
return result;
}
+// Collect debug info for issue reporting
+function savePageInfo() {
+ const pageURL = window.location.href; // Get the URL of the tab
+ const pageTitle = document.title; // Get the title of the tab
+ chrome.storage.local.set({ pageURL: pageURL, pageTitle: pageTitle });
+}
-
-SearchAndDestroySponsors() // Run initially
+// Call the function to save page info
+savePageInfo();
+GetConfigSettings()
// Look for changes in the DOM
new MutationObserver(SearchAndDestroySponsors)
diff --git a/manifest V3.json b/manifest V3.json
index 849204e..5715a42 100644
--- a/manifest V3.json
+++ b/manifest V3.json
@@ -1,17 +1,21 @@
{
"manifest_version": 3,
"name": "Block Sponsor Comments",
- "version": "1.4.3",
- "description": "Browser extension to remove sponsors from youtube descriptions and comments.",
+ "version": "1.5.0",
+ "description": "Browser extension to remove sponsors from YouTube descriptions and comments.",
"host_permissions": [
"*://*.youtube.com/*"
],
+ "action": {
+ "default_popup": "settings.html"
+ },
"content_scripts": [{
"matches": ["https://www.youtube.com/*"],
"js": ["blocker.js"]
}],
"web_accessible_resources": [{
"resources": [
+ "settings.html",
"*.json"
],
"matches": [
diff --git a/manifest.json b/manifest.json
index c36913c..9b13a4d 100644
--- a/manifest.json
+++ b/manifest.json
@@ -1,17 +1,22 @@
{
"manifest_version": 2,
"name": "Block Sponsor Comments",
- "version": "1.4.3",
- "description": "Browser extension to remove sponsors from youtube descriptions and comments.",
+ "version": "1.5.0",
+ "description": "Browser extension to remove sponsors from YouTube descriptions and comments.",
"permissions": [
- "*://*.youtube.com/*"
+ "*://*.youtube.com/*",
+ "storage"
],
+ "browser_action": {
+ "default_popup": "settings.html"
+ },
"content_scripts": [{
"matches": ["https://www.youtube.com/*"],
"js": ["blocker.js"],
"run_at": "document_idle"
}],
"web_accessible_resources": [
+ "settings.html",
"*.json"
],
"icons": {
diff --git a/settings.html b/settings.html
new file mode 100644
index 0000000..568bcca
--- /dev/null
+++ b/settings.html
@@ -0,0 +1,61 @@
+
+
+
+