Skip to content

Instantly share code, notes, and snippets.

@wshager
Last active December 22, 2015 07:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wshager/6436296 to your computer and use it in GitHub Desktop.
Save wshager/6436296 to your computer and use it in GitHub Desktop.
var input = document.createElement("input");
input.id = "path";
input.value = "/db/file.xml";
var eXideButton = document.createElement("button");
eXideButton.innerHTML = "Open in eXide";
eXideButton.title = "Open in eXide Code Editor";
eXideButton.addEventListener("click", function() {
var path = input.value;
window.eXide_onload = function(app){
// getEditor() needs patch eXide.js
var editor = app.getEditor();
// small hack to select the right tab
var doc = editor.getActiveDocument();
if(doc.path !== path) {
doc = editor.getDocument(path);
if(doc) editor.switchTo(doc);
}
editor.addEventListener("saved",function(doc){
if(doc.getPath() === path){
alert(path+" saved");
}
});
};
window.open("/path/to/eXide/index.html?open="+path,"eXide");
});
document.body.insertBefore(eXideButton,document.body.firstChild);
document.body.insertBefore(input,eXideButton);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment