Commit c16d0fb9 authored by d11e9's avatar d11e9

tidy filesEl hack

parent d98e3cc7
...@@ -93,8 +93,6 @@ THE SOFTWARE. ...@@ -93,8 +93,6 @@ THE SOFTWARE.
$(document).ready(function() { $(document).ready(function() {
var $filesEl = $('#files');
// ------------------ gist load ---------------- // ------------------ gist load ----------------
var location_hash_params = window.location.hash.substr(1).split("="); var location_hash_params = window.location.hash.substr(1).split("=");
...@@ -202,7 +200,7 @@ THE SOFTWARE. ...@@ -202,7 +200,7 @@ THE SOFTWARE.
// ----------------- file selector------------- // ----------------- file selector-------------
var $filesEl = $('#files');
$filesEl.on('click','.newFile', function() { $filesEl.on('click','.newFile', function() {
while (window.localStorage[SOL_CACHE_UNTITLED + untitledCount]) while (window.localStorage[SOL_CACHE_UNTITLED + untitledCount])
untitledCount = (untitledCount - 0) + 1; untitledCount = (untitledCount - 0) + 1;
...@@ -273,8 +271,11 @@ THE SOFTWARE. ...@@ -273,8 +271,11 @@ THE SOFTWARE.
function updateFiles() { function updateFiles() {
$filesEl.find('.file').remove(); var $filesEl = $('#files');
var files = getFiles(); var files = getFiles();
$filesEl.find('.file').remove();
for (var f in files) { for (var f in files) {
$filesEl.append(fileTabTemplate(files[f])); $filesEl.append(fileTabTemplate(files[f]));
} }
...@@ -284,10 +285,8 @@ THE SOFTWARE. ...@@ -284,10 +285,8 @@ THE SOFTWARE.
active.addClass('active'); active.addClass('active');
editor.setValue( window.localStorage[SOL_CACHE_FILE] || '', -1); editor.setValue( window.localStorage[SOL_CACHE_FILE] || '', -1);
editor.focus(); editor.focus();
$('#input').toggle( true ); }
} else { $('#input').toggle( !!SOL_CACHE_FILE );
$('#input').toggle( false );
}
} }
function fileTabTemplate(key) { function fileTabTemplate(key) {
......
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