PluginProbe ʕ •ᴥ•ʔ
SiteOrigin CSS / 1.1.2
SiteOrigin CSS v1.1.2
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 / hint / css-hint.js
so-css / lib / codemirror / addon / hint Last commit date
anyword-hint.js 10 years ago anyword-hint.min.js 9 years ago css-hint.js 11 years ago css-hint.min.js 9 years ago html-hint.js 11 years ago html-hint.min.js 9 years ago javascript-hint.js 11 years ago javascript-hint.min.js 9 years ago show-hint.css 11 years ago show-hint.js 10 years ago show-hint.min.js 9 years ago sql-hint.js 10 years ago sql-hint.min.js 9 years ago xml-hint.js 11 years ago xml-hint.min.js 10 years ago
css-hint.js
61 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"), require("../../mode/css/css"));
7 else if (typeof define == "function" && define.amd) // AMD
8 define(["../../lib/codemirror", "../../mode/css/css"], mod);
9 else // Plain browser env
10 mod(CodeMirror);
11 })(function(CodeMirror) {
12 "use strict";
13
14 var pseudoClasses = {link: 1, visited: 1, active: 1, hover: 1, focus: 1,
15 "first-letter": 1, "first-line": 1, "first-child": 1,
16 before: 1, after: 1, lang: 1};
17
18 CodeMirror.registerHelper("hint", "css", function(cm) {
19 var cur = cm.getCursor(), token = cm.getTokenAt(cur);
20 var inner = CodeMirror.innerMode(cm.getMode(), token.state);
21 if (inner.mode.name != "css") return;
22
23 if (token.type == "keyword" && "!important".indexOf(token.string) == 0)
24 return {list: ["!important"], from: CodeMirror.Pos(cur.line, token.start),
25 to: CodeMirror.Pos(cur.line, token.end)};
26
27 var start = token.start, end = cur.ch, word = token.string.slice(0, end - start);
28 if (/[^\w$_-]/.test(word)) {
29 word = ""; start = end = cur.ch;
30 }
31
32 var spec = CodeMirror.resolveMode("text/css");
33
34 var result = [];
35 function add(keywords) {
36 for (var name in keywords)
37 if (!word || name.lastIndexOf(word, 0) == 0)
38 result.push(name);
39 }
40
41 var st = inner.state.state;
42 if (st == "pseudo" || token.type == "variable-3") {
43 add(pseudoClasses);
44 } else if (st == "block" || st == "maybeprop") {
45 add(spec.propertyKeywords);
46 } else if (st == "prop" || st == "parens" || st == "at" || st == "params") {
47 add(spec.valueKeywords);
48 add(spec.colorKeywords);
49 } else if (st == "media" || st == "media_parens") {
50 add(spec.mediaTypes);
51 add(spec.mediaFeatures);
52 }
53
54 if (result.length) return {
55 list: result,
56 from: CodeMirror.Pos(cur.line, start),
57 to: CodeMirror.Pos(cur.line, end)
58 };
59 });
60 });
61