ソースを参照

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 年 前
コミット
5c68233985
3 ファイル変更19 行追加18 行削除
  1. 0 1
      app/App_FrontController.php
  2. 19 0
      public/scripts/main.js
  3. 0 17
      public/scripts/notification.js

+ 0 - 1
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 () {

+ 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 () {
 	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();
 });

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