From aaeb85c94475fd203e89656cb3bd0c97315dc39a Mon Sep 17 00:00:00 2001 From: rabuzarus Date: Thu, 14 Jun 2018 18:49:53 +0200 Subject: [PATCH] Frio: scroll to the contact request in notifications module --- view/theme/frio/js/mod_notifications.js | 36 +++++++++++++++++++++ view/theme/frio/templates/notifications.tpl | 12 ++----- 2 files changed, 38 insertions(+), 10 deletions(-) create mode 100644 view/theme/frio/js/mod_notifications.js diff --git a/view/theme/frio/js/mod_notifications.js b/view/theme/frio/js/mod_notifications.js new file mode 100644 index 000000000..9574ea02b --- /dev/null +++ b/view/theme/frio/js/mod_notifications.js @@ -0,0 +1,36 @@ + +/** + * @brief Javascript for the notifications module + */ + +// Catch the intro ID from the URL +var introID = location.pathname.split("/").pop(); + +$(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. + if($(".notif-item").hasClass("unseen")) { + $(".notif-item.unseen").parent("li").addClass("unseen"); + } +}); + +$(window).load(function(){ + // Scroll to the intro by its intro ID. + if (isIntroID()) { + 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; +} diff --git a/view/theme/frio/templates/notifications.tpl b/view/theme/frio/templates/notifications.tpl index dcea0b85f..b6b1d2da9 100644 --- a/view/theme/frio/templates/notifications.tpl +++ b/view/theme/frio/templates/notifications.tpl @@ -1,3 +1,5 @@ + +
{{include file="section_title.tpl" title=$notif_header}} @@ -26,13 +28,3 @@ {{* The pager *}} {{$notif_paginate}}
- -{{* 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 *}} - \ No newline at end of file