差分
このページの2つのバージョン間の差分を表示します。
両方とも前のリビジョン 前のリビジョン 次のリビジョン | 前のリビジョン | ||
javascript:requirejs [2019/09/08 17:42] – ともやん | 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 = []; | ||
+ | self.codes = []; | ||
const modes = [ | const modes = [ | ||
' | ' | ||
]; | ]; | ||
- | 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 = $(' | ||
行 82: | 行 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 = $(' | ||
+ | console.log(' | ||
+ | console.dir($aceCodes[0]); | ||
+ | for (let i = 0; i < $aceCodes.length; | ||
+ | codes.push(ace.edit($aceCodes[i])); | ||
+ | | ||
+ | setAceEditorStyle(codes[i], | ||
} | } | ||
| | ||
行 102: | 行 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: | ||
| | ||
行 157: | 行 180: | ||
}); | }); | ||
});%% | });%% | ||
+ | </ | ||
+ | |||
+ | ==== DokuWiki に埋め込む方法 ==== | ||
+ | <WRAP prewrap 100% acecode_html> | ||
+ | < | ||
+ | < | ||
+ | <script src="/ | ||
+ | <script src="/ | ||
+ | </ | ||
+ | </ | ||
</ | </ | ||
行 197: | 行 230: | ||
} | } | ||
| | ||
- | async getMediaList(ns, | + | async getMediaList(ns, |
- | grep = !!grep ? grep : ''; | + | |
//... | //... | ||
} | } | ||
行 209: | 行 242: | ||
});%% | });%% | ||
</ | </ | ||
+ | ※**class** を **return** するように記述する。\\ | ||
===== 参考文献 ===== | ===== 参考文献 ===== |