MediaWiki:Common.js: Unterschied zwischen den Versionen

Aus SchnuppTrupp
Wechseln zu: Navigation, Suche
(Die Seite wurde neu angelegt: „Das folgende JavaScript wird für alle Benutzer geladen.: //================================================================================ //*** Dynamic N…“)
 
 
(60 dazwischenliegende Versionen von 2 Benutzern werden nicht angezeigt)
Zeile 1: Zeile 1:
 
/* Das folgende JavaScript wird für alle Benutzer geladen. */
 
/* Das folgende JavaScript wird für alle Benutzer geladen. */
  
//================================================================================
+
function rskpopup (url,t_name,x,y) {
//*** Dynamic Navigation Bars
+
    var lat = url.match(/c1=[0-9]+[NS]+[0-9]+/);
+
    var lng = url.match(/c2=[0-9]+[OW]+[0-9]+/);
// set up the words in your language
+
    var map = url.match(/map=[RU]+[0-9]?/);
var NavigationBarHide = 'Einklappen';
+
    var gomap=0;
var NavigationBarShow = 'Ausklappen';
+
    switch (map[0]) {
+
        case "map=R":
// set up max count of Navigation Bars on page,
+
          gomap=0;
// if there are more, all will be hidden
+
          break;
// NavigationBarShowDefault = 0; // all bars will be hidden
+
        case "map=U":
// NavigationBarShowDefault = 1; // on pages with more than 1 bar all bars will be hidden
+
          gomap=1;
if (typeof NavigationBarShowDefault == 'undefined' ) {
+
          break;
    var NavigationBarShowDefault = 1;
+
        case "map=U2":
 +
          gomap=2;
 +
          break;
 +
        default:
 +
          gomap=0;
 +
    }
 +
    var map_url = 'http://www.schnupptrupp.org/Weltkarte/google/Weltkarte.html?'+lat[0]+'&'+lng[0]+'&'+map[0];
 +
    var map_is_open = open ('','Weltkarte');
 +
    if (map_is_open.location.href == 'about:blank'){
 +
        map_is_open.location = map_url;
 +
    } else {
 +
        lat=lat[0].match(/[0-9]+[NS]+[0-9]+/);
 +
        lng=lng[0].match(/[0-9]+[OW]+[0-9]+/);
 +
        var rspoint = map_is_open.RunescapeLatLngtoEuclidianLatLng(lat[0],lng[0]);
 +
        map_is_open.wikimarker.setPosition(rspoint);
 +
        map_is_open.switchLayer(gomap)
 +
        map_is_open.EuclideanMap.setZoom(6);
 +
        map_is_open.EuclideanMap.panTo(rspoint);
 +
        map_is_open.focus();
 +
    }
 
}
 
}
 
// adds show/hide-button to navigation bars
 
addOnloadHook(function() {
 
// shows and hides content and picture (if available) of navigation bars
 
// Parameters:
 
//    indexNavigationBar: the index of navigation bar to be toggled
 
function toggleNavigationBar(NavToggle, NavFrame)
 
{
 
  if (!NavFrame || !NavToggle) {
 
  return false;
 
  }
 
 
  // if shown now
 
  if (NavToggle.firstChild.data == NavigationBarHide) {
 
  for (
 
  var NavChild = NavFrame.firstChild;
 
  NavChild != null;
 
  NavChild = NavChild.nextSibling
 
  ) {
 
  if (NavChild.className == 'NavPic') {
 
  NavChild.style.display = 'none';
 
  }
 
  if (NavChild.className == 'NavContent') {
 
  NavChild.style.display = 'none';
 
  }
 
  if (NavChild.className == 'NavToggle') {
 
  NavChild.firstChild.data = NavigationBarShow;
 
  }
 
  }
 
 
  // if hidden now
 
  } else if (NavToggle.firstChild.data == NavigationBarShow) {
 
  for (
 
  var NavChild = NavFrame.firstChild;
 
  NavChild != null;
 
  NavChild = NavChild.nextSibling
 
  ) {
 
  if (NavChild.className == 'NavPic') {
 
  NavChild.style.display = 'block';
 
  }
 
  if (NavChild.className == 'NavContent') {
 
  NavChild.style.display = 'block';
 
  }
 
  if (NavChild.className == 'NavToggle') {
 
  NavChild.firstChild.data = NavigationBarHide;
 
  }
 
  }
 
  }
 
}
 
 
function toggleNavigationBarFunction(NavToggle, NavFrame) {
 
return function() {
 
toggleNavigationBar(NavToggle, NavFrame);
 
return false;
 
};
 
}
 
// iterate over all NavFrames
 
var content = document.getElementById("content") || document.getElementById("mw_content");
 
var NavFrames = getElementsByClassName(content, "div", "NavFrame");
 
// if more Navigation Bars found and not template namespace than Default: hide all
 
var initiallyToggle = NavigationBarShowDefault < NavFrames.length && wgNamespaceNumber != 10;
 
for (var i=0;  i<NavFrames.length; i++) {
 
var NavFrame = NavFrames[i];
 
var NavToggle = document.createElement("a");
 
NavToggle.className = 'NavToggle';
 
NavToggle.setAttribute('href', '#');
 
 
var NavToggleText = document.createTextNode(NavigationBarHide);
 
NavToggle.appendChild(NavToggleText);
 
 
// add NavToggle-Button as first div-element
 
// in < div class="NavFrame" >
 
NavFrame.insertBefore(NavToggle, NavFrame.firstChild);
 
 
NavToggle.onclick = toggleNavigationBarFunction(NavToggle, NavFrame);
 
if (initiallyToggle) {
 
toggleNavigationBar(NavToggle, NavFrame);
 
}
 
}
 
});
 

Aktuelle Version vom 17. April 2018, 16:34 Uhr

/* Das folgende JavaScript wird für alle Benutzer geladen. */

function rskpopup (url,t_name,x,y) {
    var lat = url.match(/c1=[0-9]+[NS]+[0-9]+/);
    var lng = url.match(/c2=[0-9]+[OW]+[0-9]+/);
    var map = url.match(/map=[RU]+[0-9]?/);
    var gomap=0;
    switch (map[0]) {
        case "map=R":
           gomap=0;
           break;
        case "map=U":
           gomap=1;
           break;
        case "map=U2":
           gomap=2;
           break;
        default:
           gomap=0;
    }
    var map_url = 'http://www.schnupptrupp.org/Weltkarte/google/Weltkarte.html?'+lat[0]+'&'+lng[0]+'&'+map[0];
    var map_is_open = open ('','Weltkarte');
    if (map_is_open.location.href == 'about:blank'){
        map_is_open.location = map_url;
    } else {
        lat=lat[0].match(/[0-9]+[NS]+[0-9]+/);
        lng=lng[0].match(/[0-9]+[OW]+[0-9]+/);
        var rspoint = map_is_open.RunescapeLatLngtoEuclidianLatLng(lat[0],lng[0]);
        map_is_open.wikimarker.setPosition(rspoint);
        map_is_open.switchLayer(gomap)
        map_is_open.EuclideanMap.setZoom(6);
        map_is_open.EuclideanMap.panTo(rspoint);
        map_is_open.focus();
    }
}