robust theme selector
This commit is contained in:
parent
795afa896f
commit
0a7b35ef8a
6
index.js
6
index.js
|
@ -16,7 +16,11 @@ function applyColors() {
|
||||||
// CodeMirror theme selector
|
// CodeMirror theme selector
|
||||||
var input = document.getElementById("select-theme");
|
var input = document.getElementById("select-theme");
|
||||||
function selectTheme() {
|
function selectTheme() {
|
||||||
var theme = input.options[input.selectedIndex].innerHTML;
|
if (input.selectedIndex > -1) {
|
||||||
|
var theme = input.options[input.selectedIndex].innerHTML;
|
||||||
|
} else {
|
||||||
|
var theme = "monokai";
|
||||||
|
}
|
||||||
editor.setOption("theme", theme);
|
editor.setOption("theme", theme);
|
||||||
document.cookie = "theme=" + theme + ";max-age=172800";
|
document.cookie = "theme=" + theme + ";max-age=172800";
|
||||||
applyColors();
|
applyColors();
|
||||||
|
|
Loading…
Reference in New Issue