Simple Custom CSS and JS - Version 3.32

Version Description

= * 07/08/2020 * Fix: compatibility issue with the Product Slider for WooCommerce by ShapedPlugin * Feature: "Ctrl + /" in the editor will comment out the code * Feature: order custom codes table by "type" and "active" state * Feature: autocomplete in the editor

Download this release

Release Info

Developer diana_burduja
Plugin Icon 128x128 Simple Custom CSS and JS
Version 3.32
Comparing to
See all releases

Code changes from version 3.31.1 to 3.32

assets/ccj_admin.css CHANGED
@@ -34,7 +34,7 @@
34
  */
35
  .inline.hide-if-no-js{ display: none; }
36
  .view-switch { display: none; }
37
- #type.manage-column { width: 50px; }
38
  .language {
39
  background: #0c73b8;
40
  border-radius: 2px;
@@ -54,12 +54,11 @@
54
  .column-options span { margin-left: 7px; }
55
  .column-active .dashicons { font-size: 17px; }
56
  .column-active a, .column-active a:active, .column-active a:hover, .column-active a:focus { display: block; outline: 0; border: 0; text-decoration: none; }
57
- #active.manage-column { width: 30px; }
58
  th.column-published, th.column-modified {
59
  width: 15%;
60
  }
61
  @media screen and (max-width:782px){
62
- .wp-list-table tr:not(.inline-edit-row):not(.no-items) td:not(.check-column) { display: table-cell !important; }
63
  .wp-list-table tr:not(.inline-edit-row):not(.no-items) td:not(.check-column)::before { display: none !important; }
64
  .wp-list-table .toggle-row { display: none !important; }
65
  }
34
  */
35
  .inline.hide-if-no-js{ display: none; }
36
  .view-switch { display: none; }
37
+ #type.manage-column { width: 70px; }
38
  .language {
39
  background: #0c73b8;
40
  border-radius: 2px;
54
  .column-options span { margin-left: 7px; }
55
  .column-active .dashicons { font-size: 17px; }
56
  .column-active a, .column-active a:active, .column-active a:hover, .column-active a:focus { display: block; outline: 0; border: 0; text-decoration: none; }
57
+ #active.manage-column { width: 54px; }
58
  th.column-published, th.column-modified {
59
  width: 15%;
60
  }
61
  @media screen and (max-width:782px){
 
62
  .wp-list-table tr:not(.inline-edit-row):not(.no-items) td:not(.check-column)::before { display: none !important; }
63
  .wp-list-table .toggle-row { display: none !important; }
64
  }
assets/ccj_admin.js CHANGED
@@ -18,7 +18,10 @@ jQuery(document).ready( function($) {
18
  matchBrackets: true,
19
  autoCloseBrackets: true,
20
  extraKeys: {
 
21
  "Ctrl-F": "findPersistent",
 
 
22
  },
23
  };
24
 
@@ -45,6 +48,16 @@ jQuery(document).ready( function($) {
45
  editor.setSize(cm_width, cm_height);
46
  });
47
 
 
 
 
 
 
 
 
 
 
 
48
  var postID = document.getElementById('post_ID') != null ? document.getElementById('post_ID').value : 0;
49
 
50
  var getCookie = function (name) {
18
  matchBrackets: true,
19
  autoCloseBrackets: true,
20
  extraKeys: {
21
+ "Ctrl-Space": "autocomplete",
22
  "Ctrl-F": "findPersistent",
23
+ "Cmd-/" : "toggleComment",
24
+ "Ctrl-/" : "toggleComment"
25
  },
26
  };
27
 
48
  editor.setSize(cm_width, cm_height);
49
  });
50
 
51
+
52
+ // Autocomplete
53
+ if ( CCJ.autocomplete === '1' ) {
54
+ editor.on( "keyup", function ( cm, event ) {
55
+ if ( ! cm.state.completionActive && event.keyCode > 64 && event.keyCode < 91 ) {
56
+ CodeMirror.commands.autocomplete( cm, null, { completeSingle: false } );
57
+ }
58
+ });
59
+ }
60
+
61
  var postID = document.getElementById('post_ID') != null ? document.getElementById('post_ID').value : 0;
62
 
63
  var getCookie = function (name) {
assets/codemirror/addon/comment/comment.js ADDED
@@ -0,0 +1,209 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // CodeMirror, copyright (c) by Marijn Haverbeke and others
2
+ // Distributed under an MIT license: https://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
+ var noOptions = {};
15
+ var nonWS = /[^\s\u00a0]/;
16
+ var Pos = CodeMirror.Pos;
17
+
18
+ function firstNonWS(str) {
19
+ var found = str.search(nonWS);
20
+ return found == -1 ? 0 : found;
21
+ }
22
+
23
+ CodeMirror.commands.toggleComment = function(cm) {
24
+ cm.toggleComment();
25
+ };
26
+
27
+ CodeMirror.defineExtension("toggleComment", function(options) {
28
+ if (!options) options = noOptions;
29
+ var cm = this;
30
+ var minLine = Infinity, ranges = this.listSelections(), mode = null;
31
+ for (var i = ranges.length - 1; i >= 0; i--) {
32
+ var from = ranges[i].from(), to = ranges[i].to();
33
+ if (from.line >= minLine) continue;
34
+ if (to.line >= minLine) to = Pos(minLine, 0);
35
+ minLine = from.line;
36
+ if (mode == null) {
37
+ if (cm.uncomment(from, to, options)) mode = "un";
38
+ else { cm.lineComment(from, to, options); mode = "line"; }
39
+ } else if (mode == "un") {
40
+ cm.uncomment(from, to, options);
41
+ } else {
42
+ cm.lineComment(from, to, options);
43
+ }
44
+ }
45
+ });
46
+
47
+ // Rough heuristic to try and detect lines that are part of multi-line string
48
+ function probablyInsideString(cm, pos, line) {
49
+ return /\bstring\b/.test(cm.getTokenTypeAt(Pos(pos.line, 0))) && !/^[\'\"\`]/.test(line)
50
+ }
51
+
52
+ function getMode(cm, pos) {
53
+ var mode = cm.getMode()
54
+ return mode.useInnerComments === false || !mode.innerMode ? mode : cm.getModeAt(pos)
55
+ }
56
+
57
+ CodeMirror.defineExtension("lineComment", function(from, to, options) {
58
+ if (!options) options = noOptions;
59
+ var self = this, mode = getMode(self, from);
60
+ var firstLine = self.getLine(from.line);
61
+ if (firstLine == null || probablyInsideString(self, from, firstLine)) return;
62
+
63
+ var commentString = options.lineComment || mode.lineComment;
64
+ if (!commentString) {
65
+ if (options.blockCommentStart || mode.blockCommentStart) {
66
+ options.fullLines = true;
67
+ self.blockComment(from, to, options);
68
+ }
69
+ return;
70
+ }
71
+
72
+ var end = Math.min(to.ch != 0 || to.line == from.line ? to.line + 1 : to.line, self.lastLine() + 1);
73
+ var pad = options.padding == null ? " " : options.padding;
74
+ var blankLines = options.commentBlankLines || from.line == to.line;
75
+
76
+ self.operation(function() {
77
+ if (options.indent) {
78
+ var baseString = null;
79
+ for (var i = from.line; i < end; ++i) {
80
+ var line = self.getLine(i);
81
+ var whitespace = line.slice(0, firstNonWS(line));
82
+ if (baseString == null || baseString.length > whitespace.length) {
83
+ baseString = whitespace;
84
+ }
85
+ }
86
+ for (var i = from.line; i < end; ++i) {
87
+ var line = self.getLine(i), cut = baseString.length;
88
+ if (!blankLines && !nonWS.test(line)) continue;
89
+ if (line.slice(0, cut) != baseString) cut = firstNonWS(line);
90
+ self.replaceRange(baseString + commentString + pad, Pos(i, 0), Pos(i, cut));
91
+ }
92
+ } else {
93
+ for (var i = from.line; i < end; ++i) {
94
+ if (blankLines || nonWS.test(self.getLine(i)))
95
+ self.replaceRange(commentString + pad, Pos(i, 0));
96
+ }
97
+ }
98
+ });
99
+ });
100
+
101
+ CodeMirror.defineExtension("blockComment", function(from, to, options) {
102
+ if (!options) options = noOptions;
103
+ var self = this, mode = getMode(self, from);
104
+ var startString = options.blockCommentStart || mode.blockCommentStart;
105
+ var endString = options.blockCommentEnd || mode.blockCommentEnd;
106
+ if (!startString || !endString) {
107
+ if ((options.lineComment || mode.lineComment) && options.fullLines != false)
108
+ self.lineComment(from, to, options);
109
+ return;
110
+ }
111
+ if (/\bcomment\b/.test(self.getTokenTypeAt(Pos(from.line, 0)))) return
112
+
113
+ var end = Math.min(to.line, self.lastLine());
114
+ if (end != from.line && to.ch == 0 && nonWS.test(self.getLine(end))) --end;
115
+
116
+ var pad = options.padding == null ? " " : options.padding;
117
+ if (from.line > end) return;
118
+
119
+ self.operation(function() {
120
+ if (options.fullLines != false) {
121
+ var lastLineHasText = nonWS.test(self.getLine(end));
122
+ self.replaceRange(pad + endString, Pos(end));
123
+ self.replaceRange(startString + pad, Pos(from.line, 0));
124
+ var lead = options.blockCommentLead || mode.blockCommentLead;
125
+ if (lead != null) for (var i = from.line + 1; i <= end; ++i)
126
+ if (i != end || lastLineHasText)
127
+ self.replaceRange(lead + pad, Pos(i, 0));
128
+ } else {
129
+ self.replaceRange(endString, to);
130
+ self.replaceRange(startString, from);
131
+ }
132
+ });
133
+ });
134
+
135
+ CodeMirror.defineExtension("uncomment", function(from, to, options) {
136
+ if (!options) options = noOptions;
137
+ var self = this, mode = getMode(self, from);
138
+ var end = Math.min(to.ch != 0 || to.line == from.line ? to.line : to.line - 1, self.lastLine()), start = Math.min(from.line, end);
139
+
140
+ // Try finding line comments
141
+ var lineString = options.lineComment || mode.lineComment, lines = [];
142
+ var pad = options.padding == null ? " " : options.padding, didSomething;
143
+ lineComment: {
144
+ if (!lineString) break lineComment;
145
+ for (var i = start; i <= end; ++i) {
146
+ var line = self.getLine(i);
147
+ var found = line.indexOf(lineString);
148
+ if (found > -1 && !/comment/.test(self.getTokenTypeAt(Pos(i, found + 1)))) found = -1;
149
+ if (found == -1 && nonWS.test(line)) break lineComment;
150
+ if (found > -1 && nonWS.test(line.slice(0, found))) break lineComment;
151
+ lines.push(line);
152
+ }
153
+ self.operation(function() {
154
+ for (var i = start; i <= end; ++i) {
155
+ var line = lines[i - start];
156
+ var pos = line.indexOf(lineString), endPos = pos + lineString.length;
157
+ if (pos < 0) continue;
158
+ if (line.slice(endPos, endPos + pad.length) == pad) endPos += pad.length;
159
+ didSomething = true;
160
+ self.replaceRange("", Pos(i, pos), Pos(i, endPos));
161
+ }
162
+ });
163
+ if (didSomething) return true;
164
+ }
165
+
166
+ // Try block comments
167
+ var startString = options.blockCommentStart || mode.blockCommentStart;
168
+ var endString = options.blockCommentEnd || mode.blockCommentEnd;
169
+ if (!startString || !endString) return false;
170
+ var lead = options.blockCommentLead || mode.blockCommentLead;
171
+ var startLine = self.getLine(start), open = startLine.indexOf(startString)
172
+ if (open == -1) return false
173
+ var endLine = end == start ? startLine : self.getLine(end)
174
+ var close = endLine.indexOf(endString, end == start ? open + startString.length : 0);
175
+ var insideStart = Pos(start, open + 1), insideEnd = Pos(end, close + 1)
176
+ if (close == -1 ||
177
+ !/comment/.test(self.getTokenTypeAt(insideStart)) ||
178
+ !/comment/.test(self.getTokenTypeAt(insideEnd)) ||
179
+ self.getRange(insideStart, insideEnd, "\n").indexOf(endString) > -1)
180
+ return false;
181
+
182
+ // Avoid killing block comments completely outside the selection.
183
+ // Positions of the last startString before the start of the selection, and the first endString after it.
184
+ var lastStart = startLine.lastIndexOf(startString, from.ch);
185
+ var firstEnd = lastStart == -1 ? -1 : startLine.slice(0, from.ch).indexOf(endString, lastStart + startString.length);
186
+ if (lastStart != -1 && firstEnd != -1 && firstEnd + endString.length != from.ch) return false;
187
+ // Positions of the first endString after the end of the selection, and the last startString before it.
188
+ firstEnd = endLine.indexOf(endString, to.ch);
189
+ var almostLastStart = endLine.slice(to.ch).lastIndexOf(startString, firstEnd - to.ch);
190
+ lastStart = (firstEnd == -1 || almostLastStart == -1) ? -1 : to.ch + almostLastStart;
191
+ if (firstEnd != -1 && lastStart != -1 && lastStart != to.ch) return false;
192
+
193
+ self.operation(function() {
194
+ self.replaceRange("", Pos(end, close - (pad && endLine.slice(close - pad.length, close) == pad ? pad.length : 0)),
195
+ Pos(end, close + endString.length));
196
+ var openEnd = open + startString.length;
197
+ if (pad && startLine.slice(openEnd, openEnd + pad.length) == pad) openEnd += pad.length;
198
+ self.replaceRange("", Pos(start, open), Pos(start, openEnd));
199
+ if (lead) for (var i = start + 1; i <= end; ++i) {
200
+ var line = self.getLine(i), found = line.indexOf(lead);
201
+ if (found == -1 || nonWS.test(line.slice(0, found))) continue;
202
+ var foundEnd = found + lead.length;
203
+ if (pad && line.slice(foundEnd, foundEnd + pad.length) == pad) foundEnd += pad.length;
204
+ self.replaceRange("", Pos(i, found), Pos(i, foundEnd));
205
+ }
206
+ });
207
+ return true;
208
+ });
209
+ });
assets/codemirror/addon/hint/anyword-hint.js ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ var WORD = /[\w$]+/, RANGE = 500;
15
+
16
+ CodeMirror.registerHelper("hint", "anyword", function(editor, options) {
17
+ var word = options && options.word || WORD;
18
+ var range = options && options.range || RANGE;
19
+ var cur = editor.getCursor(), curLine = editor.getLine(cur.line);
20
+ var end = cur.ch, start = end;
21
+ while (start && word.test(curLine.charAt(start - 1))) --start;
22
+ var curWord = start != end && curLine.slice(start, end);
23
+
24
+ var list = options && options.list || [], seen = {};
25
+ var re = new RegExp(word.source, "g");
26
+ for (var dir = -1; dir <= 1; dir += 2) {
27
+ var line = cur.line, endLine = Math.min(Math.max(line + dir * range, editor.firstLine()), editor.lastLine()) + dir;
28
+ for (; line != endLine; line += dir) {
29
+ var text = editor.getLine(line), m;
30
+ while (m = re.exec(text)) {
31
+ if (line == cur.line && m[0] === curWord) continue;
32
+ if ((!curWord || m[0].lastIndexOf(curWord, 0) == 0) && !Object.prototype.hasOwnProperty.call(seen, m[0])) {
33
+ seen[m[0]] = true;
34
+ list.push(m[0]);
35
+ }
36
+ }
37
+ }
38
+ }
39
+ return {list: list, from: CodeMirror.Pos(cur.line, start), to: CodeMirror.Pos(cur.line, end)};
40
+ });
41
+ });
assets/codemirror/addon/hint/css-hint.js ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ });
assets/codemirror/addon/hint/html-hint.js ADDED
@@ -0,0 +1,348 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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("./xml-hint"));
7
+ else if (typeof define == "function" && define.amd) // AMD
8
+ define(["../../lib/codemirror", "./xml-hint"], mod);
9
+ else // Plain browser env
10
+ mod(CodeMirror);
11
+ })(function(CodeMirror) {
12
+ "use strict";
13
+
14
+ var langs = "ab aa af ak sq am ar an hy as av ae ay az bm ba eu be bn bh bi bs br bg my ca ch ce ny zh cv kw co cr hr cs da dv nl dz en eo et ee fo fj fi fr ff gl ka de el gn gu ht ha he hz hi ho hu ia id ie ga ig ik io is it iu ja jv kl kn kr ks kk km ki rw ky kv kg ko ku kj la lb lg li ln lo lt lu lv gv mk mg ms ml mt mi mr mh mn na nv nb nd ne ng nn no ii nr oc oj cu om or os pa pi fa pl ps pt qu rm rn ro ru sa sc sd se sm sg sr gd sn si sk sl so st es su sw ss sv ta te tg th ti bo tk tl tn to tr ts tt tw ty ug uk ur uz ve vi vo wa cy wo fy xh yi yo za zu".split(" ");
15
+ var targets = ["_blank", "_self", "_top", "_parent"];
16
+ var charsets = ["ascii", "utf-8", "utf-16", "latin1", "latin1"];
17
+ var methods = ["get", "post", "put", "delete"];
18
+ var encs = ["application/x-www-form-urlencoded", "multipart/form-data", "text/plain"];
19
+ var media = ["all", "screen", "print", "embossed", "braille", "handheld", "print", "projection", "screen", "tty", "tv", "speech",
20
+ "3d-glasses", "resolution [>][<][=] [X]", "device-aspect-ratio: X/Y", "orientation:portrait",
21
+ "orientation:landscape", "device-height: [X]", "device-width: [X]"];
22
+ var s = { attrs: {} }; // Simple tag, reused for a whole lot of tags
23
+
24
+ var data = {
25
+ a: {
26
+ attrs: {
27
+ href: null, ping: null, type: null,
28
+ media: media,
29
+ target: targets,
30
+ hreflang: langs
31
+ }
32
+ },
33
+ abbr: s,
34
+ acronym: s,
35
+ address: s,
36
+ applet: s,
37
+ area: {
38
+ attrs: {
39
+ alt: null, coords: null, href: null, target: null, ping: null,
40
+ media: media, hreflang: langs, type: null,
41
+ shape: ["default", "rect", "circle", "poly"]
42
+ }
43
+ },
44
+ article: s,
45
+ aside: s,
46
+ audio: {
47
+ attrs: {
48
+ src: null, mediagroup: null,
49
+ crossorigin: ["anonymous", "use-credentials"],
50
+ preload: ["none", "metadata", "auto"],
51
+ autoplay: ["", "autoplay"],
52
+ loop: ["", "loop"],
53
+ controls: ["", "controls"]
54
+ }
55
+ },
56
+ b: s,
57
+ base: { attrs: { href: null, target: targets } },
58
+ basefont: s,
59
+ bdi: s,
60
+ bdo: s,
61
+ big: s,
62
+ blockquote: { attrs: { cite: null } },
63
+ body: s,
64
+ br: s,
65
+ button: {
66
+ attrs: {
67
+ form: null, formaction: null, name: null, value: null,
68
+ autofocus: ["", "autofocus"],
69
+ disabled: ["", "autofocus"],
70
+ formenctype: encs,
71
+ formmethod: methods,
72
+ formnovalidate: ["", "novalidate"],
73
+ formtarget: targets,
74
+ type: ["submit", "reset", "button"]
75
+ }
76
+ },
77
+ canvas: { attrs: { width: null, height: null } },
78
+ caption: s,
79
+ center: s,
80
+ cite: s,
81
+ code: s,
82
+ col: { attrs: { span: null } },
83
+ colgroup: { attrs: { span: null } },
84
+ command: {
85
+ attrs: {
86
+ type: ["command", "checkbox", "radio"],
87
+ label: null, icon: null, radiogroup: null, command: null, title: null,
88
+ disabled: ["", "disabled"],
89
+ checked: ["", "checked"]
90
+ }
91
+ },
92
+ data: { attrs: { value: null } },
93
+ datagrid: { attrs: { disabled: ["", "disabled"], multiple: ["", "multiple"] } },
94
+ datalist: { attrs: { data: null } },
95
+ dd: s,
96
+ del: { attrs: { cite: null, datetime: null } },
97
+ details: { attrs: { open: ["", "open"] } },
98
+ dfn: s,
99
+ dir: s,
100
+ div: s,
101
+ dl: s,
102
+ dt: s,
103
+ em: s,
104
+ embed: { attrs: { src: null, type: null, width: null, height: null } },
105
+ eventsource: { attrs: { src: null } },
106
+ fieldset: { attrs: { disabled: ["", "disabled"], form: null, name: null } },
107
+ figcaption: s,
108
+ figure: s,
109
+ font: s,
110
+ footer: s,
111
+ form: {
112
+ attrs: {
113
+ action: null, name: null,
114
+ "accept-charset": charsets,
115
+ autocomplete: ["on", "off"],
116
+ enctype: encs,
117
+ method: methods,
118
+ novalidate: ["", "novalidate"],
119
+ target: targets
120
+ }
121
+ },
122
+ frame: s,
123
+ frameset: s,
124
+ h1: s, h2: s, h3: s, h4: s, h5: s, h6: s,
125
+ head: {
126
+ attrs: {},
127
+ children: ["title", "base", "link", "style", "meta", "script", "noscript", "command"]
128
+ },
129
+ header: s,
130
+ hgroup: s,
131
+ hr: s,
132
+ html: {
133
+ attrs: { manifest: null },
134
+ children: ["head", "body"]
135
+ },
136
+ i: s,
137
+ iframe: {
138
+ attrs: {
139
+ src: null, srcdoc: null, name: null, width: null, height: null,
140
+ sandbox: ["allow-top-navigation", "allow-same-origin", "allow-forms", "allow-scripts"],
141
+ seamless: ["", "seamless"]
142
+ }
143
+ },
144
+ img: {
145
+ attrs: {
146
+ alt: null, src: null, ismap: null, usemap: null, width: null, height: null,
147
+ crossorigin: ["anonymous", "use-credentials"]
148
+ }
149
+ },
150
+ input: {
151
+ attrs: {
152
+ alt: null, dirname: null, form: null, formaction: null,
153
+ height: null, list: null, max: null, maxlength: null, min: null,
154
+ name: null, pattern: null, placeholder: null, size: null, src: null,
155
+ step: null, value: null, width: null,
156
+ accept: ["audio/*", "video/*", "image/*"],
157
+ autocomplete: ["on", "off"],
158
+ autofocus: ["", "autofocus"],
159
+ checked: ["", "checked"],
160
+ disabled: ["", "disabled"],
161
+ formenctype: encs,
162
+ formmethod: methods,
163
+ formnovalidate: ["", "novalidate"],
164
+ formtarget: targets,
165
+ multiple: ["", "multiple"],
166
+ readonly: ["", "readonly"],
167
+ required: ["", "required"],
168
+ type: ["hidden", "text", "search", "tel", "url", "email", "password", "datetime", "date", "month",
169
+ "week", "time", "datetime-local", "number", "range", "color", "checkbox", "radio",
170
+ "file", "submit", "image", "reset", "button"]
171
+ }
172
+ },
173
+ ins: { attrs: { cite: null, datetime: null } },
174
+ kbd: s,
175
+ keygen: {
176
+ attrs: {
177
+ challenge: null, form: null, name: null,
178
+ autofocus: ["", "autofocus"],
179
+ disabled: ["", "disabled"],
180
+ keytype: ["RSA"]
181
+ }
182
+ },
183
+ label: { attrs: { "for": null, form: null } },
184
+ legend: s,
185
+ li: { attrs: { value: null } },
186
+ link: {
187
+ attrs: {
188
+ href: null, type: null,
189
+ hreflang: langs,
190
+ media: media,
191
+ sizes: ["all", "16x16", "16x16 32x32", "16x16 32x32 64x64"]
192
+ }
193
+ },
194
+ map: { attrs: { name: null } },
195
+ mark: s,
196
+ menu: { attrs: { label: null, type: ["list", "context", "toolbar"] } },
197
+ meta: {
198
+ attrs: {
199
+ content: null,
200
+ charset: charsets,
201
+ name: ["viewport", "application-name", "author", "description", "generator", "keywords"],
202
+ "http-equiv": ["content-language", "content-type", "default-style", "refresh"]
203
+ }
204
+ },
205
+ meter: { attrs: { value: null, min: null, low: null, high: null, max: null, optimum: null } },
206
+ nav: s,
207
+ noframes: s,
208
+ noscript: s,
209
+ object: {
210
+ attrs: {
211
+ data: null, type: null, name: null, usemap: null, form: null, width: null, height: null,
212
+ typemustmatch: ["", "typemustmatch"]
213
+ }
214
+ },
215
+ ol: { attrs: { reversed: ["", "reversed"], start: null, type: ["1", "a", "A", "i", "I"] } },
216
+ optgroup: { attrs: { disabled: ["", "disabled"], label: null } },
217
+ option: { attrs: { disabled: ["", "disabled"], label: null, selected: ["", "selected"], value: null } },
218
+ output: { attrs: { "for": null, form: null, name: null } },
219
+ p: s,
220
+ param: { attrs: { name: null, value: null } },
221
+ pre: s,
222
+ progress: { attrs: { value: null, max: null } },
223
+ q: { attrs: { cite: null } },
224
+ rp: s,
225
+ rt: s,
226
+ ruby: s,
227
+ s: s,
228
+ samp: s,
229
+ script: {
230
+ attrs: {
231
+ type: ["text/javascript"],
232
+ src: null,
233
+ async: ["", "async"],
234
+ defer: ["", "defer"],
235
+ charset: charsets
236
+ }
237
+ },
238
+ section: s,
239
+ select: {
240
+ attrs: {
241
+ form: null, name: null, size: null,
242
+ autofocus: ["", "autofocus"],
243
+ disabled: ["", "disabled"],
244
+ multiple: ["", "multiple"]
245
+ }
246
+ },
247
+ small: s,
248
+ source: { attrs: { src: null, type: null, media: null } },
249
+ span: s,
250
+ strike: s,
251
+ strong: s,
252
+ style: {
253
+ attrs: {
254
+ type: ["text/css"],
255
+ media: media,
256
+ scoped: null
257
+ }
258
+ },
259
+ sub: s,
260
+ summary: s,
261
+ sup: s,
262
+ table: s,
263
+ tbody: s,
264
+ td: { attrs: { colspan: null, rowspan: null, headers: null } },
265
+ textarea: {
266
+ attrs: {
267
+ dirname: null, form: null, maxlength: null, name: null, placeholder: null,
268
+ rows: null, cols: null,
269
+ autofocus: ["", "autofocus"],
270
+ disabled: ["", "disabled"],
271
+ readonly: ["", "readonly"],
272
+ required: ["", "required"],
273
+ wrap: ["soft", "hard"]
274
+ }
275
+ },
276
+ tfoot: s,
277
+ th: { attrs: { colspan: null, rowspan: null, headers: null, scope: ["row", "col", "rowgroup", "colgroup"] } },
278
+ thead: s,
279
+ time: { attrs: { datetime: null } },
280
+ title: s,
281
+ tr: s,
282
+ track: {
283
+ attrs: {
284
+ src: null, label: null, "default": null,
285
+ kind: ["subtitles", "captions", "descriptions", "chapters", "metadata"],
286
+ srclang: langs
287
+ }
288
+ },
289
+ tt: s,
290
+ u: s,
291
+ ul: s,
292
+ "var": s,
293
+ video: {
294
+ attrs: {
295
+ src: null, poster: null, width: null, height: null,
296
+ crossorigin: ["anonymous", "use-credentials"],
297
+ preload: ["auto", "metadata", "none"],
298
+ autoplay: ["", "autoplay"],
299
+ mediagroup: ["movie"],
300
+ muted: ["", "muted"],
301
+ controls: ["", "controls"]
302
+ }
303
+ },
304
+ wbr: s
305
+ };
306
+
307
+ var globalAttrs = {
308
+ accesskey: ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
309
+ "class": null,
310
+ contenteditable: ["true", "false"],
311
+ contextmenu: null,
312
+ dir: ["ltr", "rtl", "auto"],
313
+ draggable: ["true", "false", "auto"],
314
+ dropzone: ["copy", "move", "link", "string:", "file:"],
315
+ hidden: ["hidden"],
316
+ id: null,
317
+ inert: ["inert"],
318
+ itemid: null,
319
+ itemprop: null,
320
+ itemref: null,
321
+ itemscope: ["itemscope"],
322
+ itemtype: null,
323
+ lang: ["en", "es"],
324
+ spellcheck: ["true", "false"],
325
+ style: null,
326
+ tabindex: ["1", "2", "3", "4", "5", "6", "7", "8", "9"],
327
+ title: null,
328
+ translate: ["yes", "no"],
329
+ onclick: null,
330
+ rel: ["stylesheet", "alternate", "author", "bookmark", "help", "license", "next", "nofollow", "noreferrer", "prefetch", "prev", "search", "tag"]
331
+ };
332
+ function populate(obj) {
333
+ for (var attr in globalAttrs) if (globalAttrs.hasOwnProperty(attr))
334
+ obj.attrs[attr] = globalAttrs[attr];
335
+ }
336
+
337
+ populate(s);
338
+ for (var tag in data) if (data.hasOwnProperty(tag) && data[tag] != s)
339
+ populate(data[tag]);
340
+
341
+ CodeMirror.htmlSchema = data;
342
+ function htmlHint(cm, options) {
343
+ var local = {schemaInfo: data};
344
+ if (options) for (var opt in options) local[opt] = options[opt];
345
+ return CodeMirror.hint.xml(cm, local);
346
+ }
347
+ CodeMirror.registerHelper("hint", "html", htmlHint);
348
+ });
assets/codemirror/addon/hint/javascript-hint.js ADDED
@@ -0,0 +1,155 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ var Pos = CodeMirror.Pos;
13
+
14
+ function forEach(arr, f) {
15
+ for (var i = 0, e = arr.length; i < e; ++i) f(arr[i]);
16
+ }
17
+
18
+ function arrayContains(arr, item) {
19
+ if (!Array.prototype.indexOf) {
20
+ var i = arr.length;
21
+ while (i--) {
22
+ if (arr[i] === item) {
23
+ return true;
24
+ }
25
+ }
26
+ return false;
27
+ }
28
+ return arr.indexOf(item) != -1;
29
+ }
30
+
31
+ function scriptHint(editor, keywords, getToken, options) {
32
+ // Find the token at the cursor
33
+ var cur = editor.getCursor(), token = getToken(editor, cur);
34
+ if (/\b(?:string|comment)\b/.test(token.type)) return;
35
+ token.state = CodeMirror.innerMode(editor.getMode(), token.state).state;
36
+
37
+ // If it's not a 'word-style' token, ignore the token.
38
+ if (!/^[\w$_]*$/.test(token.string)) {
39
+ token = {start: cur.ch, end: cur.ch, string: "", state: token.state,
40
+ type: token.string == "." ? "property" : null};
41
+ } else if (token.end > cur.ch) {
42
+ token.end = cur.ch;
43
+ token.string = token.string.slice(0, cur.ch - token.start);
44
+ }
45
+
46
+ var tprop = token;
47
+ // If it is a property, find out what it is a property of.
48
+ while (tprop.type == "property") {
49
+ tprop = getToken(editor, Pos(cur.line, tprop.start));
50
+ if (tprop.string != ".") return;
51
+ tprop = getToken(editor, Pos(cur.line, tprop.start));
52
+ if (!context) var context = [];
53
+ context.push(tprop);
54
+ }
55
+ return {list: getCompletions(token, context, keywords, options),
56
+ from: Pos(cur.line, token.start),
57
+ to: Pos(cur.line, token.end)};
58
+ }
59
+
60
+ function javascriptHint(editor, options) {
61
+ return scriptHint(editor, javascriptKeywords,
62
+ function (e, cur) {return e.getTokenAt(cur);},
63
+ options);
64
+ };
65
+ CodeMirror.registerHelper("hint", "javascript", javascriptHint);
66
+
67
+ function getCoffeeScriptToken(editor, cur) {
68
+ // This getToken, it is for coffeescript, imitates the behavior of
69
+ // getTokenAt method in javascript.js, that is, returning "property"
70
+ // type and treat "." as indepenent token.
71
+ var token = editor.getTokenAt(cur);
72
+ if (cur.ch == token.start + 1 && token.string.charAt(0) == '.') {
73
+ token.end = token.start;
74
+ token.string = '.';
75
+ token.type = "property";
76
+ }
77
+ else if (/^\.[\w$_]*$/.test(token.string)) {
78
+ token.type = "property";
79
+ token.start++;
80
+ token.string = token.string.replace(/\./, '');
81
+ }
82
+ return token;
83
+ }
84
+
85
+ function coffeescriptHint(editor, options) {
86
+ return scriptHint(editor, coffeescriptKeywords, getCoffeeScriptToken, options);
87
+ }
88
+ CodeMirror.registerHelper("hint", "coffeescript", coffeescriptHint);
89
+
90
+ var stringProps = ("charAt charCodeAt indexOf lastIndexOf substring substr slice trim trimLeft trimRight " +
91
+ "toUpperCase toLowerCase split concat match replace search").split(" ");
92
+ var arrayProps = ("length concat join splice push pop shift unshift slice reverse sort indexOf " +
93
+ "lastIndexOf every some filter forEach map reduce reduceRight ").split(" ");
94
+ var funcProps = "prototype apply call bind".split(" ");
95
+ var javascriptKeywords = ("break case catch continue debugger default delete do else false finally for function " +
96
+ "if in instanceof new null return switch throw true try typeof var void while with").split(" ");
97
+ var coffeescriptKeywords = ("and break catch class continue delete do else extends false finally for " +
98
+ "if in instanceof isnt new no not null of off on or return switch then throw true try typeof until void while with yes").split(" ");
99
+
100
+ function forAllProps(obj, callback) {
101
+ if (!Object.getOwnPropertyNames || !Object.getPrototypeOf) {
102
+ for (var name in obj) callback(name)
103
+ } else {
104
+ for (var o = obj; o; o = Object.getPrototypeOf(o))
105
+ Object.getOwnPropertyNames(o).forEach(callback)
106
+ }
107
+ }
108
+
109
+ function getCompletions(token, context, keywords, options) {
110
+ var found = [], start = token.string, global = options && options.globalScope || window;
111
+ function maybeAdd(str) {
112
+ if (str.lastIndexOf(start, 0) == 0 && !arrayContains(found, str)) found.push(str);
113
+ }
114
+ function gatherCompletions(obj) {
115
+ if (typeof obj == "string") forEach(stringProps, maybeAdd);
116
+ else if (obj instanceof Array) forEach(arrayProps, maybeAdd);
117
+ else if (obj instanceof Function) forEach(funcProps, maybeAdd);
118
+ forAllProps(obj, maybeAdd)
119
+ }
120
+
121
+ if (context && context.length) {
122
+ // If this is a property, see if it belongs to some object we can
123
+ // find in the current environment.
124
+ var obj = context.pop(), base;
125
+ if (obj.type && obj.type.indexOf("variable") === 0) {
126
+ if (options && options.additionalContext)
127
+ base = options.additionalContext[obj.string];
128
+ if (!options || options.useGlobalScope !== false)
129
+ base = base || global[obj.string];
130
+ } else if (obj.type == "string") {
131
+ base = "";
132
+ } else if (obj.type == "atom") {
133
+ base = 1;
134
+ } else if (obj.type == "function") {
135
+ if (global.jQuery != null && (obj.string == '$' || obj.string == 'jQuery') &&
136
+ (typeof global.jQuery == 'function'))
137
+ base = global.jQuery();
138
+ else if (global._ != null && (obj.string == '_') && (typeof global._ == 'function'))
139
+ base = global._();
140
+ }
141
+ while (base != null && context.length)
142
+ base = base[context.pop().string];
143
+ if (base != null) gatherCompletions(base);
144
+ } else {
145
+ // If not, just look in the global object and any local scope
146
+ // (reading into JS mode internals to get at the local and global variables)
147
+ for (var v = token.state.localVars; v; v = v.next) maybeAdd(v.name);
148
+ for (var v = token.state.globalVars; v; v = v.next) maybeAdd(v.name);
149
+ if (!options || options.useGlobalScope !== false)
150
+ gatherCompletions(global);
151
+ forEach(keywords, maybeAdd);
152
+ }
153
+ return found;
154
+ }
155
+ });
assets/codemirror/addon/hint/show-hint.css ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .CodeMirror-hints {
2
+ position: absolute;
3
+ z-index: 10;
4
+ overflow: hidden;
5
+ list-style: none;
6
+
7
+ margin: 0;
8
+ padding: 2px;
9
+
10
+ -webkit-box-shadow: 2px 3px 5px rgba(0,0,0,.2);
11
+ -moz-box-shadow: 2px 3px 5px rgba(0,0,0,.2);
12
+ box-shadow: 2px 3px 5px rgba(0,0,0,.2);
13
+ border-radius: 3px;
14
+ border: 1px solid silver;
15
+
16
+ background: white;
17
+ font-size: 90%;
18
+ font-family: monospace;
19
+
20
+ max-height: 20em;
21
+ overflow-y: auto;
22
+ }
23
+
24
+ .CodeMirror-hint {
25
+ margin: 0;
26
+ padding: 0 4px;
27
+ border-radius: 2px;
28
+ white-space: pre;
29
+ color: black;
30
+ cursor: pointer;
31
+ }
32
+
33
+ li.CodeMirror-hint-active {
34
+ background: #08f;
35
+ color: white;
36
+ }
assets/codemirror/addon/hint/show-hint.js ADDED
@@ -0,0 +1,432 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ var HINT_ELEMENT_CLASS = "CodeMirror-hint";
15
+ var ACTIVE_HINT_ELEMENT_CLASS = "CodeMirror-hint-active";
16
+
17
+ // This is the old interface, kept around for now to stay
18
+ // backwards-compatible.
19
+ CodeMirror.showHint = function(cm, getHints, options) {
20
+ if (!getHints) return cm.showHint(options);
21
+ if (options && options.async) getHints.async = true;
22
+ var newOpts = {hint: getHints};
23
+ if (options) for (var prop in options) newOpts[prop] = options[prop];
24
+ return cm.showHint(newOpts);
25
+ };
26
+
27
+ CodeMirror.defineExtension("showHint", function(options) {
28
+ options = parseOptions(this, this.getCursor("start"), options);
29
+ var selections = this.listSelections()
30
+ if (selections.length > 1) return;
31
+ // By default, don't allow completion when something is selected.
32
+ // A hint function can have a `supportsSelection` property to
33
+ // indicate that it can handle selections.
34
+ if (this.somethingSelected()) {
35
+ if (!options.hint.supportsSelection) return;
36
+ // Don't try with cross-line selections
37
+ for (var i = 0; i < selections.length; i++)
38
+ if (selections[i].head.line != selections[i].anchor.line) return;
39
+ }
40
+
41
+ if (this.state.completionActive) this.state.completionActive.close();
42
+ var completion = this.state.completionActive = new Completion(this, options);
43
+ if (!completion.options.hint) return;
44
+
45
+ CodeMirror.signal(this, "startCompletion", this);
46
+ completion.update(true);
47
+ });
48
+
49
+ function Completion(cm, options) {
50
+ this.cm = cm;
51
+ this.options = options;
52
+ this.widget = null;
53
+ this.debounce = 0;
54
+ this.tick = 0;
55
+ this.startPos = this.cm.getCursor("start");
56
+ this.startLen = this.cm.getLine(this.startPos.line).length - this.cm.getSelection().length;
57
+
58
+ var self = this;
59
+ cm.on("cursorActivity", this.activityFunc = function() { self.cursorActivity(); });
60
+ }
61
+
62
+ var requestAnimationFrame = window.requestAnimationFrame || function(fn) {
63
+ return setTimeout(fn, 1000/60);
64
+ };
65
+ var cancelAnimationFrame = window.cancelAnimationFrame || clearTimeout;
66
+
67
+ Completion.prototype = {
68
+ close: function() {
69
+ if (!this.active()) return;
70
+ this.cm.state.completionActive = null;
71
+ this.tick = null;
72
+ this.cm.off("cursorActivity", this.activityFunc);
73
+
74
+ if (this.widget && this.data) CodeMirror.signal(this.data, "close");
75
+ if (this.widget) this.widget.close();
76
+ CodeMirror.signal(this.cm, "endCompletion", this.cm);
77
+ },
78
+
79
+ active: function() {
80
+ return this.cm.state.completionActive == this;
81
+ },
82
+
83
+ pick: function(data, i) {
84
+ var completion = data.list[i];
85
+ if (completion.hint) completion.hint(this.cm, data, completion);
86
+ else this.cm.replaceRange(getText(completion), completion.from || data.from,
87
+ completion.to || data.to, "complete");
88
+ CodeMirror.signal(data, "pick", completion);
89
+ this.close();
90
+ },
91
+
92
+ cursorActivity: function() {
93
+ if (this.debounce) {
94
+ cancelAnimationFrame(this.debounce);
95
+ this.debounce = 0;
96
+ }
97
+
98
+ var pos = this.cm.getCursor(), line = this.cm.getLine(pos.line);
99
+ if (pos.line != this.startPos.line || line.length - pos.ch != this.startLen - this.startPos.ch ||
100
+ pos.ch < this.startPos.ch || this.cm.somethingSelected() ||
101
+ (pos.ch && this.options.closeCharacters.test(line.charAt(pos.ch - 1)))) {
102
+ this.close();
103
+ } else {
104
+ var self = this;
105
+ this.debounce = requestAnimationFrame(function() {self.update();});
106
+ if (this.widget) this.widget.disable();
107
+ }
108
+ },
109
+
110
+ update: function(first) {
111
+ if (this.tick == null) return
112
+ var self = this, myTick = ++this.tick
113
+ fetchHints(this.options.hint, this.cm, this.options, function(data) {
114
+ if (self.tick == myTick) self.finishUpdate(data, first)
115
+ })
116
+ },
117
+
118
+ finishUpdate: function(data, first) {
119
+ if (this.data) CodeMirror.signal(this.data, "update");
120
+
121
+ var picked = (this.widget && this.widget.picked) || (first && this.options.completeSingle);
122
+ if (this.widget) this.widget.close();
123
+
124
+ this.data = data;
125
+
126
+ if (data && data.list.length) {
127
+ if (picked && data.list.length == 1) {
128
+ this.pick(data, 0);
129
+ } else {
130
+ this.widget = new Widget(this, data);
131
+ CodeMirror.signal(data, "shown");
132
+ }
133
+ }
134
+ }
135
+ };
136
+
137
+ function parseOptions(cm, pos, options) {
138
+ var editor = cm.options.hintOptions;
139
+ var out = {};
140
+ for (var prop in defaultOptions) out[prop] = defaultOptions[prop];
141
+ if (editor) for (var prop in editor)
142
+ if (editor[prop] !== undefined) out[prop] = editor[prop];
143
+ if (options) for (var prop in options)
144
+ if (options[prop] !== undefined) out[prop] = options[prop];
145
+ if (out.hint.resolve) out.hint = out.hint.resolve(cm, pos)
146
+ return out;
147
+ }
148
+
149
+ function getText(completion) {
150
+ if (typeof completion == "string") return completion;
151
+ else return completion.text;
152
+ }
153
+
154
+ function buildKeyMap(completion, handle) {
155
+ var baseMap = {
156
+ Up: function() {handle.moveFocus(-1);},
157
+ Down: function() {handle.moveFocus(1);},
158
+ PageUp: function() {handle.moveFocus(-handle.menuSize() + 1, true);},
159
+ PageDown: function() {handle.moveFocus(handle.menuSize() - 1, true);},
160
+ Home: function() {handle.setFocus(0);},
161
+ End: function() {handle.setFocus(handle.length - 1);},
162
+ Enter: handle.pick,
163
+ Tab: handle.pick,
164
+ Esc: handle.close
165
+ };
166
+ var custom = completion.options.customKeys;
167
+ var ourMap = custom ? {} : baseMap;
168
+ function addBinding(key, val) {
169
+ var bound;
170
+ if (typeof val != "string")
171
+ bound = function(cm) { return val(cm, handle); };
172
+ // This mechanism is deprecated
173
+ else if (baseMap.hasOwnProperty(val))
174
+ bound = baseMap[val];
175
+ else
176
+ bound = val;
177
+ ourMap[key] = bound;
178
+ }
179
+ if (custom)
180
+ for (var key in custom) if (custom.hasOwnProperty(key))
181
+ addBinding(key, custom[key]);
182
+ var extra = completion.options.extraKeys;
183
+ if (extra)
184
+ for (var key in extra) if (extra.hasOwnProperty(key))
185
+ addBinding(key, extra[key]);
186
+ return ourMap;
187
+ }
188
+
189
+ function getHintElement(hintsElement, el) {
190
+ while (el && el != hintsElement) {
191
+ if (el.nodeName.toUpperCase() === "LI" && el.parentNode == hintsElement) return el;
192
+ el = el.parentNode;
193
+ }
194
+ }
195
+
196
+ function Widget(completion, data) {
197
+ this.completion = completion;
198
+ this.data = data;
199
+ this.picked = false;
200
+ var widget = this, cm = completion.cm;
201
+
202
+ var hints = this.hints = document.createElement("ul");
203
+ hints.className = "CodeMirror-hints";
204
+ this.selectedHint = data.selectedHint || 0;
205
+
206
+ var completions = data.list;
207
+ for (var i = 0; i < completions.length; ++i) {
208
+ var elt = hints.appendChild(document.createElement("li")), cur = completions[i];
209
+ var className = HINT_ELEMENT_CLASS + (i != this.selectedHint ? "" : " " + ACTIVE_HINT_ELEMENT_CLASS);
210
+ if (cur.className != null) className = cur.className + " " + className;
211
+ elt.className = className;
212
+ if (cur.render) cur.render(elt, data, cur);
213
+ else elt.appendChild(document.createTextNode(cur.displayText || getText(cur)));
214
+ elt.hintId = i;
215
+ }
216
+
217
+ var pos = cm.cursorCoords(completion.options.alignWithWord ? data.from : null);
218
+ var left = pos.left, top = pos.bottom, below = true;
219
+ hints.style.left = left + "px";
220
+ hints.style.top = top + "px";
221
+ // If we're at the edge of the screen, then we want the menu to appear on the left of the cursor.
222
+ var winW = window.innerWidth || Math.max(document.body.offsetWidth, document.documentElement.offsetWidth);
223
+ var winH = window.innerHeight || Math.max(document.body.offsetHeight, document.documentElement.offsetHeight);
224
+ (completion.options.container || document.body).appendChild(hints);
225
+ var box = hints.getBoundingClientRect(), overlapY = box.bottom - winH;
226
+ var scrolls = hints.scrollHeight > hints.clientHeight + 1
227
+ var startScroll = cm.getScrollInfo();
228
+
229
+ if (overlapY > 0) {
230
+ var height = box.bottom - box.top, curTop = pos.top - (pos.bottom - box.top);
231
+ if (curTop - height > 0) { // Fits above cursor
232
+ hints.style.top = (top = pos.top - height) + "px";
233
+ below = false;
234
+ } else if (height > winH) {
235
+ hints.style.height = (winH - 5) + "px";
236
+ hints.style.top = (top = pos.bottom - box.top) + "px";
237
+ var cursor = cm.getCursor();
238
+ if (data.from.ch != cursor.ch) {
239
+ pos = cm.cursorCoords(cursor);
240
+ hints.style.left = (left = pos.left) + "px";
241
+ box = hints.getBoundingClientRect();
242
+ }
243
+ }
244
+ }
245
+ var overlapX = box.right - winW;
246
+ if (overlapX > 0) {
247
+ if (box.right - box.left > winW) {
248
+ hints.style.width = (winW - 5) + "px";
249
+ overlapX -= (box.right - box.left) - winW;
250
+ }
251
+ hints.style.left = (left = pos.left - overlapX) + "px";
252
+ }
253
+ if (scrolls) for (var node = hints.firstChild; node; node = node.nextSibling)
254
+ node.style.paddingRight = cm.display.nativeBarWidth + "px"
255
+
256
+ cm.addKeyMap(this.keyMap = buildKeyMap(completion, {
257
+ moveFocus: function(n, avoidWrap) { widget.changeActive(widget.selectedHint + n, avoidWrap); },
258
+ setFocus: function(n) { widget.changeActive(n); },
259
+ menuSize: function() { return widget.screenAmount(); },
260
+ length: completions.length,
261
+ close: function() { completion.close(); },
262
+ pick: function() { widget.pick(); },
263
+ data: data
264
+ }));
265
+
266
+ if (completion.options.closeOnUnfocus) {
267
+ var closingOnBlur;
268
+ cm.on("blur", this.onBlur = function() { closingOnBlur = setTimeout(function() { completion.close(); }, 100); });
269
+ cm.on("focus", this.onFocus = function() { clearTimeout(closingOnBlur); });
270
+ }
271
+
272
+ cm.on("scroll", this.onScroll = function() {
273
+ var curScroll = cm.getScrollInfo(), editor = cm.getWrapperElement().getBoundingClientRect();
274
+ var newTop = top + startScroll.top - curScroll.top;
275
+ var point = newTop - (window.pageYOffset || (document.documentElement || document.body).scrollTop);
276
+ if (!below) point += hints.offsetHeight;
277
+ if (point <= editor.top || point >= editor.bottom) return completion.close();
278
+ hints.style.top = newTop + "px";
279
+ hints.style.left = (left + startScroll.left - curScroll.left) + "px";
280
+ });
281
+
282
+ CodeMirror.on(hints, "dblclick", function(e) {
283
+ var t = getHintElement(hints, e.target || e.srcElement);
284
+ if (t && t.hintId != null) {widget.changeActive(t.hintId); widget.pick();}
285
+ });
286
+
287
+ CodeMirror.on(hints, "click", function(e) {
288
+ var t = getHintElement(hints, e.target || e.srcElement);
289
+ if (t && t.hintId != null) {
290
+ widget.changeActive(t.hintId);
291
+ if (completion.options.completeOnSingleClick) widget.pick();
292
+ }
293
+ });
294
+
295
+ CodeMirror.on(hints, "mousedown", function() {
296
+ setTimeout(function(){cm.focus();}, 20);
297
+ });
298
+
299
+ CodeMirror.signal(data, "select", completions[this.selectedHint], hints.childNodes[this.selectedHint]);
300
+ return true;
301
+ }
302
+
303
+ Widget.prototype = {
304
+ close: function() {
305
+ if (this.completion.widget != this) return;
306
+ this.completion.widget = null;
307
+ this.hints.parentNode.removeChild(this.hints);
308
+ this.completion.cm.removeKeyMap(this.keyMap);
309
+
310
+ var cm = this.completion.cm;
311
+ if (this.completion.options.closeOnUnfocus) {
312
+ cm.off("blur", this.onBlur);
313
+ cm.off("focus", this.onFocus);
314
+ }
315
+ cm.off("scroll", this.onScroll);
316
+ },
317
+
318
+ disable: function() {
319
+ this.completion.cm.removeKeyMap(this.keyMap);
320
+ var widget = this;
321
+ this.keyMap = {Enter: function() { widget.picked = true; }};
322
+ this.completion.cm.addKeyMap(this.keyMap);
323
+ },
324
+
325
+ pick: function() {
326
+ this.completion.pick(this.data, this.selectedHint);
327
+ },
328
+
329
+ changeActive: function(i, avoidWrap) {
330
+ if (i >= this.data.list.length)
331
+ i = avoidWrap ? this.data.list.length - 1 : 0;
332
+ else if (i < 0)
333
+ i = avoidWrap ? 0 : this.data.list.length - 1;
334
+ if (this.selectedHint == i) return;
335
+ var node = this.hints.childNodes[this.selectedHint];
336
+ node.className = node.className.replace(" " + ACTIVE_HINT_ELEMENT_CLASS, "");
337
+ node = this.hints.childNodes[this.selectedHint = i];
338
+ node.className += " " + ACTIVE_HINT_ELEMENT_CLASS;
339
+ if (node.offsetTop < this.hints.scrollTop)
340
+ this.hints.scrollTop = node.offsetTop - 3;
341
+ else if (node.offsetTop + node.offsetHeight > this.hints.scrollTop + this.hints.clientHeight)
342
+ this.hints.scrollTop = node.offsetTop + node.offsetHeight - this.hints.clientHeight + 3;
343
+ CodeMirror.signal(this.data, "select", this.data.list[this.selectedHint], node);
344
+ },
345
+
346
+ screenAmount: function() {
347
+ return Math.floor(this.hints.clientHeight / this.hints.firstChild.offsetHeight) || 1;
348
+ }
349
+ };
350
+
351
+ function applicableHelpers(cm, helpers) {
352
+ if (!cm.somethingSelected()) return helpers
353
+ var result = []
354
+ for (var i = 0; i < helpers.length; i++)
355
+ if (helpers[i].supportsSelection) result.push(helpers[i])
356
+ return result
357
+ }
358
+
359
+ function fetchHints(hint, cm, options, callback) {
360
+ if (hint.async) {
361
+ hint(cm, callback, options)
362
+ } else {
363
+ var result = hint(cm, options)
364
+ if (result && result.then) result.then(callback)
365
+ else callback(result)
366
+ }
367
+ }
368
+
369
+ function resolveAutoHints(cm, pos) {
370
+ var helpers = cm.getHelpers(pos, "hint"), words
371
+ if (helpers.length) {
372
+ var resolved = function(cm, callback, options) {
373
+ var app = applicableHelpers(cm, helpers);
374
+ function run(i) {
375
+ if (i == app.length) return callback(null)
376
+ fetchHints(app[i], cm, options, function(result) {
377
+ if (result && result.list.length > 0) callback(result)
378
+ else run(i + 1)
379
+ })
380
+ }
381
+ run(0)
382
+ }
383
+ resolved.async = true
384
+ resolved.supportsSelection = true
385
+ return resolved
386
+ } else if (words = cm.getHelper(cm.getCursor(), "hintWords")) {
387
+ return function(cm) { return CodeMirror.hint.fromList(cm, {words: words}) }
388
+ } else if (CodeMirror.hint.anyword) {
389
+ return function(cm, options) { return CodeMirror.hint.anyword(cm, options) }
390
+ } else {
391
+ return function() {}
392
+ }
393
+ }
394
+
395
+ CodeMirror.registerHelper("hint", "auto", {
396
+ resolve: resolveAutoHints
397
+ });
398
+
399
+ CodeMirror.registerHelper("hint", "fromList", function(cm, options) {
400
+ var cur = cm.getCursor(), token = cm.getTokenAt(cur);
401
+ var to = CodeMirror.Pos(cur.line, token.end);
402
+ if (token.string && /\w/.test(token.string[token.string.length - 1])) {
403
+ var term = token.string, from = CodeMirror.Pos(cur.line, token.start);
404
+ } else {
405
+ var term = "", from = to;
406
+ }
407
+ var found = [];
408
+ for (var i = 0; i < options.words.length; i++) {
409
+ var word = options.words[i];
410
+ if (word.slice(0, term.length) == term)
411
+ found.push(word);
412
+ }
413
+
414
+ if (found.length) return {list: found, from: from, to: to};
415
+ });
416
+
417
+ CodeMirror.commands.autocomplete = CodeMirror.showHint;
418
+
419
+ var defaultOptions = {
420
+ hint: CodeMirror.hint.auto,
421
+ completeSingle: true,
422
+ alignWithWord: true,
423
+ closeCharacters: /[\s()\[\]{};:>,]/,
424
+ closeOnUnfocus: true,
425
+ completeOnSingleClick: true,
426
+ container: null,
427
+ customKeys: null,
428
+ extraKeys: null
429
+ };
430
+
431
+ CodeMirror.defineOption("hintOptions", null);
432
+ });
assets/codemirror/addon/hint/xml-hint.js ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ var Pos = CodeMirror.Pos;
15
+
16
+ function getHints(cm, options) {
17
+ var tags = options && options.schemaInfo;
18
+ var quote = (options && options.quoteChar) || '"';
19
+ if (!tags) return;
20
+ var cur = cm.getCursor(), token = cm.getTokenAt(cur);
21
+ if (token.end > cur.ch) {
22
+ token.end = cur.ch;
23
+ token.string = token.string.slice(0, cur.ch - token.start);
24
+ }
25
+ var inner = CodeMirror.innerMode(cm.getMode(), token.state);
26
+ if (inner.mode.name != "xml") return;
27
+ var result = [], replaceToken = false, prefix;
28
+ var tag = /\btag\b/.test(token.type) && !/>$/.test(token.string);
29
+ var tagName = tag && /^\w/.test(token.string), tagStart;
30
+
31
+ if (tagName) {
32
+ var before = cm.getLine(cur.line).slice(Math.max(0, token.start - 2), token.start);
33
+ var tagType = /<\/$/.test(before) ? "close" : /<$/.test(before) ? "open" : null;
34
+ if (tagType) tagStart = token.start - (tagType == "close" ? 2 : 1);
35
+ } else if (tag && token.string == "<") {
36
+ tagType = "open";
37
+ } else if (tag && token.string == "</") {
38
+ tagType = "close";
39
+ }
40
+
41
+ if (!tag && !inner.state.tagName || tagType) {
42
+ if (tagName)
43
+ prefix = token.string;
44
+ replaceToken = tagType;
45
+ var cx = inner.state.context, curTag = cx && tags[cx.tagName];
46
+ var childList = cx ? curTag && curTag.children : tags["!top"];
47
+ if (childList && tagType != "close") {
48
+ for (var i = 0; i < childList.length; ++i) if (!prefix || childList[i].lastIndexOf(prefix, 0) == 0)
49
+ result.push("<" + childList[i]);
50
+ } else if (tagType != "close") {
51
+ for (var name in tags)
52
+ if (tags.hasOwnProperty(name) && name != "!top" && name != "!attrs" && (!prefix || name.lastIndexOf(prefix, 0) == 0))
53
+ result.push("<" + name);
54
+ }
55
+ if (cx && (!prefix || tagType == "close" && cx.tagName.lastIndexOf(prefix, 0) == 0))
56
+ result.push("</" + cx.tagName + ">");
57
+ } else {
58
+ // Attribute completion
59
+ var curTag = tags[inner.state.tagName], attrs = curTag && curTag.attrs;
60
+ var globalAttrs = tags["!attrs"];
61
+ if (!attrs && !globalAttrs) return;
62
+ if (!attrs) {
63
+ attrs = globalAttrs;
64
+ } else if (globalAttrs) { // Combine tag-local and global attributes
65
+ var set = {};
66
+ for (var nm in globalAttrs) if (globalAttrs.hasOwnProperty(nm)) set[nm] = globalAttrs[nm];
67
+ for (var nm in attrs) if (attrs.hasOwnProperty(nm)) set[nm] = attrs[nm];
68
+ attrs = set;
69
+ }
70
+ if (token.type == "string" || token.string == "=") { // A value
71
+ var before = cm.getRange(Pos(cur.line, Math.max(0, cur.ch - 60)),
72
+ Pos(cur.line, token.type == "string" ? token.start : token.end));
73
+ var atName = before.match(/([^\s\u00a0=<>\"\']+)=$/), atValues;
74
+ if (!atName || !attrs.hasOwnProperty(atName[1]) || !(atValues = attrs[atName[1]])) return;
75
+ if (typeof atValues == 'function') atValues = atValues.call(this, cm); // Functions can be used to supply values for autocomplete widget
76
+ if (token.type == "string") {
77
+ prefix = token.string;
78
+ var n = 0;
79
+ if (/['"]/.test(token.string.charAt(0))) {
80
+ quote = token.string.charAt(0);
81
+ prefix = token.string.slice(1);
82
+ n++;
83
+ }
84
+ var len = token.string.length;
85
+ if (/['"]/.test(token.string.charAt(len - 1))) {
86
+ quote = token.string.charAt(len - 1);
87
+ prefix = token.string.substr(n, len - 2);
88
+ }
89
+ replaceToken = true;
90
+ }
91
+ for (var i = 0; i < atValues.length; ++i) if (!prefix || atValues[i].lastIndexOf(prefix, 0) == 0)
92
+ result.push(quote + atValues[i] + quote);
93
+ } else { // An attribute name
94
+ if (token.type == "attribute") {
95
+ prefix = token.string;
96
+ replaceToken = true;
97
+ }
98
+ for (var attr in attrs) if (attrs.hasOwnProperty(attr) && (!prefix || attr.lastIndexOf(prefix, 0) == 0))
99
+ result.push(attr);
100
+ }
101
+ }
102
+ return {
103
+ list: result,
104
+ from: replaceToken ? Pos(cur.line, tagStart == null ? token.start : tagStart) : cur,
105
+ to: replaceToken ? Pos(cur.line, token.end) : cur
106
+ };
107
+ }
108
+
109
+ CodeMirror.registerHelper("hint", "xml", getHints);
110
+ });
assets/empty.css ADDED
File without changes
assets/empty.js ADDED
File without changes
custom-css-js.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Simple Custom CSS and JS
4
  * Plugin URI: https://wordpress.org/plugins/custom-css-js/
5
  * Description: Easily add Custom CSS or JS to your website with an awesome editor.
6
- * Version: 3.31.1
7
  * Author: SilkyPress.com
8
  * Author URI: https://www.silkypress.com
9
  * License: GPL2
@@ -12,7 +12,7 @@
12
  * Domain Path: /languages/
13
  *
14
  * WC requires at least: 2.3.0
15
- * WC tested up to: 4.1
16
  */
17
 
18
  if ( ! defined( 'ABSPATH' ) ) {
@@ -219,7 +219,7 @@ if ( ! class_exists( 'CustomCSSandJS' ) ) :
219
  function set_constants() {
220
  $dir = wp_upload_dir();
221
  $constants = array(
222
- 'CCJ_VERSION' => '3.31.1',
223
  'CCJ_UPLOAD_DIR' => $dir['basedir'] . '/custom-css-js',
224
  'CCJ_UPLOAD_URL' => $dir['baseurl'] . '/custom-css-js',
225
  'CCJ_PLUGIN_FILE' => __FILE__,
3
  * Plugin Name: Simple Custom CSS and JS
4
  * Plugin URI: https://wordpress.org/plugins/custom-css-js/
5
  * Description: Easily add Custom CSS or JS to your website with an awesome editor.
6
+ * Version: 3.32
7
  * Author: SilkyPress.com
8
  * Author URI: https://www.silkypress.com
9
  * License: GPL2
12
  * Domain Path: /languages/
13
  *
14
  * WC requires at least: 2.3.0
15
+ * WC tested up to: 4.2
16
  */
17
 
18
  if ( ! defined( 'ABSPATH' ) ) {
219
  function set_constants() {
220
  $dir = wp_upload_dir();
221
  $constants = array(
222
+ 'CCJ_VERSION' => '3.32',
223
  'CCJ_UPLOAD_DIR' => $dir['basedir'] . '/custom-css-js',
224
  'CCJ_UPLOAD_URL' => $dir['baseurl'] . '/custom-css-js',
225
  'CCJ_PLUGIN_FILE' => __FILE__,
includes/admin-config.php CHANGED
@@ -163,6 +163,7 @@ class CustomCSSandJS_AdminConfig {
163
  return array_merge( $defaults, array(
164
  'ccj_htmlentities' => false,
165
  'ccj_htmlentities2' => false,
 
166
  'add_role' => false,
167
  'remove_comments' => false,
168
  ) );
@@ -221,14 +222,20 @@ class CustomCSSandJS_AdminConfig {
221
  <tr>
222
  <th scope="row"><label for="ccj_htmlentities"><?php _e('Keep the HTML entities, don\'t convert to its character', 'custom-css-js') ?> <span class="dashicons dashicons-editor-help" rel="tipsy" title="<?php echo $ccj_htmlentities_help; ?>"></span>
223
  </label></th>
224
- <td><input type="checkbox" name="ccj_htmlentities" id = "ccj_htmlentities" value="1" <?php checked($settings['ccj_htmlentities'], true); ?> />
225
  </td>
226
  </tr>
227
  <tr>
228
  <th scope="row"><label for="ccj_htmlentities2"><?php _e('Encode the HTML entities', 'custom-css-js') ?> <span class="dashicons dashicons-editor-help" rel="tipsy" title="<?php echo $ccj_htmlentities2_help; ?>"></span></label></th>
229
- <td><input type="checkbox" name="ccj_htmlentities2" id = "ccj_htmlentities2" value="1" <?php checked($settings['ccj_htmlentities2'], true); ?> />
230
  </td>
231
  </tr>
 
 
 
 
 
 
232
 
233
 
234
  </table>
163
  return array_merge( $defaults, array(
164
  'ccj_htmlentities' => false,
165
  'ccj_htmlentities2' => false,
166
+ 'ccj_autocomplete' => true,
167
  'add_role' => false,
168
  'remove_comments' => false,
169
  ) );
222
  <tr>
223
  <th scope="row"><label for="ccj_htmlentities"><?php _e('Keep the HTML entities, don\'t convert to its character', 'custom-css-js') ?> <span class="dashicons dashicons-editor-help" rel="tipsy" title="<?php echo $ccj_htmlentities_help; ?>"></span>
224
  </label></th>
225
+ <td><input type="checkbox" name="ccj_htmlentities" id="ccj_htmlentities" value="1" <?php checked($settings['ccj_htmlentities'], true); ?> />
226
  </td>
227
  </tr>
228
  <tr>
229
  <th scope="row"><label for="ccj_htmlentities2"><?php _e('Encode the HTML entities', 'custom-css-js') ?> <span class="dashicons dashicons-editor-help" rel="tipsy" title="<?php echo $ccj_htmlentities2_help; ?>"></span></label></th>
230
+ <td><input type="checkbox" name="ccj_htmlentities2" id="ccj_htmlentities2" value="1" <?php checked($settings['ccj_htmlentities2'], true); ?> />
231
  </td>
232
  </tr>
233
+ <tr>
234
+ <th scope="row"><label for="ccj_autocomplete"><?php _e('Autocomplete in the editor', 'custom-css-js') ?></label></th>
235
+ <td><input type="checkbox" name="ccj_autocomplete" id="ccj_autocomplete" value="1" <?php checked($settings['ccj_autocomplete'], true); ?> />
236
+ </td>
237
+ </tr>
238
+
239
 
240
 
241
  </table>
includes/admin-screens.php CHANGED
@@ -64,6 +64,8 @@ class CustomCSSandJS_Admin {
64
  'wp_ajax_ccj_permalink' => 'wp_ajax_ccj_permalink',
65
  'post_submitbox_start' => 'post_submitbox_start',
66
  'restrict_manage_posts' => 'restrict_manage_posts',
 
 
67
  'edit_form_before_permalink' => 'edit_form_before_permalink',
68
  'before_delete_post' => 'before_delete_post',
69
  );
@@ -74,6 +76,9 @@ class CustomCSSandJS_Admin {
74
  // Add some custom actions/filters
75
  add_action( 'manage_custom-css-js_posts_custom_column', array( $this, 'manage_posts_columns' ), 10, 2 );
76
  add_filter( 'manage_edit-custom-css-js_sortable_columns', array( $this, 'manage_edit_posts_sortable_columns' ) );
 
 
 
77
  add_filter( 'post_row_actions', array( $this, 'post_row_actions' ), 10, 2 );
78
  add_filter( 'parse_query', array( $this, 'parse_query' ), 10 );
79
 
@@ -149,6 +154,19 @@ class CustomCSSandJS_Admin {
149
  wp_enqueue_script( 'cm-searchcursor', $cma . 'search/searchcursor.js', array( 'ccj-codemirror' ), $v, false );
150
  wp_enqueue_script( 'cm-jump-to-line', $cma . 'search/jump-to-line.js', array( 'ccj-codemirror' ), $v, false );
151
  wp_enqueue_style( 'cm-dialog', $cma . 'dialog/dialog.css', array(), $v );
 
 
 
 
 
 
 
 
 
 
 
 
 
152
 
153
  // remove the assets from other plugins so it doesn't interfere with CodeMirror
154
  global $wp_scripts;
@@ -166,6 +184,9 @@ class CustomCSSandJS_Admin {
166
  }
167
  }
168
  }
 
 
 
169
  }
170
  }
171
 
@@ -175,7 +196,10 @@ class CustomCSSandJS_Admin {
175
  */
176
  public function cm_localize() {
177
 
 
 
178
  $vars = array(
 
179
  'active' => __( 'Active', 'custom-css-js' ),
180
  'inactive' => __( 'Inactive', 'custom-css-js' ),
181
  'activate' => __( 'Activate', 'custom-css-js' ),
@@ -326,6 +350,8 @@ class CustomCSSandJS_Admin {
326
  * Make the 'Modified' column sortable
327
  */
328
  function manage_edit_posts_sortable_columns( $columns ) {
 
 
329
  $columns['modified'] = 'modified';
330
  $columns['published'] = 'published';
331
  return $columns;
@@ -391,6 +417,62 @@ class CustomCSSandJS_Admin {
391
  }
392
 
393
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
394
  /**
395
  * Activate/deactivate a code
396
  *
@@ -1065,6 +1147,7 @@ End of comment */ ',
1065
  $before = '/******* Do not edit this file *******' . PHP_EOL .
1066
  'Simple Custom CSS and JS - by Silkypress.com' . PHP_EOL .
1067
  'Saved: ' . date( 'M d Y | H:i:s' ) . ' */' . PHP_EOL;
 
1068
  }
1069
 
1070
  if ( wp_is_writable( CCJ_UPLOAD_DIR ) ) {
@@ -1385,6 +1468,33 @@ endif;
1385
  }
1386
 
1387
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1388
  /**
1389
  * Remove the JS/CSS file from the disk when deleting the post
1390
  */
64
  'wp_ajax_ccj_permalink' => 'wp_ajax_ccj_permalink',
65
  'post_submitbox_start' => 'post_submitbox_start',
66
  'restrict_manage_posts' => 'restrict_manage_posts',
67
+ 'load-post.php' => 'contextual_help',
68
+ 'load-post-new.php' => 'contextual_help',
69
  'edit_form_before_permalink' => 'edit_form_before_permalink',
70
  'before_delete_post' => 'before_delete_post',
71
  );
76
  // Add some custom actions/filters
77
  add_action( 'manage_custom-css-js_posts_custom_column', array( $this, 'manage_posts_columns' ), 10, 2 );
78
  add_filter( 'manage_edit-custom-css-js_sortable_columns', array( $this, 'manage_edit_posts_sortable_columns' ) );
79
+ add_action( 'posts_orderby', array( $this, 'posts_orderby' ), 10, 2 );
80
+ add_action( 'posts_join_paged', array( $this, 'posts_join_paged' ), 10, 2 );
81
+ add_action( 'posts_where_paged', array( $this, 'posts_where_paged' ), 10, 2 );
82
  add_filter( 'post_row_actions', array( $this, 'post_row_actions' ), 10, 2 );
83
  add_filter( 'parse_query', array( $this, 'parse_query' ), 10 );
84
 
154
  wp_enqueue_script( 'cm-searchcursor', $cma . 'search/searchcursor.js', array( 'ccj-codemirror' ), $v, false );
155
  wp_enqueue_script( 'cm-jump-to-line', $cma . 'search/jump-to-line.js', array( 'ccj-codemirror' ), $v, false );
156
  wp_enqueue_style( 'cm-dialog', $cma . 'dialog/dialog.css', array(), $v );
157
+ wp_enqueue_script( 'ccj-comment', $cma . 'comment/comment.js', array( 'ccj-codemirror' ), $v, false );
158
+
159
+
160
+ // Hint Addons
161
+ wp_enqueue_script( 'ccj-hint', $cma . 'hint/show-hint.js', array( 'ccj-codemirror' ), $v, false );
162
+ wp_enqueue_script( 'ccj-hint-js', $cma . 'hint/javascript-hint.js', array( 'ccj-codemirror' ), $v, false );
163
+ wp_enqueue_script( 'ccj-hint-xml', $cma . 'hint/xml-hint.js', array( 'ccj-codemirror' ), $v, false );
164
+ wp_enqueue_script( 'ccj-hint-html', $cma . 'hint/html-hint.js', array( 'ccj-codemirror' ), $v, false );
165
+ wp_enqueue_script( 'ccj-hint-css', $cma . 'hint/css-hint.js', array( 'ccj-codemirror' ), $v, false );
166
+ wp_enqueue_script( 'ccj-hint-anyword', $cma . 'hint/anyword-hint.js', array( 'ccj-codemirror' ), $v, false );
167
+ wp_enqueue_style( 'ccj-hint', $cma . 'hint/show-hint.css', array(), $v );
168
+
169
+
170
 
171
  // remove the assets from other plugins so it doesn't interfere with CodeMirror
172
  global $wp_scripts;
184
  }
185
  }
186
  }
187
+ // remove the CodeMirror library added by the Product Slider for WooCommerce plugin by ShapedPlugin
188
+ wp_enqueue_style( 'spwps-codemirror', $a . '/empty.css', '1.0' );
189
+ wp_enqueue_script( 'spwps-codemirror', $a . '/empty.js', array(), '1.0', true );
190
  }
191
  }
192
 
196
  */
197
  public function cm_localize() {
198
 
199
+ $settings = get_option( 'ccj_settings' );
200
+
201
  $vars = array(
202
+ 'autocomplete' => isset( $settings['ccj_autocomplete'] ) && ! $settings['ccj_autocomplete'] ? false : true,
203
  'active' => __( 'Active', 'custom-css-js' ),
204
  'inactive' => __( 'Inactive', 'custom-css-js' ),
205
  'activate' => __( 'Activate', 'custom-css-js' ),
350
  * Make the 'Modified' column sortable
351
  */
352
  function manage_edit_posts_sortable_columns( $columns ) {
353
+ $columns['active'] = 'active';
354
+ $columns['type'] = 'type';
355
  $columns['modified'] = 'modified';
356
  $columns['published'] = 'published';
357
  return $columns;
417
  }
418
 
419
 
420
+ /**
421
+ * Order table by Type and Active columns
422
+ *
423
+ */
424
+ function posts_orderby( $orderby, $query ) {
425
+ if ( ! is_admin() ) {
426
+ return $orderby;
427
+ }
428
+ global $wpdb;
429
+
430
+ if ( 'custom-css-js' === $query->get( 'post_type' ) && 'type' === $query->get( 'orderby' ) ) {
431
+ $orderby = "REGEXP_SUBSTR( {$wpdb->prefix}postmeta.meta_value, 'js|html|css') " . $query->get( 'order' );
432
+ }
433
+ if ( 'custom-css-js' === $query->get( 'post_type' ) && 'active' === $query->get( 'orderby' ) ) {
434
+ $orderby = "coalesce( postmeta1.meta_value, 'p' ) " . $query->get( 'order' );
435
+ }
436
+ return $orderby;
437
+ }
438
+
439
+
440
+ /**
441
+ * Order table by Type and Active columns
442
+ */
443
+ function posts_join_paged( $join, $query ) {
444
+ if ( ! is_admin() ) {
445
+ return $join;
446
+ }
447
+ global $wpdb;
448
+
449
+ if ( 'custom-css-js' === $query->get( 'post_type' ) && 'type' === $query->get( 'orderby' ) ) {
450
+ $join = "LEFT JOIN {$wpdb->prefix}postmeta ON {$wpdb->prefix}posts.ID = {$wpdb->prefix}postmeta.post_id";
451
+ }
452
+
453
+ if ( 'custom-css-js' === $query->get( 'post_type' ) && 'active' === $query->get( 'orderby' ) ) {
454
+ $join = "LEFT JOIN (SELECT post_id AS ID, meta_value FROM {$wpdb->prefix}postmeta WHERE meta_key = '_active' ) as postmeta1 USING( ID )";
455
+ }
456
+ return $join;
457
+ }
458
+
459
+
460
+ /**
461
+ * Order table by Type and Active columns
462
+ */
463
+ function posts_where_paged( $where, $query ) {
464
+ if ( ! is_admin() ) {
465
+ return $where;
466
+ }
467
+ global $wpdb;
468
+
469
+ if ( 'custom-css-js' === $query->get( 'post_type' ) && 'type' === $query->get( 'orderby' ) ) {
470
+ $where .= " AND {$wpdb->prefix}postmeta.meta_key = 'options'";
471
+ }
472
+ return $where;
473
+ }
474
+
475
+
476
  /**
477
  * Activate/deactivate a code
478
  *
1147
  $before = '/******* Do not edit this file *******' . PHP_EOL .
1148
  'Simple Custom CSS and JS - by Silkypress.com' . PHP_EOL .
1149
  'Saved: ' . date( 'M d Y | H:i:s' ) . ' */' . PHP_EOL;
1150
+ $after = '';
1151
  }
1152
 
1153
  if ( wp_is_writable( CCJ_UPLOAD_DIR ) ) {
1468
  }
1469
 
1470
 
1471
+ /**
1472
+ * Show contextual help for the Custom Code edit page
1473
+ */
1474
+ public function contextual_help() {
1475
+ $screen = get_current_screen();
1476
+
1477
+ if ( $screen->id != 'custom-css-js' ) {
1478
+ return;
1479
+ }
1480
+
1481
+ $screen->add_help_tab(
1482
+ array(
1483
+ 'id' => 'ccj-editor_shortcuts',
1484
+ 'title' => __( 'Editor Shortcuts', 'custom-css-js-pro' ),
1485
+ 'content' =>
1486
+ '<p><table>
1487
+ <tr><td><strong>Auto Complete</strong></td><td> <code>Ctrl</code> + <code>Space</code></td></tr>
1488
+ <tr><td><strong>Find</strong></td><td> <code>Ctrl</code> + <code>F</code></td></tr>
1489
+ <tr><td><strong>Replace</strong></td><td> <code>Shift</code> + <code>Ctrl</code> + <code>F</code></td></tr>
1490
+ <tr><td><strong>Comment line/block</strong></td><td> <code>Ctrl</code> + <code>/</code></td></tr>
1491
+ </table></p>',
1492
+ )
1493
+ );
1494
+
1495
+ }
1496
+
1497
+
1498
  /**
1499
  * Remove the JS/CSS file from the disk when deleting the post
1500
  */
readme.txt CHANGED
@@ -4,8 +4,8 @@ Contributors: diana_burduja
4
  Email: diana@burduja.eu
5
  Tags: CSS, JS, javascript, custom CSS, custom JS, custom style, site css, add style, customize theme, custom code, external css, css3, style, styles, stylesheet, theme, editor, design, admin
6
  Requires at least: 3.0.1
7
- Tested up to: 5.4
8
- Stable tag: 3.31.1
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
11
  Requires PHP: 5.2.4
@@ -105,6 +105,12 @@ $. Add/Edit HTML
105
 
106
  == Changelog ==
107
 
 
 
 
 
 
 
108
 
109
  = 3.31.1 =
110
  * 05/05/2020
4
  Email: diana@burduja.eu
5
  Tags: CSS, JS, javascript, custom CSS, custom JS, custom style, site css, add style, customize theme, custom code, external css, css3, style, styles, stylesheet, theme, editor, design, admin
6
  Requires at least: 3.0.1
7
+ Tested up to: 5.5
8
+ Stable tag: 3.32
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
11
  Requires PHP: 5.2.4
105
 
106
  == Changelog ==
107
 
108
+ = 3.32 =
109
+ * 07/08/2020
110
+ * Fix: compatibility issue with the Product Slider for WooCommerce by ShapedPlugin
111
+ * Feature: "Ctrl + /" in the editor will comment out the code
112
+ * Feature: order custom codes table by "type" and "active" state
113
+ * Feature: autocomplete in the editor
114
 
115
  = 3.31.1 =
116
  * 05/05/2020