[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

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

   1  !function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}((function(e){"use strict";var n={},t=/[^\s\u00a0]/,i=e.Pos,l=e.cmpPos;function o(e){var n=e.search(t);return-1==n?0:n}function r(e,n){var t=e.getMode();return!1!==t.useInnerComments&&t.innerMode?e.getModeAt(n):t}e.commands.toggleComment=function(e){e.toggleComment()},e.defineExtension("toggleComment",(function(e){e||(e=n);for(var t=this,l=1/0,o=this.listSelections(),r=null,a=o.length-1;a>=0;a--){var m=o[a].from(),c=o[a].to();m.line>=l||(c.line>=l&&(c=i(l,0)),l=m.line,null==r?t.uncomment(m,c,e)?r="un":(t.lineComment(m,c,e),r="line"):"un"==r?t.uncomment(m,c,e):t.lineComment(m,c,e))}})),e.defineExtension("lineComment",(function(e,l,a){a||(a=n);var m=this,c=r(m,e),g=m.getLine(e.line);if(null!=g&&(f=e,s=g,!/\bstring\b/.test(m.getTokenTypeAt(i(f.line,0)))||/^[\'\"\`]/.test(s))){var f,s,d=a.lineComment||c.lineComment;if(d){var u=Math.min(0!=l.ch||l.line==e.line?l.line+1:l.line,m.lastLine()+1),h=null==a.padding?" ":a.padding,C=a.commentBlankLines||e.line==l.line;m.operation((function(){if(a.indent){for(var n=null,l=e.line;l<u;++l){var r=-1===(c=m.getLine(l)).search(t)?c:c.slice(0,o(c));(null==n||n.length>r.length)&&(n=r)}for(l=e.line;l<u;++l){var c=m.getLine(l),g=n.length;(C||t.test(c))&&(c.slice(0,g)!=n&&(g=o(c)),m.replaceRange(n+d+h,i(l,0),i(l,g)))}}else for(l=e.line;l<u;++l)(C||t.test(m.getLine(l)))&&m.replaceRange(d+h,i(l,0))}))}else(a.blockCommentStart||c.blockCommentStart)&&(a.fullLines=!0,m.blockComment(e,l,a))}})),e.defineExtension("blockComment",(function(e,o,a){a||(a=n);var m=this,c=r(m,e),g=a.blockCommentStart||c.blockCommentStart,f=a.blockCommentEnd||c.blockCommentEnd;if(g&&f){if(!/\bcomment\b/.test(m.getTokenTypeAt(i(e.line,0)))){var s=Math.min(o.line,m.lastLine());s!=e.line&&0==o.ch&&t.test(m.getLine(s))&&--s;var d=null==a.padding?" ":a.padding;e.line>s||m.operation((function(){if(0!=a.fullLines){var n=t.test(m.getLine(s));m.replaceRange(d+f,i(s)),m.replaceRange(g+d,i(e.line,0));var r=a.blockCommentLead||c.blockCommentLead;if(null!=r)for(var u=e.line+1;u<=s;++u)(u!=s||n)&&m.replaceRange(r+d,i(u,0))}else{var h=0==l(m.getCursor("to"),o),C=!m.somethingSelected();m.replaceRange(f,o),h&&m.setSelection(C?o:m.getCursor("from"),o),m.replaceRange(g,e)}}))}}else(a.lineComment||c.lineComment)&&0!=a.fullLines&&m.lineComment(e,o,a)})),e.defineExtension("uncomment",(function(e,l,o){o||(o=n);var a,m=this,c=r(m,e),g=Math.min(0!=l.ch||l.line==e.line?l.line:l.line-1,m.lastLine()),f=Math.min(e.line,g),s=o.lineComment||c.lineComment,d=[],u=null==o.padding?" ":o.padding;e:if(s){for(var h=f;h<=g;++h){var C=m.getLine(h),p=C.indexOf(s);if(p>-1&&!/comment/.test(m.getTokenTypeAt(i(h,p+1)))&&(p=-1),-1==p&&t.test(C))break e;if(p>-1&&t.test(C.slice(0,p)))break e;d.push(C)}if(m.operation((function(){for(var e=f;e<=g;++e){var n=d[e-f],t=n.indexOf(s),l=t+s.length;t<0||(n.slice(l,l+u.length)==u&&(l+=u.length),a=!0,m.replaceRange("",i(e,t),i(e,l)))}})),a)return!0}var v=o.blockCommentStart||c.blockCommentStart,b=o.blockCommentEnd||c.blockCommentEnd;if(!v||!b)return!1;var k=o.blockCommentLead||c.blockCommentLead,L=m.getLine(f),x=L.indexOf(v);if(-1==x)return!1;var R=g==f?L:m.getLine(g),O=R.indexOf(b,g==f?x+v.length:0),T=i(f,x+1),S=i(g,O+1);if(-1==O||!/comment/.test(m.getTokenTypeAt(T))||!/comment/.test(m.getTokenTypeAt(S))||m.getRange(T,S,"\n").indexOf(b)>-1)return!1;var y=L.lastIndexOf(v,e.ch),E=-1==y?-1:L.slice(0,e.ch).indexOf(b,y+v.length);if(-1!=y&&-1!=E&&E+b.length!=e.ch)return!1;E=R.indexOf(b,l.ch);var M=R.slice(l.ch).lastIndexOf(v,E-l.ch);return y=-1==E||-1==M?-1:l.ch+M,(-1==E||-1==y||y==l.ch)&&(m.operation((function(){m.replaceRange("",i(g,O-(u&&R.slice(O-u.length,O)==u?u.length:0)),i(g,O+b.length));var e=x+v.length;if(u&&L.slice(e,e+u.length)==u&&(e+=u.length),m.replaceRange("",i(f,x),i(f,e)),k)for(var n=f+1;n<=g;++n){var l=m.getLine(n),o=l.indexOf(k);if(-1!=o&&!t.test(l.slice(0,o))){var r=o+k.length;u&&l.slice(r,r+u.length)==u&&(r+=u.length),m.replaceRange("",i(n,o),i(n,r))}}})),!0)}))}));


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