* start to make responsive (600px breakpoint); remove singletab commands; remove urls to mobile and desktop themes

This commit is contained in:
Max Pozdeev 2020-10-19 23:48:19 +03:00
parent b76b370d1c
commit 20bd4cd822
9 changed files with 98 additions and 160 deletions

View file

@ -8,8 +8,6 @@
"author_url": "http://www.mytinytodo.net"
},
"My Tiny Todolist": "My Tiny Todolist",
"desktop_version": "Desktop version",
"mobile_version": "Mobile version",
"powered_by": "Powered by",
"htab_newtask": "New task",
"htab_search": "Search",

View file

@ -8,8 +8,6 @@
"author_url": "http://www.mytinytodo.net"
},
"My Tiny Todolist": "My Tiny Todolist",
"desktop_version": "Версия для компьютера",
"mobile_version": "Мобильная версия",
"powered_by": "Работает на",
"htab_newtask": "Новая задача",
"htab_search": "Поиск",

View file

@ -1,29 +1,25 @@
<?php header("Content-type: text/html; charset=utf-8"); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php mttinfo('title'); ?></title>
<link rel="stylesheet" type="text/css" href="<?php mttinfo('template_url'); ?>style.css?v=<?php mttinfo('version'); ?>" media="all" />
<link rel="stylesheet" type="text/css" href="<?php mttinfo('template_url'); ?>print.css?v=<?php mttinfo('version'); ?>" media="print" />
<?php if(Config::get('rtl')): ?>
<link rel="stylesheet" type="text/css" href="<?php mttinfo('template_url'); ?>style_rtl.css?v=<?php mttinfo('version'); ?>" media="all" />
<?php endif; ?>
<?php if(Config::get('mobile')): ?>
<meta name="viewport" id="viewport" content="width=device-width" />
<link rel="stylesheet" type="text/css" href="<?php mttinfo('template_url'); ?>mobile.css?v=<?php mttinfo('version'); ?>" media="all" />
<?php endif; ?>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php mttinfo('title'); ?></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" type="text/css" href="<?php mttinfo('template_url'); ?>style.css?v=<?php mttinfo('version'); ?>" media="all" />
<link rel="stylesheet" type="text/css" href="<?php mttinfo('template_url'); ?>print.css?v=<?php mttinfo('version'); ?>" media="print" />
<?php if(Config::get('rtl')): ?>
<link rel="stylesheet" type="text/css" href="<?php mttinfo('template_url'); ?>style_rtl.css?v=<?php mttinfo('version'); ?>" media="all" />
<?php endif; ?>
</head>
<body <?php if (Lang::instance()->rtl()) echo 'dir="rtl"'; ?>>
<script type="text/javascript" src="<?php mttinfo('includes_url'); ?>jquery/jquery-3.5.1.min.js"></script>
<script type="text/javascript" src="<?php mttinfo('includes_url'); ?>jquery/jquery-ui-1.12.1.min.js"></script>
<script type="text/javascript" src="<?php mttinfo('includes_url'); ?>jquery/jquery.ui.touch-punch.js"></script>
<script type="text/javascript" src="<?php mttinfo('includes_url'); ?>mytinytodo.js?v=<?php mttinfo('version'); ?>"></script>
<script type="text/javascript" src="<?php mttinfo('includes_url'); ?>mytinytodo_ajax_storage.js?v=<?php mttinfo('version'); ?>"></script>
<?php if(Config::get('mobile')): ?>
<script type="text/javascript" src="<?php mttinfo('includes_url'); ?>jquery/jquery.ui.touch-punch.js"></script>
<?php endif; ?>
<script type="text/javascript">
$().ready(function(){
@ -35,13 +31,11 @@ $().ready(function(){
db: mytinytodoStorageAjax,
needAuth: <?php echo need_auth() ? "true" : "false"; ?>,
isLogged: <?php echo 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"; ?>,
showdate: <?php echo Config::get('showdate') ? "true" : "false"; ?>,
duedatepickerformat: "<?php echo htmlspecialchars(Config::get('dateformat2')); ?>",
firstdayofweek: <?php echo (int) Config::get('firstdayofweek'); ?>,
calendarIcon: '<?php mttinfo('template_url'); ?>images/calendar.svg',
autotag: <?php echo Config::get('autotag') ? "true" : "false"; ?>
<?php if(Config::get('mobile')) echo ", touchDevice: true"; ?>
}).run();
});
</script>
@ -285,11 +279,6 @@ $().ready(function(){
<div id="footer">
<div id="footer_content">
<span><?php _e('powered_by');?> <a href="http://www.mytinytodo.net/" class="powered-by-link">myTinyTodo</a>&nbsp;<?php mttinfo('version'); ?></span>
<span id="mobileordesktop">
<?php if(Config::get('mobile')): ?><a href="<?php echo getDesktopUrl(); ?>"><?php _e('desktop_version');?></a>
<?php else: ?><a href="<?php mttinfo('mobile_url'); ?>"><?php _e('mobile_version');?></a>
<?php endif; ?>
</span>
</div>
</div>

View file

@ -1,66 +0,0 @@
/*
This file is a part of myTinyTodo.
Copyright 2009-2010,2020 Max Pozdeev <maxpozdeev@gmail.com>
*/
html { font-size:100%; }
body { margin:0px; font-size:100%; }
h2 { margin:0; margin-bottom:2px; font-size:1rem; }
#body { margin-left:1px; margin-right:1px; padding:1px; padding-bottom:12px;}
#bar_login, #bar_logout { padding-right:1px; }
.mtt-img-button { padding:4px; }
.mtt-menu-button { padding:4px; }
#tabs ul { margin-top:0px; }
#tabs ul li { width:70px; margin-right: 1px; }
.mtt-tabs-add-button { padding-left:0.4rem; padding-right:0.4rem; }
#task { padding:5px; padding-right:18px; margin-left:-22px; }
#task_placeholder span { padding:6px; }
.searchbox-c { width:30%; max-width:190px; }
#toolbar.mtt-intask .searchbox-c { display:none; }
#toolbar.mtt-insearch .taskbox-c { display:none; }
#toolbar.mtt-insearch .searchbox-c { width:100%; max-width:100%; }
#search { padding:5px 20px; border-radius:15px; }
#tasklist li { padding:0px 3px; }
.task-actions { display:none; }
.task-date { display:none; }
.task-note-actions { display:block; padding-top:8px; }
.task-note-block { margin-left:0px; border-left:1px solid #777777; background:none; padding-left:4px; display:none; }
body[dir="rtl"] .task-note-block { border-left:none; border-right:1px solid #777777; padding-left:0; padding-right:4px; }
.task-note-area textarea { width:95%; }
#tasklist li .task-through { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
#tasklist li:hover { background-color:#ffffff; }
#tasklist li.task-expanded .task-note-block { display:none; }
#tasklist li.clicked { background-color:#f6f6f6; }
#tasklist li.clicked .task-actions { display:block; }
#tasklist li.clicked .task-through { white-space:normal; display:inline; }
#tasklist li.clicked.task-has-note .task-note-block { display:block; }
#tasklist li.clicked.doubleclicked.task-has-note .task-note-block { display:none; }
.task-toggle { display:none; }
#tasklist .mtt-task-placeholder { line-height:1rem; padding-top:0.6rem; padding-bottom:0.6rem; }
#tasklist .ui-sortable-helper { box-shadow:0px 0px 3px #333; }
#page_taskedit { max-width:99.5%; border:none; position:static; padding:0; }
#page_taskedit .form-table { width:100%; }
#page_taskedit .form-row .in500 { color:#444444; }
#page_taskedit .form-row textarea { height: 70px; }
#loading { padding:0px; padding-top:1px; padding-right:1px; height:16px; overflow:hidden; }
#tagcloud { max-width:100%; margin:0px 5px 5px 5px; }
.mtt-settings-table .in350 { min-width:50px; }
.mtt-notes-showhide { display:none; }
#footer_content { padding:0.7rem 0.35rem; }
.mtt-menu-container li { padding-top:0.3rem; padding-bottom:0.3rem; }
#slmenucontainer { max-width:100vw; }
#slmenucontainer a { overflow:hidden; text-overflow:ellipsis; }
#cmenulistscontainer { max-width:100vw; }
#cmenulistscontainer li { overflow:hidden; text-overflow:ellipsis; }

View file

@ -34,7 +34,6 @@ li.task-completed { opacity:1; }
#footer_content { border-top:1px solid #777777; background:none; }
#footer_content a { text-decoration:none; color:#000000; }
#mobileordesktop { display: none; }
#tagcloudbtn { display:none; }
.mtt-notes-showhide { display:none; }

View file

@ -67,8 +67,6 @@ a { color:#0000ff; cursor:pointer; text-decoration:underline; }
.mtt-tab.mtt-tabs-selected { border-color:transparent; background-color:#ededed; }
.mtt-tab:hover { background-color:#ddd; }
.mtt-tab.mtt-tabs-selected:hover { background-color:#ededed; }
.mtt-tabs.mtt-tabs-only-one li { display:none; }
.mtt-tabs.mtt-tabs-only-one li.mtt-tabs-selected { display:block; }
.mtt-tabs-hidden { display:none; }
.mtt-tabs .mtt-list-sort-placeholder { background-color:#ddd; border:1px solid #aaa; }
@ -378,3 +376,73 @@ li.mtt-item-hidden { display:none; }
.mtt-settings-table select { padding:2px; border:1px solid #ccc; border-radius:2px; }
.mtt-settings-table .form-bottom-buttons input { padding:4px; border:1px solid #ccc; border-radius:3px; background-color:#efefef; margin:2px; }
.mtt-settings-table input:focus, .mtt-settings-table select:focus { outline:none; border-color:#5a8df0; box-shadow:0 0 0 2px rgba(90,141,240,0.7); }
@media only screen and (max-width: 600px) {
html { font-size:100%; }
body { font-size:100%; }
h2 { margin:0; margin-bottom:2px; font-size:1rem; }
#body { margin-left:1px; margin-right:1px; padding:1px; padding-bottom:12px;}
#bar_login, #bar_logout { padding-right:1px; }
.mtt-img-button { padding:4px; }
.mtt-menu-button { padding:4px; }
#tabs ul { margin-top:0px; }
#tabs ul li { width:70px; margin-right: 1px; }
.mtt-tabs-add-button { padding-left:0.4rem; padding-right:0.4rem; }
/* singletab */
.mtt-tabs li { display:none; }
.mtt-tabs li.mtt-tabs-selected { display:block; }
#task { padding:5px; padding-right:18px; margin-left:-22px; }
#task_placeholder span { padding:6px; }
.searchbox-c { width:30%; max-width:190px; }
#toolbar.mtt-intask .searchbox-c { display:none; }
#toolbar.mtt-insearch .taskbox-c { display:none; }
#toolbar.mtt-insearch .searchbox-c { width:100%; max-width:100%; }
#search { padding:5px 20px; border-radius:15px; }
#tasklist li { padding:0px 3px; }
.task-actions { display:none; }
.task-date { display:none; }
.task-note-actions { display:block; padding-top:8px; }
.task-note-block { margin-left:0px; border-left:1px solid #777777; background:none; padding-left:4px; display:none; }
body[dir="rtl"] .task-note-block { border-left:none; border-right:1px solid #777777; padding-left:0; padding-right:4px; }
.task-note-area textarea { width:95%; }
#tasklist li .task-through { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
#tasklist li:hover { background-color:#ffffff; }
#tasklist li.task-expanded .task-note-block { display:none; }
#tasklist li.clicked { background-color:#f6f6f6; }
#tasklist li.clicked .task-actions { display:block; }
#tasklist li.clicked .task-through { white-space:normal; display:inline; }
#tasklist li.clicked.task-has-note .task-note-block { display:block; }
#tasklist li.clicked.doubleclicked.task-has-note .task-note-block { display:none; }
.task-toggle { display:none; }
#tasklist .mtt-task-placeholder { line-height:1rem; padding-top:0.6rem; padding-bottom:0.6rem; }
#tasklist .ui-sortable-helper { box-shadow:0px 0px 3px #333; }
#page_taskedit { max-width:99.5%; border:none; position:static; padding:0; }
#page_taskedit .form-table { width:100%; }
#page_taskedit .form-row .in500 { color:#444444; }
#page_taskedit .form-row textarea { height: 70px; }
#loading { padding:0px; padding-top:1px; padding-right:1px; height:16px; overflow:hidden; }
#tagcloud { max-width:100%; margin:0px 5px 5px 5px; }
.mtt-settings-table .in350 { min-width:50px; }
.mtt-notes-showhide { display:none; }
#footer_content { padding:0.7rem 0.35rem; }
.mtt-menu-container li { padding-top:0.3rem; padding-bottom:0.3rem; }
#slmenucontainer { max-width:100vw; }
#slmenucontainer a { overflow:hidden; text-overflow:ellipsis; }
#cmenulistscontainer { max-width:100vw; }
#cmenulistscontainer li { overflow:hidden; text-overflow:ellipsis; }
} /* end of @media min 600px */

View file

@ -53,7 +53,6 @@ var mytinytodo = window.mytinytodo = _mtt = {
options: {
title: '',
openList: 0,
singletab: false,
autotag: false,
instantSearch: true,
tagPreview: true,
@ -130,6 +129,9 @@ var mytinytodo = window.mytinytodo = _mtt = {
else {
this.homeUrl = this.mttUrl;
}
if ( ! options.hasOwnProperty('touchDevice') ) {
this.options.touchDevice = ('ontouchend' in document);
}
jQuery.extend(this.options, options);
@ -137,7 +139,6 @@ var mytinytodo = window.mytinytodo = _mtt = {
flag.isLogged = options.isLogged ? true : false;
if(this.options.showdate) $('#page_tasks').addClass('show-inline-date');
if(this.options.singletab) $('#lists .mtt-tabs').addClass('mtt-tabs-only-one');
// handlers
$('.mtt-tabs-add-button').click(function(){
@ -145,11 +146,6 @@ var mytinytodo = window.mytinytodo = _mtt = {
});
$('.mtt-tabs-select-button').click(function(event){
if(event.metaKey || event.ctrlKey) {
// toggle singetab interface
_mtt.applySingletab(!_mtt.options.singletab);
return false;
}
if(!_mtt.menus.selectlist) _mtt.menus.selectlist = new mttMenu('slmenucontainer', {onclick:slmenuSelect, adjustWidth:true, alignRight:true});
_mtt.menus.selectlist.show(this);
});
@ -490,16 +486,6 @@ var mytinytodo = window.mytinytodo = _mtt = {
cursor: 'grabbing'
});
if (options.touchDevice) {
$("#tasklist").disableSelection();
$("#tasklist").sortable('option', {
axis: 'y',
delay: 0,
cancel: 'input',
distance: 0
});
$('#cmenu_note').hide();
}
$("#lists ul").sortable({
delay:150,
@ -508,7 +494,18 @@ var mytinytodo = window.mytinytodo = _mtt = {
cursor: 'grabbing'
});
this.applySingletab();
if (this.options.touchDevice) {
$("#tasklist").disableSelection();
$("#tasklist").sortable('option', {
axis: 'y',
delay: 0,
cancel: 'input',
distance: 0
});
$('#cmenu_note').hide();
$("#lists ul").sortable('disable');
}
// AJAX Errors
@ -757,20 +754,6 @@ var mytinytodo = window.mytinytodo = _mtt = {
if (this.pages.current.onBack) this.pages.current.onBack.call(this);
},
applySingletab: function(yesno)
{
if(yesno == null) yesno = this.options.singletab;
else this.options.singletab = yesno;
if(yesno) {
$('#lists .mtt-tabs').addClass('mtt-tabs-only-one');
$("#lists ul").sortable('disable');
}
else {
$('#lists .mtt-tabs').removeClass('mtt-tabs-only-one');
$("#lists ul").sortable('enable');
}
},
filter: {
_filters: [],

View file

@ -29,14 +29,6 @@ if (!is_int(Config::get('firstdayofweek')) || Config::get('firstdayofweek')<0 ||
Config::set('firstdayofweek', 1);
}
if ( isset($_GET['desktop']) ) { //more priority than mobile
Config::set('mobile', 0);
}
else if ( isset($_GET['mobile']) || isset($_GET['pda']) ) {
Config::set('mobile', 1);
}
define('TEMPLATEPATH', MTTTHEMES. Config::get('template'). '/');
require(TEMPLATEPATH. 'index.php');
@ -55,17 +47,3 @@ function redirectWithHashRoute(array $q, array $hash)
header("Location: ". $url);
exit;
}
function is_mobile()
{ //basic detection
if (preg_match("/(iphone|ipad|android)/i", _server('HTTP_USER_AGENT'))) {
return true;
}
return false;
}
function getDesktopUrl($escape = true)
{
$url = is_mobile() ? get_unsafe_mttinfo('desktop_url') : get_unsafe_mttinfo('url');
return $escape ? htmlspecialchars($url) : $url;
}

View file

@ -174,15 +174,6 @@ function get_unsafe_mttinfo($v)
$_mttinfo['url'] = ($is_https ? 'https://' : 'http://'). $_SERVER['HTTP_HOST']. url_dir(getRequestUri());
}
return $_mttinfo['url'];
case 'mobile_url':
$_mttinfo['mobile_url'] = Config::getUrl('mobile_url');
if ($_mttinfo['mobile_url'] == '') {
$_mttinfo['mobile_url'] = get_unsafe_mttinfo('url'). '?mobile';
}
return $_mttinfo['mobile_url'];
case 'desktop_url':
$_mttinfo['desktop_url'] = get_unsafe_mttinfo('url'). '?desktop';
return $_mttinfo['desktop_url'];
case 'mtt_url':
/* Directory with ajax.php. No need to set if you use default directory structure. */
$_mttinfo['mtt_url'] = Config::getUrl('mtt_url'); // need to have a trailing slash