Naar inhoud springen

Gebruiker:Sanderd17/vector.js

Uit Wikipedia, de vrije encyclopedie

Opmerking: na het publiceren is het wellicht nodig uw browsercache te legen om de veranderingen te zien.

  • Firefox / Safari: houd Shift ingedrukt terwijl u:je op Vernieuwen klikt of druk op Ctrl-F5 of Ctrl-R (⌘-Shift-R op een Mac)
  • Google Chrome: druk op Ctrl-Shift-R (⌘-Shift-R op een Mac)
  • Edge: houd Ctrl ingedrukt terwijl u:je op Vernieuwen klikt of druk op Ctrl-F5.
// Verwendung von OpenStreetMap in Wikipedia.
// (c) 2008 by Magnus Manske
// Released under GPL
// bron: http://de.wikipedia.org/w/index.php?title=Benutzer:Magnus_Manske/osm.js&oldid=57999905

function openStreetMapInit () {
  c = document.getElementById ( 'Coordinaten' ) ; // N.B.: "Coordinaten" ipv. "coordinates" !
  if ( !c ) return ;

  a = c.getElementsByTagName ( 'a' ) ;
  geohack = 0 ;
  for ( i = 0 ; i < a.length ; i++ ) {
    h = a[i].href ;
    if ( !h.match(/maps/) ) continue ;
    geohack = 1 ;
    break ;
  }
  if ( geohack == 0 ) return ;

  na = document.createElement ( 'a' ) ;
  na.href = '#' ;
  na.onclick = openStreetMapToggle ;
  na.appendChild ( document.createTextNode ( ' *' ) ) ;
//  c.appendChild ( document.createElement ( 'br' ) )
//  c.appendChild ( document.createTextNode ( ' (' ) ) ;
  c.appendChild ( na ) ;
//  c.appendChild ( document.createTextNode ( ')   ' ) ) ;
}

function openStreetMapToggle () {
  c = document.getElementById ( 'Coordinaten' ) ;
  if ( !c ) return ;

  cs = document.getElementById ( 'contentSub' ) ;
  osm = document.getElementById ( 'openstreetmap' ) ;

  if ( cs && osm ) {
    cs.removeChild ( osm ) ;
    return ;
  }

  var found_link = 0 ;
  a = c.getElementsByTagName ( 'a' ) ;
  for ( i = 0 ; i < a.length ; i++ ) {
    h = a[i].href ;
    if ( !h.match(/maps/) ) continue ;
    found_link = 1 ;
    break ;
  }
  if ( found_link == 0 ) return ; // No geohack link found

  h = h.split('params=')[1] ; 
  i = document.createElement ( 'iframe' ) ;
  url = 'http://tools.wikimedia.de/~magnus/ol/wp_poi.php?title=' + wgTitle ;
  url += '&language=' + wgUserLanguage ;
  url += '&params=' + h ;
  i.id = 'openstreetmap' ;
  i.style.width = '75%' ;
  i.style.height = '300px' ;
  // i.style.clear = 'both' ;
  i.src = url ;
  cs.appendChild ( i ) ;
}

$(openStreetMapInit);


// === Unwatchlink per item op volglijst ===
// Geeft op de volglijst een link "niet volgen" bij elk artikel
// Nieuwe versie d.d. 20070926

$(function () {

    // Alleen voor "Volglijst":
    if (window.location.href.indexOf("Speciaal:Volglijst") == -1) return; 

    // Niet voor "Volglijst bekijken en bewerken":
    if (window.location.href.indexOf("Speciaal:Volglijst/edit") > 0) return;

    // Idem, via link op "Ruwe volglijst bewerken":
    if (window.location.href.indexOf("Special:Watchlist/raw") > 0) return; 

    var query_prefix = "&action=unwatch";
    var count = 0;
    var links = document.getElementById('content').getElementsByTagName('a');
    for (var i = 0; i < links.length; i++) {
        if (links[i].href.substring(links[i].href.length-15) != '&action=history')
            continue;
        var unwatch = document.createElement('a');
        count++;
        if (count>35) {
         break;
        }
        unwatch.href = "/w/index.php?title=" + encodeURIComponent(links[i].title) + query_prefix;
        unwatch.title = "Verwijder "+links[i].title+" van je volglijst";
        unwatch.appendChild(document.createTextNode("unwatch"));
        links[i].parentNode.insertBefore(unwatch, links[i].nextSibling);
        // kluge to handle case where "diff" is unlinked:
        var delim = links[i].previousSibling;
        delim = (delim.nodeType == 3 ? delim.nodeValue : "");
        links[i].parentNode.insertBefore(document.createTextNode(delim.replace(/^.*diff/, "")), unwatch);
    }

});