Speed: jQuery optimisation of init_posts()

- jQuery updated from version 1.5.2 to 1.10.2 (checked that it is ok
with jQuery Migrate Plugin)
- Put hide_posts() first to avoid flashing content during load
- Big speed optimisation of init_img()
- Use a single on() delegated event (jQuery 1.7+) instead of all
per-article click events as described on http://api.jquery.com/on/
- Moved all the per-article click events to an outside function
init_stream_delegates() that is called only once even when new articles
are dynamically added. Much lighter approach, and does not require
unbinding events and rebinding them at each dynamic load.
- Side effect: corrected the bug of favourites and read/unread that were
not properly unbound during dynamic loading.
- Corrected a JavaScript error for auto_load_more when #load_more is not
visible and therefore does not have a position() defined.
This commit is contained in:
Alexandre Alapetite committed 2013-09-04 01:46:49 +02:00
1 parent 31a6a13268
commit d9db9bae0d
3 files changed
+60 -38

No files matched your search

+2 -2
View File
@@ -57,8 +57,8 @@ class App_FrontController extends FrontController {
if (login_is_conf ($this->conf)) {
View::appendScript ('https://login.persona.org/include.js');
}
View::appendScript (Url::display ('/scripts/jquery.js'));
View::appendScript (Url::display ('/scripts/jquery.lazyload.min.js'));
View::appendScript (Url::display ('/scripts/jquery.min.js'));
View::appendScript (Url::display ('/scripts/jquery.lazyload.min.js')); //TODO: Load only if used
View::appendScript (Url::display ('/scripts/notification.js'));
}