PluginProbe ʕ •ᴥ•ʔ
SiteOrigin CSS / 1.2.12
SiteOrigin CSS v1.2.12
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 / comment-fold.js
so-css / lib / codemirror / addon / fold Last commit date
brace-fold.js 9 years ago brace-fold.min.js 6 years ago comment-fold.js 9 years ago comment-fold.min.js 6 years ago foldcode.js 9 years ago foldcode.min.js 6 years ago foldgutter.css 11 years ago foldgutter.js 9 years ago foldgutter.min.js 6 years ago indent-fold.js 9 years ago indent-fold.min.js 6 years ago markdown-fold.js 11 years ago markdown-fold.min.js 6 years ago xml-fold.js 9 years ago xml-fold.min.js 6 years ago
comment-fold.js
60 lines
1 // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 // Distributed under an MIT license: http://codemirror.net/LICENSE
3
4 (function(mod) {
5 if (typeof exports == "object" && typeof module == "object") // CommonJS
6 mod(require("../../lib/codemirror"));
7 else if (typeof define == "function" && define.amd) // AMD
8 define(["../../lib/codemirror"], mod);
9 else // Plain browser env
10 mod(CodeMirror);
11 })(function(CodeMirror) {
12 "use strict";
13
14 CodeMirror.registerGlobalHelper("fold", "comment", function(mode) {
15 return mode.blockCommentStart && mode.blockCommentEnd;
16 }, function(cm, start) {
17 var mode = cm.getModeAt(start), startToken = mode.blockCommentStart, endToken = mode.blockCommentEnd;
18 if (!startToken || !endToken) return;
19 var line = start.line, lineText = cm.getLine(line);
20
21 var startCh;
22 for (var at = start.ch, pass = 0;;) {
23 var found = at <= 0 ? -1 : lineText.lastIndexOf(startToken, at - 1);
24 if (found == -1) {
25 if (pass == 1) return;
26 pass = 1;
27 at = lineText.length;
28 continue;
29 }
30 if (pass == 1 && found < start.ch) return;
31 if (/comment/.test(cm.getTokenTypeAt(CodeMirror.Pos(line, found + 1))) &&
32 (found == 0 || lineText.slice(found - endToken.length, found) == endToken ||
33 !/comment/.test(cm.getTokenTypeAt(CodeMirror.Pos(line, found))))) {
34 startCh = found + startToken.length;
35 break;
36 }
37 at = found - 1;
38 }
39
40 var depth = 1, lastLine = cm.lastLine(), end, endCh;
41 outer: for (var i = line; i <= lastLine; ++i) {
42 var text = cm.getLine(i), pos = i == line ? startCh : 0;
43 for (;;) {
44 var nextOpen = text.indexOf(startToken, pos), nextClose = text.indexOf(endToken, pos);
45 if (nextOpen < 0) nextOpen = text.length;
46 if (nextClose < 0) nextClose = text.length;
47 pos = Math.min(nextOpen, nextClose);
48 if (pos == text.length) break;
49 if (pos == nextOpen) ++depth;
50 else if (!--depth) { end = i; endCh = pos; break outer; }
51 ++pos;
52 }
53 }
54 if (end == null || line == end && endCh == startCh) return;
55 return {from: CodeMirror.Pos(line, startCh),
56 to: CodeMirror.Pos(end, endCh)};
57 });
58
59 });
60