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 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 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');
|
var bridgeCards = document.querySelectorAll('section.bridge-card');
|
||||||
for (var i = 0; i < bridgeCards.length; i++) {
|
for (var i = 0; i < bridgeCards.length; i++) {
|
||||||
var bridgeName = bridgeCards[i].getAttribute('data-ref');
|
var bridgeName = bridgeCards[i].getAttribute('data-ref');
|
||||||
var bridgeShortName = bridgeCards[i].getAttribute('data-short-name');
|
var bridgeShortName = bridgeCards[i].getAttribute('data-short-name');
|
||||||
var bridgeDescription = bridgeCards[i].querySelector('.description');
|
var bridgeDescription = bridgeCards[i].querySelector('.description');
|
||||||
var bridgeUrl = bridgeCards[i].getElementsByTagName('a')[0];
|
var bridgeUrlElement = bridgeCards[i].getElementsByTagName('a')[0];
|
||||||
remove_www_from_url(bridgeUrl);
|
var bridgeUrl = bridgeUrlElement.toString();
|
||||||
|
|
||||||
bridgeCards[i].style.display = 'none';
|
bridgeCards[i].style.display = 'none';
|
||||||
if (!bridgeName || !bridgeUrl) {
|
if (!bridgeName || !bridgeUrl) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -30,10 +23,7 @@ function rssbridge_list_search() {
|
||||||
if (bridgeDescription.textContent.match(searchRegex)) {
|
if (bridgeDescription.textContent.match(searchRegex)) {
|
||||||
bridgeCards[i].style.display = 'block';
|
bridgeCards[i].style.display = 'block';
|
||||||
}
|
}
|
||||||
if (bridgeUrl.toString().match(searchRegex)) {
|
if (bridgeUrl.match(searchRegex)) {
|
||||||
bridgeCards[i].style.display = 'block';
|
|
||||||
}
|
|
||||||
if (bridgeUrl.hostname === searchAsUrl.hostname) {
|
|
||||||
bridgeCards[i].style.display = 'block';
|
bridgeCards[i].style.display = 'block';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue