##// END OF EJS Templates
Merge pull request #5760 from ivanov/connection-mixin...
Merge pull request #5760 from ivanov/connection-mixin DRY out load_connection_file implementations

File last commit:

r16184:1cdf2fd3
r16508:3403b188 merge
Show More
tooltip.js
387 lines | 13.8 KiB | application/javascript | JavascriptLexer
Matthias Bussonnier
tooltip to mac
r7145 //----------------------------------------------------------------------------
// Copyright (C) 2008-2011 The IPython Development Team
//
// Distributed under the terms of the BSD License. The full license is in
// the file COPYING, distributed as part of this software.
//----------------------------------------------------------------------------
//============================================================================
// Tooltip
//============================================================================
Matthias Bussonnier
fix scrolltop
r7151 //
Matthias BUSSONNIER
Clean code, retab and minor fix...
r7170 // you can set the autocall time by setting `IPython.tooltip.time_before_tooltip` in ms
Matthias BUSSONNIER
make tooltip tabs fonction configurable
r7172 //
Thomas Kluyver
Update tooltips to refer to shift-tab...
r16184 // you can configure the differents action of pressing shift-tab several times in a row by
Matthias BUSSONNIER
clean code, show clock if tooltip is 'sticky'...
r7173 // setting/appending different fonction in the array
Matthias BUSSONNIER
make tooltip tabs fonction configurable
r7172 // IPython.tooltip.tabs_functions
//
// eg :
Matthias BUSSONNIER
space before function keyword in js
r7191 // IPython.tooltip.tabs_functions[4] = function (){console.log('this is the action of the 4th tab pressing')}
Matthias BUSSONNIER
make tooltip tabs fonction configurable
r7172 //
Matthias BUSSONNIER
space before function keyword in js
r7191 var IPython = (function (IPython) {
Matthias BUSSONNIER
clean code, show clock if tooltip is 'sticky'...
r7173 "use strict";
Matthias Bussonnier
tooltip to mac
r7145
var utils = IPython.utils;
Matthias BUSSONNIER
clean code, show clock if tooltip is 'sticky'...
r7173
Matthias BUSSONNIER
clean and comment tooltip file
r7162 // tooltip constructor
Matthias BUSSONNIER
space before function keyword in js
r7191 var Tooltip = function () {
Matthias BUSSONNIER
beautify tooltip.js
r7189 var that = this;
this.time_before_tooltip = 1200;
Matthias BUSSONNIER
clean and comment tooltip file
r7162
Matthias BUSSONNIER
beautify tooltip.js
r7189 // handle to html
this.tooltip = $('#tooltip');
this._hidden = true;
Matthias BUSSONNIER
animation if already shown
r7153
Matthias BUSSONNIER
beautify tooltip.js
r7189 // variable for consecutive call
this._old_cell = null;
this._old_request = null;
this._consecutive_counter = 0;
Matthias BUSSONNIER
multiple tooltip action...
r7160
Matthias BUSSONNIER
beautify tooltip.js
r7189 // 'sticky ?'
this._sticky = false;
Matthias BUSSONNIER
multiple tooltip action...
r7160
Jessica B. Hamrick
Closes #3788
r11715 // display tooltip if the docstring is empty?
this._hide_if_no_docstring = false;
Matthias BUSSONNIER
beautify tooltip.js
r7189 // contain the button in the upper right corner
this.buttons = $('<div/>').addClass('tooltipbuttons');
// will contain the docstring
this.text = $('<div/>').addClass('tooltiptext').addClass('smalltooltip');
// build the buttons menu on the upper right
// expand the tooltip to see more
var expandlink = $('<a/>').attr('href', "#").addClass("ui-corner-all") //rounded corner
Thomas Kluyver
Update tooltips to refer to shift-tab...
r16184 .attr('role', "button").attr('id', 'expanbutton').attr('title', 'Grow the tooltip vertically (press shift-tab twice)').click(function () {
Jonathan Frederic
Fixed lots of bugs...
r15493 that.expand();
Matthias BUSSONNIER
beautify tooltip.js
r7189 }).append(
$('<span/>').text('Expand').addClass('ui-icon').addClass('ui-icon-plus'));
// open in pager
Thomas Kluyver
Update tooltips to refer to shift-tab...
r16184 var morelink = $('<a/>').attr('href', "#").attr('role', "button").addClass('ui-button').attr('title', 'show the current docstring in pager (press shift-tab 4 times)');
Matthias BUSSONNIER
beautify tooltip.js
r7189 var morespan = $('<span/>').text('Open in Pager').addClass('ui-icon').addClass('ui-icon-arrowstop-l-n');
morelink.append(morespan);
Matthias BUSSONNIER
space before function keyword in js
r7191 morelink.click(function () {
Paul Ivanov
passing cell to showInPager, closes #3625
r11331 that.showInPager(that._old_cell);
Matthias BUSSONNIER
beautify tooltip.js
r7189 });
Matthias BUSSONNIER
improve new tooltip
r7147
Matthias BUSSONNIER
beautify tooltip.js
r7189 // close the tooltip
var closelink = $('<a/>').attr('href', "#").attr('role', "button").addClass('ui-button');
var closespan = $('<span/>').text('Close').addClass('ui-icon').addClass('ui-icon-close');
closelink.append(closespan);
Matthias BUSSONNIER
space before function keyword in js
r7191 closelink.click(function () {
Matthias BUSSONNIER
beautify tooltip.js
r7189 that.remove_and_cancel_tooltip(true);
Matthias BUSSONNIER
improve new tooltip
r7147 });
Matthias BUSSONNIER
clean and comment tooltip file
r7162
Matthias BUSSONNIER
beautify tooltip.js
r7189 this._clocklink = $('<a/>').attr('href', "#");
this._clocklink.attr('role', "button");
this._clocklink.addClass('ui-button');
this._clocklink.attr('title', 'Tootip is not dismissed while typing for 10 seconds');
var clockspan = $('<span/>').text('Close');
Matthias BUSSONNIER
clean code, show clock if tooltip is 'sticky'...
r7173 clockspan.addClass('ui-icon');
clockspan.addClass('ui-icon-clock');
Matthias BUSSONNIER
beautify tooltip.js
r7189 this._clocklink.append(clockspan);
Matthias BUSSONNIER
space before function keyword in js
r7191 this._clocklink.click(function () {
Matthias BUSSONNIER
beautify tooltip.js
r7189 that.cancel_stick();
Matthias BUSSONNIER
clean code, show clock if tooltip is 'sticky'...
r7173 });
Matthias BUSSONNIER
beautify tooltip.js
r7189 //construct the tooltip
// add in the reverse order you want them to appear
this.buttons.append(closelink);
this.buttons.append(expandlink);
this.buttons.append(morelink);
this.buttons.append(this._clocklink);
this._clocklink.hide();
// we need a phony element to make the small arrow
// of the tooltip in css
// we will move the arrow later
this.arrow = $('<div/>').addClass('pretooltiparrow');
this.tooltip.append(this.buttons);
this.tooltip.append(this.arrow);
this.tooltip.append(this.text);
// function that will be called if you press tab 1, 2, 3... times in a row
Matthias BUSSONNIER
space before function keyword in js
r7191 this.tabs_functions = [function (cell, text) {
Matthias BUSSONNIER
beautify tooltip.js
r7189 that._request_tooltip(cell, text);
Matthias BUSSONNIER
space before function keyword in js
r7191 }, function () {
Matthias BUSSONNIER
beautify tooltip.js
r7189 that.expand();
Matthias BUSSONNIER
space before function keyword in js
r7191 }, function () {
Matthias BUSSONNIER
beautify tooltip.js
r7189 that.stick();
Matthias BUSSONNIER
space before function keyword in js
r7191 }, function (cell) {
Matthias BUSSONNIER
beautify tooltip.js
r7189 that.cancel_stick();
that.showInPager(cell);
}];
// call after all the tabs function above have bee call to clean their effects
// if necessary
Matthias BUSSONNIER
space before function keyword in js
r7191 this.reset_tabs_function = function (cell, text) {
Matthias BUSSONNIER
beautify tooltip.js
r7189 this._old_cell = (cell) ? cell : null;
this._old_request = (text) ? text : null;
this._consecutive_counter = 0;
Jonathan Frederic
Fixed lots of bugs...
r15493 };
Matthias BUSSONNIER
beautify tooltip.js
r7189 };
Jonathan Frederic
Fixed lots of bugs...
r15493 Tooltip.prototype.is_visible = function () {
return !this._hidden;
};
Matthias BUSSONNIER
space before function keyword in js
r7191 Tooltip.prototype.showInPager = function (cell) {
Matthias BUSSONNIER
make tooltip tabs fonction configurable
r7172 // reexecute last call in pager by appending ? to show back in pager
var that = this;
Jonathan Frederic
Fix tooltip pager feature...
r15987 var callbacks = {'shell' : {
'payload' : {
'page' : $.proxy(cell._open_with_pager, cell)
}
}
};
cell.kernel.execute(that.name + '?', callbacks, {'silent': false, 'store_history': true});
Matthias BUSSONNIER
make tooltip tabs fonction configurable
r7172 this.remove_and_cancel_tooltip();
Jonathan Frederic
Fixed lots of bugs...
r15493 };
Matthias BUSSONNIER
multiple tooltip action...
r7160
Matthias BUSSONNIER
clean and comment tooltip file
r7162 // grow the tooltip verticaly
Matthias BUSSONNIER
space before function keyword in js
r7191 Tooltip.prototype.expand = function () {
Matthias BUSSONNIER
multiple tooltip action...
r7160 this.text.removeClass('smalltooltip');
this.text.addClass('bigtooltip');
Matthias BUSSONNIER
clean code, show clock if tooltip is 'sticky'...
r7173 $('#expanbutton').hide('slow');
Jonathan Frederic
Fixed lots of bugs...
r15493 };
Matthias BUSSONNIER
multiple tooltip action...
r7160
Matthias Bussonnier
fix scrolltop
r7151 // deal with all the logic of hiding the tooltip
// and reset it's status
Matthias BUSSONNIER
rename show/hide methods to avoid jQuery conflict....
r7202 Tooltip.prototype._hide = function () {
Jonathan Frederic
Fixed lots of bugs...
r15493 this._hidden = true;
Matthias BUSSONNIER
rename show/hide methods to avoid jQuery conflict....
r7202 this.tooltip.fadeOut('fast');
Matthias BUSSONNIER
beautify tooltip.js
r7189 $('#expanbutton').show('slow');
this.text.removeClass('bigtooltip');
this.text.addClass('smalltooltip');
// keep scroll top to be sure to always see the first line
this.text.scrollTop(0);
Matthias BUSSONNIER
fix tooltip keep focus on wrong cell...
r7204 this.code_mirror = null;
Jonathan Frederic
Fixed lots of bugs...
r15493 };
Matthias Bussonnier
tooltip to mac
r7145
Takeshi Kanmae
Have remove_and_cancel_tooltip() return a boolean
r12459 // return true on successfully removing a visible tooltip; otherwise return
// false.
Matthias BUSSONNIER
space before function keyword in js
r7191 Tooltip.prototype.remove_and_cancel_tooltip = function (force) {
Matthias Bussonnier
tooltip to mac
r7145 // note that we don't handle closing directly inside the calltip
// as in the completer, because it is not focusable, so won't
// get the event.
MinRK
fix tooltip cancel...
r12955 this.cancel_pending();
Takeshi Kanmae
Update boolean tests
r12533 if (!this._hidden) {
if (force || !this._sticky) {
Takeshi Kanmae
Have remove_and_cancel_tooltip() return a boolean
r12459 this.cancel_stick();
this._hide();
}
this.reset_tabs_function();
return true;
} else {
return false;
Matthias BUSSONNIER
multiple tooltip action...
r7160 }
Jonathan Frederic
Fixed lots of bugs...
r15493 };
Matthias BUSSONNIER
multiple tooltip action...
r7160
Matthias BUSSONNIER
clean and comment tooltip file
r7162 // cancel autocall done after '(' for example.
Matthias BUSSONNIER
space before function keyword in js
r7191 Tooltip.prototype.cancel_pending = function () {
Jonathan Frederic
Fixed lots of bugs...
r15493 if (this._tooltip_timeout !== null) {
Matthias BUSSONNIER
clean code, show clock if tooltip is 'sticky'...
r7173 clearTimeout(this._tooltip_timeout);
this._tooltip_timeout = null;
Matthias Bussonnier
tooltip to mac
r7145 }
Jonathan Frederic
Fixed lots of bugs...
r15493 };
Matthias BUSSONNIER
clean and comment tooltip file
r7162
// will trigger tooltip after timeout
Jessica B. Hamrick
Closes #3788
r11715 Tooltip.prototype.pending = function (cell, hide_if_no_docstring) {
Matthias BUSSONNIER
call tooltip after time
r7157 var that = this;
Matthias BUSSONNIER
space before function keyword in js
r7191 this._tooltip_timeout = setTimeout(function () {
Jonathan Frederic
Fixed lots of bugs...
r15493 that.request(cell, hide_if_no_docstring);
Matthias BUSSONNIER
beautify tooltip.js
r7189 }, that.time_before_tooltip);
Jonathan Frederic
Fixed lots of bugs...
r15493 };
Matthias BUSSONNIER
clean code, show clock if tooltip is 'sticky'...
r7173
Matthias BUSSONNIER
Factorise code in tooltip for julia monkeypatching
r12819 // easy access for julia monkey patching.
MinRK
fix tooltip token regex for single-character names...
r14716 Tooltip.last_token_re = /[a-z_][0-9a-z._]*$/gi;
Matthias BUSSONNIER
Factorise code in tooltip for julia monkeypatching
r12819
Tooltip.prototype.extract_oir_token = function(line){
Matthias BUSSONNIER
beautify tooltip.js
r7189 // use internally just to make the request to the kernel
// Feel free to shorten this logic if you are better
// than me in regEx
// basicaly you shoul be able to get xxx.xxx.xxx from
// something(range(10), kwarg=smth) ; xxx.xxx.xxx( firstarg, rand(234,23), kwarg1=2,
// remove everything between matchin bracket (need to iterate)
var matchBracket = /\([^\(\)]+\)/g;
var endBracket = /\([^\(]*$/g;
Matthias BUSSONNIER
Factorise code in tooltip for julia monkeypatching
r12819 var oldline = line;
Matthias BUSSONNIER
beautify tooltip.js
r7189
Matthias BUSSONNIER
Factorise code in tooltip for julia monkeypatching
r12819 line = line.replace(matchBracket, "");
while (oldline != line) {
oldline = line;
line = line.replace(matchBracket, "");
Matthias BUSSONNIER
beautify tooltip.js
r7189 }
// remove everything after last open bracket
Matthias BUSSONNIER
Factorise code in tooltip for julia monkeypatching
r12819 line = line.replace(endBracket, "");
Steve Fox
Tabs converted to spaces for #4643
r13883 // reset the regex object
Tooltip.last_token_re.lastIndex = 0;
Jonathan Frederic
Fixed lots of bugs...
r15493 return Tooltip.last_token_re.exec(line);
MinRK
only pass shell.reply callback to oinfo / complete...
r13208 };
Matthias BUSSONNIER
beautify tooltip.js
r7189
Matthias BUSSONNIER
Factorise code in tooltip for julia monkeypatching
r12819 Tooltip.prototype._request_tooltip = function (cell, line) {
Matthias BUSSONNIER
fix and add shim for change introduce by #4195...
r13327 var callbacks = $.proxy(this._show, this);
Zachary Sailer
drop file ext off notebook name in notebook
r13005 var oir_token = this.extract_oir_token(line);
Matthias BUSSONNIER
fix and add shim for change introduce by #4195...
r13327 var msg_id = cell.kernel.object_info(oir_token, callbacks);
MinRK
refactor js callbacks...
r13207 };
Matthias BUSSONNIER
clean and comment tooltip file
r7162
// make an imediate completion request
Jessica B. Hamrick
Closes #3788
r11715 Tooltip.prototype.request = function (cell, hide_if_no_docstring) {
Matthias BUSSONNIER
clean code, show clock if tooltip is 'sticky'...
r7173 // request(codecell)
Matthias BUSSONNIER
make tooltip tabs fonction configurable
r7172 // Deal with extracting the text from the cell and counting
// call in a row
Matthias BUSSONNIER
multiple tooltip action...
r7160 this.cancel_pending();
var editor = cell.code_mirror;
var cursor = editor.getCursor();
Matthias BUSSONNIER
beautify tooltip.js
r7189 var text = editor.getRange({
line: cursor.line,
ch: 0
}, cursor).trim();
Matthias BUSSONNIER
clean code, show clock if tooltip is 'sticky'...
r7173
Jessica B. Hamrick
Closes #3788
r11715 this._hide_if_no_docstring = hide_if_no_docstring;
Bussonnier Matthias
shift tqb for tooltip
r8949 if(editor.somethingSelected()){
text = editor.getSelection();
}
Matthias BUSSONNIER
fix tooltip keep focus on wrong cell...
r7204 // need a permanent handel to code_mirror for future auto recall
Matthias BUSSONNIER
make tooltip tabs fonction configurable
r7172 this.code_mirror = editor;
Matthias BUSSONNIER
clean code, show clock if tooltip is 'sticky'...
r7173 // now we treat the different number of keypress
Matthias BUSSONNIER
make tooltip tabs fonction configurable
r7172 // first if same cell, same text, increment counter by 1
Jonathan Frederic
Fixed lots of bugs...
r15493 if (this._old_cell == cell && this._old_request == text && this._hidden === false) {
Matthias BUSSONNIER
clean code, show clock if tooltip is 'sticky'...
r7173 this._consecutive_counter++;
Matthias BUSSONNIER
multiple tooltip action...
r7160 } else {
Matthias BUSSONNIER
make tooltip tabs fonction configurable
r7172 // else reset
Matthias BUSSONNIER
clean code, show clock if tooltip is 'sticky'...
r7173 this.cancel_stick();
Matthias BUSSONNIER
space before function keyword in js
r7191 this.reset_tabs_function (cell, text);
Matthias BUSSONNIER
multiple tooltip action...
r7160 }
Matthias BUSSONNIER
clean code, show clock if tooltip is 'sticky'...
r7173
Matthias BUSSONNIER
make tooltip tabs fonction configurable
r7172 // don't do anything if line beggin with '(' or is empty
Matthias BUSSONNIER
beautify tooltip.js
r7189 if (text === "" || text === "(") {
Matthias BUSSONNIER
multiple tooltip action...
r7160 return;
}
Matthias BUSSONNIER
clean code, show clock if tooltip is 'sticky'...
r7173
Matthias BUSSONNIER
beautify tooltip.js
r7189 this.tabs_functions[this._consecutive_counter](cell, text);
Matthias BUSSONNIER
clean code, show clock if tooltip is 'sticky'...
r7173
// then if we are at the end of list function, reset
Steve Fox
Bug fix for #4643: Regex object needs to be reset between calls in tooltip.js
r13793 if (this._consecutive_counter == this.tabs_functions.length) {
Steve Fox
Tabs converted to spaces for #4643
r13883 this.reset_tabs_function (cell, text);
Steve Fox
Bug fix for #4643: Regex object needs to be reset between calls in tooltip.js
r13793 }
Matthias BUSSONNIER
clean code, show clock if tooltip is 'sticky'...
r7173
Matthias BUSSONNIER
make tooltip tabs fonction configurable
r7172 return;
Jonathan Frederic
Fixed lots of bugs...
r15493 };
Matthias BUSSONNIER
clean and comment tooltip file
r7162
// cancel the option of having the tooltip to stick
Matthias BUSSONNIER
space before function keyword in js
r7191 Tooltip.prototype.cancel_stick = function () {
Matthias BUSSONNIER
beautify tooltip.js
r7189 clearTimeout(this._stick_timeout);
this._stick_timeout = null;
this._clocklink.hide('slow');
this._sticky = false;
Jonathan Frederic
Fixed lots of bugs...
r15493 };
Matthias BUSSONNIER
multiple tooltip action...
r7160
Matthias BUSSONNIER
clean and comment tooltip file
r7162 // put the tooltip in a sicky state for 10 seconds
// it won't be removed by remove_and_cancell() unless you called with
// the first parameter set to true.
// remove_and_cancell_tooltip(true)
Matthias BUSSONNIER
space before function keyword in js
r7191 Tooltip.prototype.stick = function (time) {
Jonathan Frederic
Fixed lots of bugs...
r15493 time = (time !== undefined) ? time : 10;
Matthias BUSSONNIER
clean and comment tooltip file
r7162 var that = this;
Matthias BUSSONNIER
multiple tooltip action...
r7160 this._sticky = true;
Matthias BUSSONNIER
clean code, show clock if tooltip is 'sticky'...
r7173 this._clocklink.show('slow');
Matthias BUSSONNIER
space before function keyword in js
r7191 this._stick_timeout = setTimeout(function () {
Matthias BUSSONNIER
multiple tooltip action...
r7160 that._sticky = false;
Matthias BUSSONNIER
clean code, show clock if tooltip is 'sticky'...
r7173 that._clocklink.hide('slow');
Matthias BUSSONNIER
beautify tooltip.js
r7189 }, time * 1000);
Jonathan Frederic
Fixed lots of bugs...
r15493 };
Matthias BUSSONNIER
call tooltip by cell reference
r7156
Matthias BUSSONNIER
clean and comment tooltip file
r7162 // should be called with the kernel reply to actually show the tooltip
Matthias BUSSONNIER
rename show/hide methods to avoid jQuery conflict....
r7202 Tooltip.prototype._show = function (reply) {
Matthias BUSSONNIER
animation if already shown
r7153 // move the bubble if it is not hidden
// otherwise fade it
MinRK
refactor js callbacks...
r13207 var content = reply.content;
MinRK
don't show tooltip if object is not found...
r14787 if (!content.found) {
// object not found, nothing to show
return;
}
MinRK
refactor js callbacks...
r13207 this.name = content.name;
Matthias BUSSONNIER
multiple tooltip action...
r7160
// do some math to have the tooltip arrow on more or less on left or right
// width of the editor
Matthias BUSSONNIER
clean code, show clock if tooltip is 'sticky'...
r7173 var w = $(this.code_mirror.getScrollerElement()).width();
Matthias BUSSONNIER
multiple tooltip action...
r7160 // ofset of the editor
Matthias BUSSONNIER
clean code, show clock if tooltip is 'sticky'...
r7173 var o = $(this.code_mirror.getScrollerElement()).offset();
Bussonnier Matthias
shift tqb for tooltip
r8949
// whatever anchor/head order but arrow at mid x selection
var anchor = this.code_mirror.cursorCoords(false);
var head = this.code_mirror.cursorCoords(true);
Brian E. Granger
Fix CM related sizing issues for completer and tooltip.
r10425 var xinit = (head.left+anchor.left)/2;
Matthias BUSSONNIER
beautify tooltip.js
r7189 var xinter = o.left + (xinit - o.left) / w * (w - 450);
Matthias BUSSONNIER
move arow with tooltip positoin
r7155 var posarrowleft = xinit - xinter;
Matthias BUSSONNIER
clean and comment tooltip file
r7162
Jonathan Frederic
Fixed lots of bugs...
r15493 if (this._hidden === false) {
Matthias BUSSONNIER
beautify tooltip.js
r7189 this.tooltip.animate({
'left': xinter - 30 + 'px',
Brian E. Granger
Fix CM related sizing issues for completer and tooltip.
r10425 'top': (head.bottom + 10) + 'px'
Matthias BUSSONNIER
beautify tooltip.js
r7189 });
} else {
this.tooltip.css({
'left': xinter - 30 + 'px'
});
this.tooltip.css({
Brian E. Granger
Fix CM related sizing issues for completer and tooltip.
r10425 'top': (head.bottom + 10) + 'px'
Matthias BUSSONNIER
beautify tooltip.js
r7189 });
Matthias BUSSONNIER
animation if already shown
r7153 }
Matthias BUSSONNIER
beautify tooltip.js
r7189 this.arrow.animate({
'left': posarrowleft + 'px'
});
Matthias BUSSONNIER
improve new tooltip
r7147
// build docstring
MinRK
refactor js callbacks...
r13207 var defstring = content.call_def;
MinRK
treat all falsy values the same in tooltip...
r14788 if (!defstring) {
MinRK
refactor js callbacks...
r13207 defstring = content.init_definition;
Matthias BUSSONNIER
beautify tooltip.js
r7189 }
MinRK
treat all falsy values the same in tooltip...
r14788 if (!defstring) {
MinRK
refactor js callbacks...
r13207 defstring = content.definition;
Matthias BUSSONNIER
beautify tooltip.js
r7189 }
Matthias BUSSONNIER
improve new tooltip
r7147
MinRK
refactor js callbacks...
r13207 var docstring = content.call_docstring;
MinRK
treat all falsy values the same in tooltip...
r14788 if (!docstring) {
MinRK
refactor js callbacks...
r13207 docstring = content.init_docstring;
Matthias BUSSONNIER
beautify tooltip.js
r7189 }
MinRK
treat all falsy values the same in tooltip...
r14788 if (!docstring) {
MinRK
refactor js callbacks...
r13207 docstring = content.docstring;
Matthias BUSSONNIER
beautify tooltip.js
r7189 }
Takeshi Kanmae
Have remove_and_cancel_tooltip() return a boolean
r12459
MinRK
treat all falsy values the same in tooltip...
r14788 if (!docstring) {
MinRK
fix incorrect `empty-docstring`...
r11855 // For reals this time, no docstring
if (this._hide_if_no_docstring) {
return;
} else {
docstring = "<empty docstring>";
}
Matthias BUSSONNIER
beautify tooltip.js
r7189 }
Matthias BUSSONNIER
improve new tooltip
r7147
Jessica B. Hamrick
Closes #3788
r11715 this._hidden = false;
Jonathan Frederic
Fixed lots of bugs...
r15493 this.tooltip.fadeIn('fast');
Matthias BUSSONNIER
improve new tooltip
r7147 this.text.children().remove();
Jonathan Frederic
Audit .html() calls take #2
r15376 // Any HTML within the docstring is escaped by the fixConsole() method.
Matthias BUSSONNIER
beautify tooltip.js
r7189 var pre = $('<pre/>').html(utils.fixConsole(docstring));
if (defstring) {
Matthias BUSSONNIER
improve new tooltip
r7147 var defstring_html = $('<pre/>').html(utils.fixConsole(defstring));
this.text.append(defstring_html);
}
Matthias Bussonnier
fix scrolltop
r7151 this.text.append(pre);
Matthias BUSSONNIER
almost all logic in tooltip.js, padding right button
r7158 // keep scroll top to be sure to always see the first line
this.text.scrollTop(0);
Jonathan Frederic
Fixed lots of bugs...
r15493 };
Matthias BUSSONNIER
call tooltip by cell reference
r7156
Matthias Bussonnier
tooltip to mac
r7145 IPython.Tooltip = Tooltip;
Matthias BUSSONNIER
clean code, show clock if tooltip is 'sticky'...
r7173
Matthias Bussonnier
tooltip to mac
r7145 return IPython;
Matthias BUSSONNIER
clean code, show clock if tooltip is 'sticky'...
r7173
Matthias Bussonnier
tooltip to mac
r7145 }(IPython));