// ==UserScript== // @name TW(NL) Afstand tot dorp // @namespace c1b1.de | changed by Tuam // @version 0.3.20121105 // @include http://nl*.tribalwars.nl/game.php*screen=info_village* // ==/UserScript== // ds.distanceOnVillageProfile.user.js // Translated by BeNnOo. // fixed by Lekensteyn /* DS Entfernung im Dorfprofil Version 1.1 (c) by C1B1SE info@c1b1.de http://c1b1.de You may change string values if it's necessary for your language area. Do not republish, use in other scripts, change or reproduce this code nor a part of this code without permission from C1B1SE. This script may be forbidden in some language areas. Please look in the respective forum for further information! I won't take responsibility. */ var table = document.getElementById('content_value').getElementsByTagName('table')[1]; // Local Village var local_village = (typeof unsafeWindow != 'undefined' ? unsafeWindow : window).game_data.village.coord.split('|'); // Remote Village var remote_village = table.rows[1].cells[1].innerHTML.match(/\d+\|\d+/); remote_village = (''+remote_village).split('|'); // Calc Distance var distance = Math.sqrt( Math.pow(local_village[0] - remote_village[0], 2) + Math.pow(local_village[1] - remote_village[1], 2) ).toFixed(2); // Insert Content var row = document.createElement('tr'); table.appendChild(row); // Opera is buggy with insertRow :/ row.insertCell(0).innerHTML = 'Afstand:'; row.insertCell(1).innerHTML = distance + ' velden';