I enjoy the jQuery-library when I write javascript, so I've added that to BOB. But it slowly became harder to do. So I guess I should share that knowledge.

At first, I just loaded it by adding a <script>-tag to the page with jQuery, and wait till it came available. In the end, this doesn't work because it could take .1 or .2 seconds extra to load. It wasn't really noticable at the start, and it was 1 time per page, but still it's better to fetch it directly.

Then I found out about @Require, which loads the file along with the script when installing, and so it doesn't cost any extra time. So I was satisfied with the result (except that 1 person complained about fetching things from google, the script is hosted there etc.).

After that, 2 problems came up: jQuery 1.4 came out, which did not work fully in greasemonkey, and I tried to make the script work in Chrome, which does not support @Require.The solution for the latter was to include the jQuery-code in the script itself. It's ugly, but happily it's not too large after minification (script is still smaller now than when I started), and it doesn't complicate anything after that. The other was to adapt the jQuery code in a specific place.. I chose not to get stuck with an old version, so I get the code, make the modifications and minify it through google closure. With jQuery 1.4.4, there seem to be 3 places the code has to be adjusted now, and I'm wondering if the speedup that came with 1.4 and 1.4.2 is worth making the changes.. In time, I hope a better solution will show up.

Yeah, I could do that. But I think the solution is pretty equal to my first variant. The downside (you have to wait till the thing is downloaded) is still true. And the other disadvantage: If it adds it to the page (which is likely), Chrome won't have access to it.

Dako wrote:It is better to add jQuery externally because it may be already cached by client and will result in a small speed up. Loading it inline with the BOB script just slows every bob-load.

LBjs should work at Chrome afaik but I never tried it there.

I did try require.js once (work-related), but I still think it adds things to the page (http://requirejs.org/docs/why.html , just checked labjs and it does about the same).

And the case I have here is different. Because the script is already at the client, it takes no time to fetch it, execution time is all that matters. Hitting the cache would result in a small speedup compared to fetching it from a server. But still it should be slower than actually having it in the script already.

LABjs should work in chrome, but not in chrome extensions I think. Extensions normally allow you to add extra files anyway, so it will be hard to get information on that. Time to try something out I guess.