UtilitiesHere is what you do to simple JQuery-enable your web pages served as Acre templates:
<acre:script>
var t = acre.require("/freebase/libs/jquery/templates");
</acre:script>
<html>
<head>
<title>whatever</title>
${t.jquery()} <!-- tell browser to load jquery -->
${t.jquery_ui('smoothness')} <!-- tell browser to load jquery UI with the given theme (and all required css files) -->
${t.jquery_plugin('cookie')} <!-- tell browser to load a jquery plugin -->
${t.underscore()} <!-- tell browser to load underscore -->
</head>
<body>
...
</body>
</html>
canvastable dynamicNote: as a convenience, this library is capable of following dependencies, meaning that if you load jquery_ui
or other plugins that depend on jquery, you don't have to specify to load
jquery explicitly, it will be loaded automatically.
jQuery 1.4: jquery, jquery_ui, and jquery_plugin now accept a major
jquery version number (i.e., 1.3 and 1.4) so that it will give you the latest and greatest
versions of jQuery and/or jQuery UI. To be backwards compatible, jquery defaults to 1.3.
<acre:script>
var t = acre.require("/freebase/libs/jquery/templates");
</acre:script>
<html>
<head>
<title>whatever</title>
${t.jquery(1.4)} <!-- tell browser to load the latest jQuery 1.4 which as of this writing is 1.4.2 -->
${t.jquery_ui('smoothness', 1.4)} <!-- tell browser to load the latest jQuery UI compatible with jQuery 1.4, which as of this writing is 1.8.1 -->
${t.jquery_plugin('compat-1.3', 1.4)} <!-- tell browser to load the latest jQuery 1.4 with the compatibility plugin for jQuery 1.3 -->
</head>
<body>
...
</body>
</html>