mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2024-11-21 17:15:25 +03:00
parent
206bebc7bd
commit
00074b9bfc
1 changed files with 5 additions and 15 deletions
|
@ -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';
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue