Browse Source

Add mobile support

master
KaKi87 2 months ago
parent
commit
12ab1df34f
2 changed files with 7 additions and 8 deletions
  1. +2
    -1
      GoogleSearchCloudFlareDetector/README.md
  2. +5
    -7
      GoogleSearchCloudFlareDetector/index.js

+ 2
- 1
GoogleSearchCloudFlareDetector/README.md View File

@ -10,4 +10,5 @@ Tag Google Search results pointing to CloudFlare-protected websites.
## Changelog
* `1.0.0` (2020-02-20) • [Initial release](https://greasyfork.org/fr/scripts/396682-google-search-cloudflare-detector?version=774106)
* `1.0.0` (2020-02-20) • [Initial release](https://greasyfork.org/fr/scripts/396682-google-search-cloudflare-detector?version=774106)
* `1.1.0` (2020-12-30) • Add mobile support

+ 5
- 7
GoogleSearchCloudFlareDetector/index.js View File

@ -3,7 +3,7 @@
// @name Google Search CloudFlare detector
// @description Tag Google Search results pointing to CloudFlare-protected websites
// @grant none
// @version 1.0.0
// @version 1.1.0
// @author KaKi87
// @license GPL-3.0-or-later
// @namespace https://git.kaki87.net/KaKi87/userscripts/src/branch/master/GoogleSearchCloudFlareDetector
@ -79,9 +79,7 @@ const cloudFlareCidrList = [
const isCloudFlareIp = ip => !! cloudFlareCidrList.find(cidr => isIpInCidr(ip, cidr));
const links = [...document.querySelectorAll('#search a')]
.filter(el => !el.id && !el.className);
const links = [...document.querySelectorAll('a[href*="//"]:not([href^="/"]):not([href*="google."]):not([href*="googleusercontent.com"])')];
(async () => {
@ -89,11 +87,11 @@ const links = [...document.querySelectorAll('#search a')]
const element = links[i];
const title = element.querySelector('h3');
const title = element.querySelector('h3, div[role="heading"] div');
const host = element.href.split('/')[2];
if(!title) continue;
const ip = await getIp(host);
const ip = await getIp((new URL(element.href)).host);
if(isCloudFlareIp(ip))


Loading…
Cancel
Save