corrade-nucleus-nucleons – Blame information for rev 20
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
20 | office | 1 | define("ace/ext/searchbox",["require","exports","module","ace/lib/dom","ace/lib/lang","ace/lib/event","ace/keyboard/hash_handler","ace/lib/keys"], function(require, exports, module) { |
2 | "use strict"; |
||
3 | |||
4 | var dom = require("../lib/dom"); |
||
5 | var lang = require("../lib/lang"); |
||
6 | var event = require("../lib/event"); |
||
7 | var searchboxCss = "\ |
||
8 | .ace_search {\ |
||
9 | background-color: #ddd;\ |
||
10 | border: 1px solid #cbcbcb;\ |
||
11 | border-top: 0 none;\ |
||
12 | max-width: 325px;\ |
||
13 | overflow: hidden;\ |
||
14 | margin: 0;\ |
||
15 | padding: 4px;\ |
||
16 | padding-right: 6px;\ |
||
17 | padding-bottom: 0;\ |
||
18 | position: absolute;\ |
||
19 | top: 0px;\ |
||
20 | z-index: 99;\ |
||
21 | white-space: normal;\ |
||
22 | }\ |
||
23 | .ace_search.left {\ |
||
24 | border-left: 0 none;\ |
||
25 | border-radius: 0px 0px 5px 0px;\ |
||
26 | left: 0;\ |
||
27 | }\ |
||
28 | .ace_search.right {\ |
||
29 | border-radius: 0px 0px 0px 5px;\ |
||
30 | border-right: 0 none;\ |
||
31 | right: 0;\ |
||
32 | }\ |
||
33 | .ace_search_form, .ace_replace_form {\ |
||
34 | border-radius: 3px;\ |
||
35 | border: 1px solid #cbcbcb;\ |
||
36 | float: left;\ |
||
37 | margin-bottom: 4px;\ |
||
38 | overflow: hidden;\ |
||
39 | }\ |
||
40 | .ace_search_form.ace_nomatch {\ |
||
41 | outline: 1px solid red;\ |
||
42 | }\ |
||
43 | .ace_search_field {\ |
||
44 | background-color: white;\ |
||
45 | color: black;\ |
||
46 | border-right: 1px solid #cbcbcb;\ |
||
47 | border: 0 none;\ |
||
48 | -webkit-box-sizing: border-box;\ |
||
49 | -moz-box-sizing: border-box;\ |
||
50 | box-sizing: border-box;\ |
||
51 | float: left;\ |
||
52 | height: 22px;\ |
||
53 | outline: 0;\ |
||
54 | padding: 0 7px;\ |
||
55 | width: 214px;\ |
||
56 | margin: 0;\ |
||
57 | }\ |
||
58 | .ace_searchbtn,\ |
||
59 | .ace_replacebtn {\ |
||
60 | background: #fff;\ |
||
61 | border: 0 none;\ |
||
62 | border-left: 1px solid #dcdcdc;\ |
||
63 | cursor: pointer;\ |
||
64 | float: left;\ |
||
65 | height: 22px;\ |
||
66 | margin: 0;\ |
||
67 | position: relative;\ |
||
68 | }\ |
||
69 | .ace_searchbtn:last-child,\ |
||
70 | .ace_replacebtn:last-child {\ |
||
71 | border-top-right-radius: 3px;\ |
||
72 | border-bottom-right-radius: 3px;\ |
||
73 | }\ |
||
74 | .ace_searchbtn:disabled {\ |
||
75 | background: none;\ |
||
76 | cursor: default;\ |
||
77 | }\ |
||
78 | .ace_searchbtn {\ |
||
79 | background-position: 50% 50%;\ |
||
80 | background-repeat: no-repeat;\ |
||
81 | width: 27px;\ |
||
82 | }\ |
||
83 | .ace_searchbtn.prev {\ |
||
84 | background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAFCAYAAAB4ka1VAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAADFJREFUeNpiSU1NZUAC/6E0I0yACYskCpsJiySKIiY0SUZk40FyTEgCjGgKwTRAgAEAQJUIPCE+qfkAAAAASUVORK5CYII=); \ |
||
85 | }\ |
||
86 | .ace_searchbtn.next {\ |
||
87 | background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAFCAYAAAB4ka1VAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAADRJREFUeNpiTE1NZQCC/0DMyIAKwGJMUAYDEo3M/s+EpvM/mkKwCQxYjIeLMaELoLMBAgwAU7UJObTKsvAAAAAASUVORK5CYII=); \ |
||
88 | }\ |
||
89 | .ace_searchbtn_close {\ |
||
90 | background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAcCAYAAABRVo5BAAAAZ0lEQVR42u2SUQrAMAhDvazn8OjZBilCkYVVxiis8H4CT0VrAJb4WHT3C5xU2a2IQZXJjiQIRMdkEoJ5Q2yMqpfDIo+XY4k6h+YXOyKqTIj5REaxloNAd0xiKmAtsTHqW8sR2W5f7gCu5nWFUpVjZwAAAABJRU5ErkJggg==) no-repeat 50% 0;\ |
||
91 | border-radius: 50%;\ |
||
92 | border: 0 none;\ |
||
93 | color: #656565;\ |
||
94 | cursor: pointer;\ |
||
95 | float: right;\ |
||
96 | font: 16px/16px Arial;\ |
||
97 | height: 14px;\ |
||
98 | margin: 5px 1px 9px 5px;\ |
||
99 | padding: 0;\ |
||
100 | text-align: center;\ |
||
101 | width: 14px;\ |
||
102 | }\ |
||
103 | .ace_searchbtn_close:hover {\ |
||
104 | background-color: #656565;\ |
||
105 | background-position: 50% 100%;\ |
||
106 | color: white;\ |
||
107 | }\ |
||
108 | .ace_replacebtn.prev {\ |
||
109 | width: 54px\ |
||
110 | }\ |
||
111 | .ace_replacebtn.next {\ |
||
112 | width: 27px\ |
||
113 | }\ |
||
114 | .ace_button {\ |
||
115 | margin-left: 2px;\ |
||
116 | cursor: pointer;\ |
||
117 | -webkit-user-select: none;\ |
||
118 | -moz-user-select: none;\ |
||
119 | -o-user-select: none;\ |
||
120 | -ms-user-select: none;\ |
||
121 | user-select: none;\ |
||
122 | overflow: hidden;\ |
||
123 | opacity: 0.7;\ |
||
124 | border: 1px solid rgba(100,100,100,0.23);\ |
||
125 | padding: 1px;\ |
||
126 | -moz-box-sizing: border-box;\ |
||
127 | box-sizing: border-box;\ |
||
128 | color: black;\ |
||
129 | }\ |
||
130 | .ace_button:hover {\ |
||
131 | background-color: #eee;\ |
||
132 | opacity:1;\ |
||
133 | }\ |
||
134 | .ace_button:active {\ |
||
135 | background-color: #ddd;\ |
||
136 | }\ |
||
137 | .ace_button.checked {\ |
||
138 | border-color: #3399ff;\ |
||
139 | opacity:1;\ |
||
140 | }\ |
||
141 | .ace_search_options{\ |
||
142 | margin-bottom: 3px;\ |
||
143 | text-align: right;\ |
||
144 | -webkit-user-select: none;\ |
||
145 | -moz-user-select: none;\ |
||
146 | -o-user-select: none;\ |
||
147 | -ms-user-select: none;\ |
||
148 | user-select: none;\ |
||
149 | }"; |
||
150 | var HashHandler = require("../keyboard/hash_handler").HashHandler; |
||
151 | var keyUtil = require("../lib/keys"); |
||
152 | |||
153 | dom.importCssString(searchboxCss, "ace_searchbox"); |
||
154 | |||
155 | var html = '<div class="ace_search right">\ |
||
156 | <button type="button" action="hide" class="ace_searchbtn_close"></button>\ |
||
157 | <div class="ace_search_form">\ |
||
158 | <input class="ace_search_field" placeholder="Search for" spellcheck="false"></input>\ |
||
159 | <button type="button" action="findNext" class="ace_searchbtn next"></button>\ |
||
160 | <button type="button" action="findPrev" class="ace_searchbtn prev"></button>\ |
||
161 | <button type="button" action="findAll" class="ace_searchbtn" title="Alt-Enter">All</button>\ |
||
162 | </div>\ |
||
163 | <div class="ace_replace_form">\ |
||
164 | <input class="ace_search_field" placeholder="Replace with" spellcheck="false"></input>\ |
||
165 | <button type="button" action="replaceAndFindNext" class="ace_replacebtn">Replace</button>\ |
||
166 | <button type="button" action="replaceAll" class="ace_replacebtn">All</button>\ |
||
167 | </div>\ |
||
168 | <div class="ace_search_options">\ |
||
169 | <span action="toggleRegexpMode" class="ace_button" title="RegExp Search">.*</span>\ |
||
170 | <span action="toggleCaseSensitive" class="ace_button" title="CaseSensitive Search">Aa</span>\ |
||
171 | <span action="toggleWholeWords" class="ace_button" title="Whole Word Search">\\b</span>\ |
||
172 | </div>\ |
||
173 | </div>'.replace(/>\s+/g, ">"); |
||
174 | |||
175 | var SearchBox = function(editor, range, showReplaceForm) { |
||
176 | var div = dom.createElement("div"); |
||
177 | div.innerHTML = html; |
||
178 | this.element = div.firstChild; |
||
179 | |||
180 | this.$init(); |
||
181 | this.setEditor(editor); |
||
182 | }; |
||
183 | |||
184 | (function() { |
||
185 | this.setEditor = function(editor) { |
||
186 | editor.searchBox = this; |
||
187 | editor.container.appendChild(this.element); |
||
188 | this.editor = editor; |
||
189 | }; |
||
190 | |||
191 | this.$initElements = function(sb) { |
||
192 | this.searchBox = sb.querySelector(".ace_search_form"); |
||
193 | this.replaceBox = sb.querySelector(".ace_replace_form"); |
||
194 | this.searchOptions = sb.querySelector(".ace_search_options"); |
||
195 | this.regExpOption = sb.querySelector("[action=toggleRegexpMode]"); |
||
196 | this.caseSensitiveOption = sb.querySelector("[action=toggleCaseSensitive]"); |
||
197 | this.wholeWordOption = sb.querySelector("[action=toggleWholeWords]"); |
||
198 | this.searchInput = this.searchBox.querySelector(".ace_search_field"); |
||
199 | this.replaceInput = this.replaceBox.querySelector(".ace_search_field"); |
||
200 | }; |
||
201 | |||
202 | this.$init = function() { |
||
203 | var sb = this.element; |
||
204 | |||
205 | this.$initElements(sb); |
||
206 | |||
207 | var _this = this; |
||
208 | event.addListener(sb, "mousedown", function(e) { |
||
209 | setTimeout(function(){ |
||
210 | _this.activeInput.focus(); |
||
211 | }, 0); |
||
212 | event.stopPropagation(e); |
||
213 | }); |
||
214 | event.addListener(sb, "click", function(e) { |
||
215 | var t = e.target || e.srcElement; |
||
216 | var action = t.getAttribute("action"); |
||
217 | if (action && _this[action]) |
||
218 | _this[action](); |
||
219 | else if (_this.$searchBarKb.commands[action]) |
||
220 | _this.$searchBarKb.commands[action].exec(_this); |
||
221 | event.stopPropagation(e); |
||
222 | }); |
||
223 | |||
224 | event.addCommandKeyListener(sb, function(e, hashId, keyCode) { |
||
225 | var keyString = keyUtil.keyCodeToString(keyCode); |
||
226 | var command = _this.$searchBarKb.findKeyCommand(hashId, keyString); |
||
227 | if (command && command.exec) { |
||
228 | command.exec(_this); |
||
229 | event.stopEvent(e); |
||
230 | } |
||
231 | }); |
||
232 | |||
233 | this.$onChange = lang.delayedCall(function() { |
||
234 | _this.find(false, false); |
||
235 | }); |
||
236 | |||
237 | event.addListener(this.searchInput, "input", function() { |
||
238 | _this.$onChange.schedule(20); |
||
239 | }); |
||
240 | event.addListener(this.searchInput, "focus", function() { |
||
241 | _this.activeInput = _this.searchInput; |
||
242 | _this.searchInput.value && _this.highlight(); |
||
243 | }); |
||
244 | event.addListener(this.replaceInput, "focus", function() { |
||
245 | _this.activeInput = _this.replaceInput; |
||
246 | _this.searchInput.value && _this.highlight(); |
||
247 | }); |
||
248 | }; |
||
249 | this.$closeSearchBarKb = new HashHandler([{ |
||
250 | bindKey: "Esc", |
||
251 | name: "closeSearchBar", |
||
252 | exec: function(editor) { |
||
253 | editor.searchBox.hide(); |
||
254 | } |
||
255 | }]); |
||
256 | this.$searchBarKb = new HashHandler(); |
||
257 | this.$searchBarKb.bindKeys({ |
||
258 | "Ctrl-f|Command-f": function(sb) { |
||
259 | var isReplace = sb.isReplace = !sb.isReplace; |
||
260 | sb.replaceBox.style.display = isReplace ? "" : "none"; |
||
261 | sb.searchInput.focus(); |
||
262 | }, |
||
263 | "Ctrl-H|Command-Option-F": function(sb) { |
||
264 | sb.replaceBox.style.display = ""; |
||
265 | sb.replaceInput.focus(); |
||
266 | }, |
||
267 | "Ctrl-G|Command-G": function(sb) { |
||
268 | sb.findNext(); |
||
269 | }, |
||
270 | "Ctrl-Shift-G|Command-Shift-G": function(sb) { |
||
271 | sb.findPrev(); |
||
272 | }, |
||
273 | "esc": function(sb) { |
||
274 | setTimeout(function() { sb.hide();}); |
||
275 | }, |
||
276 | "Return": function(sb) { |
||
277 | if (sb.activeInput == sb.replaceInput) |
||
278 | sb.replace(); |
||
279 | sb.findNext(); |
||
280 | }, |
||
281 | "Shift-Return": function(sb) { |
||
282 | if (sb.activeInput == sb.replaceInput) |
||
283 | sb.replace(); |
||
284 | sb.findPrev(); |
||
285 | }, |
||
286 | "Alt-Return": function(sb) { |
||
287 | if (sb.activeInput == sb.replaceInput) |
||
288 | sb.replaceAll(); |
||
289 | sb.findAll(); |
||
290 | }, |
||
291 | "Tab": function(sb) { |
||
292 | (sb.activeInput == sb.replaceInput ? sb.searchInput : sb.replaceInput).focus(); |
||
293 | } |
||
294 | }); |
||
295 | |||
296 | this.$searchBarKb.addCommands([{ |
||
297 | name: "toggleRegexpMode", |
||
298 | bindKey: {win: "Alt-R|Alt-/", mac: "Ctrl-Alt-R|Ctrl-Alt-/"}, |
||
299 | exec: function(sb) { |
||
300 | sb.regExpOption.checked = !sb.regExpOption.checked; |
||
301 | sb.$syncOptions(); |
||
302 | } |
||
303 | }, { |
||
304 | name: "toggleCaseSensitive", |
||
305 | bindKey: {win: "Alt-C|Alt-I", mac: "Ctrl-Alt-R|Ctrl-Alt-I"}, |
||
306 | exec: function(sb) { |
||
307 | sb.caseSensitiveOption.checked = !sb.caseSensitiveOption.checked; |
||
308 | sb.$syncOptions(); |
||
309 | } |
||
310 | }, { |
||
311 | name: "toggleWholeWords", |
||
312 | bindKey: {win: "Alt-B|Alt-W", mac: "Ctrl-Alt-B|Ctrl-Alt-W"}, |
||
313 | exec: function(sb) { |
||
314 | sb.wholeWordOption.checked = !sb.wholeWordOption.checked; |
||
315 | sb.$syncOptions(); |
||
316 | } |
||
317 | }]); |
||
318 | |||
319 | this.$syncOptions = function() { |
||
320 | dom.setCssClass(this.regExpOption, "checked", this.regExpOption.checked); |
||
321 | dom.setCssClass(this.wholeWordOption, "checked", this.wholeWordOption.checked); |
||
322 | dom.setCssClass(this.caseSensitiveOption, "checked", this.caseSensitiveOption.checked); |
||
323 | this.find(false, false); |
||
324 | }; |
||
325 | |||
326 | this.highlight = function(re) { |
||
327 | this.editor.session.highlight(re || this.editor.$search.$options.re); |
||
328 | this.editor.renderer.updateBackMarkers() |
||
329 | }; |
||
330 | this.find = function(skipCurrent, backwards, preventScroll) { |
||
331 | var range = this.editor.find(this.searchInput.value, { |
||
332 | skipCurrent: skipCurrent, |
||
333 | backwards: backwards, |
||
334 | wrap: true, |
||
335 | regExp: this.regExpOption.checked, |
||
336 | caseSensitive: this.caseSensitiveOption.checked, |
||
337 | wholeWord: this.wholeWordOption.checked, |
||
338 | preventScroll: preventScroll |
||
339 | }); |
||
340 | var noMatch = !range && this.searchInput.value; |
||
341 | dom.setCssClass(this.searchBox, "ace_nomatch", noMatch); |
||
342 | this.editor._emit("findSearchBox", { match: !noMatch }); |
||
343 | this.highlight(); |
||
344 | }; |
||
345 | this.findNext = function() { |
||
346 | this.find(true, false); |
||
347 | }; |
||
348 | this.findPrev = function() { |
||
349 | this.find(true, true); |
||
350 | }; |
||
351 | this.findAll = function(){ |
||
352 | var range = this.editor.findAll(this.searchInput.value, { |
||
353 | regExp: this.regExpOption.checked, |
||
354 | caseSensitive: this.caseSensitiveOption.checked, |
||
355 | wholeWord: this.wholeWordOption.checked |
||
356 | }); |
||
357 | var noMatch = !range && this.searchInput.value; |
||
358 | dom.setCssClass(this.searchBox, "ace_nomatch", noMatch); |
||
359 | this.editor._emit("findSearchBox", { match: !noMatch }); |
||
360 | this.highlight(); |
||
361 | this.hide(); |
||
362 | }; |
||
363 | this.replace = function() { |
||
364 | if (!this.editor.getReadOnly()) |
||
365 | this.editor.replace(this.replaceInput.value); |
||
366 | }; |
||
367 | this.replaceAndFindNext = function() { |
||
368 | if (!this.editor.getReadOnly()) { |
||
369 | this.editor.replace(this.replaceInput.value); |
||
370 | this.findNext() |
||
371 | } |
||
372 | }; |
||
373 | this.replaceAll = function() { |
||
374 | if (!this.editor.getReadOnly()) |
||
375 | this.editor.replaceAll(this.replaceInput.value); |
||
376 | }; |
||
377 | |||
378 | this.hide = function() { |
||
379 | this.element.style.display = "none"; |
||
380 | this.editor.keyBinding.removeKeyboardHandler(this.$closeSearchBarKb); |
||
381 | this.editor.focus(); |
||
382 | }; |
||
383 | this.show = function(value, isReplace) { |
||
384 | this.element.style.display = ""; |
||
385 | this.replaceBox.style.display = isReplace ? "" : "none"; |
||
386 | |||
387 | this.isReplace = isReplace; |
||
388 | |||
389 | if (value) |
||
390 | this.searchInput.value = value; |
||
391 | |||
392 | this.find(false, false, true); |
||
393 | |||
394 | this.searchInput.focus(); |
||
395 | this.searchInput.select(); |
||
396 | |||
397 | this.editor.keyBinding.addKeyboardHandler(this.$closeSearchBarKb); |
||
398 | }; |
||
399 | |||
400 | this.isFocused = function() { |
||
401 | var el = document.activeElement; |
||
402 | return el == this.searchInput || el == this.replaceInput; |
||
403 | } |
||
404 | }).call(SearchBox.prototype); |
||
405 | |||
406 | exports.SearchBox = SearchBox; |
||
407 | |||
408 | exports.Search = function(editor, isReplace) { |
||
409 | var sb = editor.searchBox || new SearchBox(editor); |
||
410 | sb.show(editor.session.getTextRange(), isReplace); |
||
411 | }; |
||
412 | |||
413 | }); |
||
414 | |||
415 | define("ace/ext/old_ie",["require","exports","module","ace/lib/useragent","ace/tokenizer","ace/ext/searchbox","ace/mode/text"], function(require, exports, module) { |
||
416 | "use strict"; |
||
417 | var MAX_TOKEN_COUNT = 1000; |
||
418 | var useragent = require("../lib/useragent"); |
||
419 | var TokenizerModule = require("../tokenizer"); |
||
420 | |||
421 | function patch(obj, name, regexp, replacement) { |
||
422 | eval("obj['" + name + "']=" + obj[name].toString().replace( |
||
423 | regexp, replacement |
||
424 | )); |
||
425 | } |
||
426 | |||
427 | if (useragent.isIE && useragent.isIE < 10 && window.top.document.compatMode === "BackCompat") |
||
428 | useragent.isOldIE = true; |
||
429 | |||
430 | if (typeof document != "undefined" && !document.documentElement.querySelector) { |
||
431 | useragent.isOldIE = true; |
||
432 | var qs = function(el, selector) { |
||
433 | if (selector.charAt(0) == ".") { |
||
434 | var classNeme = selector.slice(1); |
||
435 | } else { |
||
436 | var m = selector.match(/(\w+)=(\w+)/); |
||
437 | var attr = m && m[1]; |
||
438 | var attrVal = m && m[2]; |
||
439 | } |
||
440 | for (var i = 0; i < el.all.length; i++) { |
||
441 | var ch = el.all[i]; |
||
442 | if (classNeme) { |
||
443 | if (ch.className.indexOf(classNeme) != -1) |
||
444 | return ch; |
||
445 | } else if (attr) { |
||
446 | if (ch.getAttribute(attr) == attrVal) |
||
447 | return ch; |
||
448 | } |
||
449 | } |
||
450 | }; |
||
451 | var sb = require("./searchbox").SearchBox.prototype; |
||
452 | patch( |
||
453 | sb, "$initElements", |
||
454 | /([^\s=]*).querySelector\((".*?")\)/g, |
||
455 | "qs($1, $2)" |
||
456 | ); |
||
457 | } |
||
458 | |||
459 | var compliantExecNpcg = /()??/.exec("")[1] === undefined; |
||
460 | if (compliantExecNpcg) |
||
461 | return; |
||
462 | var proto = TokenizerModule.Tokenizer.prototype; |
||
463 | TokenizerModule.Tokenizer_orig = TokenizerModule.Tokenizer; |
||
464 | proto.getLineTokens_orig = proto.getLineTokens; |
||
465 | |||
466 | patch( |
||
467 | TokenizerModule, "Tokenizer", |
||
468 | "ruleRegExps.push(adjustedregex);\n", |
||
469 | function(m) { |
||
470 | return m + '\ |
||
471 | if (state[i].next && RegExp(adjustedregex).test(""))\n\ |
||
472 | rule._qre = RegExp(adjustedregex, "g");\n\ |
||
473 | '; |
||
474 | } |
||
475 | ); |
||
476 | TokenizerModule.Tokenizer.prototype = proto; |
||
477 | patch( |
||
478 | proto, "getLineTokens", |
||
479 | /if \(match\[i \+ 1\] === undefined\)\s*continue;/, |
||
480 | "if (!match[i + 1]) {\n\ |
||
481 | if (value)continue;\n\ |
||
482 | var qre = state[mapping[i]]._qre;\n\ |
||
483 | if (!qre) continue;\n\ |
||
484 | qre.lastIndex = lastIndex;\n\ |
||
485 | if (!qre.exec(line) || qre.lastIndex != lastIndex)\n\ |
||
486 | continue;\n\ |
||
487 | }" |
||
488 | ); |
||
489 | |||
490 | patch( |
||
491 | require("../mode/text").Mode.prototype, "getTokenizer", |
||
492 | /Tokenizer/, |
||
493 | "TokenizerModule.Tokenizer" |
||
494 | ); |
||
495 | |||
496 | useragent.isOldIE = true; |
||
497 | |||
498 | }); |
||
499 | (function() { |
||
500 | window.require(["ace/ext/old_ie"], function() {}); |
||
501 | })(); |
||
502 |