Zum Inhalt springen

„Benutzer:PDD/tooltips.js“ – Versionsunterschied

aus Wikipedia, der freien Enzyklopädie
Inhalt gelöscht Inhalt hinzugefügt
+version (wird zwar nix nutzen, aber...)
fix für übersetzte Contribs; bug report von Benutzer:Berlin-Jurist
Zeile 1: Zeile 1:
/*
// ******************** Tooltips ****** Littl *************************************************
* tooltips.js : Ripe Tooltips
*
* von [[[Benutzer:Littl]]
*
* Changelog: 2007-03-04 [PDD] angepasst auf deutsche SpecialPageNames
*/
// <nowiki>
// <nowiki>
function initmtt(){
function initmtt(){
Zeile 7: Zeile 14:
document.write("<div class='mytooltip' id='mytooltip'><a id='mtt_ripe' href='#'>R</a><br><div id='mtt_nr'> </div></div>");
document.write("<div class='mytooltip' id='mytooltip'><a id='mtt_ripe' href='#'>R</a><br><div id='mtt_nr'> </div></div>");
}
}
var mtt = null;
var mtt = null;
var mttt = null;
var mttt = null;
var mttp = false;
var mttp = false;
function ipcontribs() {
function ipcontribs() {
if (minimalVersion(29)<29) return; // ALERT 2
if (minimalVersion(29)<29) return; // ALERT 2
for (var i=0; aNode = document.getElementsByTagName("a")[i]; i++) {
for (var i=0; aNode = document.getElementsByTagName("a")[i]; i++) {
if (( hr = aNode.getAttribute("href") ) && ( hr.search(/title=Spezial:Contributions/) != -1 )) {
if (( hr = aNode.getAttribute("href") ) && ( hr.search(/Spezial:Beitr%C3%A4ge/) != -1 )) {
ip = hr.slice(hr.lastIndexOf("=") + 1);
ip = hr.slice(hr.lastIndexOf("/") + 1);
// hier stimmt was nicht, die regexp matcht IMMER, nicht nur bei IPs!
if ( ip.match(/[0-9]*.[0-9]*.[0-9]*.[0-9]*/) ) aNode.setAttribute("onMouseOver","showMTT('"+ip+"')");
if ( ip.match(/[0-9]*.[0-9]*.[0-9]*.[0-9]*/) != null) {
}
// alert("match: "+ ip.match(/[0-9]*.[0-9]*.[0-9]*.[0-9]*/) + " !");
}
aNode.setAttribute("onMouseOver","showMTT('"+ip+"')");
document.onmousemove = updateMTT;
}
}
}
document.onmousemove = updateMTT;
}
}
function updateMTT(e) {
function updateMTT(e) {
if (mtt && mttp) {
if (mtt && mttp) {
x = (document.all) ? window.event.x + document.body.scrollLeft : e.pageX;
x = (document.all) ? window.event.x + document.body.scrollLeft : e.pageX;
y = (document.all) ? window.event.y + document.body.scrollTop : e.pageY;
y = (document.all) ? window.event.y + document.body.scrollTop : e.pageY;
mtt.style.left = (x - 4) + "px";
mtt.style.left = (x - 4) + "px";
mtt.style.top = (y + 6) + "px";
mtt.style.top = (y + 6) + "px";
mttp = false;
mttp = false;
}
}
}
}
function showMTT(ip) {
function showMTT(ip) {
hideMTT();
hideMTT();
mtt = document.getElementById("mytooltip");
mtt = document.getElementById("mytooltip");
mtt.style.display = "block";
mtt.style.display = "block";
if (mttt == null) mttt = window.setTimeout("hideMTT()", 3000);
if (mttt == null) mttt = window.setTimeout("hideMTT()", 3000);
document.getElementById("mtt_ripe").href='http://www.ripe.net/fcgi-bin/whois?form_type=simple&full_query_string=&&do_search=Search&searchtext='+ip;
document.getElementById("mtt_ripe").href='http://www.ripe.net/fcgi-bin/whois?form_type=simple&full_query_string=&&do_search=Search&searchtext='+ip;
document.getElementById("mtt_ripe").firstChild.data = 'Ripe:'+ip;
document.getElementById("mtt_ripe").firstChild.data = 'Ripe:'+ip;
//document.getElementById("mtt_nr").firstChild.data = anz+' weitere Edits auf dieser Seite';
// document.getElementById("mtt_nr").firstChild.data = anz+' weitere Edits auf dieser Seite';
mttp = true;
mttp = true;
}
}
function hideMTT() {
function hideMTT() {
mttp = false;
mttp = false;
window.clearTimeout(mttt);
window.clearTimeout(mttt);
mttt = null;
mttt = null;
if (mtt) mtt.style.display = "none";
if (mtt) mtt.style.display = "none";
}
}

Version vom 4. März 2007, 20:53 Uhr

 /*
  * tooltips.js : Ripe Tooltips
  *
  * von [[[Benutzer:Littl]]
  *
  * Changelog:  2007-03-04 [PDD] angepasst auf deutsche SpecialPageNames
  */
 
 // <nowiki>
 function initmtt(){
  if (minimalVersion(29)<29) return; // ALERT 1
  document.write("<style type='text/css'>.mytooltip {position: absolute;display: none;background-color: #FFFFFF;");
  document.write("z-index: 99; border-width: 1px;border-style: solid;border-color: #000000;padding: 1px;}</style>");
  document.write("<div class='mytooltip' id='mytooltip'><a id='mtt_ripe' href='#'>R</a><br><div id='mtt_nr'> </div></div>");
 }
 
 var mtt  = null;
 var mttt = null;
 var mttp = false;
 
 function ipcontribs() {
   if (minimalVersion(29)<29) return; // ALERT 2
   for (var i=0; aNode = document.getElementsByTagName("a")[i]; i++) {
      if (( hr = aNode.getAttribute("href") )  && ( hr.search(/Spezial:Beitr%C3%A4ge/) != -1 )) {
         ip = hr.slice(hr.lastIndexOf("/") + 1);
         // hier stimmt was nicht, die regexp matcht IMMER, nicht nur bei IPs!
         if ( ip.match(/[0-9]*.[0-9]*.[0-9]*.[0-9]*/) != null) {
            // alert("match: "+ ip.match(/[0-9]*.[0-9]*.[0-9]*.[0-9]*/) + " !");
            aNode.setAttribute("onMouseOver","showMTT('"+ip+"')");
         } 
      }
   }
   document.onmousemove = updateMTT;
 }
 
 function updateMTT(e) {
   if (mtt && mttp) {
      x = (document.all) ? window.event.x + document.body.scrollLeft : e.pageX;
      y = (document.all) ? window.event.y + document.body.scrollTop  : e.pageY;
      mtt.style.left = (x - 4) + "px";
      mtt.style.top  = (y + 6) + "px";
      mttp = false;
   }
 }
 
 function showMTT(ip) {
   hideMTT();
   mtt = document.getElementById("mytooltip");
   mtt.style.display = "block";
   if (mttt == null) mttt = window.setTimeout("hideMTT()", 3000);
   document.getElementById("mtt_ripe").href='http://www.ripe.net/fcgi-bin/whois?form_type=simple&full_query_string=&&do_search=Search&searchtext='+ip;
   document.getElementById("mtt_ripe").firstChild.data = 'Ripe:'+ip;
   // document.getElementById("mtt_nr").firstChild.data = anz+' weitere Edits auf dieser Seite';
   mttp = true;
 }
 
 function hideMTT() {
   mttp = false;
   window.clearTimeout(mttt);
   mttt = null;
   if (mtt) mtt.style.display = "none";
 }
 
 addOnloadHook(initmtt);
 addOnloadHook(ipcontribs);
 // </nowiki>