summaryrefslogtreecommitdiff
path: root/app/views
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2013-11-03 19:22:59 +0100
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2013-11-04 23:31:36 +0100
commit231516f5238b6023001bed548569077c61411a4e (patch)
tree2265c174152f3bc7c0fbe49f5a776bc4ca5c3020 /app/views
parentb23d66ec360208cf1e1d8ee2fc3bebf25997d9fa (diff)
Grosse optimisation JavaScript
* Fusion de endless_mode.js dans main.js car endless_mode.js est toujours chargé et assez petit. * Suppression des changements de style en JavaScript lors du chargement (genre boucle de .hide(), ou d'ajout de classe ".stick") et implémentation en PHP + CSS à la place. * Chargement JavaScript asynchrone (defer + async) pour de meilleurs performances. * Utilisation préférable des événements globaux plutôt que des événements pour chaque élément avec jQuery.on(events, selector) pour un chargement plus rapide et moins de mémoire utilisée. * Optimisation manuelle du JavaScript (sélecteurs CSS plus performants, méthodes jQuery plus appropriées, etc.). * Désactivation de init_img() qui était coûteux, lancé à un moment où les images ne sont de toute manière pas encore chargées, et qui n'apporte rien car il y a déjà un img {max-width:100%} en CSS. * JavaScript en mode strict. * Enfin, passage du code JavaScript dans JSLint et du coup nombreuses corrections (syntaxe, variables, méthodes dépréciées...). * Devrait permettre de fermer https://github.com/marienfressinaud/FreshRSS/issues/121 * Au passage, quelques simplifications CSS pour de meilleures performances.
Diffstat (limited to 'app/views')
-rw-r--r--app/views/helpers/view/global_view.phtml2
-rw-r--r--app/views/helpers/view/normal_view.phtml9
-rw-r--r--app/views/javascript/main.phtml14
3 files changed, 12 insertions, 13 deletions
diff --git a/app/views/helpers/view/global_view.phtml b/app/views/helpers/view/global_view.phtml
index 131152f27..9fd7d9863 100644
--- a/app/views/helpers/view/global_view.phtml
+++ b/app/views/helpers/view/global_view.phtml
@@ -37,6 +37,6 @@
</div>
<div id="overlay"></div>
-<div id="panel">
+<div id="panel"<?php echo $this->conf->displayPosts () === 'no' ? ' class="hide_posts"' : ''; ?>>
<a class="close" href="#"><i class="icon i_close"></i></a>
</div> \ No newline at end of file
diff --git a/app/views/helpers/view/normal_view.phtml b/app/views/helpers/view/normal_view.phtml
index 88fc602f6..46547587f 100644
--- a/app/views/helpers/view/normal_view.phtml
+++ b/app/views/helpers/view/normal_view.phtml
@@ -7,7 +7,7 @@ if (isset ($this->entryPaginator) && !$this->entryPaginator->isEmpty ()) {
$items = $this->entryPaginator->items ();
?>
-<div id="stream" class="normal">
+<div id="stream" class="normal<?php echo $this->conf->displayPosts () === 'no' ? ' hide_posts' : ''; ?>">
<?php
$display_today = true;
$display_yesterday = true;
@@ -77,7 +77,7 @@ if (isset ($this->entryPaginator) && !$this->entryPaginator->isEmpty ()) {
$link = urlencode ($item->link ());
$title = urlencode ($item->title () . ' - ' . $feed->name ());
?>
- <div class="dropdown">
+ <div class="dropdown">
<div id="dropdown-share-<?php echo $item->id ();?>" class="dropdown-target"></div>
<i class="icon i_share"></i> <a class="dropdown-toggle" href="#dropdown-share-<?php echo $item->id ();?>"><?php echo Translate::t ('share'); ?></a>
@@ -85,8 +85,8 @@ if (isset ($this->entryPaginator) && !$this->entryPaginator->isEmpty ()) {
<li class="dropdown-close"><a href="#close">&nbsp;</a></li>
<?php
- $shaarli = $this->conf->urlShaarli ();
- if ((!login_is_conf ($this->conf) || is_logged ()) && $shaarli) {
+ $shaarli = $this->conf->urlShaarli ();
+ if ((!login_is_conf ($this->conf) || is_logged ()) && $shaarli) {
?>
<li class="item">
<a target="_blank" href="<?php echo $shaarli . '?post=' . $link . '&amp;title=' . $title . '&amp;source=bookmarklet'; ?>">
@@ -128,7 +128,6 @@ if (isset ($this->entryPaginator) && !$this->entryPaginator->isEmpty ()) {
<ul class="dropdown-menu">
<li class="dropdown-close"><a href="#close">&nbsp;</a></li>
-
<?php foreach($tags as $tag) { ?>
<li class="item"><a href="<?php echo _url ('index', 'index', 'search', urlencode ('#' . $tag)); ?>"><?php echo $tag; ?></a></li>
<?php } ?>
diff --git a/app/views/javascript/main.phtml b/app/views/javascript/main.phtml
index 82ed8ff18..7adb57037 100644
--- a/app/views/javascript/main.phtml
+++ b/app/views/javascript/main.phtml
@@ -1,13 +1,13 @@
<?php
+ echo '"use strict";', "\n";
$mark = $this->conf->markWhen ();
echo 'var ',
- 'hide_posts=', $this->conf->displayPosts () === 'no' ? 'true,' : 'false,',
- 'hide_posts=', $this->conf->displayPosts () === 'no' ? 'true,' : 'false,',
- 'auto_mark_article=', $mark['article'] === 'yes' ? 'true,' : 'false,',
- 'auto_mark_site=', $mark['site'] === 'yes' ? 'true,' : 'false,',
- 'auto_mark_scroll=', $mark['scroll'] === 'yes' ? 'true,' : 'false,',
- 'auto_load_more=', $this->conf->autoLoadMore () === 'yes' ? 'true,' : 'false,',
- 'does_lazyload=', $this->conf->lazyload() === 'yes' ? 'true' : 'false', ";\n";
+ 'hide_posts=', ($this->conf->displayPosts () === 'yes' || Request::param ('output') === 'reader') ? 'false' : 'true',
+ ',auto_mark_article=', $mark['article'] === 'yes' ? 'true' : 'false',
+ ',auto_mark_site=', $mark['site'] === 'yes' ? 'true' : 'false',
+ ',auto_mark_scroll=', $mark['scroll'] === 'yes' ? 'true' : 'false',
+ ',auto_load_more=', $this->conf->autoLoadMore () === 'yes' ? 'true' : 'false',
+ ',does_lazyload=', $this->conf->lazyload() === 'yes' ? 'true' : 'false', ";\n";
$s = $this->conf->shortcuts ();
echo 'var shortcuts={',