diff --git a/src/ajax.js b/src/ajax.js
index b9d2b61..1ec7f5f 100644
--- a/src/ajax.js
+++ b/src/ajax.js
@@ -22,12 +22,13 @@ var img = {
var taskCnt = { total:0, past: 0, today:0, soon:0 };
var tmp = {};
var oBtnMenu = {};
-var tabLists;
+var tabLists = [];
var curList = 0;
var tagsList = [];
function loadTasks()
{
+ if(!curList) return false;
tz = -1 * (new Date()).getTimezoneOffset();
setAjaxErrorTrigger();
var search = filter.search ? '&s='+encodeURIComponent(filter.search) : '';
@@ -872,7 +873,7 @@ function btnMenu(el)
if(o.onclick) {
oBtnMenu.h[i] = o.onclick;
$(o).bind("click2", o.onclick);
- o.onclick = function(event) { $('#'+oBtnMenu.container).hide(); $(o).trigger('click2'); btnMenuClose(); }
+ if(!$(o).is('.li-disabled')) o.onclick = function(event) { $('#'+oBtnMenu.container).hide(); $(o).trigger('click2'); btnMenuClose(); }
} else {
oBtnMenu.h[i] = null;
}
@@ -938,22 +939,32 @@ function loadLists(onInit)
var nocache = '&rnd='+Math.random();
$.getJSON('ajax.php?loadLists'+nocache, function(json){
resetAjaxErrorTrigger();
- if(!parseInt(json.total)) {
- $('#page_tasks').hide();
- return;
- }
tabLists = new Array();
var ti = '';
- $.each(json.list, function(i,item){
- item.i = i;
- tabLists[i] = item;
- ti += '
'+item.name+'';
- });
+ if(parseInt(json.total))
+ {
+ $.each(json.list, function(i,item){
+ item.i = i;
+ tabLists[i] = item;
+ ti += ''+item.name+'';
+ });
+ if(!curList) {
+ $('#lists .mtt-htabs').children().removeClass('invisible');
+ $('#page_tasks h3').children().removeClass('invisible');
+ $('#mylistscontainer .mtt-need-list').removeClass('li-disabled');
+ }
+ curList = tabLists[0];
+ loadTasks();
+ }
+ else {
+ curList = 0;
+ $('#lists .mtt-htabs').children().addClass('invisible');
+ $('#page_tasks h3').children().addClass('invisible');
+ $('#mylistscontainer .mtt-need-list').addClass('li-disabled');
+ }
ti += '';
$('#lists>ul').html(ti);
$('#lists').show();
- curList = tabLists[0];
- loadTasks();
});
}
@@ -970,7 +981,8 @@ function addList()
var i = tabLists.length;
item.i = i;
tabLists[i] = item;
- $('#lists>ul').append(''+item.name+'');
+ if(i > 0) $('#lists>ul>li.mtt-tabs-button').before(''+item.name+'') ;
+ else loadLists();
}, 'json');
}
@@ -994,6 +1006,7 @@ function renameCurList()
function deleteCurList()
{
+ if(!curList) return false;
var r = confirm(lang.deleteList);
if(!r) return;
setAjaxErrorTrigger()
diff --git a/src/index.php b/src/index.php
index 70f38b0..2b782e9 100644
--- a/src/index.php
+++ b/src/index.php
@@ -196,8 +196,8 @@ $().ajaxStop( function(r,s) {$("#loading").fadeOut();} );
diff --git a/src/style.css b/src/style.css
index db4604e..6a27672 100644
--- a/src/style.css
+++ b/src/style.css
@@ -177,4 +177,5 @@ div.task-note-area textarea { color:#999999; width:100%; display:block; height:6
.mtt-btnmenu-container { overflow: hidden; z-index:103; background-color:#f9f9f9; border:1px solid #cccccc; padding:3px; }
.mtt-btnmenu-container .li { margin:1px 0px; padding:2px; cursor:pointer; }
-.mtt-btnmenu-container .li:hover { background-color:#316AC5; color:white; }
\ No newline at end of file
+.mtt-btnmenu-container .li:hover { background-color:#316AC5; color:white; }
+.mtt-btnmenu-container .li.mtt-need-list.li-disabled {color:#ACA899; }