差分
このページの2つのバージョン間の差分を表示します。
| 両方とも前のリビジョン 前のリビジョン | |||
| javascript:requirejs [2020/08/30 11:59] – ともやん | javascript:requirejs [2020/08/30 13:05] (現在) – ともやん | ||
|---|---|---|---|
| 行 68: | 行 68: | ||
| } | } | ||
| } | } | ||
| + |  | ||
| + | $.fn.regex = function(pattern, | ||
| + | var fn = $.fn.attr || $.fn.text; | ||
| + | return this.filter(function() { | ||
| + | return pattern.test(fn.apply($(this), | ||
| + | }); | ||
| + | }; | ||
|  |  | ||
| self.editors = []; | self.editors = []; | ||
| 行 74: | 行 81: | ||
| ' | ' | ||
| ]; | ]; | ||
| - | let lines = 0; | + |  | 
| + | function setAceEditorStyle(editor, | ||
| + |  | ||
| + | |||
| + | editor.setTheme(' | ||
| + | editor.session.setOptions({ | ||
| + | mode: ' | ||
| + | tabSize: 2, | ||
| + | useSoftTabs: | ||
| + | }); // setOptions | ||
| + | editor.setValue(editor.getValue().trim(), | ||
| + | |||
| + | lines = editor.getSession().getDocument().getLength(); | ||
| + | editor.setOptions({maxLines: | ||
| + | |||
| + | editor.setReadOnly(true); | ||
| + | } | ||
|  |  | ||
| const $aceEditors = $(' | const $aceEditors = $(' | ||
| 行 83: | 行 106: | ||
| console.log(`mode: | console.log(`mode: | ||
|  |  | ||
| - |  | + |  | 
| - |  | + | |
| - |  | + | |
| - | tabSize: 2, | + | |
| - | useSoftTabs: | + | |
| - | }); // setOptions | + | |
| - | editors[i].setValue(editors[i].getValue().trim(), | + | |
|  |  | ||
| - | lines = editors[i].getSession().getDocument().getLength(); | ||
| - | editors[i].setOptions({maxLines: | ||
| - |  | ||
| - | editors[i].setReadOnly(true); | ||
| $($aceEditors[i]).fadeIn(' | $($aceEditors[i]).fadeIn(' | ||
| } | } | ||
|  |  | ||
| - | const $aceCodes = $(' | + | const $aceCodes = $('div' | 
| - | console.dir($aceCodes); | + | console.log(' | 
| + | console.dir($aceCodes[0]); | ||
| + | for (let i = 0; i < $aceCodes.length; | ||
| + | codes.push(ace.edit($aceCodes[i])); | ||
| + | |||
| + | setAceEditorStyle(codes[i], | ||
| + | } | ||
|  |  | ||
| $.ajax({ | $.ajax({ | ||
| 行 106: | 行 125: | ||
| }).done((data) => { | }).done((data) => { | ||
| editors[3].setValue(data, | editors[3].setValue(data, | ||
| - | lines = editors[3].getSession().getDocument().getLength(); | + |  | 
| editors[3].setOptions({maxLines: | editors[3].setOptions({maxLines: | ||
|  |  | ||
