Skip to content

Instantly share code, notes, and snippets.

@kaho2063
Created October 17, 2018 00:20
Show Gist options
  • Save kaho2063/8e568f80c739ca9e014f8225cd7865aa to your computer and use it in GitHub Desktop.
Save kaho2063/8e568f80c739ca9e014f8225cd7865aa to your computer and use it in GitHub Desktop.
Google Chromeで除外したいURLのドメインを指定することで、検索結果からDOMロード時に非表示にするユーザースクリプト(※あくまで非表示にするだけです)
"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