Jump to content

User:Lupin/sandbox/taralPatch

From Wikipedia, the free encyclopedia
--- d/popupsdev.js.wiki	2005-12-09 17:30:12.000000000 -0500
+++ ../User:Lupin/popupsdev.js	2005-12-09 17:21:10.000000000 -0500
@@ -2479,43 +2478,48 @@ function makeOverDraggable() {
   Drag.start=function (e) { if (!e.shiftKey) return; 
                             Drag.originalStart.apply(this, [e]); 
                             return false; }
   Drag.init(over);
 };
 
 function mouseOverWikiLink() {
   return mouseOverWikiLink2(this);
 };
 
-function mouseOverWikiLink2(a) {
+window.mouseOverWikiLink2=function(a) {
   // FIXME: should not generate the HTML until the delay has elapsed,
   //        and then popup immediately. Can be a CPU hog otherwise.
  
   log('mouseOverWikiLink: a='+a+', window.currentLink='+window.currentLink);
 
   // try not to duplicate effort
   if (a==window.currentLink) return;
   window.currentLink=a;
 
   if (typeof over != undef && over != null
       && typeof over.dragging != undef && over.dragging) return;
 
-  // increment global counter now
-  popupIdNumber++;
-
 
   if (getValueOf('simplePopups') && window.popupStructure===null) {
     // reset *default value* of popupStructure
     log ('simplePopups is true and no popupStructure selected. Defaulting to "original"');
     newOption('popupStructure', "'original'");
   }
+  
+  a.popup_display_timer=setTimeout(function() { displayPopup(a); }, 100 );
+
+};
 
+window.displayPopup=function(a) {
+  // increment global counter now
+  clearTimeout(a.popup_display_timer);
+  popupIdNumber++;
   var html = popupHTML(a);
   var article=articleFromAnchor(a); 
   var oldid=oldidFromAnchor(a);
 
   if (popupImageTimer != null) {
     clearInterval(popupImageTimer);
     counter=0;
   }
   
   // keep this (or fix other refs)
@@ -2960,32 +2965,38 @@ function fuzzyCursorOffOver(fuzz) {
 
 window.fuzzyCursorOff=function(fuzz) {
   return fuzzyCursorOffOver(fuzz) && fuzzyCursorOffMenus(fuzz);
 }
 
 // seems that fuzzyCursorOff should precede mouseOutWikiLink in the source
 // or sometimes during page loads, errors are generated
 
 var stopPopupTimer=null;
 
-function mouseOutWikiLink () {
+window.mouseOutWikiLink=function (a) {
+  if (a && typeof a.popup_display_timer !== undef) {
+    clearTimeout(a.popup_display_timer);
+    delete a.popup_display_timer;
+  }
   if (typeof over != undef &&  over && over.dragging) return null;
   if (fuzzyCursorOff(5)) { 
     if (window.stopPopupTimer) {
       clearInterval(window.stopPopupTimer); 
       window.stopPopupTimer=null; 
     }
     killPopup(); 
     return;
   }
+  // at this point, we've left the link but remain within the popup
+  // so we call this function again until we leave the popup.
   if (!window.stopPopupTimer) 
-    window.stopPopupTimer=setInterval("mouseOutWikiLink()", 500);
+    window.stopPopupTimer=setInterval(mouseOutWikiLink, 500);
 };
 
 function killPopup() {
   // o3_showingsticky should be defined in overlib.js
   //if ( typeof o3_showingsticky != "undefined" && o3_showingsticky == 0 ) {
   if (getValueOf('popupShortcutKeys')) rmPopupShortcuts();
   cClick();
   window.currentLink=null;
   abortAllDownloads();
   stopImagesDownloading();