daily pastebin goal
53%
SHARE
TWEET

Untitled

a guest Nov 2nd, 2013 4,059 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*--- Create a proper unsafeWindow object on browsers where it doesn't exist
  2.     (Chrome, mainly).
  3.     Chrome now defines unsafeWindow, but does not give it the same access to
  4.     a page's javascript that a properly unsafe, unsafeWindow has.
  5.     This code remedies that.
  6. */
  7. var bGreasemonkeyServiceDefined     = false;
  8.  
  9. try {
  10.     if (typeof Components.interfaces.gmIGreasemonkeyService === "object") {
  11.         bGreasemonkeyServiceDefined = true;
  12.     }
  13. }
  14. catch (err) {
  15.     //Ignore.
  16. }
  17.  
  18. if ( typeof unsafeWindow === "undefined"  ||  ! bGreasemonkeyServiceDefined) {
  19.     unsafeWindow    = ( function () {
  20.         var dummyElem   = document.createElement('p');
  21.         dummyElem.setAttribute ('onclick', 'return window;');
  22.         return dummyElem.onclick ();
  23.     } ) ();
  24. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top