eklem / nowcontent.xyz

Create bookmarklets for sending content / pages to service [xyz]
MIT License
7 stars 1 forks source link

Script doesn't need to be linked in, just embed it #40

Closed eklem closed 5 years ago

eklem commented 5 years ago

Just generate a string to embed directly: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#attr-src

This way, we can generate all sorts of bookmarklets based on what's stored in indexedDB

eklem commented 5 years ago

Check out issue 46 - javascript link, need to figure out two things and issue 47. Create a minimal vuejs example of bookmarklet

eklem commented 5 years ago

Also, I've tried to append a script that appends other stuff. Maybe set the variables and then append them one after another? Makes it a little less obfuscated and maybe easier to debug?

eklem commented 5 years ago

Ok, try this for the string that is the bookmarklet:

eklem commented 5 years ago

Use solution 2b in the answer to this question: Insert code into the page contextz using a content script

eklem commented 5 years ago

Well, seems I need to use method 2b, using a function w/ dynamic values in the injected code, since part of the script is variables that the user can define.

// NOTE: Do not insert unsafe variables in this way, see below // at "Dynamic values in the injected code"

and

Dynamic values in the injected code Occasionally, you need to pass an arbitrary variable to the injected function.

eklem commented 5 years ago

Got it working with commit 49.