summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2013-10-26 17:29:53 +0200
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2013-10-26 17:29:53 +0200
commit5c68233985b19262f44ff667417e0127df003854 (patch)
tree0889b769d6a0542e720446ff0ad6d01a94e2fb79
parentdd5273871a74d01d87fa1eaad7aa53bc1c148f85 (diff)
Fusionne notification.js dans main.js
notification.js était tout petit et occasionnait une requête supplémentaire et un événement JavaScript en plus. Proposition de fusion dans le nouveau main.js statique.
-rw-r--r--app/App_FrontController.php1
-rw-r--r--public/scripts/main.js19
-rw-r--r--public/scripts/notification.js17
3 files changed, 19 insertions, 18 deletions
diff --git a/app/App_FrontController.php b/app/App_FrontController.php
index 844956cf9..411550b38 100644
--- a/app/App_FrontController.php
+++ b/app/App_FrontController.php
@@ -65,7 +65,6 @@ class App_FrontController extends FrontController {
if ($this->conf->lazyload () === 'yes') {
View::appendScript (Url::display ('/scripts/jquery.lazyload.min.js'));
}
- View::appendScript (Url::display ('/scripts/notification.js'));
}
private function loadNotifications () {
diff --git a/public/scripts/main.js b/public/scripts/main.js
index 72795be51..18df73820 100644
--- a/public/scripts/main.js
+++ b/public/scripts/main.js
@@ -408,6 +408,24 @@ function init_actualize() {
});
}
+function closeNotification () {
+ $(".notification").slideUp (200, function () {
+ $(".notification").remove ();
+ });
+}
+
+function init_notifications() {
+ notif = $(".notification");
+ if (notif[0] !== undefined) {
+ timer = setInterval('closeNotification()', 5000);
+
+ notif.find ("a.close").click (function () {
+ closeNotification ();
+ return false;
+ });
+ }
+}
+
$(function () {
if (is_reader_mode()) {
hide_posts = false;
@@ -418,5 +436,6 @@ $(function () {
init_stream_delegates($('#stream'));
init_nav_entries();
init_templates();
+ init_notifications();
init_actualize();
});
diff --git a/public/scripts/notification.js b/public/scripts/notification.js
deleted file mode 100644
index e4f9fb649..000000000
--- a/public/scripts/notification.js
+++ /dev/null
@@ -1,17 +0,0 @@
-function closeNotification () {
- $(".notification").slideUp (200, function () {
- $(".notification").remove ();
- });
-}
-
-$(document).ready (function () {
- notif = $(".notification");
- if (notif[0] !== undefined) {
- timer = setInterval('closeNotification()', 5000);
-
- notif.find ("a.close").click (function () {
- closeNotification ();
- return false;
- });
- }
-});