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('');
}