覆盖Greasemonkey中已弃用的javascript函数

时间:2015-11-30 17:42:09

标签: javascript greasemonkey tampermonkey

这个脚本打破了当前的gecko浏览器。它用户Window.captureEvents()和Window.releaseEvents()。释放功能似乎不再起作用。是否有一个greasemonkey脚本可以覆盖此脚本并从子窗口释放锁?

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 = "";
           }
    }
  }
}

0 个答案:

没有答案