Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #36318 > unrolled thread
| Started by | "R.Wieser" <address@not.available> |
|---|---|
| First post | 2019-04-06 10:27 +0200 |
| Last post | 2019-04-07 01:51 -0700 |
| Articles | 3 — 3 participants |
Back to article view | Back to comp.lang.javascript
GreaseMonkey - How to call another userscript. "R.Wieser" <address@not.available> - 2019-04-06 10:27 +0200
Re: GreaseMonkey - How to call another userscript. JJ <jj4public@vfemail.net> - 2019-04-07 02:20 +0700
Re: GreaseMonkey - How to call another userscript. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-04-07 01:51 -0700
| From | "R.Wieser" <address@not.available> |
|---|---|
| Date | 2019-04-06 10:27 +0200 |
| Subject | GreaseMonkey - How to call another userscript. |
| Message-ID | <q89nuc$1k4n$1@gioia.aioe.org> |
Hello all, I would like to be able to run another userscript from within the first one. The problem: The second userscript cannot be "@include" -ed, as it depends on what the first script finds. Case in question: Googles cached pages. Depending on where the cached page came from I would like to call another (already written for that page) userscript. Remark: I've seen an 'unsafeWindow.xxx' solution, but do not really want to expose the userscript to the webpage. Regards, Rudy Wieser
[toc] | [next] | [standalone]
| From | JJ <jj4public@vfemail.net> |
|---|---|
| Date | 2019-04-07 02:20 +0700 |
| Message-ID | <12l0fnx6f6btn.17yltoqbdepp9$.dlg@40tude.net> |
| In reply to | #36318 |
On Sat, 6 Apr 2019 10:27:41 +0200, R.Wieser wrote: > Hello all, > > I would like to be able to run another userscript from within the first one. > The problem: The second userscript cannot be "@include" -ed, as it depends > on what the first script finds. > > Case in question: Googles cached pages. Depending on where the cached page > came from I would like to call another (already written for that page) > userscript. > > Remark: I've seen an 'unsafeWindow.xxx' solution, but do not really want to > expose the userscript to the webpage. > > Regards, > Rudy Wieser UserScripts are isolated, unless they specifically provide an interface to expose themselves. `unsafeWindow` is a direct approach of exposing the interface. For indirect one (recommended), use message event. i.e. have the (communicatable) UserScripts listen to message events. Includes an ID, signature, or some kind of a key in the the message event's data so that the interface can't be easily accessible, or be only accessible by known/trusted UserScripts. However, message event is an async function. If you want synchronous function, you'll have to use global function. Preferably with some protection as mentioned above.
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2019-04-07 01:51 -0700 |
| Message-ID | <e79dd60a-2035-4c8c-80e0-446835720337@googlegroups.com> |
| In reply to | #36318 |
Den lördag 6 april 2019 kl. 10:28:02 UTC+2 skrev R.Wieser: > Hello all, > > I would like to be able to run another userscript from within the first one. > The problem: The second userscript cannot be "@include" -ed, as it depends > on what the first script finds. > > Case in question: Googles cached pages. Depending on where the cached page > came from I would like to call another (already written for that page) > userscript. > > Remark: I've seen an 'unsafeWindow.xxx' solution, but do not really want to > expose the userscript to the webpage. > > Regards, > Rudy Wieser https://www.youtube.com/watch?v=F9E2yBYJhGc
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.javascript
csiph-web