mirror of
https://github.com/friendica/friendica
synced 2024-11-10 09:02:53 +00:00
frio: fix for display auto position scroll + some cleanup
This commit is contained in:
parent
c7eb7ba73f
commit
7e65d84577
3 changed files with 31 additions and 14 deletions
11
view/theme/frio/js/mod_display.js
Normal file
11
view/theme/frio/js/mod_display.js
Normal file
|
@ -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);
|
||||
});
|
|
@ -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);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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}}
|
||||
|
||||
|
@ -23,17 +24,3 @@
|
|||
</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}}
|
||||
|
||||
|
|
Loading…
Reference in a new issue