live preview of themes in demo

This commit is contained in:
nightwing 2012-04-23 19:15:18 +04:00
commit 2538e85780

View file

@ -390,10 +390,28 @@ function saveOption(el, val) {
}
}
themeEl.addEventListener("mouseover", function(e){
this.desiredValue = e.target.value;
if (!this.$timer)
this.$timer = setTimeout(this.updateTheme);
})
themeEl.addEventListener("mouseout", function(e){
this.desiredValue = null;
if (!this.$timer)
this.$timer = setTimeout(this.updateTheme, 20);
})
themeEl.updateTheme = function(){
env.split.setTheme(themeEl.desiredValue || themeEl.selectedValue);
themeEl.$timer = null;
}
bindDropdown("theme", function(value) {
if (!value)
return;
env.editor.setTheme(value);
themeEl.selectedValue = value;
});
bindDropdown("keybinding", function(value) {