From: rabuzarus <> Date: Wed, 10 Aug 2016 11:07:13 +0000 (+0200) Subject: frio: fix for display auto position scroll + some cleanup X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=7e65d845779bf14a82ae52ca2d7c0bb20284c0b5;p=friendica.git frio: fix for display auto position scroll + some cleanup --- 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}} -