mirror of
https://github.com/maxpozdeev/mytinytodo.git
synced 2026-03-11 08:55:27 +00:00
+ ability to open all task tab on page load using "list=-1" query string parameter or "#alltasks" or "#list/-1"
This commit is contained in:
parent
627c6661da
commit
9adcadab67
1 changed files with 6 additions and 4 deletions
|
|
@ -539,12 +539,15 @@ var mytinytodo = window.mytinytodo = _mtt = {
|
|||
}
|
||||
}
|
||||
|
||||
// open all tasks tab
|
||||
if(_mtt.options.openList == -1) openListId = -1;
|
||||
|
||||
// or open first if all list are hidden
|
||||
if(!openListId) openListId = res.list[0].id;
|
||||
|
||||
$.each(res.list, function(i,item){
|
||||
tabLists.add(item);
|
||||
ti += '<li id="list_'+item.id+'" class="mtt-tab'+(item.id==openListId?' mtt-tabs-selected':'')+(item.hidden?' mtt-tabs-hidden':'')+'">'+
|
||||
ti += '<li id="list_'+item.id+'" class="mtt-tab'+(item.hidden?' mtt-tabs-hidden':'')+'">'+
|
||||
'<a href="#list/'+item.id+'" title="'+item.name+'"><span>'+item.name+'</span>'+
|
||||
'<div class="list-action"></div></a></li>';
|
||||
});
|
||||
|
|
@ -680,8 +683,6 @@ var mytinytodo = window.mytinytodo = _mtt = {
|
|||
if(location.hash == '') return false;
|
||||
var h = location.hash.substr(1);
|
||||
var a = h.split("/");
|
||||
if(a.length < 2) return false;
|
||||
|
||||
var p = {};
|
||||
var s = '';
|
||||
|
||||
|
|
@ -689,7 +690,8 @@ var mytinytodo = window.mytinytodo = _mtt = {
|
|||
{
|
||||
s = a[i];
|
||||
switch(s) {
|
||||
case "list": if(a[++i].match(/^\d+$/)) { p[s] = a[i]; } break;
|
||||
case "list": if(a[++i].match(/^-?\d+$/)) { p[s] = a[i]; } break;
|
||||
case "alltasks": p.list = '-1'; break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue