qword 1.1.12 → 1.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ChangeLog +5 -0
- package/client/options.js +6 -4
- package/dist/qword.js +1 -1
- package/dist/qword.js.map +1 -1
- package/dist-dev/qword.js +1 -1
- package/package.json +1 -1
- package/modules/cm-searchbox/ChangeLog +0 -60
- package/modules/cm-searchbox/LICENSE +0 -21
- package/modules/cm-searchbox/README.md +0 -27
- package/modules/cm-searchbox/bower.json +0 -26
- package/modules/cm-searchbox/img/searchbox.png +0 -0
- package/modules/cm-searchbox/lib/searchbox.js +0 -679
- package/modules/cm-searchbox/package.json +0 -27
- package/modules/cm-show-invisibles/ChangeLog +0 -108
- package/modules/cm-show-invisibles/LICENSE +0 -21
- package/modules/cm-show-invisibles/README.md +0 -25
- package/modules/cm-show-invisibles/bower.json +0 -25
- package/modules/cm-show-invisibles/lib/show-invisibles.js +0 -131
- package/modules/cm-show-invisibles/package.json +0 -34
- package/modules/codemirror-emmet/README.md +0 -56
- package/modules/codemirror-emmet/dist/emmet.js +0 -48661
- package/modules/codemirror-emmet/dist/emmet.min.js +0 -8
- package/modules/codemirror-emmet/dist/emmetPlugin.js +0 -840
- package/modules/codemirror-emmet/dist/emmetPlugin.min.js +0 -1
- package/modules/codemirror-emmet/dist/index.html +0 -46
- package/modules/codemirror-emmet/editor.js +0 -204
- package/modules/codemirror-emmet/gulpfile.js +0 -54
- package/modules/codemirror-emmet/index.html +0 -68
- package/modules/codemirror-emmet/package.json +0 -36
- package/modules/codemirror-emmet/plugin.js +0 -201
- package/modules/codemirror-emmet/shim.js +0 -19
- package/modules/codemirror-emmet/vendor/almond.js +0 -410
- package/modules/codemirror-emmet/vendor/codemirror/v4/codemirror.css +0 -270
- package/modules/codemirror-emmet/vendor/codemirror/v4/codemirror.js +0 -7339
- package/modules/codemirror-emmet/vendor/codemirror/v4/css.js +0 -701
- package/modules/codemirror-emmet/vendor/codemirror/v4/htmlmixed.js +0 -117
- package/modules/codemirror-emmet/vendor/codemirror/v4/xml.js +0 -349
- package/modules/execon/ChangeLog +0 -86
- package/modules/execon/LICENSE +0 -20
- package/modules/execon/README.md +0 -154
- package/modules/execon/bower.json +0 -25
- package/modules/execon/lib/exec.js +0 -244
- package/modules/execon/package.json +0 -23
- package/modules/jshint/README.md +0 -114
- package/modules/jshint/dist/jshint-rhino.js +0 -32143
- package/modules/jshint/dist/jshint.js +0 -32141
- package/modules/jshint/package.json +0 -77
- package/modules/loadremote/ChangeLog +0 -23
- package/modules/loadremote/LICENSE +0 -21
- package/modules/loadremote/README.md +0 -53
- package/modules/loadremote/bower.json +0 -27
- package/modules/loadremote/lib/loadremote.js +0 -147
- package/modules/loadremote/package.json +0 -26
|
@@ -1,679 +0,0 @@
|
|
|
1
|
-
/* global CodeMirror */
|
|
2
|
-
/* global define */
|
|
3
|
-
|
|
4
|
-
(function(mod) {
|
|
5
|
-
'use strict';
|
|
6
|
-
|
|
7
|
-
if (typeof exports === 'object' && typeof module === 'object') // CommonJS
|
|
8
|
-
mod(require('../../lib/codemirror'));
|
|
9
|
-
else if (typeof define === 'function' && define.amd) // AMD
|
|
10
|
-
define(['../../lib/codemirror'], mod);
|
|
11
|
-
else
|
|
12
|
-
mod(CodeMirror);
|
|
13
|
-
})(function(CodeMirror) {
|
|
14
|
-
'use strict';
|
|
15
|
-
|
|
16
|
-
var Search;
|
|
17
|
-
|
|
18
|
-
CodeMirror.defineOption('searchbox', false, function(cm) {
|
|
19
|
-
cm.addKeyMap({
|
|
20
|
-
'Ctrl-F': function() {
|
|
21
|
-
if (!Search)
|
|
22
|
-
Search = new SearchBox(cm);
|
|
23
|
-
|
|
24
|
-
Search.show();
|
|
25
|
-
},
|
|
26
|
-
|
|
27
|
-
'Esc': function() {
|
|
28
|
-
if (!Search || !Search.isVisible())
|
|
29
|
-
return CodeMirror.Pass;
|
|
30
|
-
|
|
31
|
-
Search.hide();
|
|
32
|
-
|
|
33
|
-
if (typeof event !== 'undefined')
|
|
34
|
-
event.stopPropagation();
|
|
35
|
-
},
|
|
36
|
-
|
|
37
|
-
'Cmd-F': function() {
|
|
38
|
-
if (!Search)
|
|
39
|
-
Search = new SearchBox(cm);
|
|
40
|
-
|
|
41
|
-
Search.show();
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
function SearchBox(cm) {
|
|
47
|
-
var self = this;
|
|
48
|
-
|
|
49
|
-
init();
|
|
50
|
-
|
|
51
|
-
function initElements(el) {
|
|
52
|
-
self.searchBox = el.querySelector('.ace_search_form');
|
|
53
|
-
self.replaceBox = el.querySelector('.ace_replace_form');
|
|
54
|
-
self.searchOptions = el.querySelector('.ace_search_options');
|
|
55
|
-
|
|
56
|
-
self.regExpOption = el.querySelector('[action=toggleRegexpMode]');
|
|
57
|
-
self.caseSensitiveOption = el.querySelector('[action=toggleCaseSensitive]');
|
|
58
|
-
self.wholeWordOption = el.querySelector('[action=toggleWholeWords]');
|
|
59
|
-
|
|
60
|
-
self.searchInput = self.searchBox.querySelector('.ace_search_field');
|
|
61
|
-
self.replaceInput = self.replaceBox.querySelector('.ace_search_field');
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function init() {
|
|
65
|
-
var el = self.element = addHtml();
|
|
66
|
-
|
|
67
|
-
addStyle();
|
|
68
|
-
|
|
69
|
-
initElements(el);
|
|
70
|
-
bindKeys();
|
|
71
|
-
|
|
72
|
-
el.addEventListener('mousedown', function(e) {
|
|
73
|
-
setTimeout(function(){
|
|
74
|
-
self.activeInput.focus();
|
|
75
|
-
}, 0);
|
|
76
|
-
|
|
77
|
-
e.stopPropagation();
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
el.addEventListener('click', function(e) {
|
|
81
|
-
var t = e.target || e.srcElement;
|
|
82
|
-
var action = t.getAttribute('action');
|
|
83
|
-
if (action && self[action])
|
|
84
|
-
self[action]();
|
|
85
|
-
else if (self.commands[action])
|
|
86
|
-
self.commands[action]();
|
|
87
|
-
|
|
88
|
-
e.stopPropagation();
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
self.searchInput.addEventListener('input', function() {
|
|
92
|
-
self.$onChange.schedule(20);
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
self.searchInput.addEventListener('focus', function() {
|
|
96
|
-
self.activeInput = self.searchInput;
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
self.replaceInput.addEventListener('focus', function() {
|
|
100
|
-
self.activeInput = self.replaceInput;
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
self.$onChange = delayedCall(function() {
|
|
104
|
-
self.find(false, false);
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
function bindKeys() {
|
|
109
|
-
var sb = self,
|
|
110
|
-
obj = {
|
|
111
|
-
'Ctrl-F|Cmd-F|Ctrl-H|Command-Alt-F': function() {
|
|
112
|
-
var isReplace = sb.isReplace = !sb.isReplace;
|
|
113
|
-
sb.replaceBox.style.display = isReplace ? '' : 'none';
|
|
114
|
-
sb[isReplace ? 'replaceInput' : 'searchInput'].focus();
|
|
115
|
-
},
|
|
116
|
-
'Ctrl-G|Cmd-G': function() {
|
|
117
|
-
sb.findNext();
|
|
118
|
-
},
|
|
119
|
-
'Ctrl-Shift-G|Cmd-Shift-G': function() {
|
|
120
|
-
sb.findPrev();
|
|
121
|
-
},
|
|
122
|
-
'Esc': function() {
|
|
123
|
-
setTimeout(function() { sb.hide();});
|
|
124
|
-
},
|
|
125
|
-
'Enter': function() {
|
|
126
|
-
if (sb.activeInput === sb.replaceInput)
|
|
127
|
-
sb.replace();
|
|
128
|
-
sb.findNext();
|
|
129
|
-
},
|
|
130
|
-
'Shift-Enter': function() {
|
|
131
|
-
if (sb.activeInput === sb.replaceInput)
|
|
132
|
-
sb.replace();
|
|
133
|
-
sb.findPrev();
|
|
134
|
-
},
|
|
135
|
-
'Alt-Enter': function() {
|
|
136
|
-
if (sb.activeInput === sb.replaceInput)
|
|
137
|
-
sb.replaceAll();
|
|
138
|
-
sb.findAll();
|
|
139
|
-
},
|
|
140
|
-
'Tab': function() {
|
|
141
|
-
if (self.activeInput === self.replaceInput)
|
|
142
|
-
self.searchInput.focus();
|
|
143
|
-
else
|
|
144
|
-
self.replaceInput.focus();
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
self.element.addEventListener('keydown', function(event) {
|
|
149
|
-
Object.keys(obj).some(function(name) {
|
|
150
|
-
var is = key(name, event);
|
|
151
|
-
|
|
152
|
-
if (is) {
|
|
153
|
-
event.stopPropagation();
|
|
154
|
-
event.preventDefault();
|
|
155
|
-
obj[name](event);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
return is;
|
|
159
|
-
});
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
this.commands = {
|
|
164
|
-
toggleRegexpMode: function() {
|
|
165
|
-
self.regExpOption.checked = !self.regExpOption.checked;
|
|
166
|
-
self.$syncOptions();
|
|
167
|
-
},
|
|
168
|
-
|
|
169
|
-
toggleCaseSensitive: function() {
|
|
170
|
-
self.caseSensitiveOption.checked = !self.caseSensitiveOption.checked;
|
|
171
|
-
self.$syncOptions();
|
|
172
|
-
},
|
|
173
|
-
|
|
174
|
-
toggleWholeWords: function() {
|
|
175
|
-
self.wholeWordOption.checked = !self.wholeWordOption.checked;
|
|
176
|
-
self.$syncOptions();
|
|
177
|
-
}
|
|
178
|
-
};
|
|
179
|
-
|
|
180
|
-
this.$syncOptions = function() {
|
|
181
|
-
setCssClass(this.regExpOption, 'checked', this.regExpOption.checked);
|
|
182
|
-
setCssClass(this.wholeWordOption, 'checked', this.wholeWordOption.checked);
|
|
183
|
-
setCssClass(this.caseSensitiveOption, 'checked', this.caseSensitiveOption.checked);
|
|
184
|
-
|
|
185
|
-
this.find(false, false);
|
|
186
|
-
};
|
|
187
|
-
|
|
188
|
-
this.find = function(skipCurrent, backwards) {
|
|
189
|
-
var value = this.searchInput.value,
|
|
190
|
-
options = {
|
|
191
|
-
skipCurrent: skipCurrent,
|
|
192
|
-
backwards: backwards,
|
|
193
|
-
regExp: this.regExpOption.checked,
|
|
194
|
-
caseSensitive: this.caseSensitiveOption.checked,
|
|
195
|
-
wholeWord: this.wholeWordOption.checked
|
|
196
|
-
};
|
|
197
|
-
|
|
198
|
-
find(value, options, function(searchCursor) {
|
|
199
|
-
var current = searchCursor.matches(false, searchCursor.from());
|
|
200
|
-
cm.setSelection(current.from, current.to);
|
|
201
|
-
});
|
|
202
|
-
};
|
|
203
|
-
|
|
204
|
-
function find(value, options, callback) {
|
|
205
|
-
var done,
|
|
206
|
-
noMatch, searchCursor, next, prev, matches, cursor,
|
|
207
|
-
position,
|
|
208
|
-
val = value,
|
|
209
|
-
o = options,
|
|
210
|
-
is = true,
|
|
211
|
-
caseSensitive = o.caseSensitive,
|
|
212
|
-
regExp = o.regExp,
|
|
213
|
-
wholeWord = o.wholeWord;
|
|
214
|
-
|
|
215
|
-
if (regExp || wholeWord) {
|
|
216
|
-
if (options.wholeWord)
|
|
217
|
-
val = '\\b' + val + '\\b';
|
|
218
|
-
|
|
219
|
-
val = RegExp(val);
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
if (o.backwards)
|
|
223
|
-
position = o.skipCurrent ? 'from': 'to';
|
|
224
|
-
else
|
|
225
|
-
position = o.skipCurrent ? 'to' : 'from';
|
|
226
|
-
|
|
227
|
-
cursor = cm.getCursor(position);
|
|
228
|
-
searchCursor = cm.getSearchCursor(val, cursor, !caseSensitive);
|
|
229
|
-
|
|
230
|
-
next = searchCursor.findNext.bind(searchCursor),
|
|
231
|
-
prev = searchCursor.findPrevious.bind(searchCursor),
|
|
232
|
-
matches = searchCursor.matches.bind(searchCursor);
|
|
233
|
-
|
|
234
|
-
if (o.backwards && !prev()) {
|
|
235
|
-
is = next();
|
|
236
|
-
|
|
237
|
-
if (is) {
|
|
238
|
-
cm.setCursor(cm.doc.size - 1, 0);
|
|
239
|
-
find(value, options, callback);
|
|
240
|
-
done = true;
|
|
241
|
-
}
|
|
242
|
-
} else if (!o.backwards && !next()) {
|
|
243
|
-
is = prev();
|
|
244
|
-
|
|
245
|
-
if (is) {
|
|
246
|
-
cm.setCursor(0, 0);
|
|
247
|
-
find(value, options, callback);
|
|
248
|
-
done = true;
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
noMatch = !is && self.searchInput.value;
|
|
253
|
-
setCssClass(self.searchBox, 'ace_nomatch', noMatch);
|
|
254
|
-
|
|
255
|
-
if (!done && is)
|
|
256
|
-
callback(searchCursor);
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
this.findNext = function() {
|
|
260
|
-
this.find(true, false);
|
|
261
|
-
};
|
|
262
|
-
|
|
263
|
-
this.findPrev = function() {
|
|
264
|
-
this.find(true, true);
|
|
265
|
-
};
|
|
266
|
-
|
|
267
|
-
this.findAll = function(){
|
|
268
|
-
/*
|
|
269
|
-
var range = this.editor.findAll(this.searchInput.value, {
|
|
270
|
-
regExp: this.regExpOption.checked,
|
|
271
|
-
caseSensitive: this.caseSensitiveOption.checked,
|
|
272
|
-
wholeWord: this.wholeWordOption.checked
|
|
273
|
-
});
|
|
274
|
-
*/
|
|
275
|
-
|
|
276
|
-
var value = this.searchInput.value,
|
|
277
|
-
range,
|
|
278
|
-
noMatch = !range && this.searchInput.value;
|
|
279
|
-
|
|
280
|
-
setCssClass(this.searchBox, 'ace_nomatch', noMatch);
|
|
281
|
-
|
|
282
|
-
if (cm.showMatchesOnScrollbar)
|
|
283
|
-
cm.showMatchesOnScrollbar(value);
|
|
284
|
-
|
|
285
|
-
this.hide();
|
|
286
|
-
};
|
|
287
|
-
|
|
288
|
-
this.replace = function() {
|
|
289
|
-
var readOnly = cm.getOption('readOnly'),
|
|
290
|
-
isSelection = !!cm.getSelection();
|
|
291
|
-
|
|
292
|
-
if (!readOnly && isSelection)
|
|
293
|
-
cm.replaceSelection(this.replaceInput.value, 'start');
|
|
294
|
-
};
|
|
295
|
-
|
|
296
|
-
this.replaceAndFindNext = function() {
|
|
297
|
-
var readOnly = cm.getOption('readOnly');
|
|
298
|
-
|
|
299
|
-
if (!readOnly) {
|
|
300
|
-
this.replace();
|
|
301
|
-
this.findNext();
|
|
302
|
-
}
|
|
303
|
-
};
|
|
304
|
-
|
|
305
|
-
this.replaceAll = function() {
|
|
306
|
-
var value,
|
|
307
|
-
cursor,
|
|
308
|
-
from = this.searchInput.value,
|
|
309
|
-
to = this.replaceInput.value,
|
|
310
|
-
reg = RegExp(from, 'g');
|
|
311
|
-
|
|
312
|
-
if (!cm.getOption('readOnly')) {
|
|
313
|
-
cursor = cm.getCursor();
|
|
314
|
-
value = cm.getValue();
|
|
315
|
-
value = value.replace(reg, to);
|
|
316
|
-
|
|
317
|
-
cm.setValue(value);
|
|
318
|
-
cm.setCursor(cursor);
|
|
319
|
-
}
|
|
320
|
-
};
|
|
321
|
-
|
|
322
|
-
this.hide = function() {
|
|
323
|
-
this.element.style.display = 'none';
|
|
324
|
-
cm.focus();
|
|
325
|
-
};
|
|
326
|
-
|
|
327
|
-
this.isVisible = function() {
|
|
328
|
-
var is = this.element.style.display === '';
|
|
329
|
-
|
|
330
|
-
return is;
|
|
331
|
-
};
|
|
332
|
-
|
|
333
|
-
this.show = function(value, isReplace) {
|
|
334
|
-
this.element.style.display = '';
|
|
335
|
-
this.replaceBox.style.display = isReplace ? '' : 'none';
|
|
336
|
-
|
|
337
|
-
this.isReplace = isReplace;
|
|
338
|
-
|
|
339
|
-
if (value)
|
|
340
|
-
this.searchInput.value = value;
|
|
341
|
-
|
|
342
|
-
this.searchInput.focus();
|
|
343
|
-
this.searchInput.select();
|
|
344
|
-
};
|
|
345
|
-
|
|
346
|
-
this.isFocused = function() {
|
|
347
|
-
var el = document.activeElement;
|
|
348
|
-
return el === this.searchInput || el === this.replaceInput;
|
|
349
|
-
};
|
|
350
|
-
|
|
351
|
-
function addStyle() {
|
|
352
|
-
var style = document.createElement('style'),
|
|
353
|
-
css = [
|
|
354
|
-
'.ace_search {',
|
|
355
|
-
'background-color: #ddd;',
|
|
356
|
-
'border: 1px solid #cbcbcb;',
|
|
357
|
-
'border-top: 0 none;',
|
|
358
|
-
'max-width: 325px;',
|
|
359
|
-
'overflow: hidden;',
|
|
360
|
-
'margin: 0;',
|
|
361
|
-
'padding: 4px;',
|
|
362
|
-
'padding-right: 6px;',
|
|
363
|
-
'padding-bottom: 0;',
|
|
364
|
-
'position: absolute;',
|
|
365
|
-
'top: 0px;',
|
|
366
|
-
'z-index: 99;',
|
|
367
|
-
'white-space: normal;',
|
|
368
|
-
'}',
|
|
369
|
-
'.ace_search.left {',
|
|
370
|
-
'border-left: 0 none;',
|
|
371
|
-
'border-radius: 0px 0px 5px 0px;',
|
|
372
|
-
'left: 0;',
|
|
373
|
-
'}',
|
|
374
|
-
'.ace_search.right {',
|
|
375
|
-
'border-radius: 0px 0px 0px 5px;',
|
|
376
|
-
'border-right: 0 none;',
|
|
377
|
-
'right: 0;',
|
|
378
|
-
'}',
|
|
379
|
-
'.ace_search_form, .ace_replace_form {',
|
|
380
|
-
'border-radius: 3px;',
|
|
381
|
-
'border: 1px solid #cbcbcb;',
|
|
382
|
-
'float: left;',
|
|
383
|
-
'margin-bottom: 4px;',
|
|
384
|
-
'overflow: hidden;',
|
|
385
|
-
'}',
|
|
386
|
-
'.ace_search_form.ace_nomatch {',
|
|
387
|
-
'outline: 1px solid red;',
|
|
388
|
-
'}',
|
|
389
|
-
'.ace_search_field {',
|
|
390
|
-
'background-color: white;',
|
|
391
|
-
'border-right: 1px solid #cbcbcb;',
|
|
392
|
-
'border: 0 none;',
|
|
393
|
-
'-webkit-box-sizing: border-box;',
|
|
394
|
-
'-moz-box-sizing: border-box;',
|
|
395
|
-
'box-sizing: border-box;',
|
|
396
|
-
'float: left;',
|
|
397
|
-
'height: 22px;',
|
|
398
|
-
'outline: 0;',
|
|
399
|
-
'padding: 0 7px;',
|
|
400
|
-
'width: 214px;',
|
|
401
|
-
'margin: 0;',
|
|
402
|
-
'}',
|
|
403
|
-
'.ace_searchbtn,',
|
|
404
|
-
'.ace_replacebtn {',
|
|
405
|
-
'background: #fff;',
|
|
406
|
-
'border: 0 none;',
|
|
407
|
-
'border-left: 1px solid #dcdcdc;',
|
|
408
|
-
'cursor: pointer;',
|
|
409
|
-
'float: left;',
|
|
410
|
-
'height: 22px;',
|
|
411
|
-
'margin: 0;',
|
|
412
|
-
'padding: 0;',
|
|
413
|
-
'position: relative;',
|
|
414
|
-
'}',
|
|
415
|
-
'.ace_searchbtn:last-child,',
|
|
416
|
-
'.ace_replacebtn:last-child {',
|
|
417
|
-
'border-top-right-radius: 3px;',
|
|
418
|
-
'border-bottom-right-radius: 3px;',
|
|
419
|
-
'}',
|
|
420
|
-
'.ace_searchbtn:disabled {',
|
|
421
|
-
'background: none;',
|
|
422
|
-
'cursor: default;',
|
|
423
|
-
'}',
|
|
424
|
-
'.ace_searchbtn {',
|
|
425
|
-
'background-position: 50% 50%;',
|
|
426
|
-
'background-repeat: no-repeat;',
|
|
427
|
-
'width: 27px;',
|
|
428
|
-
'}',
|
|
429
|
-
'.ace_searchbtn.prev {',
|
|
430
|
-
'background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAFCAYAAAB4ka1VAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAADFJREFUeNpiSU1NZUAC/6E0I0yACYskCpsJiySKIiY0SUZk40FyTEgCjGgKwTRAgAEAQJUIPCE+qfkAAAAASUVORK5CYII=); ',
|
|
431
|
-
'}',
|
|
432
|
-
'.ace_searchbtn.next {',
|
|
433
|
-
'background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAFCAYAAAB4ka1VAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAADRJREFUeNpiTE1NZQCC/0DMyIAKwGJMUAYDEo3M/s+EpvM/mkKwCQxYjIeLMaELoLMBAgwAU7UJObTKsvAAAAAASUVORK5CYII=); ',
|
|
434
|
-
'}',
|
|
435
|
-
'.ace_searchbtn_close {',
|
|
436
|
-
'background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAcCAYAAABRVo5BAAAAZ0lEQVR42u2SUQrAMAhDvazn8OjZBilCkYVVxiis8H4CT0VrAJb4WHT3C5xU2a2IQZXJjiQIRMdkEoJ5Q2yMqpfDIo+XY4k6h+YXOyKqTIj5REaxloNAd0xiKmAtsTHqW8sR2W5f7gCu5nWFUpVjZwAAAABJRU5ErkJggg==) no-repeat 50% 0;',
|
|
437
|
-
'border-radius: 50%;',
|
|
438
|
-
'border: 0 none;',
|
|
439
|
-
'color: #656565;',
|
|
440
|
-
'cursor: pointer;',
|
|
441
|
-
'float: right;',
|
|
442
|
-
'font: 16px/16px Arial;',
|
|
443
|
-
'height: 14px;',
|
|
444
|
-
'margin: 5px 1px 9px 5px;',
|
|
445
|
-
'padding: 0;',
|
|
446
|
-
'text-align: center;',
|
|
447
|
-
'width: 14px;',
|
|
448
|
-
'}',
|
|
449
|
-
'.ace_searchbtn_close:hover {',
|
|
450
|
-
'background-color: #656565;',
|
|
451
|
-
'background-position: 50% 100%;',
|
|
452
|
-
'color: white;',
|
|
453
|
-
'}',
|
|
454
|
-
'.ace_replacebtn.prev {',
|
|
455
|
-
'width: 54px',
|
|
456
|
-
'}',
|
|
457
|
-
'.ace_replacebtn.next {',
|
|
458
|
-
'width: 27px',
|
|
459
|
-
'}',
|
|
460
|
-
'.ace_button {',
|
|
461
|
-
'margin-left: 2px;',
|
|
462
|
-
'cursor: pointer;',
|
|
463
|
-
'-webkit-user-select: none;',
|
|
464
|
-
'-moz-user-select: none;',
|
|
465
|
-
'-o-user-select: none;',
|
|
466
|
-
'-ms-user-select: none;',
|
|
467
|
-
'user-select: none;',
|
|
468
|
-
'overflow: hidden;',
|
|
469
|
-
'opacity: 0.7;',
|
|
470
|
-
'border: 1px solid rgba(100,100,100,0.23);',
|
|
471
|
-
'padding: 1px;',
|
|
472
|
-
'-moz-box-sizing: border-box;',
|
|
473
|
-
'box-sizing: border-box;',
|
|
474
|
-
'color: black;',
|
|
475
|
-
'}',
|
|
476
|
-
'.ace_button:hover {',
|
|
477
|
-
'background-color: #eee;',
|
|
478
|
-
'opacity:1;',
|
|
479
|
-
'}',
|
|
480
|
-
'.ace_button:active {',
|
|
481
|
-
'background-color: #ddd;',
|
|
482
|
-
'}',
|
|
483
|
-
'.ace_button.checked {',
|
|
484
|
-
'border-color: #3399ff;',
|
|
485
|
-
'opacity:1;',
|
|
486
|
-
'}',
|
|
487
|
-
'.ace_search_options{',
|
|
488
|
-
'margin-bottom: 3px;',
|
|
489
|
-
'text-align: right;',
|
|
490
|
-
'-webkit-user-select: none;',
|
|
491
|
-
'-moz-user-select: none;',
|
|
492
|
-
'-o-user-select: none;',
|
|
493
|
-
'-ms-user-select: none;',
|
|
494
|
-
'user-select: none;',
|
|
495
|
-
'}'
|
|
496
|
-
].join('');
|
|
497
|
-
|
|
498
|
-
style.setAttribute('data-name', 'js-searchbox');
|
|
499
|
-
|
|
500
|
-
style.textContent = css;
|
|
501
|
-
|
|
502
|
-
document.head.appendChild(style);
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
function addHtml() {
|
|
506
|
-
var elSearch,
|
|
507
|
-
el = document.querySelector('.CodeMirror'),
|
|
508
|
-
div = document.createElement('div'),
|
|
509
|
-
html = [
|
|
510
|
-
'<div class="ace_search right">',
|
|
511
|
-
'<button type="button" action="hide" class="ace_searchbtn_close"></button>',
|
|
512
|
-
'<div class="ace_search_form">',
|
|
513
|
-
'<input class="ace_search_field" placeholder="Search for" spellcheck="false"></input>',
|
|
514
|
-
'<button type="button" action="findNext" class="ace_searchbtn next"></button>',
|
|
515
|
-
'<button type="button" action="findPrev" class="ace_searchbtn prev"></button>',
|
|
516
|
-
'<button type="button" action="findAll" class="ace_searchbtn" title="Alt-Enter">All</button>',
|
|
517
|
-
'</div>',
|
|
518
|
-
'<div class="ace_replace_form">',
|
|
519
|
-
'<input class="ace_search_field" placeholder="Replace with" spellcheck="false"></input>',
|
|
520
|
-
'<button type="button" action="replaceAndFindNext" class="ace_replacebtn">Replace</button>',
|
|
521
|
-
'<button type="button" action="replaceAll" class="ace_replacebtn">All</button>',
|
|
522
|
-
'</div>',
|
|
523
|
-
'<div class="ace_search_options">',
|
|
524
|
-
'<span action="toggleRegexpMode" class="ace_button" title="RegExp Search">.*</span>',
|
|
525
|
-
'<span action="toggleCaseSensitive" class="ace_button" title="CaseSensitive Search">Aa</span>',
|
|
526
|
-
'<span action="toggleWholeWords" class="ace_button" title="Whole Word Search">\\b</span>',
|
|
527
|
-
'</div>',
|
|
528
|
-
'</div>'
|
|
529
|
-
].join('');
|
|
530
|
-
|
|
531
|
-
div.innerHTML = html;
|
|
532
|
-
|
|
533
|
-
elSearch = div.firstChild;
|
|
534
|
-
|
|
535
|
-
el.parentElement.appendChild(elSearch);
|
|
536
|
-
|
|
537
|
-
return elSearch;
|
|
538
|
-
}
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
function setCssClass(el, className, condition) {
|
|
542
|
-
var list = el.classList;
|
|
543
|
-
|
|
544
|
-
list[condition ? 'add' : 'remove'](className);
|
|
545
|
-
}
|
|
546
|
-
|
|
547
|
-
function delayedCall(fcn, defaultTimeout) {
|
|
548
|
-
var timer,
|
|
549
|
-
callback = function() {
|
|
550
|
-
timer = null;
|
|
551
|
-
fcn();
|
|
552
|
-
},
|
|
553
|
-
|
|
554
|
-
_self = function(timeout) {
|
|
555
|
-
if (!timer)
|
|
556
|
-
timer = setTimeout(callback, timeout || defaultTimeout);
|
|
557
|
-
};
|
|
558
|
-
|
|
559
|
-
_self.delay = function(timeout) {
|
|
560
|
-
timer && clearTimeout(timer);
|
|
561
|
-
timer = setTimeout(callback, timeout || defaultTimeout);
|
|
562
|
-
};
|
|
563
|
-
_self.schedule = _self;
|
|
564
|
-
|
|
565
|
-
_self.call = function() {
|
|
566
|
-
this.cancel();
|
|
567
|
-
fcn();
|
|
568
|
-
};
|
|
569
|
-
|
|
570
|
-
_self.cancel = function() {
|
|
571
|
-
timer && clearTimeout(timer);
|
|
572
|
-
timer = null;
|
|
573
|
-
};
|
|
574
|
-
|
|
575
|
-
_self.isPending = function() {
|
|
576
|
-
return timer;
|
|
577
|
-
};
|
|
578
|
-
|
|
579
|
-
return _self;
|
|
580
|
-
}
|
|
581
|
-
|
|
582
|
-
/* https://github.com/coderaiser/key */
|
|
583
|
-
function key(str, event) {
|
|
584
|
-
var right,
|
|
585
|
-
KEY = {
|
|
586
|
-
BACKSPACE : 8,
|
|
587
|
-
TAB : 9,
|
|
588
|
-
ENTER : 13,
|
|
589
|
-
ESC : 27,
|
|
590
|
-
|
|
591
|
-
SPACE : 32,
|
|
592
|
-
PAGE_UP : 33,
|
|
593
|
-
PAGE_DOWN : 34,
|
|
594
|
-
END : 35,
|
|
595
|
-
HOME : 36,
|
|
596
|
-
UP : 38,
|
|
597
|
-
DOWN : 40,
|
|
598
|
-
|
|
599
|
-
INSERT : 45,
|
|
600
|
-
DELETE : 46,
|
|
601
|
-
|
|
602
|
-
INSERT_MAC : 96,
|
|
603
|
-
|
|
604
|
-
ASTERISK : 106,
|
|
605
|
-
PLUS : 107,
|
|
606
|
-
MINUS : 109,
|
|
607
|
-
|
|
608
|
-
F1 : 112,
|
|
609
|
-
F2 : 113,
|
|
610
|
-
F3 : 114,
|
|
611
|
-
F4 : 115,
|
|
612
|
-
F5 : 116,
|
|
613
|
-
F6 : 117,
|
|
614
|
-
F7 : 118,
|
|
615
|
-
F8 : 119,
|
|
616
|
-
F9 : 120,
|
|
617
|
-
F10 : 121,
|
|
618
|
-
|
|
619
|
-
SLASH : 191,
|
|
620
|
-
TRA : 192, /* Typewritten Reverse Apostrophe (`) */
|
|
621
|
-
BACKSLASH : 220
|
|
622
|
-
};
|
|
623
|
-
|
|
624
|
-
keyCheck(str, event);
|
|
625
|
-
|
|
626
|
-
right = str.split('|').some(function(combination) {
|
|
627
|
-
var wrong;
|
|
628
|
-
|
|
629
|
-
wrong = combination.split('-').some(function(key) {
|
|
630
|
-
var right;
|
|
631
|
-
|
|
632
|
-
switch(key) {
|
|
633
|
-
case 'Ctrl':
|
|
634
|
-
right = event.ctrlKey;
|
|
635
|
-
break;
|
|
636
|
-
|
|
637
|
-
case 'Shift':
|
|
638
|
-
right = event.shiftKey;
|
|
639
|
-
break;
|
|
640
|
-
|
|
641
|
-
case 'Alt':
|
|
642
|
-
right = event.altKey;
|
|
643
|
-
break;
|
|
644
|
-
|
|
645
|
-
case 'Cmd':
|
|
646
|
-
right = event.metaKey;
|
|
647
|
-
break;
|
|
648
|
-
|
|
649
|
-
default:
|
|
650
|
-
if (key.length === 1)
|
|
651
|
-
right = event.keyCode === key.charCodeAt(0);
|
|
652
|
-
else
|
|
653
|
-
Object.keys(KEY).some(function(name) {
|
|
654
|
-
var up = key.toUpperCase();
|
|
655
|
-
|
|
656
|
-
if (up === name)
|
|
657
|
-
right = event.keyCode === KEY[name];
|
|
658
|
-
});
|
|
659
|
-
break;
|
|
660
|
-
}
|
|
661
|
-
|
|
662
|
-
return !right;
|
|
663
|
-
});
|
|
664
|
-
|
|
665
|
-
return !wrong;
|
|
666
|
-
});
|
|
667
|
-
|
|
668
|
-
return right;
|
|
669
|
-
}
|
|
670
|
-
|
|
671
|
-
function keyCheck(str, event) {
|
|
672
|
-
if (typeof str !== 'string')
|
|
673
|
-
throw(Error('str should be string!'));
|
|
674
|
-
|
|
675
|
-
if (typeof event !== 'object')
|
|
676
|
-
throw(Error('event should be object!'));
|
|
677
|
-
}
|
|
678
|
-
|
|
679
|
-
});
|