Kaynağa Gözat

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.
Alexandre Alapetite 12 yıl önce
ebeveyn
işleme
5c68233985

+ 0 - 1
app/App_FrontController.php

@@ -65,7 +65,6 @@ class App_FrontController extends FrontController {
 		if ($this->conf->lazyload () === 'yes') {
 		if ($this->conf->lazyload () === 'yes') {
 			View::appendScript (Url::display ('/scripts/jquery.lazyload.min.js'));
 			View::appendScript (Url::display ('/scripts/jquery.lazyload.min.js'));
 		}
 		}
-		View::appendScript (Url::display ('/scripts/notification.js'));
 	}
 	}
 
 
 	private function loadNotifications () {
 	private function loadNotifications () {

+ 19 - 0
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 () {
 $(function () {
 	if (is_reader_mode()) {
 	if (is_reader_mode()) {
 		hide_posts = false;
 		hide_posts = false;
@@ -418,5 +436,6 @@ $(function () {
 	init_stream_delegates($('#stream'));
 	init_stream_delegates($('#stream'));
 	init_nav_entries();
 	init_nav_entries();
 	init_templates();
 	init_templates();
+	init_notifications();
 	init_actualize();
 	init_actualize();
 });
 });

+ 0 - 17
public/scripts/notification.js

@@ -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;
-		});
-	}
-});