make run() to parse anchor

This commit is contained in:
Max Pozdeev 2020-09-24 17:28:14 +03:00
parent d8a341cd52
commit ac0d635ec1
3 changed files with 24 additions and 9 deletions

View file

@ -39,7 +39,7 @@ $().ready(function(){
calendarIcon: '<?php mttinfo('template_url'); ?>images/calendar.svg',
autotag: <?php echo Config::get('autotag') ? "true" : "false"; ?>
<?php if(Config::get('mobile')) echo ", touchDevice: true"; ?>
}).loadLists();
}).run();
});
</script>

View file

@ -40,7 +40,7 @@ $().ready(function(){
calendarIcon: '<?php mttinfo('template_url'); ?>images/calendar.png',
autotag: <?php echo Config::get('autotag') ? "true" : "false"; ?>
<?php if(Config::get('mobile')) echo ", touchDevice: true"; ?>
}).loadLists();
}).run();
});
</script>

View file

@ -131,8 +131,6 @@ var mytinytodo = window.mytinytodo = _mtt = {
if(this.options.showdate) $('#page_tasks').addClass('show-inline-date');
if(this.options.singletab) $('#lists .mtt-tabs').addClass('mtt-tabs-only-one');
this.parseAnchor();
// handlers
$('.mtt-tabs-add-button').click(function(){
addList();
@ -590,6 +588,23 @@ var mytinytodo = window.mytinytodo = _mtt = {
setOptions: function(opts) {
jQuery.extend(this.options, opts);
},
run: function()
{
var path = this.parseAnchor();
if (flag.firstLoad) {
updateAccessStatus();
}
if (path.settings) {
this.pages.current.onBack = function(){ this.loadLists(); }
showSettings();
}
else {
this.loadLists();
}
},
loadLists: function()
{
@ -661,10 +676,6 @@ var mytinytodo = window.mytinytodo = _mtt = {
$('#page_tasks').show();
});
if (flag.firstLoad) {
updateAccessStatus();
}
},
duedatepickerformat: function()
@ -711,6 +722,7 @@ var mytinytodo = window.mytinytodo = _mtt = {
this.pages.current = this.pages.prev.pop();
showhide($('#page_'+ this.pages.current.page), $('#page_'+ prev.page).removeClass('mtt-page-'+prev.page.pageClass));
$(window).scrollTop(this.pages.current.lastScrollTop);
if (this.pages.current.onBack) this.pages.current.onBack.call(this);
},
applySingletab: function(yesno)
@ -791,6 +803,7 @@ var mytinytodo = window.mytinytodo = _mtt = {
switch(s) {
case "list": if(a[++i].match(/^-?\d+$/)) { p[s] = a[i]; } break;
case "alltasks": p.list = '-1'; break;
case "settings": p.settings = true; break;
}
}
@ -2371,7 +2384,9 @@ function saveSettings(frm)
$.post(_mtt.mttUrl+'settings.php', params, function(json){
if(json.saved) {
flashInfo(_mtt.lang.get('settingsSaved'));
setTimeout('window.location.reload();', 1000);
setTimeout( function(){
window.location.assign(_mtt.mttUrl); //window.location.reload();
}, 1000);
}
}, 'json');
}