can3p (can3p) wrote in changelog,
can3p
can3p
changelog

[livejournal] r19136: LJSUP-8811: Sharing in controlstrip - ne...

Committer: dpetrov
LJSUP-8811: Sharing in controlstrip - need to show all icons
U   trunk/htdocs/js/share.js
Modified: trunk/htdocs/js/share.js
===================================================================
--- trunk/htdocs/js/share.js	2011-05-26 06:26:53 UTC (rev 19135)
+++ trunk/htdocs/js/share.js	2011-05-26 06:57:48 UTC (rev 19136)
@@ -136,7 +136,8 @@
 		}
 	},
 	//list of links wich will be shown, when user will click on share link. Can be overriden in init and link methods.
-	links: [ 'livejournal', 'facebook', 'twitter', 'vkontakte', 'odnoklassniki', 'moimir', 'email', 'digg', 'tumblr', 'stumbleupon' ]
+	links: [ 'livejournal', 'facebook', 'twitter', 'vkontakte', 'odnoklassniki', 'moimir', 'email', 'digg', 'tumblr', 'stumbleupon' ],
+	showOn: 'click'
 };
 
 var global_options = $.extend( true, {}, default_options );
@@ -178,7 +179,8 @@
 
 	var links = ( opts.links ) ? opts.links : global_options.links;
 
-	function buildDom() {
+	function buildDom( initHidden ) {
+		initHidden = initHidden || false;
 		var str = [ supplant( template.start, global_options.ml ) ],
 			serviceName, serviceObj;
 
@@ -195,10 +197,19 @@
 
 		str.push( supplant( template.end, global_options.ml ) );
 
+		bubbleOptions = { target: link, showOn: options.showOn };
+		if( options.showOn === "hover" ) {
+			bubbleOptions.closeControl = false;
+		}
+
 		dom = $( str.join( ' ' ) )
 			.hide()
-			.bubble( { target: link, showOn: 'click' } )
-			.bubble( 'show' );
+			.bubble( bubbleOptions );
+
+		if( !initHidden ) {
+			dom
+				.bubble( 'show' );
+		}
 	}
 
 	function bindControls() {
@@ -227,6 +238,13 @@
 		} );
 	}
 
+	if( options.showOn === "hover" ) {
+		if( !dom ) {
+			buildDom( true );
+			bindControls();
+		}
+	}
+
 	link.one( 'click', function( ev ) {
 		ev.stopPropagation();
 		

Tags: can3p, js, livejournal
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments