diff --git a/plugins/UiFileManager/media/codemirror/extension/dialog/dialog.js b/plugins/UiFileManager/media/codemirror/extension/dialog/dialog.js index 5f1f4aa4..ae4cc413 100644 --- a/plugins/UiFileManager/media/codemirror/extension/dialog/dialog.js +++ b/plugins/UiFileManager/media/codemirror/extension/dialog/dialog.js @@ -41,7 +41,9 @@ closeNotification(this, null); var dialog = dialogDiv(this, template, options.bottom); - var closed = false, me = this; + var closed = false, + me = this; + function close(newVal) { if (typeof newVal == 'string') { inp.value = newVal; @@ -56,7 +58,8 @@ } } - var inp = dialog.getElementsByTagName("input")[0], button; + var inp = dialog.getElementsByTagName("input")[0], + button; if (inp) { inp.focus(); @@ -68,12 +71,18 @@ } if (options.onInput) - CodeMirror.on(inp, "input", function(e) { options.onInput(e, inp.value, close);}); + CodeMirror.on(inp, "input", function(e) { + options.onInput(e, inp.value, close); + }); if (options.onKeyUp) - CodeMirror.on(inp, "keyup", function(e) {options.onKeyUp(e, inp.value, close);}); + CodeMirror.on(inp, "keyup", function(e) { + options.onKeyUp(e, inp.value, close); + }); CodeMirror.on(inp, "keydown", function(e) { - if (options && options.onKeyDown && options.onKeyDown(e, inp.value, close)) { return; } + if (options && options.onKeyDown && options.onKeyDown(e, inp.value, close)) { + return; + } if (e.keyCode == 27 || (options.closeOnEnter !== false && e.keyCode == 13)) { inp.blur(); CodeMirror.e_stop(e); @@ -82,7 +91,7 @@ if (e.keyCode == 13) callback(inp.value, e); }); - if (options.closeOnBlur !== false) CodeMirror.on(dialog, "focusout", function (evt) { + if (options.closeOnBlur !== false) CodeMirror.on(dialog, "focusout", function(evt) { if (evt.relatedTarget !== null) close(); }); } else if (button = dialog.getElementsByTagName("button")[0]) { @@ -102,7 +111,10 @@ closeNotification(this, null); var dialog = dialogDiv(this, template, options && options.bottom); var buttons = dialog.getElementsByTagName("button"); - var closed = false, me = this, blurring = 1; + var closed = false, + me = this, + blurring = 1; + function close() { if (closed) return; closed = true; @@ -122,9 +134,13 @@ })(callbacks[i]); CodeMirror.on(b, "blur", function() { --blurring; - setTimeout(function() { if (blurring <= 0) close(); }, 200); + setTimeout(function() { + if (blurring <= 0) close(); + }, 200); + }); + CodeMirror.on(b, "focus", function() { + ++blurring; }); - CodeMirror.on(b, "focus", function() { ++blurring; }); } }); @@ -139,7 +155,8 @@ CodeMirror.defineExtension("openNotification", function(template, options) { closeNotification(this, close); var dialog = dialogDiv(this, template, options && options.bottom); - var closed = false, doneTimer; + var closed = false, + doneTimer; var duration = options && typeof options.duration !== "undefined" ? options.duration : 5000; function close() {