Commit 4f6a1412 authored by Ysragh Heiden's avatar Ysragh Heiden
Browse files

Add Open-Local-File

parent be5089bb
......@@ -36,6 +36,14 @@ html,body,#app{margin:0;padding:0;width:100%;height:100%;}
border-bottom: 5px solid #669644;
text-shadow: 0px -2px #669644;
}
#file {
display:none;
}
#btn_file {
background-color: #56bf8f;
border-bottom: 5px solid #36aa7a;
text-shadow: 0px -2px #36aa7a;
}
#btn_add {
background-color: #F2CF66;
border-bottom: 5px solid #D1B358;
......@@ -121,7 +129,8 @@ html,body,#app{margin:0;padding:0;width:100%;height:100%;}
font-family: 'Source Code Pro';
}
#drawer li button, #drawer li select {
#drawer li button,
#drawer li select {
font-family: 'Source Code Pro';
position: relative;
padding: 10px 40px;
......
......@@ -82,13 +82,15 @@
'#app'
);
self.append(self.createElement('ul'),'#drawer');
self.append(self.createElement('input', null, [['id', 'file'], ['name', 'file'], ['type', 'file']]));
self.append(
[
self.createElement('li', [self.createElement('button', 'Run', [['id', 'btn_run']])]),
self.createElement('li', [self.createElement('select', null, [['id', 'syntax']])]),
self.createElement('li', [self.createElement('button', 'Add', [['id', 'btn_add']])]),
self.createElement('li', [self.createElement('button', 'Open File', [['id', 'btn_file']])]),
self.createElement('li', [self.createElement('button', 'Add Template', [['id', 'btn_add']])]),
self.createElement('li', [self.createElement('select', null, [['id', 'templates']])]),
self.createElement('li', [self.createElement('button', 'Delete', [['id', 'btn_delete']])]),
self.createElement('li', [self.createElement('button', 'Delete Template', [['id', 'btn_delete']])]),
self.createElement('li', [self.createElement('button', 'Share', [['id', 'btn_share']])])
],
'#drawer ul'
......@@ -627,6 +629,20 @@
};
window.addEventListener('resize', onResizeEvent);
onResizeEvent();
var loadFromFile = function(evt) {
var files = evt.target.files; // FileList object
var fr = new FileReader();
fr.onload = function(e) {
EDITOR.setValue(e.target.result);
};
if (files && files.length) {
fr.readAsText(files[0]);
}
};
document.getElementById('file').addEventListener('change', loadFromFile, false);
btn_file.onclick = function(){
file.click();
};
self.loadFromHash();
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment