Created
October 17, 2018 00:20
-
-
Save kaho2063/8e568f80c739ca9e014f8225cd7865aa to your computer and use it in GitHub Desktop.
Google Chromeで除外したいURLのドメインを指定することで、検索結果からDOMロード時に非表示にするユーザースクリプト(※あくまで非表示にするだけです)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
{ | |
/** | |
* 除外したいURLのドメインリスト | |
*/ | |
const ExcludedURL = [ | |
'www.excite.co.jp', | |
]; | |
let urlCheck = linkText => { | |
return ExcludedURL.some(url => linkText.indexOf(url) > -1); | |
}; | |
document.addEventListener('DOMContentLoaded', () => { | |
let parentElements = document.querySelectorAll('div.g'); | |
Array.prototype.forEach.call(parentElements, parentElement => { | |
let link = parentElement.querySelector('a'); | |
if (urlCheck(link.href) || urlCheck(link.textContent)) { | |
parentElement.style.display = 'none'; | |
} | |
}); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment