Diferencia entre revisiones de «Usuario:Otourly/vector.js»
Apariencia
Contenido eliminado Contenido añadido
mSin resumen de edición |
mSin resumen de edición |
||
Línea 73: | Línea 73: | ||
h = h.split('params=')[1] ; |
h = h.split('params=')[1] ; |
||
var |
var AnchuraPantalla = MoveResizeAbsolute_GetScreenWidth(); |
||
var |
var AlturaPantalla = MoveResizeAbsolute_GetScreenHeight(); |
||
var OSMDiv = document.createElement('div'); |
var OSMDiv = document.createElement('div'); |
||
Línea 80: | Línea 80: | ||
OSMDiv.style.position = "absolute"; |
OSMDiv.style.position = "absolute"; |
||
OSMDiv.style.zIndex = 5000; |
OSMDiv.style.zIndex = 5000; |
||
OSMDiv.style.top = ( |
OSMDiv.style.top = (AlturaPantalla*10/100) + "px"; |
||
OSMDiv.style.left = ( |
OSMDiv.style.left = (AnchuraPantalla*15/100) + "px"; |
||
OSMDiv.style.width = "70%"; |
OSMDiv.style.width = "70%"; |
||
OSMDiv.style.height = ( |
OSMDiv.style.height = (AlturaPantalla*80/100) + "px"; |
||
OSMDiv.style.border = "2px solid black"; |
OSMDiv.style.border = "2px solid black"; |
||
OSMDiv.style.backgroundColor = "white"; |
OSMDiv.style.backgroundColor = "white"; |
||
Línea 105: | Línea 105: | ||
var url = 'http://toolserver.org/~kolossos/openlayers/kml-on-ol.php?lang=' + mw.config.get('wgUserLanguage') + '¶ms=' + h ; |
var url = 'http://toolserver.org/~kolossos/openlayers/kml-on-ol.php?lang=' + mw.config.get('wgUserLanguage') + '¶ms=' + h ; |
||
iFrame.style.width = '100%' ; |
iFrame.style.width = '100%' ; |
||
iFrame.style.height = (( |
iFrame.style.height = ((AlturaPantalla*80/100)-100) + 'px' ; |
||
iFrame.style.clear = 'both' ; |
iFrame.style.clear = 'both' ; |
||
iFrame.src = url ; |
iFrame.src = url ; |
Revisión del 18:50 8 jun 2011
/**
* Move the coordinates which are at the top of the page
* From fr:mediawiki:common.js
*/
function moveCoord() {
var h1 = document.getElementById('firstHeading');
if(!h1) h1 = document.getElementsByTagName('h1')[0]; // Nostalgia, Standard
var coord = document.getElementById('coordinates');
if ( !coord || !h1 ) return;
coord.id = "coordinates-title";
h1.parentNode.insertBefore(coord, h1); /* déplacement de l'élément */
}
addOnloadHook(moveCoord);
// Verwendung von OpenStreetMap in Wikipedia.
// (c) 2008 by Magnus Manske
// Released under GPL
// Modified version in order to makes it work with moveCoord() above
// From fr:mediawiki:common.js
// modified to makes it work for ES : Otourly
// translation into ES : Superzerocool
if(typeof(MoveResizeAbsolute_AddMoveArea)!="function") importScriptURI('http://fr.wikipedia.org/eswiki/w/index.php?title=MediaWiki:Gadget-MoveResizeAbsolute.js&action=raw&ctype=text/javascript'); // caution the code is on FR wikipedia
function openStreetMap_Init () {
var c = document.getElementById ( 'coordinates-title' ) ;
if ( !c ) return ;
var a = c.getElementsByTagName ( 'a' ) ;
var geohack = false;
for ( var i = 0 ; i < a.length ; i++ ) {
var h = a[i].href ;
if ( !h.match(/geohack/) ) continue ;
geohack = true ;
break ;
}
if ( !geohack ) return ;
var na = document.createElement ( 'a' ) ;
na.href = 'javascript:openStreetMap_Toggle();' ;
na.title = 'Mostrar / ocultar mapa' ;
na.appendChild ( document.createTextNode ( 'Mapa' ) ) ;
c.appendChild ( document.createTextNode ( ' (' ) ) ;
c.appendChild ( na ) ;
c.appendChild ( document.createTextNode ( ') ' ) ) ;
}
function openStreetMap_Toggle () {
var c = document.getElementById ( 'coordinates-title' ) ;
if ( !c) return ;
var osm = document.getElementById ( 'OpenStreetMap' ) ;
if (osm) {
if ( osm.style.display == 'none' ) {
osm.style.display = 'block' ;
} else {
osm.style.display = 'none' ;
}
return;
}
var found_link = false ;
var a = c.getElementsByTagName ( 'a' ) ;
var h;
for ( var i = 0 ; i < a.length ; i++ ) {
h = a[i].href ;
if ( !h.match(/geohack/) ) continue ;
found_link = true ;
break ;
}
if ( !found_link ) return ; // No geohack link found
h = h.split('params=')[1] ;
var AnchuraPantalla = MoveResizeAbsolute_GetScreenWidth();
var AlturaPantalla = MoveResizeAbsolute_GetScreenHeight();
var OSMDiv = document.createElement('div');
OSMDiv.id = 'OpenStreetMap' ;
OSMDiv.style.position = "absolute";
OSMDiv.style.zIndex = 5000;
OSMDiv.style.top = (AlturaPantalla*10/100) + "px";
OSMDiv.style.left = (AnchuraPantalla*15/100) + "px";
OSMDiv.style.width = "70%";
OSMDiv.style.height = (AlturaPantalla*80/100) + "px";
OSMDiv.style.border = "2px solid black";
OSMDiv.style.backgroundColor = "white";
OSMDiv.style.overflow = "hidden";
var MoveArea = document.createElement('div');
MoveArea.style.position = "relative";
MoveArea.style.top = "0";
MoveArea.style.width = "100%";
MoveArea.style.height = "50px";
MoveArea.title = "Haga clic y arrastre para mover el mapa";
var CloseLink = document.createElement('a');
CloseLink.setAttribute("style", "float:right;margin:10px;");
CloseLink.innerHTML = "Ocultar";
CloseLink.title = "Haga clic para cerrar";
CloseLink.href = "javascript:openStreetMap_Toggle();";
MoveArea.appendChild(CloseLink);
var iFrame = document.createElement ( 'iframe' ) ;
var url = 'http://toolserver.org/~kolossos/openlayers/kml-on-ol.php?lang=' + mw.config.get('wgUserLanguage') + '¶ms=' + h ;
iFrame.style.width = '100%' ;
iFrame.style.height = ((AlturaPantalla*80/100)-100) + 'px' ;
iFrame.style.clear = 'both' ;
iFrame.src = url ;
var ResizeArea = document.createElement('div');
ResizeArea.style.position = "relative";
ResizeArea.style.top = "0";
ResizeArea.style.width = "100%";
ResizeArea.style.height = "50px";
ResizeArea.title = "Haga clic y arrastre para redimensionar el mapa";
OSMDiv.appendChild(MoveArea);
OSMDiv.appendChild(iFrame);
OSMDiv.appendChild(ResizeArea);
document.body.appendChild ( OSMDiv ) ;
var ElementsToMove = new Array(OSMDiv);
var ElementsToResize = new Array(OSMDiv, iFrame);
var ElementsMinWidth = new Array(150, 150);
var ElementsMinHeights = new Array(200, 100);
MoveResizeAbsolute_AddMoveArea(MoveArea, ElementsToMove);
MoveResizeAbsolute_AddResizeArea(ResizeArea, ElementsToResize, ElementsMinWidth, ElementsMinHeights);
}
addOnloadHook(openStreetMap_Init);