fix: dont remove www from anchors in DOM, fix #4114 (#4135)

This commit is contained in:
Dag 2024-06-18 20:55:05 +02:00 committed by GitHub
parent 206bebc7bd
commit 00074b9bfc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,21 +1,14 @@
function rssbridge_list_search() {
function remove_www_from_url(url) {
if (url.hostname.indexOf('www.') === 0) {
url.hostname = url.hostname.substr(4);
}
}
var search = document.getElementById('searchfield').value;
var searchAsUrl = document.createElement('a');
searchAsUrl.href = search;
remove_www_from_url(searchAsUrl);
var bridgeCards = document.querySelectorAll('section.bridge-card');
for (var i = 0; i < bridgeCards.length; i++) {
var bridgeName = bridgeCards[i].getAttribute('data-ref');
var bridgeShortName = bridgeCards[i].getAttribute('data-short-name');
var bridgeDescription = bridgeCards[i].querySelector('.description');
var bridgeUrl = bridgeCards[i].getElementsByTagName('a')[0];
remove_www_from_url(bridgeUrl);
var bridgeUrlElement = bridgeCards[i].getElementsByTagName('a')[0];
var bridgeUrl = bridgeUrlElement.toString();
bridgeCards[i].style.display = 'none';
if (!bridgeName || !bridgeUrl) {
continue;
@ -30,10 +23,7 @@ function rssbridge_list_search() {
if (bridgeDescription.textContent.match(searchRegex)) {
bridgeCards[i].style.display = 'block';
}
if (bridgeUrl.toString().match(searchRegex)) {
bridgeCards[i].style.display = 'block';
}
if (bridgeUrl.hostname === searchAsUrl.hostname) {
if (bridgeUrl.match(searchRegex)) {
bridgeCards[i].style.display = 'block';
}
}