Frio: scroll to the contact request in notifications module

This commit is contained in:
rabuzarus 2018-06-14 18:49:53 +02:00
parent b8186ba98b
commit aaeb85c944
2 changed files with 38 additions and 10 deletions

View File

@ -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;
}

View File

@ -1,3 +1,5 @@
<script type="text/javascript" src="view/theme/frio/frameworks/jquery-color/jquery.color.js"></script>
<script type="text/javascript" src="view/theme/frio/js/mod_notifications.js"></script>
<div class="generic-page-wrapper">
{{include file="section_title.tpl" title=$notif_header}}
@ -26,13 +28,3 @@
{{* The pager *}}
{{$notif_paginate}}
</div>
{{* 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 *}}
<script type="text/javascript">
$(document).ready(function(){
if( $(".notif-item").hasClass("unseen")) {
$(".notif-item.unseen").parent("li").addClass("unseen");
}
});
</script>