Overview
Comment: | Mise à jour scripts minifiés |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
31850bf0845a31f82e4cb0a984fb6d07 |
User & Date: | bohwaz on 2019-10-06 21:32:33 |
Other Links: | manifest | tags |
Context
2019-10-06
| ||
21:34 | Inclusion de l'identifiant de manifeste dans le version_hash check-in: 73748e7ed7 user: bohwaz tags: trunk, stable | |
21:32 | Mise à jour scripts minifiés check-in: 31850bf084 user: bohwaz tags: trunk | |
21:08 | Mise à jour dépendance éditeur de texte check-in: cf42e13369 user: bohwaz tags: trunk, stable | |
Changes
Modified src/www/admin/static/scripts/code_editor.min.js from [265e7b62f2] to [f838117490].
|
| | > | 1 2 | window.textEditor=function(t){if(!document.getElementById(t))throw new Error("Invalid ID parameter: "+t);return this.id=t,this.textarea=document.getElementById(t),this.shortcuts=[],"selectionStart"in this.textarea&&(this.textarea.addEventListener("keydown",this.keyEvent.bind(this),!0),this.textarea.addEventListener("keypress",this.keyEvent.bind(this),!0),!0)},textEditor.prototype.keyEvent=function(t){for(var e in t=t||window.event,this.shortcuts){var r=this.shortcuts[e];if(!t.metaKey&&!(t.ctrlKey&&!r.ctrl||r.ctrl&&!t.ctrlKey)&&!(t.shiftKey&&!r.shift||r.shift&&!t.shiftKey)&&!(t.altKey&&!r.alt||r.alt&&!t.altKey)&&(e=this.matchKeyPress(r.key,t))){if("function"==typeof r.callback)return!r.callback.call(this,t,e)||this.preventDefault(t);var n=(r.ctrl?"Ctrl-":"")+(r.alt?"Alt-":"");throw n+=(r.shift?"Shift-":"")+r,new Error("Invalid callback type for shortcut "+n)}}return!0},textEditor.prototype.matchKeyPress=function(t,e){return!(e.defaultPrevented||!e.key)&&(t=t.toLowerCase(),e.key.toLowerCase()==t&&t)},textEditor.prototype.preventDefault=function(t){return t.preventDefault&&t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.stopImmediatePropagation&&t.stopImmediatePropagation(),t.returnValue=!1,!(t.cancelBubble=!0)},textEditor.prototype.getSelection=function(){var t=this.textarea,e=t.selectionEnd-t.selectionStart;return{start:t.selectionStart,end:t.selectionEnd,length:e,text:t.value.substr(t.selectionStart,e)}},textEditor.prototype.replaceSelection=function(t,e){var r=this.textarea,n=t.start,o=n+e.length;return r.value=r.value.substr(0,n)+e+r.value.substr(t.end,r.value.length),this.setSelection(n,o),{start:n,end:o,length:e.length,text:e}},textEditor.prototype.insertAtPosition=function(t,e,r){var n=t+e.length,o=this.textarea;return o.value=o.value.substr(0,t)+e+o.value.substr(t,o.value.length-t),r||(r=n),this.setSelection(r,r)},textEditor.prototype.setSelection=function(t,e){var r=this.textarea;return r.focus(),r.selectionStart=t,r.selectionEnd=e,this.getSelection()},textEditor.prototype.scrollToSelection=function(t){var e=this.textarea,r=e.value.substr(t.end);e.value=e.value.substr(0,t.end),e.scrollTop=1e5;var n=e.scrollTop;e.value+=r,e.scrollTop=n,this.setSelection(t.start,t.end)},textEditor.prototype.wrapSelection=function(t,e,r){var n=this.textarea,o=n.scrollTop,a=t.text;return t=this.replaceSelection(t,e+a+r),""==a&&(t=this.setSelection(t.start+e.length,t.start+e.length)),n.scrollTop=o,t}; String.prototype.repeat=function(t){return new Array(t+1).join(this)},window.codeEditor=function(t){if(!textEditor.call(this,t))return!1;this.onlinechange=null,this.onlinenumberchange=null,this.fullscreen=!1,this.nb_lines=0,this.current_line=0,this.search_str=null,this.search_pos=0,this.params={indent_size:4,tab_size:4,convert_tabs:!0,lang:{search:"Text to search?\n(regexps allowed, begin them with '/')",replace:"Text for replacement?\n(use $1, $2... for regexp replacement)",search_selection:"Text to replace in selection?\n(regexps allowed, begin them with '/')",replace_result:"%d occurence found and replaced.",goto:"Line to go to:",no_search_result:"No search result found."}},(that=this).init(),this.textarea.spellcheck=!1,this.shortcuts.push({shift:!0,key:"tab",callback:this.indent}),this.shortcuts.push({key:"tab",callback:this.indent}),this.shortcuts.push({ctrl:!0,key:"f",callback:this.search}),this.shortcuts.push({ctrl:!0,key:"h",callback:this.searchAndReplace}),this.shortcuts.push({ctrl:!0,key:"g",callback:this.goToLine}),this.shortcuts.push({key:"F3",callback:this.searchNext}),this.shortcuts.push({key:"backspace",callback:this.backspace}),this.shortcuts.push({key:"enter",callback:this.enter}),this.shortcuts.push({key:'"',callback:this.insertBrackets}),this.shortcuts.push({key:"[",callback:this.insertBrackets}),this.shortcuts.push({key:"{",callback:this.insertBrackets}),this.shortcuts.push({key:"(",callback:this.insertBrackets}),this.shortcuts.push({key:"F11",callback:this.toggleFullscreen}),this.textarea.addEventListener("keypress",this.keyEvent.bind(this),!0),this.textarea.addEventListener("keydown",this.keyEvent.bind(this),!0)},codeEditor.prototype=function(t){function e(){}return e.prototype=t,new e}(textEditor.prototype),codeEditor.prototype.init=function(){var t=this;for(this.nb_lines=this.countLines(),this.parent=document.createElement("div"),this.parent.className="codeEditor",this.lineCounter=document.createElement("span"),this.lineCounter.className="lineCount",i=1;i<=this.nb_lines;i++)this.lineCounter.innerHTML+="<b>"+i+"</b>";this.lineCounter.innerHTML+="<i>---</i>",this.parent.appendChild(this.lineCounter);var e=document.createElement("div");e.className="container",e.appendChild(this.textarea.cloneNode(!0)),this.parent.appendChild(e);var s=this.textarea.parentNode;s.appendChild(this.parent),s.removeChild(this.textarea),this.textarea=this.parent.getElementsByTagName("textarea")[0],this.textarea.wrap="off",this.params.convert_tabs&&(this.textarea.value=this.textarea.value.replace(/[ ]{1,7}\t/g," ".repeat(this.params.tab_size)),this.textarea.value=this.textarea.value.replace(/\t/g," ".repeat(this.params.tab_size))),this.textarea.addEventListener("focus",function(){t.update()},!1),this.textarea.addEventListener("keyup",function(){t.update()},!1),this.textarea.addEventListener("click",function(){t.update()},!1),this.textarea.addEventListener("scroll",function(){t.lineCounter.scrollTop=t.textarea.scrollTop},!1)},codeEditor.prototype.update=function(){var t=this.getSelection(),e=this.getLineNumberFromPosition(t),s=this.countLines();if(this.search_pos=t.end,s!=this.nb_lines){for(var r=this.lineCounter.getElementsByTagName("b"),i=this.nb_lines;s<i;i--)this.lineCounter.removeChild(r[i-1]);var n=this.lineCounter.lastChild;for(i=r.length;i<s;i++){var a=document.createElement("b");a.innerHTML=i+1,this.lineCounter.insertBefore(a,n)}this.nb_lines=s,"function"==typeof this.onlinenumberchange&&this.onlinenumberchange.call(this)}if(e!=this.current_line){for(r=this.lineCounter.getElementsByTagName("b"),i=0;i<this.nb_lines;i++)r[i].className="";r[e].className="current",this.current_line=e,"function"==typeof this.onlinechange&&this.onlinechange.call(this)}},codeEditor.prototype.countLines=function(){var t=this.textarea.value.match(/(\r?\n)/g);return t?t.length+1:1},codeEditor.prototype.getLineNumberFromPosition=function(t){if(0==(t=t||this.getSelection()).start)return 0;var e=this.textarea.value.substr(0,t.start).match(/(\r?\n)/g);return e?e.length:0},codeEditor.prototype.getLines=function(){return this.textarea.value.split("\n")},codeEditor.prototype.getLine=function(t){return this.textarea.value.split("\n",t+1)[t]},codeEditor.prototype.getLinePosition=function(t,e){var s=0;for(i=0;i<t.length;i++){if(i==e)return{start:s+i,end:s+t[i].length,length:t[i].length,text:t[i]};s+=t[i].length}return!1},codeEditor.prototype.selectLines=function(t){for(var e=t.start;0<e;e--)if("\n"==this.textarea.value.substr(e,1)){t.start=e+1;break}for(e=t.end-1;e<this.textarea.length;e++)if("\n"==this.textarea.value.substr(e,1)){t.end=e-1;break}return this.setSelection(t.start,t.end),t},codeEditor.prototype.goToLine=function(t){var e=window.prompt(that.params.lang.goto);if(e){var s=this.textarea.value.split("\n",parseInt(e,10)).join("\n").length;return this.scrollToSelection(this.setSelection(s,s)),!0}},codeEditor.prototype.indent=function(t,e){var s=this.getSelection(),r=t.shiftKey,i=this.getLines(),n=this.getLineNumberFromPosition(s),a=this.getLinePosition(i,n),h=s.end>a.end;if((0==s.length||!h)&&s.start!=a.start)return this.insertAtPosition(s.start," ".repeat(this.params.indent_size)),!0;if(0==s.length&&s.start==a.start){var o=n-1 in i&&i[n-1].match(/^(\s+)/);if(o&&0==a.length)c=" ".repeat(o[1].length);else var c=" ".repeat(this.params.indent_size);return this.insertAtPosition(s.start,c),!0}s=this.selectLines(s);var l=this.textarea.value.substr(s.start,s.end-s.start);if(i=l.split("\n"),r)for(var p=new RegExp("^[ ]{1,"+this.params.indent_size+"}"),u=0;u<i.length;u++)i[u]=i[u].replace(p,"");else for(u=0;u<i.length;u++)i[u]=" ".repeat(this.params.indent_size)+i[u];return l=i.join("\n"),this.replaceSelection(s,l),!0},codeEditor.prototype.search=function(){if(this.search_str=window.prompt(this.params.lang.search,this.search_str))return this.search_pos=0,this.searchNext()},codeEditor.prototype.searchNext=function(){if(!this.search_str)return!0;var t=this.getSelection(),e=t.end>=this.search_pos?this.search_pos:t.start,s=this.textarea.value.substr(e),r=this.getSearchRegexp(this.search_str),i=s.search(r);if(-1==i)return window.alert(this.params.lang.no_search_result);var n=s.match(r);return t.start=e+i,t.end=t.start+n[0].length,t.length=n[0].length,t.text=n[0],this.setSelection(t.start,t.end),this.search_pos=t.end,this.scrollToSelection(t),!0},codeEditor.prototype.getSearchRegexp=function(t,e){var s,r;if("/"==t.substr(0,1)){var i=t.lastIndexOf("/");s=t.substr(1,i-1),r=t.substr(i+1).replace(/g/,"")}else s=t.replace(/([\/$^.?()[\]{}\\])/,"\\$1"),r="i";return e&&(r+="g"),new RegExp(s,r)},codeEditor.prototype.searchAndReplace=function(t){var e=this.getSelection(),i=0!=e.length?this.params.lang.search_selection:this.params.lang.search;if(!(s=window.prompt(i,this.search_str))||!(r=window.prompt(that.params.lang.replace)))return!0;var n=this.getSearchRegexp(s,!0);if(0==e.length){var a=this.textarea.value.match(n).length;this.textarea.value=this.textarea.value.replace(n,r)}else a=e.text.match(n).length,this.replaceSelection(e,e.text.replace(n,r));return window.alert(this.params.lang.replace_result.replace(/%d/g,a)),!0},codeEditor.prototype.enter=function(t){var e=this.getSelection(),s=this.getLineNumberFromPosition(e),r="";return s=this.getLine(s),"{"==this.textarea.value.substr(e.start-1,1)&&(r+=" ".repeat(this.params.indent_size)),(match=s.match(/^(\s+)/))&&(r+=match[1]),!!r&&(this.insertAtPosition(e.start,"\n"+r),!0)},codeEditor.prototype.backspace=function(t){var e=this.getSelection();if(0<e.length)return!1;if('""'==(s=this.textarea.value.substr(e.start-2,2))||"''"==s||"{}"==s||"()"==s||"[]"==s)return e.start-=2,this.replaceSelection(e,""),!0;var s=this.textarea.value.substr(e.start-20,20);return-1!=(pos=s.search(/^(\s+)$/m))&&(e.start-=this.params.indent_size,this.replaceSelection(e,""),!0)},codeEditor.prototype.insertBrackets=function(t,e){var s=this.getSelection(),r=e,i=r;switch(r){case"(":i=")";break;case"[":i="]";break;case"{":i="}"}return 0==s.length?this.insertAtPosition(s.start,r+i,s.start+1):this.wrapSelection(s,r,i),!0},codeEditor.prototype.toggleFullscreen=function(t){for(var e=this.parent.className.split(" "),s=0;s<e.length;s++)if("fullscreen"==e[s])return e.splice(s,1),this.parent.className=e.join(" "),!(this.fullscreen=!1);return e.push("fullscreen"),this.parent.className=e.join(" "),this.fullscreen=!0}; |
Modified src/www/admin/static/scripts/query_builder.min.js from [652d101dbf] to [f2e9e173b4].
Modified src/www/admin/static/scripts/text_editor.min.js from [757efe7963] to [83bda3f0af].
|
| | | 1 | window.textEditor=function(t){if(!document.getElementById(t))throw new Error("Invalid ID parameter: "+t);return this.id=t,this.textarea=document.getElementById(t),this.shortcuts=[],"selectionStart"in this.textarea&&(this.textarea.addEventListener("keydown",this.keyEvent.bind(this),!0),this.textarea.addEventListener("keypress",this.keyEvent.bind(this),!0),!0)},textEditor.prototype.keyEvent=function(t){for(var e in t=t||window.event,this.shortcuts){var r=this.shortcuts[e];if(!t.metaKey&&!(t.ctrlKey&&!r.ctrl||r.ctrl&&!t.ctrlKey)&&!(t.shiftKey&&!r.shift||r.shift&&!t.shiftKey)&&!(t.altKey&&!r.alt||r.alt&&!t.altKey)&&(e=this.matchKeyPress(r.key,t))){if("function"==typeof r.callback)return!r.callback.call(this,t,e)||this.preventDefault(t);var n=(r.ctrl?"Ctrl-":"")+(r.alt?"Alt-":"");throw n+=(r.shift?"Shift-":"")+r,new Error("Invalid callback type for shortcut "+n)}}return!0},textEditor.prototype.matchKeyPress=function(t,e){return!(e.defaultPrevented||!e.key)&&(t=t.toLowerCase(),e.key.toLowerCase()==t&&t)},textEditor.prototype.preventDefault=function(t){return t.preventDefault&&t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.stopImmediatePropagation&&t.stopImmediatePropagation(),t.returnValue=!1,!(t.cancelBubble=!0)},textEditor.prototype.getSelection=function(){var t=this.textarea,e=t.selectionEnd-t.selectionStart;return{start:t.selectionStart,end:t.selectionEnd,length:e,text:t.value.substr(t.selectionStart,e)}},textEditor.prototype.replaceSelection=function(t,e){var r=this.textarea,n=t.start,o=n+e.length;return r.value=r.value.substr(0,n)+e+r.value.substr(t.end,r.value.length),this.setSelection(n,o),{start:n,end:o,length:e.length,text:e}},textEditor.prototype.insertAtPosition=function(t,e,r){var n=t+e.length,o=this.textarea;return o.value=o.value.substr(0,t)+e+o.value.substr(t,o.value.length-t),r||(r=n),this.setSelection(r,r)},textEditor.prototype.setSelection=function(t,e){var r=this.textarea;return r.focus(),r.selectionStart=t,r.selectionEnd=e,this.getSelection()},textEditor.prototype.scrollToSelection=function(t){var e=this.textarea,r=e.value.substr(t.end);e.value=e.value.substr(0,t.end),e.scrollTop=1e5;var n=e.scrollTop;e.value+=r,e.scrollTop=n,this.setSelection(t.start,t.end)},textEditor.prototype.wrapSelection=function(t,e,r){var n=this.textarea,o=n.scrollTop,a=t.text;return t=this.replaceSelection(t,e+a+r),""==a&&(t=this.setSelection(t.start+e.length,t.start+e.length)),n.scrollTop=o,t}; |