Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a simple dotjs plugin system #6

Closed
wants to merge 3 commits into from

Conversation

koddsson
Copy link

Hey hey 👋 I've no idea if you're accepting PRs to this project but I just saw it on HN and really like it.

Ever since the dotjs project got abandoned I've been looking for something similar. It works like dis:

Whenever a webpage is loaded we look for a file in ~/.js/<hostname>.js and if we find one we read it's contents and execute the javascript we find there on the page we just loaded.

I think the quote on the original dotjs project describes the functionality pretty well.

"I almost wish you could just stick JavaScript in ~/.js. Do you know what I'm saying?"

Ever since the dotjs project got abandoned I've been looking for
something similar. It works like dis:

Whenever a webpage is loaded we look for a file in `~/.js/<hostname>.js`
and if we find one we read it's contents and execute the javascript we
find there on the page we just loaded.

I think the quote on the original dotjs project describes the
functionality pretty well.

> "I almost wish you could just stick JavaScript in ~/.js. Do you know
what I'm saying?"

- https://github.com/defunkt/dotjs
@thmsbfft
Copy link
Owner

Hey! 👋 I need to organize things a bit in the project first so I can accept PRs. Webpages plugins are on the todo list though so that'll come soon – super happy learning about dotjs :)

Since the implementation might be a little different I'd suggest to maybe store the plugins in Application Support/Oryoki? Possibly also adding a menu toggle to turn everything on/off.

@koddsson
Copy link
Author

I need to organize things a bit in the project first so I can accept PRs.

Awesome! I'm in no rush to merge this since I can just use my current fork for now. If you need a hand you could label some issues and I might be able to pick some up when I have some spare time.

Since the implementation might be a little different I'd suggest to maybe store the plugins in Application Support/Oryoki?

I added a preference for plugin folder path in 6635d24 since I really like having my plugins at .js/ but it defaults to Application Support/Oryoki 😀

Possibly also adding a menu toggle to turn everything on/off.

I didn't do this yet but I probably will soon.

@koddsson
Copy link
Author

Possibly also adding a menu toggle to turn everything on/off.

Ok I added this in a81bef4 but it's not persistant between reboots (just like show_title) but there's a preference property now that you can set so that it starts with plugins either enabled or disabled (just like show_title).

@thmsbfft
Copy link
Owner

thmsbfft commented Jul 2, 2016

Just checked out your branch. Trying to wrap my head around it. Node paths are a little tricky I guess, so just using ~/Library/Application Support/Oryoki/plugins doesn't work for me 😢

Q: why use ~/.js/ over Application Support? Easier to access from a terminal?

@thmsbfft
Copy link
Owner

thmsbfft commented Jul 4, 2016

Hey there – branched off dev to implement the dotjs-like plugin system (5fc5edd). I think your PR came in a little early, but the project is ready-ish now. I'll branch off dev for every feature and merge back up to master for releases.

Basically your code, with a few tweaks: A – if the path defined in preferences isn't set we look for plugins in Application Support/Web Plugins. I need to rewrite a bit the preference file so it accepts comments to explain that. B – we reload the page when toggling the web plugins. I also added Tools > Browse Web Plugins....

I'm looking at adding a couple default plugins now. What are some useful ones? Thinking of one that adds a way of playing youtube etc. in full window, so you can have video players floating on top of everything else.

✌️

@thmsbfft
Copy link
Owner

Hey! Web plugins are implemented in /dev as of 5645bc2 💥

Note: custom paths have to be absolute, so ~/.js would be /Users/YourUserName/.js

Looks okay to me, but let me know if you end up using it and find anything :)

I included hot-reloading the preference file so you can change the directory without relaunching the app. The menu toggle also reloads the current view when turning the plugins on/off. Plugins can be activated independently on each window.

@thmsbfft thmsbfft closed this Jul 20, 2016
@koddsson
Copy link
Author

Hey! Web plugins are implemented in /dev as of 5645bc2 💥

✨✨✨ AWESOME ✨✨✨

Sorry for not being responsive about this PR but real life got in the way 😄

@koddsson koddsson deleted the add-plugins branch July 21, 2016 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants