[Fusionforge-commits] FusionForge branch Branch_5_3 updated. cdfc1cd6c65871fe460009931c0b4ed660969852

Franck VILLAUME nerville at fusionforge.org
Mon Feb 24 17:27:58 CET 2014


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "FusionForge".

The branch, Branch_5_3 has been updated
       via  cdfc1cd6c65871fe460009931c0b4ed660969852 (commit)
      from  e31a27ad1cf127e75667854354bd5e53a90fff91 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit cdfc1cd6c65871fe460009931c0b4ed660969852
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Mon Feb 24 17:27:10 2014 +0100

    plugin compactpreview: make it usable. increase the delay, move the div, make the div hide on click anywhere else

diff --git a/src/plugins/compactpreview/www/scripts/oslcTooltip.js b/src/plugins/compactpreview/www/scripts/oslcTooltip.js
index 0860f2c..fcccb87 100644
--- a/src/plugins/compactpreview/www/scripts/oslcTooltip.js
+++ b/src/plugins/compactpreview/www/scripts/oslcTooltip.js
@@ -1,5 +1,6 @@
 /**
  * This file is (c) Copyright 2011 by Sabri LABBENE, Institut TELECOM
+ * Copyright 2014, Franck Villaume - TrivialDev
  *
  * This file is part of FusionForge.
  *
@@ -7,12 +8,12 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
@@ -26,91 +27,91 @@
 // TODO : verify license
 // TODO : use the improved version with hoverIntent plugin (http://cherne.net/brian/resources/jquery.hoverIntent.html) as documented in : http://rndnext.blogspot.com/2009/02/jquery-live-and-plugins.html
 
-jQuery(function(){  
-	var hideDelay = 500;    
-	var hideTimer = null;  
-
-	// One instance that's reused to show info for the current resource  
-	var container = jQuery('<div id="resourcePopupContainer">'  
-			+ '<table width="" border="0" cellspacing="0" cellpadding="0" class="resourcePopupPopup">'  
-			+ '<tr>'  
-			+ '   <td class="corner topLeft"></td>'  
-			+ '   <td class="top"></td>'  
-			+ '   <td class="corner topRight"></td>'  
-			+ '</tr>'  
-			+ '<tr>'  
+jQuery(function(){
+	var hideDelay = 2000;
+	var hideTimer = null;
+
+	// One instance that's reused to show info for the current resource
+	var container = jQuery('<div id="resourcePopupContainer">'
+			+ '<table width="" border="0" cellspacing="0" cellpadding="0" class="resourcePopupPopup">'
+			+ '<tr>'
+			+ '   <td class="corner topLeft"></td>'
+			+ '   <td class="top"></td>'
+			+ '   <td class="corner topRight"></td>'
+			+ '</tr>'
+			+ '<tr>'
 			+ '   <td class="left"> </td>'
-			+ '   <td class="resourcePopupResult"><div id="resourcePopupContent"></div></td>'  
-			+ '   <td class="right"> </td>'  
-			+ '</tr>'  
-			+ '<tr>'  
-			+ '   <td class="corner bottomLeft"> </td>'  
-			+ '   <td class="bottom"> </td>'  
-			+ '   <td class="corner bottomRight"></td>'  
-			+ '</tr>'  
-			+ '</table>'  
+			+ '   <td class="resourcePopupResult"><div id="resourcePopupContent"></div></td>'
+			+ '   <td class="right"> </td>'
+			+ '</tr>'
+			+ '<tr>'
+			+ '   <td class="corner bottomLeft"> </td>'
+			+ '   <td class="bottom"> </td>'
+			+ '   <td class="corner bottomRight"></td>'
+			+ '</tr>'
+			+ '</table>'
 			+ '</div>'
-	);  
+	);
 
 	jQuery('body').append(container);
-	
+
 	jQuery('.resourceLocalPopupTrigger').live('mouseover', function() {
 		var url = jQuery(this).attr('href');
-		
+
 		if (hideTimer) {
-			clearTimeout(hideTimer);  
+			clearTimeout(hideTimer);
 		}
 		var pos = jQuery(this).offset();
 		var width = jQuery(this).width();
-		container.css({  
-			left: (pos.left + width) + 'px',  
-			top: pos.top - 5 + 'px'  
+		container.css({
+			left: (pos.left) + 'px',
+			top: pos.top + 10 + 'px'
 		});
 
-		jQuery.ajax({  
+		jQuery.ajax({
 			type: 'GET',
 			url: url,
 			dataType: 'html',
 			beforeSend: function(xhr) {
 				xhr.setRequestHeader("Accept","application/x-fusionforge-compact+html");
 			},
-			
-			success: function(data) { 
+
+			success: function(data) {
 				jQuery('#resourcePopupContent').html(data);
 			}
 		}
-		);  
+		);
 
-		container.css('display', 'block');  
-	});  
+		container.css('display', 'block');
+	});
 
 	jQuery('.resourceOslcPopupTrigger').live('mouseover', function() {
 		var url = jQuery(this).attr('href');
-		
+
 		if (hideTimer) {
-			clearTimeout(hideTimer);  
+			clearTimeout(hideTimer);
 		}
 		var pos = jQuery(this).offset();
 		var width = jQuery(this).width();
-		container.css({  
-			left: (pos.left + width) + 'px',  
-			top: pos.top - 5 + 'px'  
+		container.css({
+			left: (pos.left + width) + 'px',
+			top: pos.top - 5 + 'px'
 		});
 
 		// if remote URL, do some OSLC compact-preview fetching
 		jQuery('#resourcePopupContent').html('<i>...loading compact preview...</i>');
-	
+
 		// Fetch the OSLC compact preview representation of the resource
 		//url: '/'+ resource +'/' + resourceId + '/',
-		jQuery.ajax({  
+		jQuery.ajax({
 			type: 'GET',
 			url: url,
 			dataType: 'xml',
 			beforeSend: function(xhr) {
 				xhr.setRequestHeader("Accept","application/x-oslc-compact+xml");
 			},
-			
-			success: function(data) { 
+
+			success: function(data) {
 				var smPreview = data.documentElement.getElementsByTagName('oslc:smallPreview')[0];
 				if( smPreview ) {
 					var Preview = smPreview.getElementsByTagName('oslc:Preview')[0];
@@ -125,67 +126,73 @@ jQuery(function(){
 					}
 				}
 			}
-		});  
+		});
 
-		container.css('display', 'block');  
-	});  
+		container.css('display', 'block');
+	});
 
-	jQuery('.resourceLocalPopupTrigger').live('mouseout', function() { 
-		if (hideTimer) { 
+	jQuery('.resourceLocalPopupTrigger').live('mouseout', function() {
+		if (hideTimer) {
 			clearTimeout(hideTimer);
 		}
-		hideTimer = setTimeout(function() {  
-			container.css('display', 'none');  
-			}, 
+		hideTimer = setTimeout(function() {
+			container.css('display', 'none');
+			},
 			hideDelay
-		);  
+		);
 	});
 
-	jQuery('.resourceOslcPopupTrigger').live('mouseout', function() { 
-		if (hideTimer) { 
+	jQuery(document).live('mouseup', function(e) {
+		if (!container.is(e.target) && container.has(e.target).length === 0) {
+			container.hide();
+		}
+	});
+
+	jQuery('.resourceOslcPopupTrigger').live('mouseout', function() {
+		if (hideTimer) {
 			clearTimeout(hideTimer);
 		}
-		hideTimer = setTimeout(function() {  
-			container.css('display', 'none');  
-			}, 
+		hideTimer = setTimeout(function() {
+			container.css('display', 'none');
+			},
 			hideDelay
-		);  
+		);
 	});
 
-	// Allow mouse over of details without hiding details  
-	jQuery('#resourceLocalPopupContainer').mouseover(function() {  
-		if (hideTimer) { 
+	// Allow mouse over of details without hiding details
+	jQuery('#resourceLocalPopupContainer').mouseover(function() {
+		if (hideTimer) {
 			clearTimeout(hideTimer);
 		}
-	});  
+	});
 
-	// Allow mouse over of details without hiding details  
-	jQuery('#resourceOslcPopupContainer').mouseover(function() {  
-		if (hideTimer) { 
+	// Allow mouse over of details without hiding details
+	jQuery('#resourceOslcPopupContainer').mouseover(function() {
+		if (hideTimer) {
 			clearTimeout(hideTimer);
 		}
-	});  
+	});
 
-	// Hide after mouseout  
-	jQuery('#resourceLocalPopupContainer').mouseout(function() {  
-		if (hideTimer){  
+	// Hide after mouseout
+	jQuery('#resourceLocalPopupContainer').mouseout(function() {
+		if (hideTimer){
 			clearTimeout(hideTimer);
 		}
-		hideTimer = setTimeout(function() {  
-				container.css('display', 'none');  
+		hideTimer = setTimeout(function() {
+				container.css('display', 'none');
 			},
 			hideDelay
-		);  
-	});  
-	// Hide after mouseout  
-	jQuery('#resourceOslcPopupContainer').mouseout(function() {  
-		if (hideTimer){  
+		);
+	});
+	// Hide after mouseout
+	jQuery('#resourceOslcPopupContainer').mouseout(function() {
+		if (hideTimer){
 			clearTimeout(hideTimer);
 		}
-		hideTimer = setTimeout(function() {  
-				container.css('display', 'none');  
+		hideTimer = setTimeout(function() {
+				container.css('display', 'none');
 			},
 			hideDelay
-		);  
-	});  
-}); 
\ No newline at end of file
+		);
+	});
+});

-----------------------------------------------------------------------

Summary of changes:
 .../compactpreview/www/scripts/oslcTooltip.js      |  175 ++++++++++----------
 1 file changed, 91 insertions(+), 84 deletions(-)


hooks/post-receive
-- 
FusionForge



More information about the Fusionforge-commits mailing list