mirror of
https://github.com/maxpozdeev/mytinytodo.git
synced 2026-03-11 08:55:27 +00:00
move some properties to init() in mtt js
This commit is contained in:
parent
5d579d3ada
commit
d99c85c4eb
2 changed files with 24 additions and 10 deletions
|
|
@ -48,7 +48,6 @@ var mytinytodo = window.mytinytodo = _mtt = {
|
|||
actions: {},
|
||||
menus: {},
|
||||
mttUrl: '',
|
||||
templateUrl: '',
|
||||
options: {
|
||||
openList: 0,
|
||||
singletab: false,
|
||||
|
|
@ -97,6 +96,20 @@ var mytinytodo = window.mytinytodo = _mtt = {
|
|||
// procs
|
||||
init: function(options)
|
||||
{
|
||||
// required properties
|
||||
if (options.hasOwnProperty('lang')) {
|
||||
this.lang.init(options.lang);
|
||||
delete options.lang;
|
||||
}
|
||||
if (options.hasOwnProperty('mttUrl')) {
|
||||
this.mttUrl = options.mttUrl;
|
||||
delete options.mttUrl;
|
||||
}
|
||||
if (options.hasOwnProperty('db')) {
|
||||
this.db = new options.db(this);
|
||||
delete options.db;
|
||||
}
|
||||
|
||||
jQuery.extend(this.options, options);
|
||||
|
||||
flag.needAuth = options.needAuth ? true : false;
|
||||
|
|
@ -557,6 +570,11 @@ var mytinytodo = window.mytinytodo = _mtt = {
|
|||
jQuery.extend(this.options, opts);
|
||||
},
|
||||
|
||||
loadListsAtStart: function()
|
||||
{
|
||||
this.loadLists(1);
|
||||
},
|
||||
|
||||
loadLists: function(onInit)
|
||||
{
|
||||
if(filter.search != '') {
|
||||
|
|
|
|||
|
|
@ -25,25 +25,21 @@
|
|||
|
||||
<script type="text/javascript">
|
||||
$().ready(function(){
|
||||
|
||||
<?php echo "mytinytodo.lang.init(". Lang::instance()->makeJS() .");"; ?>
|
||||
|
||||
mytinytodo.mttUrl = "<?php mttinfo('mtt_url'); ?>";
|
||||
mytinytodo.templateUrl = "<?php mttinfo('template_url'); ?>";
|
||||
mytinytodo.db = new mytinytodoStorageAjax(mytinytodo);
|
||||
mytinytodo.init({
|
||||
lang: <?php echo Lang::instance()->makeJS() ?>,
|
||||
mttUrl: "<?php mttinfo('mtt_url'); ?>",
|
||||
db: mytinytodoStorageAjax,
|
||||
needAuth: <?php echo $needAuth ? "true" : "false"; ?>,
|
||||
isLogged: <?php echo ($needAuth && is_logged()) ? "true" : "false"; ?>,
|
||||
showdate: <?php echo (Config::get('showdate') && !Config::get('mobile')) ? "true" : "false"; ?>,
|
||||
singletab: <?php echo (isset($_GET['singletab']) || Config::get('mobile')) ? "true" : "false"; ?>,
|
||||
duedatepickerformat: "<?php echo htmlspecialchars(Config::get('dateformat2')); ?>",
|
||||
firstdayofweek: <?php echo (int) Config::get('firstdayofweek'); ?>,
|
||||
calendarIcon: mytinytodo.templateUrl + 'images/calendar.svg',
|
||||
calendarIcon: '<?php mttinfo('template_url'); ?>images/calendar.svg',
|
||||
autotag: <?php echo Config::get('autotag') ? "true" : "false"; ?>
|
||||
<?php if(isset($_GET['list'])) echo ",openList: ". (int)$_GET['list']; ?>
|
||||
<?php if(Config::get('mobile')) echo ", touchDevice: true"; ?>
|
||||
|
||||
}).loadLists(1);
|
||||
}).loadListsAtStart();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue