Kategorien
MediaWiki:Gesamtkarte.js
Hinweis
Nach dem Speichern sollte zunächst der Browser-Cache geleert werden, bevor man die Auswirkungen der Änderung sehen kann.
Nach dem Speichern sollte zunächst der Browser-Cache geleert werden, bevor man die Auswirkungen der Änderung sehen kann.
- Mozilla/Firefox/Safari: Strg + R (Mactaste + R bei Macintosh) drücken
- Konqueror: F5 drücken
- Opera: kompletten Cache unter Extras → Internetspuren löschen → Individuelle Auswahl leeren
- Internet Explorer: Strg + F5
// Code für die [[Gesamtkarte]] // Einbindung in [[MediaWiki:Common.js#Gesamtkarte]] function map_click(event) { // Alle folgenden Pixelangaben siehe in show_map_position // Alle folgenden sonstigen Zahlen sind Minimalkoordinatenangaben. var offsetX = 55, offsetY = 80; if (this.id == 'map_img_narubia' || ((this.id == 'map_horz' || this.id == 'map_vert') && document.getElementById('map_vert').style.top.substring(0, 1) == '0' && document.getElementById('map_horz').style.left == '1185px')) { offsetX = 498; offsetY = 50; } else if (this.id == 'map_img_eisinsel' || ((this.id == 'map_horz' || this.id == 'map_vert') && document.getElementById('map_vert').style.top == '150px')) { offsetX = 1002; offsetY = 1001; } else if (this.id == 'map_img_felsinsel' || ((this.id == 'map_horz' || this.id == 'map_vert') && document.getElementById('map_vert').style.top == '300px')) { offsetX = 134; offsetY = 121; } else if (this.id == 'map_vert' && this.style.top == '450px') offsetY = 110; if (window.event) // Internet Explorer, Opera, Konqueror, Safari { if (this.id != 'map_vert') document.map_form.map_x.value = Math.floor((window.event.offsetX - 2) / 15 + offsetX); if (this.id != 'map_horz') document.map_form.map_y.value = Math.floor((window.event.offsetY - 2) / 15 + offsetY); } else { if (this.id != 'map_vert') document.map_form.map_x.value = Math.floor((event.layerX - 2) / 15 + offsetX); if (this.id != 'map_horz') document.map_form.map_y.value = Math.floor((event.layerY - 2) / 15 + offsetY); } show_map_position(); } function get_koords_position(str, x, y) { // Hilfsfunktion: Position von "x,y" in str ermitteln, sodass vor und nach dem Ergebnis keine Ziffer steht. if (str.indexOf(' ' + x + ',' + y + ';') > -1) return str.indexOf(' ' + x + ',' + y + ';') + 1; else if (str.indexOf(' ' + x + ',' + y + '{') > -1) return str.indexOf(' ' + x + ',' + y + '{') + 1; else if (str.indexOf('}' + x + ',' + y + ';') > -1) return str.indexOf('}' + x + ',' + y + ';') + 1; else return str.indexOf('}' + x + ',' + y + '{') + 1; } function show_map_position() { var map_horz = document.getElementById('map_horz'); var map_vert = document.getElementById('map_vert'); var gebiet = gebiet_map_position(document.map_form.map_x.value, document.map_form.map_y.value); var map_out = document.getElementById('map_out'); var map_out_ort = document.getElementById('map_out_ort'); if (gebiet != '') { map_out.firstChild.href = '/index.php/' + gebiet; map_out.firstChild.firstChild.nodeValue = gebiet; map_out.firstChild.nextSibling.nextSibling.href = '/index.php/Karte:' + gebiet; ort = ort_map_position(document.map_form.map_x.value, document.map_form.map_y.value); if (ort != '') { map_out_ort.firstChild.nextSibling.firstChild.nodeValue = ort; map_out_ort.firstChild.nextSibling.href = '/index.php/' + ort; map_out_ort.style.display = 'inline'; } else map_out_ort.style.display = 'none'; map_out.style.visibility = 'visible'; } else map_out.style.visibility = 'hidden'; if (gebiet == '' || document.map_form.map_x.value < 1 || document.map_form.map_y.value < 1) { map_horz.style.display = 'none'; map_vert.style.display = 'none'; return false; } if (gebiet == 'Linya') { map_horz.style.left = '0'; map_vert.style.top = '450px'; map_horz.style.width = '1320px'; map_vert.style.height = '180px'; map_horz.style.top = String(document.map_form.map_y.value * 15 - 1200) + 'px'; map_vert.style.left = String(document.map_form.map_x.value * 15 - 825) + 'px'; } else if (gebiet == 'Narubia') { map_horz.style.left = '1185px'; map_vert.style.top = '0'; map_horz.style.width = '180px'; map_vert.style.height = '135px'; map_horz.style.top = String(document.map_form.map_y.value * 15 - 750) + 'px'; map_vert.style.left = String(document.map_form.map_x.value * 15 - 6285) + 'px'; } else if (gebiet == 'Gefrorene Insel') { map_horz.style.left = '1200px'; map_vert.style.top = '150px'; map_horz.style.width = '165px'; map_vert.style.height = '135px'; map_horz.style.top = String(document.map_form.map_y.value * 15 - 14790) + 'px'; map_vert.style.left = String(document.map_form.map_x.value * 15 - 13830) + 'px'; } else if (gebiet == 'Felsinsel') { map_horz.style.left = '1185px'; map_vert.style.top = '300px'; map_horz.style.width = '180px'; map_vert.style.height = '135px'; map_horz.style.top = String(document.map_form.map_y.value * 15 - 1815) + 'px'; map_vert.style.left = String(document.map_form.map_x.value * 15 - 2010) + 'px'; } else { map_horz.style.left = '0'; map_vert.style.top = '0'; if (document.map_form.map_y.value > 110 && document.map_form.map_y.value < 121) map_horz.style.width = '1320px'; else map_horz.style.width = '1170px'; // Linya-Breite map_vert.style.height = '630px'; map_horz.style.top = String(document.map_form.map_y.value * 15 - 1200) + 'px'; map_vert.style.left = String(document.map_form.map_x.value * 15 - 825) + 'px'; } map_horz.style.display = 'block'; map_vert.style.display = 'block'; return false; } function init_map() { var map_nav = document.getElementById('map_nav'); if (map_nav) { map_nav.firstChild.style.display = 'none'; var map_form, map_x, map_y, map_submit, map_kartenlink, map_link_img; map_form = document.createElement('form'); map_form.name = 'map_form'; map_x = document.createElement('input'); map_y = document.createElement('input'); map_x.type = 'text'; map_y.type = 'text'; map_x.id = 'map_x'; map_y.id = 'map_y'; map_x.size = '3'; map_y.size = '3'; map_x.style.textAlign = 'right'; map_y.style.textAlign = 'right'; map_submit = document.createElement('input'); map_submit.type = 'submit'; map_submit.value = 'OK'; map_form.appendChild(document.createTextNode('X: ')); map_form.appendChild(map_x); map_form.appendChild(document.createTextNode(' Y: ')); map_form.appendChild(map_y); map_form.appendChild(document.createTextNode(' ')); map_form.appendChild(map_submit); map_form.onsubmit = show_map_position; map_nav.insertBefore(map_form, map_nav.firstChild); map_kartenlink = document.createElement('a'); map_link_img = document.createElement('img'); map_link_img.src = 'http://www.fwwiki.de/images/4/41/12px-Erde.png'; map_link_img.border = '0'; map_kartenlink.appendChild(map_link_img); document.getElementById('map_out').insertBefore(map_kartenlink, document.getElementById('map_out_ort')); document.getElementById('map_img').onclick = map_click; document.getElementById('map_img_narubia').onclick = map_click; document.getElementById('map_img_eisinsel').onclick = map_click; document.getElementById('map_img_felsinsel').onclick = map_click; document.getElementById('map_horz').onclick = map_click; document.getElementById('map_vert').onclick = map_click; } } aOnloadFunctions[aOnloadFunctions.length] = init_map;