diff --git a/background.js b/background.js index 227c368e..35217ff5 100644 --- a/background.js +++ b/background.js @@ -1604,6 +1604,8 @@ ext_api.runtime.onMessage.addListener(function (message, sender) { let article_new = doc.querySelector(message.data.selector_source); if (article_new) html = article_new.outerHTML; + else + html = ''; } } message.data.html = html; diff --git a/changelog.txt b/changelog.txt index 57c0a59a..513fcbed 100644 --- a/changelog.txt +++ b/changelog.txt @@ -4,6 +4,7 @@ Updates (install signed xpi-file): https://gitlab.com/magnolia1234/bypass-paywal Post-release Add Ringier Axel Springer Polska +Update custom sites (search) * v3.6.1.0 (2024-03-24) Add Blick.ch (Ringier Gruppe) diff --git a/contentScript.js b/contentScript.js index 85754918..d5994e7a 100644 --- a/contentScript.js +++ b/contentScript.js @@ -6561,6 +6561,7 @@ function getSelectorLevel(selector) { function replaceDomElementExtSrc(url, url_src, html, proxy, base64, selector, text_fail = '', selector_source = selector, selector_archive = selector) { let article = document.querySelector(selector); + let no_content_msg = ' | no article content found! | :'; if (html) { if (!proxy && base64) { html = decode_utf8(atob(html)); @@ -6604,10 +6605,10 @@ function replaceDomElementExtSrc(url, url_src, html, proxy, base64, selector, te }, 200); } } else - replaceTextFail(url, article, proxy, text_fail); + replaceTextFail(url, article, proxy, text_fail.replace(':', no_content_msg)); }, 200); } else { - replaceTextFail(url, article, proxy, text_fail); + replaceTextFail(url, article, proxy, url_src ? text_fail.replace(':', no_content_msg) : text_fail); } } @@ -6618,7 +6619,7 @@ function replaceTextFail(url, article, proxy, text_fail) { text_fail_div.appendChild(document.createTextNode(text_fail)); if (proxy) { if (url.startsWith('https://archive.')) { - text_fail_div = archiveLink(url.replace(/^https:\/\/archive\.\w{2}\//, '')); + text_fail_div = archiveLink(url.replace(/^https:\/\/archive\.\w{2}\//, ''), text_fail); } else { let a_link = document.createElement('a'); a_link.innerText = url; diff --git a/custom/manifest.json b/custom/manifest.json index 2247b972..67333b67 100644 --- a/custom/manifest.json +++ b/custom/manifest.json @@ -51,5 +51,5 @@ "webRequestBlocking", "*://*/*" ], - "version": "3.6.1.1" + "version": "3.6.1.2" } diff --git a/manifest.json b/manifest.json index 337b75d6..9e33df8e 100644 --- a/manifest.json +++ b/manifest.json @@ -867,5 +867,5 @@ "*://archive.vn/*", "*://webcache.googleusercontent.com/*" ], - "version": "3.6.1.1" + "version": "3.6.1.2" } diff --git a/options/options_custom.html b/options/options_custom.html index 0bbc25c7..2b009441 100644 --- a/options/options_custom.html +++ b/options/options_custom.html @@ -38,7 +38,8 @@ -
+ +

permissions granted (for all in custom list + updated):
diff --git a/options/options_custom.js b/options/options_custom.js index 0d25100a..722bf4c8 100644 --- a/options/options_custom.js +++ b/options/options_custom.js @@ -510,6 +510,30 @@ function renderOptions() { }); } +function handleSearch() { + let search = document.getElementById('search').value.toLowerCase().replace('www.', ''); + let listItems = document.querySelectorAll('select#sites > option'); + ext_api.storage.local.get({ + sites_custom: {} + }, function (items) { + let sites_custom = items.sites_custom; + let grouped_sites = filterObject(sites_custom, function (val, key) { + return val.group + }, function (val, key) { + return [val.domain, val.group.split(',')] + }); + for (let item of listItems) { + let itemDomain = sites_custom[item.value].domain; + let itemText = item.value.toLowerCase(); + let itemGroup = itemDomain ? grouped_sites[itemDomain] : ''; + if (itemText.includes(search) || (itemDomain.includes(search) || (itemGroup && itemGroup.includes(search)))) + item.style.display = 'block'; + else + item.style.display = 'none'; + } + }); +} + document.addEventListener('DOMContentLoaded', renderOptions); document.getElementById('save').addEventListener('click', save_options); document.getElementById('sort').addEventListener('click', sort_options); @@ -521,6 +545,7 @@ document.getElementById('add').addEventListener('click', add_options); document.getElementById('delete').addEventListener('click', delete_options); document.getElementById('delete_default').addEventListener('click', delete_default_options); document.getElementById('edit').addEventListener('click', edit_options); +document.getElementById('search').addEventListener('input', handleSearch); if (custom_switch) { document.getElementById('perm_request').addEventListener('click', request_permissions); document.getElementById('perm_remove').addEventListener('click', remove_permissions);