awesome!
Pushed it now
I’m already using it 😅🚀
There is now also scittle.core.eval_script_tags()
, handy if you are editing remote scripts and want to reload them from the console
Yeah I saw it while experimenting. Nothing better than working in a live environment 😅
Awesome that you can now edit your existing bookmarklet :)
released it
If we end up with many plugins maybe something like a require-plugins
will be handy. For the bookmarklet case for instance you need to coordinate the loading of scripts and it’s all asynchronous. This is for when you want to go fancy with reagent in your bookmarklet
Yeah nice right, i’m having fun with it as well haha
maybe it will be best if we left the moment of all evaluation to the user
and also the moment of when the plugin is registered?
oh you want to use reagent in your bookmarklet?
Maybe 🙂
you can disable the auto-loading of the snippets right now using scittle.core.disable_auto_eval()
I’ll come up with some use cases first and hack around. Maybe a nice pattern will emerge later
sounds good. https://borkdude.github.io/scittle/disable_auto_eval.html
I also thought sharing bookmarklets via gists could be nice. E.g something like your https://borkdude.github.io/sci.web/?gist=jeroenvandijk/190c254c3ff5c25752d3f59d5d3e7f19
yeah, I guess people could just publish an HTML page where you click on a button to get it as a bookmarklet right
but yeah, loading from a gist...
feel free to implement it, it's your subproject :)
you can also put your name on the page: Author: Jeroen van Dijk
haha yeah I’ll try to make something useful first. I just wanted to fix at least the obvious errors for now
Would it be possible to let the user upload their cljs code as a file with scittle?
It could make a cool intro to reagent xD
@neo2551 I think you can implement that in scittle, if the browser lets you do that
I mean you can add a new tag at the end of the body
scittle exposes scittle.core.eval_string()
so you can call that after you load the file
Oki doky
what exactly prevents apps from loading bookmarklets?
when is it not allowed?
Some sites (rightfully so) set the Content Security Policy headers to be restricting this (https://content-security-policy.com/)
This limits the use cases a bit, but maybe a browser extension could be added that undoes this again if we want to use it on those sites
I was thinking of adding metadata to a bookmarklet that would check (in javascript) to see if the domain is whitelisted to give the user a better error. E.g. “This bookmarklet can only be used on the following domains …”
An extension like https://requestly.io/ could alter those headers to add http://borkdude.github.com to the whitelist for instance. Probably too much effort for most people, but maybe interesting for the power users
The scittle bookmarklet-generator is good fun 🙂 Search the Slack-archives:
(when-some [q (js/prompt "Search the Clojurians Slack-archive:")]
(set! (.. js/document -location -href) (str "<https://clojurians.zulipchat.com/#narrow/stream/180378-slack-archive/search/>" q)))
Prefilling via a query-param would be cool: https://borkdude.github.io/scittle/bookmarklet.html?script=%28when-some,,,,
Sounds like a good idea! How would you generate the query string?
Should it be part of the editor?
Like a “Share button” (copy to clipboard)?
I was looking at using history.pushstate - it would update the script
-param while editing.
Will fiddle with it some more tonight
Yeah that could work. Right now you can also drag an existing bookmark to the editor and the cljs code will be extracted
ah nice. This preload-via-script-param would allow for a bookmark to be inspected/modified by others before bookmarking
Makes sense! Better not too trust arbitrary obfuscated scripts in urls 😅
🙂 WCGW!
@eval2020 I’ve added some support for gists https://github.com/borkdude/scittle/pull/4
Your idea is probably easier to work with (no need to create gists, just copy link somewhere)
nice one! Will build on top of that PR then.
merged and released
PR open https://github.com/borkdude/scittle/pull/5 I hope the wording in the UI for the newly introduced link is clear…
merged and releasing now
@eval2020 what is the sharing button supposed to do?
it refreshes the page for me
It’s meant as a permalink to the state of the editor
ah
So copy and share
but when you click the link, it's not on your clipboard right?
no indeed - that would’ve been the nicer way to do it
it's already a nice improvement btw :)
I’m sure it can be improved with better layout/icon etc
already it would allow for a paragraph on that page with sample bookmarklets 🙂