Created
June 18, 2020 08:00
-
-
Save enlavin/3849253cac5f3a852e35c39e9a7edf13 to your computer and use it in GitHub Desktop.
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
// ==UserScript== | |
// @name dotmain | |
// @namespace http://enlavin.com/ | |
// @version 0.1 | |
// @description Adds a dot at the end of the url domains to mess up with ads | |
// @author enlavin | |
// @match http*://*/* | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
function dotit(url) { | |
var u = new URL(url, location.href); | |
if (u.hostname != '' && u.hostname[u.length - 1] != '.') { | |
u.hostname += '.'; | |
} | |
return u.toString(); | |
} | |
//if (location.href[location.href.length - 1] != '.') { | |
// location.href = dotit(location.href); | |
//} | |
var links = document.getElementsByTagName('a'); | |
for (var idx in links) { | |
var a = links[idx]; | |
try { | |
a.href = dotit(a.href); | |
} catch (e) { | |
continue; | |
} | |
console.log(a.hostname); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment