2024-08-25 06:45:08 +00:00
|
|
|
// SPDX-FileCopyrightText: 2010-2024 the Friendica project
|
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
|
2020-09-27 16:36:33 +00:00
|
|
|
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPLv3-or-later
|
2018-06-14 16:49:53 +00:00
|
|
|
|
|
|
|
/**
|
2023-03-21 03:16:32 +00:00
|
|
|
* JavaScript for the notifications module
|
2018-06-14 16:49:53 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
// Catch the intro ID from the URL
|
|
|
|
var introID = location.pathname.split("/").pop();
|
|
|
|
|
2021-01-22 13:38:44 +00:00
|
|
|
$(document).ready(function () {
|
2018-06-20 20:12:59 +00:00
|
|
|
// Since only the DIV's inside the notification-list are marked
|
2018-06-14 16:49:53 +00:00
|
|
|
// with the class "unseen", we need some js to transfer this class
|
|
|
|
// to the parent li list-elements.
|
2021-01-22 13:38:44 +00:00
|
|
|
if ($(".notif-item").hasClass("unseen")) {
|
2018-06-14 16:49:53 +00:00
|
|
|
$(".notif-item.unseen").parent("li").addClass("unseen");
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2021-01-22 13:38:44 +00:00
|
|
|
$(window).load(function () {
|
2018-06-14 16:49:53 +00:00
|
|
|
// Scroll to the intro by its intro ID.
|
|
|
|
if (isIntroID()) {
|
2021-01-22 13:38:44 +00:00
|
|
|
scrollToItem("intro-" + introID);
|
2018-06-14 16:49:53 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
// Check if it is a real introduction ID.
|
|
|
|
function isIntroID() {
|
|
|
|
// Check for the correct path.
|
|
|
|
if (window.location.href.indexOf("/notifications/intros/") !== -1) {
|
|
|
|
// Make sure the introID is a positive Integer value.
|
|
|
|
var intVal = Number(introID);
|
|
|
|
if (Math.floor(intVal) !== Infinity && String(intVal) === introID && intVal > 0) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
2020-09-27 16:36:33 +00:00
|
|
|
// @license-end
|