5168b581f1bd9ec40500fd2023d96ab9eaf84a6f
[friendica.git/.git] / view / theme / frio / js / mod_notifications.js
1
2 /**
3  * Javascript for the notifications module
4  */
5
6 // Catch the intro ID from the URL
7 var introID = location.pathname.split("/").pop();
8
9 $(document).ready(function(){
10         // Since only the DIV's inside the notification-list are marked
11         // with the class "unseen", we need some js to transfer this class
12         // to the parent li list-elements.
13         if($(".notif-item").hasClass("unseen")) {
14                 $(".notif-item.unseen").parent("li").addClass("unseen");
15         }
16 });
17
18 $(window).load(function(){
19         // Scroll to the intro by its intro ID.
20         if (isIntroID()) {
21                 scrollToItem('intro-' + introID);
22         }
23 });
24
25 // Check if it is a real introduction ID.
26 function isIntroID() {
27         // Check for the correct path.
28         if (window.location.href.indexOf("/notifications/intros/") !== -1) {
29                 // Make sure the introID is a positive Integer value.
30                 var intVal = Number(introID);
31                 if (Math.floor(intVal) !== Infinity && String(intVal) === introID && intVal > 0) {
32                         return true;
33                 }
34         }
35         return false;
36 }