web/data/cubicweb.ajax.js
changeset 6952 7de13eb473e3
parent 6947 3d72028a6cd4
child 7122 3b0f1c2af20f
--- a/web/data/cubicweb.ajax.js	Tue Feb 08 18:00:23 2011 +0100
+++ b/web/data/cubicweb.ajax.js	Tue Feb 08 18:00:42 2011 +0100
@@ -608,6 +608,29 @@
     $('#'+domid).loadxhtml('json', params, null, 'swap');
 }
 
+/* ajax tabs ******************************************************************/
+
+function setTab(tabname, cookiename) {
+    // set appropriate cookie
+    loadRemote('json', ajaxFuncArgs('set_cookie', null, cookiename, tabname));
+    // trigger show + tabname event
+    triggerLoad(tabname);
+}
+
+function loadNow(eltsel, holesel, reloadable) {
+    var lazydiv = jQuery(eltsel);
+    var hole = lazydiv.children(holesel);
+    if ((hole.length == 0) && ! reloadable) {
+        /* the hole is already filed */
+        return;
+    }
+    lazydiv.loadxhtml(lazydiv.attr('cubicweb:loadurl'), {'pageid': pageid});
+}
+
+function triggerLoad(divid) {
+    jQuery('#lazy-' + divid).trigger('load_' + divid);
+}
+
 /* DEPRECATED *****************************************************************/
 
 preprocessAjaxLoad = cw.utils.deprecatedFunction(