PluginProbe ʕ •ᴥ•ʔ
SiteOrigin CSS / 1.0
SiteOrigin CSS v1.0
1.2.1 1.2.10 1.2.11 1.2.12 1.2.13 1.2.14 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.5.1 1.5.10 1.5.11 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 trunk 1.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.1 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.2.0
so-css / lib / codemirror / addon / fold / brace-fold.min.js
so-css / lib / codemirror / addon / fold Last commit date
brace-fold.js 11 years ago brace-fold.min.js 11 years ago comment-fold.js 11 years ago comment-fold.min.js 11 years ago foldcode.js 11 years ago foldcode.min.js 11 years ago foldgutter.css 11 years ago foldgutter.js 11 years ago foldgutter.min.js 11 years ago indent-fold.js 11 years ago indent-fold.min.js 11 years ago markdown-fold.js 11 years ago markdown-fold.min.js 11 years ago xml-fold.js 11 years ago xml-fold.min.js 11 years ago
brace-fold.min.js
15 lines
1
2 (function(mod){if(typeof exports=="object"&&typeof module=="object")
3 mod(require("../../lib/codemirror"));else if(typeof define=="function"&&define.amd)
4 define(["../../lib/codemirror"],mod);else
5 mod(CodeMirror);})(function(CodeMirror){"use strict";CodeMirror.registerHelper("fold","brace",function(cm,start){var line=start.line,lineText=cm.getLine(line);var startCh,tokenType;function findOpening(openCh){for(var at=start.ch,pass=0;;){var found=at<=0?-1:lineText.lastIndexOf(openCh,at-1);if(found==-1){if(pass==1)break;pass=1;at=lineText.length;continue;}
6 if(pass==1&&found<start.ch)break;tokenType=cm.getTokenTypeAt(CodeMirror.Pos(line,found+1));if(!/^(comment|string)/.test(tokenType))return found+1;at=found-1;}}
7 var startToken="{",endToken="}",startCh=findOpening("{");if(startCh==null){startToken="[",endToken="]";startCh=findOpening("[");}
8 if(startCh==null)return;var count=1,lastLine=cm.lastLine(),end,endCh;outer:for(var i=line;i<=lastLine;++i){var text=cm.getLine(i),pos=i==line?startCh:0;for(;;){var nextOpen=text.indexOf(startToken,pos),nextClose=text.indexOf(endToken,pos);if(nextOpen<0)nextOpen=text.length;if(nextClose<0)nextClose=text.length;pos=Math.min(nextOpen,nextClose);if(pos==text.length)break;if(cm.getTokenTypeAt(CodeMirror.Pos(i,pos+1))==tokenType){if(pos==nextOpen)++count;else if(!--count){end=i;endCh=pos;break outer;}}
9 ++pos;}}
10 if(end==null||line==end&&endCh==startCh)return;return{from:CodeMirror.Pos(line,startCh),to:CodeMirror.Pos(end,endCh)};});CodeMirror.registerHelper("fold","import",function(cm,start){function hasImport(line){if(line<cm.firstLine()||line>cm.lastLine())return null;var start=cm.getTokenAt(CodeMirror.Pos(line,1));if(!/\S/.test(start.string))start=cm.getTokenAt(CodeMirror.Pos(line,start.end+1));if(start.type!="keyword"||start.string!="import")return null;for(var i=line,e=Math.min(cm.lastLine(),line+10);i<=e;++i){var text=cm.getLine(i),semi=text.indexOf(";");if(semi!=-1)return{startCh:start.end,end:CodeMirror.Pos(i,semi)};}}
11 var start=start.line,has=hasImport(start),prev;if(!has||hasImport(start-1)||((prev=hasImport(start-2))&&prev.end.line==start-1))
12 return null;for(var end=has.end;;){var next=hasImport(end.line+1);if(next==null)break;end=next.end;}
13 return{from:cm.clipPos(CodeMirror.Pos(start,has.startCh+1)),to:end};});CodeMirror.registerHelper("fold","include",function(cm,start){function hasInclude(line){if(line<cm.firstLine()||line>cm.lastLine())return null;var start=cm.getTokenAt(CodeMirror.Pos(line,1));if(!/\S/.test(start.string))start=cm.getTokenAt(CodeMirror.Pos(line,start.end+1));if(start.type=="meta"&&start.string.slice(0,8)=="#include")return start.start+8;}
14 var start=start.line,has=hasInclude(start);if(has==null||hasInclude(start-1)!=null)return null;for(var end=start;;){var next=hasInclude(end+1);if(next==null)break;++end;}
15 return{from:CodeMirror.Pos(start,has+1),to:cm.clipPos(CodeMirror.Pos(end))};});});