Merge branch 'master' into develop

This commit is contained in:
fabrixxm 2016-09-13 17:19:57 +02:00
commit 3d6e3cbb78
59 changed files with 11590 additions and 10998 deletions

View file

@ -0,0 +1,11 @@
/**
* @brief Javascript for the display module
*/
// Catch the GUID from the URL
var itemGuid = window.location.pathname.split("/").pop();
$(window).load(function(){
// Scroll to the Item by its GUID
scrollToItem('item-'+itemGuid);
});

View file

@ -189,11 +189,19 @@ function confirmDelete() { return confirm(aStr.delitem); }
function dropItem(url, object) {
var confirm = confirmDelete();
//if the first character of the object is #, remove it because
// we use getElementById which don't need the #
// getElementByID selects elements even if there are special characters
// in the ID (like %) which won't work with jQuery
/// @todo ceck if we can solve this in the template
object = object.indexOf('#') == 0 ? object.substring(1) : object;
if(confirm) {
$('body').css('cursor', 'wait');
$(object).fadeTo('fast', 0.33, function () {
$(document.getElementById(object)).fadeTo('fast', 0.33, function () {
$.get(url).done(function() {
$(object).remove();
$(document.getElementById(object)).remove();
$('body').css('cursor', 'auto');
});
});

View file

@ -542,3 +542,31 @@ 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 itemID === "undefined")
return;
var elm = $('#'+itemID);
// Test if the Item exists
if(!elm.length)
return;
// Define the colors which are used for highlighting
var colWhite = {backgroundColor:'#F5F5F5'};
var colShiny = {backgroundColor:'#FFF176'};
// Get the Item Position (we need to substract 100 to match
// correct position
var itemPos = $(elm).offset().top - 100;
// Scroll to the DIV with the ID (GUID)
$('html, body').animate({
scrollTop: itemPos
}, 400, function() {
// Highlight post/commenent with ID (GUID)
$(elm).animate(colWhite, 1000).animate(colShiny).animate(colWhite, 600);
});
}