using lodash in a userscript

780 views
Skip to first unread message

Gergely Pihentagy

unread,
Sep 23, 2014, 5:28:10 AM9/23/14
to greasemon...@googlegroups.com
Hi all!

I am trying to write a greasemonkey script, which uses lodash. I am not very familiar with lodash. However, when I use it with the following require:

// @require     https://cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.js

the Browser console (Pressing Ctrl+Shift+J) warns me about this:



The problematic function is:

    /** Used to detect if a method is native */
    var reNative = RegExp('^' +
      String(toString)
        .replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
        .replace(/toString| for [^\]]+/g, '.*?') + '$'
    );


However, I cannot reproduce this with a hello world greasemonkey script, which includes this file.

To say the whole truth, I don't know how to debug greasemonkey scripts at all! I found little or no feedback from browser console. How can one debug greasemonkey scripts?

thanks

Gergo

Gergely Pihentagy

unread,
Sep 23, 2014, 7:37:25 AM9/23/14
to greasemon...@googlegroups.com

The problem in the Console:
Permission denied to access property toString lodash.js:470

Gergely Pihentagy

unread,
Sep 24, 2014, 5:54:21 PM9/24/14
to greasemon...@googlegroups.com
Ok, here is a minimal problematic script:

https://greasyfork.org/scripts/5283-testing

Open Browser Console, and you will see the error (hopefully).


On Tuesday, September 23, 2014 11:28:10 AM UTC+2, Gergely Pihentagy wrote:

Gergely Pihentagy

unread,
Sep 29, 2014, 10:32:28 AM9/29/14
to greasemon...@googlegroups.com
Anyone?

If no, where else could I ask about this problem?

thanks
Gergo

Gergely Pihentagy

unread,
Oct 30, 2014, 12:13:25 PM10/30/14
to greasemon...@googlegroups.com

Ray Foss

unread,
Dec 1, 2017, 4:01:15 PM12/1/17
to greasemonkey-users
Just get something that installs with a global... 

in tampermonkey this worked for me:
// @require https://raw.githubusercontent.com/lodash/lodash/4.17.4/dist/lodash.js
Reply all
Reply to author
Forward
0 new messages