-
Notifications
You must be signed in to change notification settings - Fork 7
/
render_unlocked_komoot_regions.user.js
42 lines (35 loc) · 1.45 KB
/
render_unlocked_komoot_regions.user.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// ==UserScript==
// @name Render Unlocked Komoot Regions
// @namespace http://tampermonkey.net/
// @version 0.2
// @include /^https?://www\.komoot\.(.*)/product/regions(.*)
// @grant none
// ==/UserScript==
function GM_main () {
window.onload = function () {
function loadScriptFromGithub() {
const http = new XMLHttpRequest();
http.open("GET", "https://raw.githubusercontent.com/cahz/komoot-unlocked-regions/master/view.js", true);
http.onreadystatechange = function() {
console.log(http.status);
if(http.readyState == 4 && http.status == 200) {
const d = document;
const scriptNode = d.createElement ('script');
scriptNode.type = "text/javascript";
scriptNode.textContent = http.responseText;
const eHead = d.getElementsByTagName('head')[0] || d.body || d.documentElement;
eHead.appendChild (scriptNode);
}
}
http.send();
}
// run loadScriptFromGithub after 1sec
setTimeout(loadScriptFromGithub, 1000);
}
}
const d = document;
const scriptNode = d.createElement ('script');
scriptNode.type = "text/javascript";
scriptNode.textContent = '(' + GM_main.toString() + ')()';
const eHead = d.getElementsByTagName('head')[0] || d.body || d.documentElement;
eHead.appendChild (scriptNode);