1
1
Fork 0
friendica_2019-12_sharedHos.../view/theme/frio/js/mod_notifications.js

39 lines
1.1 KiB
JavaScript
Raw Normal View History

// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPLv3-or-later
/**
2020-01-19 07:05:23 +01:00
* Javascript for the notifications module
*/
// Catch the intro ID from the URL
var introID = location.pathname.split("/").pop();
2021-01-22 14:38:44 +01:00
$(document).ready(function () {
// Since only the DIV's inside the notification-list are marked
// with the class "unseen", we need some js to transfer this class
// to the parent li list-elements.
2021-01-22 14:38:44 +01:00
if ($(".notif-item").hasClass("unseen")) {
$(".notif-item.unseen").parent("li").addClass("unseen");
}
});
2021-01-22 14:38:44 +01:00
$(window).load(function () {
// Scroll to the intro by its intro ID.
if (isIntroID()) {
2021-01-22 14:38:44 +01:00
scrollToItem("intro-" + introID);
}
});
// 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;
}
// @license-end