[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/media/vendor/codemirror/addon/search/ -> search.min.js (source)

   1  !function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("./searchcursor"),require("../dialog/dialog")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./searchcursor","../dialog/dialog"],e):e(CodeMirror)}((function(e){"use strict";function r(){this.posFrom=this.posTo=this.lastQuery=this.query=null,this.overlay=null}function o(e){return e.state.search||(e.state.search=new r)}function n(e){return"string"==typeof e&&e==e.toLowerCase()}function t(e,r,o){return e.getSearchCursor(r,o,{caseFold:n(r),multiline:!0})}function a(e,r,o,n,t){e.openDialog?e.openDialog(r,t,{value:n,selectValueOnOpen:!0,bottom:e.options.search.bottom}):t(prompt(o,n))}function i(e){return e.replace(/\\([nrt\\])/g,(function(e,r){return"n"==r?"\n":"r"==r?"\r":"t"==r?"\t":"\\"==r?"\\":e}))}function s(e){var r=e.match(/^\/(.*)\/([a-z]*)$/);if(r)try{e=new RegExp(r[1],-1==r[2].indexOf("i")?"":"i")}catch(e){}else e=i(e);return("string"==typeof e?""==e:e.test(""))&&(e=/x^/),e}function c(e,r,o){r.queryText=o,r.query=s(o),e.removeOverlay(r.overlay,n(r.query)),r.overlay=function(e,r){return"string"==typeof e?e=new RegExp(e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),r?"gi":"g"):e.global||(e=new RegExp(e.source,e.ignoreCase?"gi":"g")),{token:function(r){e.lastIndex=r.pos;var o=e.exec(r.string);if(o&&o.index==r.pos)return r.pos+=o[0].length||1,"searching";o?r.pos=o.index:r.skipToEnd()}}}(r.query,n(r.query)),e.addOverlay(r.overlay),e.showMatchesOnScrollbar&&(r.annotate&&(r.annotate.clear(),r.annotate=null),r.annotate=e.showMatchesOnScrollbar(r.query,n(r.query)))}function l(r,n,t,i){var s=o(r);if(s.query)return u(r,n);var l=r.getSelection()||s.lastQuery;if(l instanceof RegExp&&"x^"==l.source&&(l=null),t&&r.openDialog){var p=null,m=function(o,n){e.e_stop(n),o&&(o!=s.queryText&&(c(r,s,o),s.posFrom=s.posTo=r.getCursor()),p&&(p.style.opacity=1),u(r,n.shiftKey,(function(e,o){var n;o.line<3&&document.querySelector&&(n=r.display.wrapper.querySelector(".CodeMirror-dialog"))&&n.getBoundingClientRect().bottom-4>r.cursorCoords(o,"window").top&&((p=n).style.opacity=.4)})))};!function(e,r,o,n,t){e.openDialog(r,n,{value:o,selectValueOnOpen:!0,closeOnEnter:!1,onClose:function(){f(e)},onKeyDown:t,bottom:e.options.search.bottom})}(r,d(r),l,m,(function(n,t){var a=e.keyName(n),i=r.getOption("extraKeys"),s=i&&i[a]||e.keyMap[r.getOption("keyMap")][a];"findNext"==s||"findPrev"==s||"findPersistentNext"==s||"findPersistentPrev"==s?(e.e_stop(n),c(r,o(r),t),r.execCommand(s)):"find"!=s&&"findPersistent"!=s||(e.e_stop(n),m(t,n))})),i&&l&&(c(r,s,l),u(r,n))}else a(r,d(r),"Search for:",l,(function(e){e&&!s.query&&r.operation((function(){c(r,s,e),s.posFrom=s.posTo=r.getCursor(),u(r,n)}))}))}function u(r,n,a){r.operation((function(){var i=o(r),s=t(r,i.query,n?i.posFrom:i.posTo);(s.find(n)||(s=t(r,i.query,n?e.Pos(r.lastLine()):e.Pos(r.firstLine(),0))).find(n))&&(r.setSelection(s.from(),s.to()),r.scrollIntoView({from:s.from(),to:s.to()},20),i.posFrom=s.from(),i.posTo=s.to(),a&&a(s.from(),s.to()))}))}function f(e){e.operation((function(){var r=o(e);r.lastQuery=r.query,r.query&&(r.query=r.queryText=null,e.removeOverlay(r.overlay),r.annotate&&(r.annotate.clear(),r.annotate=null))}))}function p(e,r){var o=e?document.createElement(e):document.createDocumentFragment();for(var n in r)o[n]=r[n];for(var t=2;t<arguments.length;t++){var a=arguments[t];o.appendChild("string"==typeof a?document.createTextNode(a):a)}return o}function d(e){var r=p("label",{className:"CodeMirror-search-label"},e.phrase("Search:"),p("input",{type:"text",style:"width: 10em",className:"CodeMirror-search-field",id:"CodeMirror-search-field"}));return r.setAttribute("for","CodeMirror-search-field"),p("",null,r," ",p("span",{style:"color: #666",className:"CodeMirror-search-hint"},e.phrase("(Use /re/ syntax for regexp search)")))}function m(e,r,o){e.operation((function(){for(var n=t(e,r);n.findNext();)if("string"!=typeof r){var a=e.getRange(n.from(),n.to()).match(r);n.replace(o.replace(/\$(\d)/g,(function(e,r){return a[r]})))}else n.replace(o)}))}function h(e,r){if(!e.getOption("readOnly")){var n=e.getSelection()||o(e).lastQuery,c=r?e.phrase("Replace all:"):e.phrase("Replace:"),l=p("",null,p("span",{className:"CodeMirror-search-label"},c),function(e){return p("",null," ",p("input",{type:"text",style:"width: 10em",className:"CodeMirror-search-field"})," ",p("span",{style:"color: #666",className:"CodeMirror-search-hint"},e.phrase("(Use /re/ syntax for regexp search)")))}(e));a(e,l,c,n,(function(o){o&&(o=s(o),a(e,function(e){return p("",null,p("span",{className:"CodeMirror-search-label"},e.phrase("With:"))," ",p("input",{type:"text",style:"width: 10em",className:"CodeMirror-search-field"}))}(e),e.phrase("Replace with:"),"",(function(n){if(n=i(n),r)m(e,o,n);else{f(e);var a=t(e,o,e.getCursor("from")),s=function(){var r,i=a.from();!(r=a.findNext())&&(a=t(e,o),!(r=a.findNext())||i&&a.from().line==i.line&&a.from().ch==i.ch)||(e.setSelection(a.from(),a.to()),e.scrollIntoView({from:a.from(),to:a.to()}),function(e,r,o,n){e.openConfirm?e.openConfirm(r,n):confirm(o)&&n[0]()}(e,function(e){return p("",null,p("span",{className:"CodeMirror-search-label"},e.phrase("Replace?"))," ",p("button",{},e.phrase("Yes"))," ",p("button",{},e.phrase("No"))," ",p("button",{},e.phrase("All"))," ",p("button",{},e.phrase("Stop")))}(e),e.phrase("Replace?"),[function(){c(r)},s,function(){m(e,o,n)}]))},c=function(e){a.replace("string"==typeof o?n:n.replace(/\$(\d)/g,(function(r,o){return e[o]}))),s()};s()}})))}))}}e.defineOption("search",{bottom:!1}),e.commands.find=function(e){f(e),l(e)},e.commands.findPersistent=function(e){f(e),l(e,!1,!0)},e.commands.findPersistentNext=function(e){l(e,!1,!0,!0)},e.commands.findPersistentPrev=function(e){l(e,!0,!0,!0)},e.commands.findNext=l,e.commands.findPrev=function(e){l(e,!0)},e.commands.clearSearch=f,e.commands.replace=h,e.commands.replaceAll=function(e){h(e,!0)}}));


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer