]> git.mxchange.org Git - friendica.git/commitdiff
frio: fix for display auto position scroll + some cleanup
authorrabuzarus <>
Wed, 10 Aug 2016 11:07:13 +0000 (13:07 +0200)
committerrabuzarus <>
Wed, 10 Aug 2016 11:07:13 +0000 (13:07 +0200)
view/theme/frio/js/mod_display.js [new file with mode: 0644]
view/theme/frio/js/theme.js
view/theme/frio/templates/threaded_conversation.tpl

diff --git a/view/theme/frio/js/mod_display.js b/view/theme/frio/js/mod_display.js
new file mode 100644 (file)
index 0000000..1faacae
--- /dev/null
@@ -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);
+});
index 1e26ad7705af71e57e5e782497b920f674db7f28..27f2c93a79d273aea8588c2cd7be241a788d72dc 100644 (file)
@@ -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);
+       });
+}
index 3746ba0324e623f64b35bc21345348e4f88a6de7..a5402ede5d9b426687693b5c15bf2def19c731b6 100644 (file)
@@ -1,4 +1,5 @@
 <script type="text/javascript" src="view/theme/frio/frameworks/jquery-color/jquery.color.js"></script>
+{{if $mode == display}}<script type="text/javascript" src="view/theme/frio/js/mod_display.js"></script>{{/if}}
 
 {{$live_update}}
 
 </a>
 <img id="item-delete-selected-rotator" class="like-rotator" src="images/rotator.gif" style="display: none;" />
 {{/if}}
-
-<script>
-    var colWhite = {backgroundColor:'#F5F5F5'};
-    var colShiny = {backgroundColor:'#FFF176'};
-</script>
-
-{{if $mode == display}}
-<script>
-    var id = window.location.pathname.split("/").pop();
-    $(window).scrollTop($('#item-'+id).position().top);
-    $('#item-'+id).animate(colWhite, 1000).animate(colShiny).animate(colWhite, 2000);   
-</script>
-{{/if}}
-