Seditio Source
Root |
./othercms/xenForo 2.2.8/js/vendor/codemirror/addon/dialog/dialog.min.js
(function(c){"object"==typeof exports&&"object"==typeof module?c(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],c):c(CodeMirror)})(function(c){function l(a,g,b){a=a.getWrapperElement();var d=a.appendChild(document.createElement("div"));d.className=b?"CodeMirror-dialog CodeMirror-dialog-bottom":"CodeMirror-dialog CodeMirror-dialog-top";"string"==typeof g?d.innerHTML=g:d.appendChild(g);c.addClass(a,"dialog-opened");return d}function m(a,c){a.state.currentNotificationClose&&
a.state.currentNotificationClose();a.state.currentNotificationClose=c}c.defineExtension("openDialog",function(a,g,b){function d(a){if("string"==typeof a)e.value=a;else if(!h&&(h=!0,c.rmClass(f.parentNode,"dialog-opened"),f.parentNode.removeChild(f),k.focus(),b.onClose))b.onClose(f)}b||(b={});m(this,null);var f=l(this,a,b.bottom),h=!1,k=this,e=f.getElementsByTagName("input")[0];if(e){e.focus();b.value&&(e.value=b.value,!1!==b.selectValueOnOpen&&e.select());if(b.onInput)c.on(e,"input",function(a){b.onInput(a,
e.value,d)});if(b.onKeyUp)c.on(e,"keyup",function(a){b.onKeyUp(a,e.value,d)});c.on(e,"keydown",function(a){if(!(b&&b.onKeyDown&&b.onKeyDown(a,e.value,d))){if(27==a.keyCode||!1!==b.closeOnEnter&&13==a.keyCode)e.blur(),c.e_stop(a),d();13==a.keyCode&&g(e.value,a)}});if(!1!==b.closeOnBlur)c.on(f,"focusout",function(a){null!==a.relatedTarget&&d()})}else if(a=f.getElementsByTagName("button")[0]){c.on(a,"click",function(){d();k.focus()});if(!1!==b.closeOnBlur)c.on(a,"blur",d);a.focus()}return d});c.defineExtension("openConfirm",
function(a,g,b){function d(){h||(h=!0,c.rmClass(f.parentNode,"dialog-opened"),f.parentNode.removeChild(f),k.focus())}m(this,null);var f=l(this,a,b&&b.bottom);a=f.getElementsByTagName("button");var h=!1,k=this,e=1;a[0].focus();for(b=0;b<a.length;++b){var n=a[b];(function(a){c.on(n,"click",function(b){c.e_preventDefault(b);d();a&&a(k)})})(g[b]);c.on(n,"blur",function(){--e;setTimeout(function(){0>=e&&d()},200)});c.on(n,"focus",function(){++e})}});c.defineExtension("openNotification",function(a,g){function b(){f||
(f=!0,clearTimeout(h),c.rmClass(d.parentNode,"dialog-opened"),d.parentNode.removeChild(d))}m(this,b);var d=l(this,a,g&&g.bottom),f=!1,h;a=g&&"undefined"!==typeof g.duration?g.duration:5E3;c.on(d,"click",function(a){c.e_preventDefault(a);b()});a&&(h=setTimeout(b,a));return b})});