Replace Clanlinks
目前為
// ==UserScript==
// @name Munzee Clanlink Replace
// @namespace https://greasyfork.org/users/156194
// @version 0.2
// @description Replace Clanlinks
// @author rabe85
// @match https://www.munzee.com/m/*/*
// @match https://www.munzee.com/settings
// @match https://www.munzee.com/settings/*
// @grant GM_setValue
// @grant GM_getValue
// @grant GM_deleteValue
// ==/UserScript==
(function() {
'use strict';
function munzee_clanlink_replace() {
var clanlink = GM_getValue('clanlink', '');
var page = document.getElementById('timezone');
if(page) {
function clanlink_speichern() {
GM_setValue('clanlink', document.getElementById('clanlink').value);
}
document.getElementById('distance_type').parentElement.parentElement.setAttribute('style', 'margin-bottom: 10px;');
var pos = document.getElementById('email_address').parentElement.parentElement;
pos.setAttribute('style', 'margin-bottom: 10px;');
pos.insertAdjacentHTML('afterend', '<div class="clearfix col-xs-12 col-md-6 setting-box" style="margin-bottom: 25px;"><label for="xlInput">Clanlink (Automatic, if empty)</label><div><input class="form-control" id="clanlink" name="clanlink" size="30" type="text" value="' + clanlink + '"></div></div>');
document.getElementById('clanlink').addEventListener('input', clanlink_speichern, false);
} else {
var clanlink_replace0 = document.querySelectorAll('a[href^="/clans/"]');
for(var cr = 0, clanlink_replace; !!(clanlink_replace=clanlink_replace0[cr]); cr++) {
if(clanlink) {
clanlink_replace.setAttribute('href', clanlink);
} else {
var link = clanlink_replace.getAttribute('href');
if(link) {
var teamname = link.split('/')[link.split('/').length - 2];
if(teamname) {
clanlink_replace.setAttribute('href', 'http://www.munzeemeetsowl.de/redirect-clan.php?clan=' + teamname);
}
}
}
}
}
}
// DOM vollständig aufgebaut?
if (/complete|interactive|loaded/.test(document.readyState)) {
munzee_clanlink_replace();
} else {
document.addEventListener("DOMContentLoaded", munzee_clanlink_replace, false);
}
})();