Commit 1d1ddcf8 authored by d11e9's avatar d11e9

remove logs

parent a8a879fa
...@@ -123,7 +123,7 @@ ...@@ -123,7 +123,7 @@
var files = getFiles(); var files = getFiles();
for (var x in files) for (var x in files) {
sessions[files[x]] = newEditorSession(files[x]) sessions[files[x]] = newEditorSession(files[x])
editor.setSession( sessions[SOL_CACHE_FILE] ); editor.setSession( sessions[SOL_CACHE_FILE] );
...@@ -226,24 +226,24 @@ ...@@ -226,24 +226,24 @@
}); });
// ----------------- file selector------------- // ----------------- file selector-------------
var $filesEl = $('#files'); var $filesEl = $('#files');
var FILE_SCROLL_DELTA = 300; var FILE_SCROLL_DELTA = 300;
$('.newFile').on('click', function() { $('.newFile').on('click', function() {
while (window.localStorage[SOL_CACHE_UNTITLED + untitledCount]) while (window.localStorage[SOL_CACHE_UNTITLED + untitledCount])
untitledCount = (untitledCount - 0) + 1; untitledCount = (untitledCount - 0) + 1;
SOL_CACHE_FILE = SOL_CACHE_UNTITLED + untitledCount; SOL_CACHE_FILE = SOL_CACHE_UNTITLED + untitledCount;
window.localStorage[SOL_CACHE_FILE] = ''; window.localStorage[SOL_CACHE_FILE] = '';
updateFiles(); updateFiles();
$filesEl.animate({left: (0 - activeFilePos() + (FILE_SCROLL_DELTA/2)) + "px"}, "slow", function(){ $filesEl.animate({left: (0 - activeFilePos() + (FILE_SCROLL_DELTA/2)) + "px"}, "slow", function(){
reAdjust(); reAdjust();
}) })
}); });
$filesEl.on('click', '.file:not(.active)', showFileHandler); $filesEl.on('click', '.file:not(.active)', showFileHandler);
$filesEl.on('click', '.file.active', function(ev) { $filesEl.on('click', '.file.active', function(ev) {
var $fileTabEl = $(this); var $fileTabEl = $(this);
...@@ -350,9 +350,9 @@ ...@@ -350,9 +350,9 @@
} }
$filesWrapper = $('.files-wrapper'); $filesWrapper = $('.files-wrapper');
$scrollerRight = $('.scroller-right'); $scrollerRight = $('.scroller-right');
$scrollerLeft = $('.scroller-left'); $scrollerLeft = $('.scroller-left');
function widthOfList (){ function widthOfList (){
var itemsWidth = 0; var itemsWidth = 0;
...@@ -361,61 +361,61 @@ ...@@ -361,61 +361,61 @@
itemsWidth += itemWidth; itemsWidth += itemWidth;
}); });
return itemsWidth; return itemsWidth;
}; };
function widthOfHidden(){ function widthOfHidden(){
return (($filesWrapper.outerWidth()) - widthOfList() - getLeftPosi()); return (($filesWrapper.outerWidth()) - widthOfList() - getLeftPosi());
}; };
function widthOfVisible(){ function widthOfVisible(){
return $filesWrapper.outerWidth(); return $filesWrapper.outerWidth();
}; };
function getLeftPosi(){ function getLeftPosi(){
return $filesEl.position().left; return $filesEl.position().left;
}; };
function activeFilePos() { function activeFilePos() {
var el = $filesEl.find('.active'); var el = $filesEl.find('.active');
var l = el.position().left; var l = el.position().left;
console.log("active file left", l, el) return l;
return l; }
}
function reAdjust (){
function reAdjust (){ if (widthOfList() + getLeftPosi() > + widthOfVisible()) {
if (widthOfList() + getLeftPosi() > + widthOfVisible()) { $scrollerRight.fadeIn('fast');
$scrollerRight.fadeIn('fast'); } else {
} else { $scrollerRight.fadeOut('fast');
$scrollerRight.fadeOut('fast'); }
}
if (getLeftPosi()<0) {
if (getLeftPosi()<0) { $scrollerLeft.fadeIn('fast');
$scrollerLeft.fadeIn('fast'); } else {
} else { $scrollerLeft.fadeOut('fast');
$scrollerLeft.fadeOut('fast'); $filesEl.animate({left: getLeftPosi() + "px"},'slow');
$filesEl.animate({left: getLeftPosi() + "px"},'slow'); }
} }
}
$scrollerRight.click(function() {
$scrollerRight.click(function() { var delta = (getLeftPosi() - FILE_SCROLL_DELTA)
var delta = (getLeftPosi() - FILE_SCROLL_DELTA) $filesEl.animate({left: delta + "px"},'slow',function(){
$filesEl.animate({left: delta + "px"},'slow',function(){ reAdjust();
reAdjust(); });
}); });
});
$scrollerLeft.click(function() {
$scrollerLeft.click(function() { var delta = Math.min( (getLeftPosi() + FILE_SCROLL_DELTA), 0 )
var delta = Math.min( (getLeftPosi() + FILE_SCROLL_DELTA), 0 ) $filesEl.animate({left: delta + "px"},'slow',function(){
$filesEl.animate({left: delta + "px"},'slow',function(){ reAdjust();
reAdjust(); });
}); });
});
updateFiles();
updateFiles();
// ----------------- version selector-------------
// ----------------- version selector-------------
// var soljsonSources is provided by bin/list.js
// var soljsonSources is provided by bin/list.js
$('option', '#versionSelector').remove(); $('option', '#versionSelector').remove();
$.each(soljsonSources, function(i, file) { $.each(soljsonSources, function(i, file) {
if (file) { if (file) {
......
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