0

This script broke for current gecko browsers. It users Window.captureEvents() and Window.releaseEvents(). The release function no longer appears to be working. Is there a greasemonkey script that can override this script and release the lock from the child window?

var winModalWindowLevel1

function IgnoreEvents(e)
{
  return false;
}
function ShowWindow(URL, name, property)
{
  URL = secureURL(URL);
  if(window.showModalDialog)
  {
    window.onclick=IgnoreEvents;
    window.onfocus=HandleFocus ;
    winModalWindowLevel1 = window.open (URL, name, property);
    winModalWindowLevel1.focus();
   }
  else
  {
    window.top.captureEvents (Event.CLICK|Event.FOCUS);
    window.top.onclick=IgnoreEvents;
    window.top.onfocus=HandleFocus ;
    winModalWindowLevel1 = window.open (URL, name, property);
    winModalWindowLevel1.focus();
  }

  return winModalWindowLevel1;
}
function HandleFocus()
{
      if(window.showModalDialog){  
        setTimeout("finishChecking()", 10);
      }
      else{
        finishChecking();
      }
      return true;
}
function finishChecking() {
  if (winModalWindowLevel1)
  {
    if (!winModalWindowLevel1.closed)
    {
      winModalWindowLevel1.focus();
    }
    else
    {
         if(!window.showModalDialog)
           {
               window.top.releaseEvents (Event.CLICK|Event.FOCUS);
               window.top.onclick = "";
           }
    }
  }
}
  • 1
    These events were deprecated 5 years ago. Just use the normal event handlers via `window.addEventListener("event", handler, true)` (`true for `useCapture`) like everybody does since. – wOxxOm Nov 30 '15 at 17:50
  • I can't modify the source code. I could modify each open window button so that it runs my showWindow function in the greasemonkey script, but I would prefer a way to override the function so that when it is called my function runs instead. – Chris Michaels Nov 30 '15 at 19:18
  • I guess you can try setting `document.body.style.pointerEvents = "none"` or `""`. – wOxxOm Dec 03 '15 at 16:18
  • going to try out the method listed on this site: [link](http://www.squakmt.com/replacing_javascript/) – Chris Michaels Dec 14 '15 at 20:36

0 Answers0