
Dotjs — hack the web - duck
http://defunkt.io/dotjs/
======
gue5t
This seems like it's a lot of overhead for what amounts, in terms of
capability, to a reimplementation of greasemonkey. It also makes you implement
finer controls on execution by url yourself, whereas greasemonkey has them in
its syntax. The author states,

"GreaseMonkey user scripts are great, but you need to publish them somewhere
and re-publish after making modifications. With dotjs, just add or edit files
in ~/.js."

but this caveat is just as strong for files you maintain outside of your
browser, and some browsers' implementations of userscripts/greasemonkeylikes
actually have a similar filesystem-based model for managing scripts already.

While respectable, I had hoped to be more impressed by a tool that beckons me
to "hack the web".

~~~
defunkt
That's all true, but dotjs is only for Google Chrome on OS X.

Google Chrome on OS X has no such filesystem-based model for managing scripts.

~~~
seanp2k
So actually it's much worse than Greasemonkey.

Also, with GM you can just save the script with the same filename and it'll
use that instead.

This project is 100% useless.

~~~
dasil003
Unless you don't use Firefox and you tend to have a lot of dot files that you
hack around with in your home directory. Then it starts to seem pretty
awesome.

~~~
scrrr
Chrome runs Greasemonkey-scripts, too. They are automatically converted to
extensions in the background. Works very well. (
<http://blog.chromium.org/2010/02/40000-more-extensions.html> )

But I wouldn't call this useless. It's just another approach.

------
rpearl
There's a firefox version too: <https://github.com/rlr/dotjs-addon>

And Safari: <https://github.com/wfarr/dotjs.safariextension>

------
holman
I've sneakily been using this for months on Hacker News itself- I just .hide()
stories past around story #15. More signal, less noise. And it's just jQuery,
so it's really easy to whip up.

Bonus points for it being so easy to share, too:
[https://github.com/holman/holman-
js/blob/master/news.ycombin...](https://github.com/holman/holman-
js/blob/master/news.ycombinator.com.js)

~~~
forgotusername
It's interesting how perspectives differ on what is considered noise. On the
average day I start my browsing here around link 15, or even the new queue.

You're pretty much guaranteed to hear of anything hitting the front page
anyway if it was meaningful to begin with. If not, it's probably some
momentary obsession or buzzword bingo (say, "Google", "Social", "Facebook
killer", "Privacy", "Product launch" to take an ephemeral example :))

~~~
alsocasey
I'll add bitcoin to that list.

~~~
niekmaas
don't forget the cloud!

~~~
smcl
and node.js

------
mph
I added CoffeeScript support if anyone's interested.

just change your file extension from .js to .coffee

[https://github.com/eightbitraptor/dotjs/commit/20c97774eb29f...](https://github.com/eightbitraptor/dotjs/commit/20c97774eb29f2a737facd8a12ed9b872dbea47b)

------
omaranto
Doesn't Chrome have builtin support for Greasemonkey scripts? How is this
better? Is it just the convenience of having jQuery preloaded?

------
TheMiddleMan
"GreaseMonkey user scripts are great, but you need to publish them somewhere
and re-publish after making modifications."

Publish them where? I don't understand this. Whenever I change a user.js file
and save it the browser updates it and it's ready to go next time the page
reloads.

Side node: Scriptish is a fork of greasemonkey with many cool extras.
<https://addons.mozilla.org/en-US/firefox/addon/scriptish/>

------
reustle
Requires Ruby? Why...

~~~
defunkt
Chrome extensions can't access the local filesystem so we have to start a tiny
webserver in the background.

If someone knows a way around this limitation, or a simpler webserver to
require / embed, I would be thrilled. But so far this is the best I've found.

~~~
seanp2k
ahahahahah what? Dude, do you work for Microsoft? "Well see, we just have to
run MS-SQL server (DESKTOP OMG EXPRESS ENGINE) here, and then we run IIS on
top of it to serve this file listing..."

~~~
vijaydev
He co-founded GitHub and is the CEO presently. That will be good enough for
you?

------
tung
See also jsshell[1] for Chrome. Press the button and you can run jQuery-
powered JS on the fly, save snippets and run them, even automatically on
regex-matched URLs.

[1]
[https://chrome.google.com/webstore/detail/kmgmkbicahmbceidoi...](https://chrome.google.com/webstore/detail/kmgmkbicahmbceidoidjbkbpkfogaldh)

------
oldgregg
I'm waiting for someone to build a social browser extension on top of
something like this. Anyone could submit custom CSS/JS for a website and the
most upvoted "theme" automatically gets loaded. Sure the JS security issues
might be a nightmare, but the web would look soooo much prettier!

~~~
mburns
<http://userscripts.org/>

------
JackWebbHeller
Great work! But I had some trouble getting it to run on my Mac.

I think it might be because I use VirtualHostX -
<http://clickontyler.com/virtualhostx/> \- which alters my hosts file. I had
to create a host - <http://dotjs/> \- pointing to my ~/.js/ folder - then edit
the Extension JS to point the Ajax to <http://dotjs/> instead of
<http://localhost:3131>. A bit of pain but it might just be who this affects.

------
jasonkit
I think the ruby web server is not necessarily needed, simply change the
dotjs.js's content to

$.get(chrome.extension.getURL("script/"+window.location.hostname+".js"),
function(script){ eval(script); });

it will look for the js file in the extension directory instead of the local
ruby web server, and this should work for any platform. To take the ~/.js
convenience, a symlink in *inx system or shortcut in window will do the job.

------
sim0n
Sweet! Believe it or not I've been actually looking for something like this
for Chrome over the past couple of days so this is great.

------
__rkaup__
The instructions given only work for Mac.

~~~
rpearl
Should work fine in Linux too, from looking at the instructions.

(Firefox user here... This looks like a poor man's greasemonkey).

~~~
__rkaup__
Nah, it tries to install some OS X "launch agent" thing. Should be quite
simple to get it to work in Linux, but it doesn't yet.

~~~
defunkt
Try <https://github.com/glenbot/dotjs/tree/ubuntu-support-merged>

------
Sym3tri
I wrote a simliar extension for CSS.

It's free in the Chrome store: <http://goo.gl/vWcqr>

------
DanielRibeiro
Reminded me a lot of Greasemonkey for FF.

~~~
cleverjake
greasemonkey scripts also work in chrome.

~~~
inconditus
In fact, Chrome built them into the web browser so they work without
installing any Greasemonkey extensions.

------
blago
Awesome, exactly what I needed. I was just about to create yet another "inject
X.js" bookmarklet.

------
antihero
Why does this need OSX?

~~~
pavel_lishin
It seems like a pretty trivial little hack - I think the only reason it really
requires OS X is to launch the toy web server that serves the scripts.

------
meow
Umm.. is there a way to run it on windows :( ?

~~~
pavel_lishin
Looks like you'll have to modify the Rakefile to use whatever Windows uses to
launch the webserver. If you don't have ruby, you could probably write one in
your local language of choice.

------
robinduckett
Sorry, how is this different to greasemonkey?

------
Brewer
This just made my day, keep up the good work.

