author | sylvain.thenault@logilab.fr |
Fri, 30 Jan 2009 15:26:25 +0100 | |
changeset 528 | 60bd171ecd04 |
parent 522 | 385ce5e0b30b |
child 543 | c0f2b6378f70 |
permissions | -rw-r--r-- |
485
0f830732be19
[tabs] provide a working tabs implementation, that lazy-loads tab content & should remember the current position
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
1 |
|
0f830732be19
[tabs] provide a working tabs implementation, that lazy-loads tab content & should remember the current position
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
2 |
function load_now(eltsel, holesel) { |
0f830732be19
[tabs] provide a working tabs implementation, that lazy-loads tab content & should remember the current position
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
3 |
var lazydiv = jQuery(eltsel); |
0f830732be19
[tabs] provide a working tabs implementation, that lazy-loads tab content & should remember the current position
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
4 |
var hole = lazydiv.children(holesel); |
0f830732be19
[tabs] provide a working tabs implementation, that lazy-loads tab content & should remember the current position
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
5 |
if (hole.length == 0) /* the hole is already filled */ |
0f830732be19
[tabs] provide a working tabs implementation, that lazy-loads tab content & should remember the current position
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
6 |
return; |
522
385ce5e0b30b
cubicweb__loadurl -> cubicweb:lazyloadurl
sylvain.thenault@logilab.fr
parents:
485
diff
changeset
|
7 |
var vid_eid = lazydiv.attr('cubicweb:lazyloadurl'); |
485
0f830732be19
[tabs] provide a working tabs implementation, that lazy-loads tab content & should remember the current position
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
8 |
/* XXX see what could be done with jquery.loadxhtml(...) */ |
0f830732be19
[tabs] provide a working tabs implementation, that lazy-loads tab content & should remember the current position
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
9 |
var later = async_rawremote_exec('lazily', vid_eid); |
0f830732be19
[tabs] provide a working tabs implementation, that lazy-loads tab content & should remember the current position
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
10 |
later.addCallback(function(req) { |
0f830732be19
[tabs] provide a working tabs implementation, that lazy-loads tab content & should remember the current position
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
11 |
var div = lazydiv[0]; |
0f830732be19
[tabs] provide a working tabs implementation, that lazy-loads tab content & should remember the current position
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
12 |
div.appendChild(getDomFromResponse(req)); |
0f830732be19
[tabs] provide a working tabs implementation, that lazy-loads tab content & should remember the current position
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
13 |
div.removeChild(hole[0]); |
0f830732be19
[tabs] provide a working tabs implementation, that lazy-loads tab content & should remember the current position
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
14 |
}); |
0f830732be19
[tabs] provide a working tabs implementation, that lazy-loads tab content & should remember the current position
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
15 |
later.addErrback(function(err) { |
0f830732be19
[tabs] provide a working tabs implementation, that lazy-loads tab content & should remember the current position
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
16 |
log(err); |
0f830732be19
[tabs] provide a working tabs implementation, that lazy-loads tab content & should remember the current position
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
17 |
}); |
0f830732be19
[tabs] provide a working tabs implementation, that lazy-loads tab content & should remember the current position
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
18 |
} |
0f830732be19
[tabs] provide a working tabs implementation, that lazy-loads tab content & should remember the current position
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
19 |
|
0f830732be19
[tabs] provide a working tabs implementation, that lazy-loads tab content & should remember the current position
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
20 |
function trigger_load(divid) { |
0f830732be19
[tabs] provide a working tabs implementation, that lazy-loads tab content & should remember the current position
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
21 |
jQuery('#lazy-' + divid).trigger('load_' + divid); |
0f830732be19
[tabs] provide a working tabs implementation, that lazy-loads tab content & should remember the current position
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff
changeset
|
22 |
} |