Fork me on GitHub
#sci
<
2021-05-27
>
borkdude09:05:26

Pushed it now

jeroenvandijk09:05:34

I’m already using it 😅🚀

borkdude10:05:08

There is now also scittle.core.eval_script_tags(), handy if you are editing remote scripts and want to reload them from the console

jeroenvandijk10:05:35

Yeah I saw it while experimenting. Nothing better than working in a live environment 😅

borkdude10:05:26

Awesome that you can now edit your existing bookmarklet :)

borkdude10:05:29

released it

🎉 3
jeroenvandijk10:05:30

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

jeroenvandijk10:05:41

Yeah nice right, i’m having fun with it as well haha

borkdude10:05:27

maybe it will be best if we left the moment of all evaluation to the user

borkdude10:05:44

and also the moment of when the plugin is registered?

borkdude10:05:39

oh you want to use reagent in your bookmarklet?

borkdude10:05:05

you can disable the auto-loading of the snippets right now using scittle.core.disable_auto_eval()

jeroenvandijk10:05:38

I’ll come up with some use cases first and hack around. Maybe a nice pattern will emerge later

jeroenvandijk10:05:04

I also thought sharing bookmarklets via gists could be nice. E.g something like your https://borkdude.github.io/sci.web/?gist=jeroenvandijk/190c254c3ff5c25752d3f59d5d3e7f19

borkdude10:05:46

yeah, I guess people could just publish an HTML page where you click on a button to get it as a bookmarklet right

borkdude10:05:06

but yeah, loading from a gist...

borkdude10:05:17

feel free to implement it, it's your subproject :)

borkdude10:05:27

you can also put your name on the page: Author: Jeroen van Dijk

😅 3
👍 3
jeroenvandijk10:05:51

haha yeah I’ll try to make something useful first. I just wanted to fix at least the obvious errors for now

borkdude10:05:44

what exactly prevents apps from loading bookmarklets?

borkdude10:05:49

when is it not allowed?

jeroenvandijk11:05:11

Some sites (rightfully so) set the Content Security Policy headers to be restricting this (https://content-security-policy.com/)

jeroenvandijk11:05:08

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

jeroenvandijk12:05:44

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 …”

jeroenvandijk12:05:56

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

David Pham10:05:43

Would it be possible to let the user upload their cljs code as a file with scittle?

David Pham10:05:58

It could make a cool intro to reagent xD

borkdude10:05:06

@neo2551 I think you can implement that in scittle, if the browser lets you do that

David Pham10:05:38

I mean you can add a new tag at the end of the body

borkdude10:05:42

scittle exposes scittle.core.eval_string() so you can call that after you load the file

eval202013:05:58

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 "" q)))

👍 6
jeroenvandijk14:05:39

Sounds like a good idea! How would you generate the query string?

jeroenvandijk14:05:59

Should it be part of the editor?

jeroenvandijk14:05:33

Like a “Share button” (copy to clipboard)?

eval202014:05:38

I was looking at using history.pushstate - it would update the script -param while editing.

eval202014:05:31

Will fiddle with it some more tonight

jeroenvandijk14:05:56

Yeah that could work. Right now you can also drag an existing bookmark to the editor and the cljs code will be extracted

eval202014:05:34

ah nice. This preload-via-script-param would allow for a bookmark to be inspected/modified by others before bookmarking

jeroenvandijk14:05:52

Makes sense! Better not too trust arbitrary obfuscated scripts in urls 😅

jeroenvandijk16:05:07

Your idea is probably easier to work with (no need to create gists, just copy link somewhere)

eval202016:05:34

nice one! Will build on top of that PR then.

borkdude17:05:20

merged and released

eval202020:05:47

PR open https://github.com/borkdude/scittle/pull/5 I hope the wording in the UI for the newly introduced link is clear…

👏 3
borkdude20:05:24

merged and releasing now

3
borkdude20:05:48

@U04V6FEES what is the sharing button supposed to do?

borkdude20:05:54

it refreshes the page for me

eval202020:05:12

It’s meant as a permalink to the state of the editor

eval202020:05:22

So copy and share

borkdude20:05:54

but when you click the link, it's not on your clipboard right?

eval202020:05:23

no indeed - that would’ve been the nicer way to do it

borkdude20:05:38

it's already a nice improvement btw :)

eval202020:05:30

I’m sure it can be improved with better layout/icon etc

eval202020:05:59

already it would allow for a paragraph on that page with sample bookmarklets 🙂