From 7e65d845779bf14a82ae52ca2d7c0bb20284c0b5 Mon Sep 17 00:00:00 2001
From: rabuzarus <>
Date: Wed, 10 Aug 2016 13:07:13 +0200
Subject: [PATCH] frio: fix for display auto position scroll + some cleanup
---
view/theme/frio/js/mod_display.js | 11 +++++++++++
view/theme/frio/js/theme.js | 19 +++++++++++++++++++
.../frio/templates/threaded_conversation.tpl | 15 +--------------
3 files changed, 31 insertions(+), 14 deletions(-)
create mode 100644 view/theme/frio/js/mod_display.js
diff --git a/view/theme/frio/js/mod_display.js b/view/theme/frio/js/mod_display.js
new file mode 100644
index 0000000000..1faacaeb73
--- /dev/null
+++ b/view/theme/frio/js/mod_display.js
@@ -0,0 +1,11 @@
+/**
+ * @brief Javascript for the display module
+ */
+
+// Catch the GUID from the URL
+var itemID = window.location.pathname.split("/").pop();
+
+$(document).ready(function(){
+ // Scroll to the Item by its GUID
+ scrollToItem(itemID);
+});
diff --git a/view/theme/frio/js/theme.js b/view/theme/frio/js/theme.js
index 1e26ad7705..27f2c93a79 100644
--- a/view/theme/frio/js/theme.js
+++ b/view/theme/frio/js/theme.js
@@ -542,3 +542,22 @@ String.prototype.rtrim = function() {
var trimmed = this.replace(/\s+$/g, '');
return trimmed;
};
+
+// Scroll to a specific item and highlight it
+// Note: jquery.color.js is needed
+function scrollToItem(itemID) {
+ if( typeof searchValue === "undefined")
+ return;
+
+ // Define the colors which are used for highlighting
+ var colWhite = {backgroundColor:'#F5F5F5'};
+ var colShiny = {backgroundColor:'#FFF176'};
+
+ // Scroll to the DIV with the ID (GUID)
+ $('html, body').animate({
+ scrollTop: $('#item-'+itemID).position().top
+ }, 400, function() {
+ // Highlight post/commenent with ID (GUID)
+ $('#item-'+itemID).animate(colWhite, 1000).animate(colShiny).animate(colWhite, 2000);
+ });
+}
diff --git a/view/theme/frio/templates/threaded_conversation.tpl b/view/theme/frio/templates/threaded_conversation.tpl
index 3746ba0324..a5402ede5d 100644
--- a/view/theme/frio/templates/threaded_conversation.tpl
+++ b/view/theme/frio/templates/threaded_conversation.tpl
@@ -1,4 +1,5 @@
+{{if $mode == display}}{{/if}}
{{$live_update}}
@@ -23,17 +24,3 @@
{{/if}}
-
-
-
-{{if $mode == display}}
-
-{{/if}}
-
--
2.39.5