Central repositories for scripts

Javascript, Jquery is often blamed for slow loading of websites. Plugin writers don’t care whether their code goes in the Head or Footer etc. Can’t there be some central repositories (say in big hosting sites) that could reduce the loading and execution times?
When everyone is concerned about the bandwidth choking, why not some initiative being taken? Though $10/month pinches me, I won’t mind 10 cents extra per month if some solution comes up.
I may be wrong or this subject may not be that simple, but I would be happy if you could just put a line.

There is and there are. See for example the Google Libraries API

It can be as simple as this for off-site loading of a library:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>

So Paul listed an example of these repositories, and they help since any user who’se already loaded those files once somewhere else now doesn’t have to ask for them again…
but that doesn’t excuse us from avoiding bloat in the first place. The less you need to ask users to load, the less it matters if some of them have some huge library cached already.

jQuery especially is popular for developers like me who know little Javascript but need to get stuff done… so unfortunately this often means loading (in total) a crapload of libraries and associated files (like, if you’re writing something with widgets, then you’re also asking the user to load the widget UI files, and then the specific files for the whatever you’re doing, and maybe you’re doing a couple of things at once, each is a separate file… and then they each come with their own CSS file if you’re not bundling them (you should incorporate those CSS files into your main CSS file, unless these are being shared across many sites on your network)…)
and all for a little bit of something that quite possibly you could have written yourself in 10kb in vanilla Javascript.

Well, the base library itself (jquery’s main lib for example) should be okay being loaded, but yeah once you start mixing libraries you have the potential of interference.

Someone on another forum I’m on asked something like, “wouldn’t it be better if browsers came with jQuery already loaded?”

I didn’t think so (why jQuery, for one thing), but it’s an interesting question. Reducing accidental errors and interference would mean strong limits on developer freedom.

With WP, the problems I hear the most about involve widgets. The trouble with widgets is, they’re all written by other people.
Like, I know the jQuery guys are pretty aware of interference and they work hard to write their code tight as far as namespacing and whatnot, but any Joe or Jane can write a widget plugin thingie. And they offer it on the web. And it does something useful or neat so lots of others use it. But it wasn’t written to the same high standard as the library it uses. It’s not careful with its scope or whatever.

Also, re the question of loading times: often widgets are connecting to other servers. Suddenly it doesn’t matter how super-fast your server is… some widget is stopping the loading of your page because it’s waiting for acknowledgement from, say, Facebook, so it can load an iframe with fb stuff in it.

Go to deviantart.com and watch all the requests to servers that aren’t deviantart.com or .net. That’s what you’re waiting for, all those server requests. Your page is then only as fast as the slowest server, if you’re measuring full page load.

The one you point at, and the plugins available “Use google libraries” often break one functionality or the other (WP forums acknowledge it). I myself installed and uninstalled.

There are some glitches that no one appears to look at. If scripts are used within (time & bandwidth consuming) everything works, if outsourced, partly effective. Why not some collective approach?

Open source means free. I believe that if some money is thrown in, the development will be fast and effective.

There is no common set of instructions for browsers to adhere too. Each blows his own trumpet. Opera is one IE is another. Now another spanner added, SEO, Google’s own rules. Somewhere, some people should get together and like Global Warming rules the minds, Internet warming should also be discussed. Collective effort is needed. OR HTML should be widened…

Well recently, Google Microsoft and Yahoo have just recently got in to bed together over HTML. It’s called schema.org which provides a set of common HTML structures that developers are advised to use for a wide range of types of uses.

Good one. I think Wordpress should also allow only those plugins on their site that adhere to placing their script requests properly. Big platforms can always tighten the screws. The web would be a better place to live.

Haaha, yeah that’s funny, the RDFa people are having a fit… the WHATWG is siding with the browsers (well, um… one man who happens to run the WHATWG is siding with the browsers)… while the W3C is clinging to RDFa (which so far as I understand really does offer more than schema.org)…
actually the whole growing split between W3C and WHATWG is going to be trouble for all of us. There are groups of people trying to make standards for us, standards for browser vendors… but everyone wants their own thing so it’s still all over the place (like it always has been).

Javascript, I’m not sure how that’s affected. More that Ecmascript 5 is out, yet obviously older browsers don’t support all that… Mozilla is always writing a bunch of new stuff that, frankly, I can’t count on it working on my pages in all browsers.

I think Wordpress should also allow only those plugins on their site that adhere to placing their script requests properly

I think Drupal does this. Or at least, they have a core section where certain rules have to be followed, and then they have modules where fewer rules have to be followed…
for every thing that has to be vetted within the main group of developers, you get
-more guarantee that it’s safe and plays well with others
-longer time before it’s actually available to everyone