Revision 3980:df625feec28c,
808 bytes
checked in by franck <carnet.franck.paul@…>, 6 years ago
(diff) |
Switching from inline JS variables to JSON script, theme editor plugin
|
Rev | Line | |
---|
[3980] | 1 | /*global $, CodeMirror, getData */ |
---|
| 2 | 'use strict'; |
---|
| 3 | |
---|
| 4 | $(function() { |
---|
| 5 | //const input = document.getElementById("colorsyntax_theme"); |
---|
| 6 | //var theme = input.options[input.selectedIndex].textContent; |
---|
| 7 | const current = getData('theme_editor_current'); |
---|
| 8 | var editor = CodeMirror.fromTextArea(document.getElementById("codemirror"), { |
---|
| 9 | mode: "javascript", |
---|
| 10 | tabMode: "indent", |
---|
| 11 | lineWrapping: 1, |
---|
| 12 | lineNumbers: 1, |
---|
| 13 | matchBrackets: 1, |
---|
| 14 | autoCloseBrackets: 1, |
---|
| 15 | theme: current.theme != '' ? current.theme : 'default' |
---|
| 16 | }); |
---|
| 17 | |
---|
| 18 | $('#colorsyntax_theme').on('change', function() { |
---|
| 19 | var input = document.getElementById("colorsyntax_theme"); |
---|
| 20 | var theme = input.options[input.selectedIndex].value; |
---|
| 21 | if (theme == "") theme = "default"; |
---|
| 22 | editor.setOption("theme", theme); |
---|
| 23 | editor.refresh(); |
---|
| 24 | }); |
---|
| 25 | }); |
---|
Note: See
TracBrowser
for help on using the repository browser.