From f6be2714d9c38f3cf6724e1e26b0ea349c79f178 Mon Sep 17 00:00:00 2001 From: Max Pozdeev Date: Mon, 19 Oct 2020 16:37:13 +0300 Subject: [PATCH] + add list menu item "Hide list" --- src/content/lang/en.json | 5 +++-- src/content/lang/ru.json | 7 ++++--- src/content/themes/default/index.php | 1 + src/includes/mytinytodo.js | 17 ++++++++++------- 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/content/lang/en.json b/src/content/lang/en.json index fe7bc29..c5f0763 100644 --- a/src/content/lang/en.json +++ b/src/content/lang/en.json @@ -117,7 +117,8 @@ "list_export": "Export", "list_export_csv": "CSV", "list_export_ical": "iCalendar", - "list_rssfeed": "RSS Feed", + "list_rssfeed": "RSS Feed", + "list_hide": "Hide list", "alltags": "All tags:", "alltags_show": "Show all", "alltags_hide": "Hide all", @@ -169,4 +170,4 @@ "deleteList": "This will delete current list with all tasks in it.\nAre you sure?", "clearCompleted": "This will delete all completed tasks in the list.\nAre you sure?", "settingsSaved": "Settings saved. Reloading..." -} \ No newline at end of file +} diff --git a/src/content/lang/ru.json b/src/content/lang/ru.json index 6ecfbae..fd4b2d0 100644 --- a/src/content/lang/ru.json +++ b/src/content/lang/ru.json @@ -10,7 +10,7 @@ "My Tiny Todolist": "My Tiny Todolist", "desktop_version": "Версия для компьютера", "mobile_version": "Мобильная версия", - "powered_by": "Работает на", + "powered_by": "Работает на", "htab_newtask": "Новая задача", "htab_search": "Поиск", "btn_add": "Добавить", @@ -117,7 +117,8 @@ "list_export": "Экспортировать", "list_export_csv": "CSV", "list_export_ical": "iCalendar", - "list_rssfeed": "RSS-лента", + "list_rssfeed": "RSS-лента", + "list_hide": "Скрыть список", "alltags": "Все теги:", "alltags_show": "Показать все", "alltags_hide": "Скрыть все", @@ -169,4 +170,4 @@ "deleteList": "Вы действительно хотите удалить этот список со всеми задачами?", "clearCompleted": "Удалить все выполненные задачи из списка?", "settingsSaved": "Настройки сохранены. Перезагрузка..." -} \ No newline at end of file +} diff --git a/src/content/themes/default/index.php b/src/content/themes/default/index.php index 5711ae8..c79ec50 100644 --- a/src/content/themes/default/index.php +++ b/src/content/themes/default/index.php @@ -224,6 +224,7 @@ $().ready(function(){
  • +
  • diff --git a/src/includes/mytinytodo.js b/src/includes/mytinytodo.js index fc8ccaf..0a9b042 100644 --- a/src/includes/mytinytodo.js +++ b/src/includes/mytinytodo.js @@ -280,7 +280,8 @@ var mytinytodo = window.mytinytodo = _mtt = { $('#lists').on('click', 'li.mtt-tab', function(event){ if(event.metaKey || event.ctrlKey) { // hide the tab - hideTab(this); + var listId = parseInt(this.id.split('_', 2)[1]); + hideList(listId); return false; } tabSelect(this); @@ -290,7 +291,7 @@ var mytinytodo = window.mytinytodo = _mtt = { $('#list_all').click(function(event){ if(event.metaKey || event.ctrlKey) { // hide the tab - hideTab(-1); + hideList(-1); return false; } tabSelect(-1); @@ -1371,6 +1372,7 @@ function listMenuClick(el, menu) case 'btnRenameList': renameCurList(); break; case 'btnDeleteList': deleteCurList(); break; case 'btnPublish': publishCurList(); break; + case 'btnHideList': hideList(curList.id); break; case 'btnExportCSV': return true; case 'btnExportICAL': return true; case 'btnRssFeed': return true; @@ -2239,12 +2241,13 @@ function slmenuSelect(el, menu) return false; }; -function hideTab(listId) +function hideList(listId) { - if(typeof listId != 'number') { - var id = $(listId).attr('id'); - if(!id) return; - listId = parseInt(id.split('_', 2)[1]); + if (typeof listId === 'string') { + listId = parseInt(listId); + } + else if (typeof listId !== 'number') { + return; } if(!tabLists.get(listId)) return false;