summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rw-r--r--js/codeq/console.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/js/codeq/console.js b/js/codeq/console.js
index 859b064..ebf09cc 100644
--- a/js/codeq/console.js
+++ b/js/codeq/console.js
@@ -159,6 +159,8 @@
return result;
};
+ var instanceCounter = 1; // for generating unique console instance numbers
+
codeq.makeConsole = function (jqElt, options) {
var lines = [],// console content, line descriptors of the form {'content': 'string', 'classNames': [], 'jqLine': jQuery object, 'row': number}
maxLines = (options && options.maxLines) || 10000, // how many lines to display at most
@@ -172,6 +174,7 @@
history = [], // the list of entered lines, it is only appended
currentHistory = [], // the list of entered lines, some possibly modified (it is copied from history on each new line editing)
currentHistoryIndex = -1,
+ instanceNumber = instanceCounter++, // unique instace number, to be used with stuff tied to this instance, e.g.: jqElt events, life-cycle debug output
renderSpan = function (lineDescriptor, startCol, length) {
var jqLine = lineDescriptor.jqLine,
@@ -751,6 +754,8 @@
delete handler[i];
}
}
+ jqElt.off('click.console' + instanceNumber);
+ jqElt.off('blur.console' + instanceNumber);
jqElt.empty();
jqElt = null;
options = null;
@@ -910,11 +915,11 @@
jqElt.empty();
jqElt.append(jqContent);
jqElt.append(jqInput);
- jqElt.on('click', function () {
+ jqElt.on('click.console' + instanceNumber, function () {
// set focus to the textarea so we pick up keypresses
jqInput.css('position', 'fixed').focus();
});
- jqElt.on('blur', function () {
+ jqElt.on('blur.console' + instanceNumber, function () {
jqInput.css('position', 'absolute');
});