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