[wp-hackers] Standard JavaScript

Mike Purvis mike at uwmike.com
Thu Aug 17 16:21:44 GMT 2006


Hi everyone,

I just wanted to inquire as to the state of a "standard JavaScript"
initiative for Wordpress. I've noticed that many plugins--both admin-
and public-facing--include common functions like the AJAX try-catch
block, and this seem unnecessarily wasteful.

I like that the WP admin area includes addLoadEvent, and I guess I'm
just wondering if there'd be interest in either creating a small WP JS
library, or adopting one, such as Prototype/Behaviour.

It could be "not in the header" by default, but any plugin or theme
could call a function (before output starts) that causes the link to
be included, both on the public side and admin panel.

Finally, I've noticed a lot of plugins that insert great gobs of JS
and CSS directly into the header, rather than referencing external,
cache-able locations. The get_plugininfo would help make this easier,
but in the meantime, you could do a trick like the WP-Cats plugin,
where the "external" locations are just GET parameters on the root of
the blog, eg:

<http://uwmike.com/?wp-cats=css> and <http://uwmike.com/?wp-cats=js>

Doing this keeps the main markup clean, and it also lets the whole
plugin be packaged neatly into a single PHP file. But it would be
helpful to have a way to "trigger" the availability of certain
oft-used JS functions.

Mike


More information about the wp-hackers mailing list