You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is in regards to this thread: http://userscripts.org/topics/115200
When trying to use Raphael with Greasemonkey, I am getting an error as though it isn't loading.
Simplified test case
// ==UserScript==// @name Testing Raphael// @namespace #Cletus// @include https://www.google.com/// @version 1// @grant GM_log// @require http://github.com/DmitryBaranovskiy/raphael/raw/master/raphael.js// ==/UserScript==console.log(Raphael);/** * Expected: Your browser supports SVG. You are running Raphael 2.1.0 * Actual: window.Raphael is undefined, file:///.../raphael.js, Line 3755 * Note: @grant set to "GM_log" to force it into a sandbox, but it still won't work with @grant set to "none". */
Note that once Raphael is actually defined, it works as intended.
When digging around for the possible cause of this, I found a change that DOES fix it.
raphael.js, Line 3738
Change oldRaphael.was ? (g.win.Raphael = R) : (Raphael = R);
to oldRaphael.was ? (g.win.Raphael = R) : (g.win.Raphael = R);
or simply g.win.Raphael = R;
This seems to fix it, but then again I don't know of the side effects. From the looks of it, that line just checks to see if Raphael exists and overwrites it, otherwise it just creates a new variable.
Is this a known issue or has anyone else had any success with Raphael and Greasemonkey?
The text was updated successfully, but these errors were encountered:
This is in regards to this thread: http://userscripts.org/topics/115200
When trying to use Raphael with Greasemonkey, I am getting an error as though it isn't loading.
Simplified test case
Note that once Raphael is actually defined, it works as intended.
Using
Firefox v15.0
Greasemonkey v1.0
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20100101 Firefox/15.0
Possible cause
When digging around for the possible cause of this, I found a change that DOES fix it.
raphael.js, Line 3738
Change
oldRaphael.was ? (g.win.Raphael = R) : (Raphael = R);
to
oldRaphael.was ? (g.win.Raphael = R) : (g.win.Raphael = R);
or simply
g.win.Raphael = R;
This seems to fix it, but then again I don't know of the side effects. From the looks of it, that line just checks to see if Raphael exists and overwrites it, otherwise it just creates a new variable.
Is this a known issue or has anyone else had any success with Raphael and Greasemonkey?
The text was updated successfully, but these errors were encountered: