libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject svn commit: r1556999 - /libcloud/site/trunk/source/_assets/js/code-examples.js
Date Fri, 10 Jan 2014 00:42:37 GMT
Author: tomaz
Date: Fri Jan 10 00:42:37 2014
New Revision: 1556999

URL: http://svn.apache.org/r1556999
Log:
Toggle popover on click.

Modified:
    libcloud/site/trunk/source/_assets/js/code-examples.js

Modified: libcloud/site/trunk/source/_assets/js/code-examples.js
URL: http://svn.apache.org/viewvc/libcloud/site/trunk/source/_assets/js/code-examples.js?rev=1556999&r1=1556998&r2=1556999&view=diff
==============================================================================
--- libcloud/site/trunk/source/_assets/js/code-examples.js (original)
+++ libcloud/site/trunk/source/_assets/js/code-examples.js Fri Jan 10 00:42:37 2014
@@ -46,7 +46,7 @@ var LINE_TOOLTIPS = {
 };
 
 jQuery(document).ready(function($) {
-  $('.example code span[id]').on('mouseover click', function(e) {
+  $('.example code span[id]').on('mouseover click', function(event) {
     var tooltips, lineNumber, content, parentElem, key, options, tooltip,
         hasTooltip;
 
@@ -63,16 +63,21 @@ jQuery(document).ready(function($) {
     lineNumber = $(this).attr('id').replace('line-', '');
     tooltip = tooltips[lineNumber];
 
-    if (hasTooltip) {
-      // Popover for this line has already been created.
+    if (!tooltip) {
+      // No tool tip for this line.
       return;
     }
 
-    if (!tooltip) {
-      // No tool tip for this line.
+    if (hasTooltip) {
+      // Popover for this line has already been created.
+      if (event.type === 'click') {
+        $(this).popover('toggle');
+      }
+
       return;
     }
 
+
     if (tooltip instanceof Array) {
       content = tooltip.join('');
     }



Mime
View raw message