Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added button to clear all tasks. #1622

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 28 additions & 1 deletion css/taskOverlay.css
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,8 @@ body:not(.touch)
opacity: 0.8;
}
#add-task {
width: 80%;
display:inline-block;
width: 40%;
margin-left: 10%;
padding: 1.25em;
text-align: center;
Expand Down Expand Up @@ -261,3 +262,29 @@ body.dark-mode #task-overlay {
.dark-mode #switch-task-button {
color: dodgerblue;
}

#destroy-all-tasks {
display:inline-block;
width: 40%;
margin-left: 0%;
padding: 1.25em;
text-align: center;
color: inherit;
background-color: rgb(245, 245, 245);
cursor: pointer;
}
.dark-mode #destroy-all-tasks {
background-color: rgb(33, 37, 43);
color: lightgrey;
}
#destroy-all-tasks:hover {
background-color: rgb(235, 235, 235);
}
.dark-mode #destroy-all-tasks:hover {
background-color: rgb(44, 49, 56);
}
#destroy-all-tasks .i {
opacity: 0.75;
vertical-align: middle;
margin-right: 0.25em;
}
6 changes: 6 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -222,10 +222,16 @@
id="task-overlay-navbar"
></div>
<div id="task-area"></div>
<div>
<button id="add-task">
<i class="i carbon:new-tab"></i>
<span></span>
</button>
<button id="destroy-all-tasks">
<i class="i carbon:close"></i>
<span></span>
</button>
</div>
</div>

<div id="download-bar" hidden>
Expand Down
16 changes: 15 additions & 1 deletion js/browserUI.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,19 @@ function destroyTask (id) {
tasks.destroy(id)
}

/* Destroys all tasks */
function destroyAllTasks () {
tasks.forEach( function(task) {
task.tabs.forEach(function (tab) {
webviews.destroy(tab.id)
})
}
)

tasks.destroyAll();
return addTask();
}

/* destroys the webview and tab element for a tab */
function destroyTab (id) {
tabBar.removeTab(id)
Expand Down Expand Up @@ -225,5 +238,6 @@ module.exports = {
closeTask,
closeTab,
switchToTask,
switchToTab
switchToTab,
destroyAllTasks
}
14 changes: 14 additions & 0 deletions js/searchbar/customBangs.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,20 @@ function initialize () {
}
})

bangsPlugin.registerCustomBang({
phrase: '!destroyalltasks',
snippet: l('destroyAllTasks'),
isAction: false,
fn: function () {
browserUI.destroyAllTasks();

taskOverlay.show()
setTimeout(function () {
taskOverlay.hide()
}, 600)
}
})

bangsPlugin.registerCustomBang({
phrase: '!nametask',
snippet: l('nameTask'),
Expand Down
9 changes: 9 additions & 0 deletions js/taskOverlay/taskOverlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ var taskContainer = document.getElementById('task-area')
var taskSwitcherButton = document.getElementById('switch-task-button')
var addTaskButton = document.getElementById('add-task')
var addTaskLabel = addTaskButton.querySelector('span')
var destroyAllTasksButton = document.getElementById('destroy-all-tasks')
var destroyAllTasksLabel = destroyAllTasksButton.querySelector('span')
var taskOverlayNavbar = document.getElementById('task-overlay-navbar')

function addTaskFromMenu () {
Expand Down Expand Up @@ -374,6 +376,8 @@ var taskOverlay = {
taskSwitcherButton.title = l('viewTasks')
addTaskLabel.textContent = l('newTask')

destroyAllTasksLabel.textContent = l('destroyAllTasks')

taskSwitcherButton.addEventListener('click', function () {
taskOverlay.toggle()
})
Expand All @@ -383,6 +387,11 @@ var taskOverlay = {
taskOverlay.hide()
})

destroyAllTasksButton.addEventListener('click', function(e) {
browserUI.destroyAllTasks()
taskOverlay.hide()
})

taskOverlayNavbar.addEventListener('click', function () {
taskOverlay.hide()
})
Expand Down
1 change: 1 addition & 0 deletions localization/languages/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
/* task overlay */
"viewTasks": "عرض المهام",
"newTask": "مهمة جديدة", //"new" is a verb - it is used for a button at the bottom of the task overlay
"destroyAllTasks":null, // "clear" is a verb - it is used on the button that clears all tasks at the bottom of the task overlay
"defaultTaskName": " %n مهمة رقم", //this is the name used for newly-created tasks; %n is replaced with a number ("task 1", "task 2", etc)
"taskDeleteWarning": {
"unsafeHTML": null //missing translation
Expand Down
1 change: 1 addition & 0 deletions localization/languages/bg.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
/* task overlay */
"viewTasks": "Преглеждане на задачи",
"newTask": "Отваряне на нова задача", //"new" is a verb - it is used for a button at the bottom of the task overlay
"destroyAllTasks":null, // "clear" is a verb - it is used on the button that clears all tasks at the bottom of the task overlay
"defaultTaskName": "Задача %n", //this is the name used for newly-created tasks; %n is replaced with a number ("task 1", "task 2", etc)
"taskDeleteWarning": {
"unsafeHTML": "Задачата е изтрита. <a>Върни обратно?</a>"
Expand Down
1 change: 1 addition & 0 deletions localization/languages/bn.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
/* task overlay */
"viewTasks": "কাজগুলি দেখুন",
"newTask": "ত্যে", //"new" is a verb - it is used for a button at the bottom of the task overlay
"destroyAllTasks":null, // "clear" is a verb - it is used on the button that clears all tasks at the bottom of the task overlay
"defaultTaskName": "টাস্ক%n", //this is the name used for newly-created tasks; %n is replaced with a number ("task 1", "task 2", etc)
"taskDeleteWarning": {
"unsafeHTML": "কার্য মোছা হয়েছে <a>Undo?</a>"
Expand Down
1 change: 1 addition & 0 deletions localization/languages/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
/* task overlay */
"viewTasks": "Zobrazit dimenze",
"newTask": "Nová dimenze", //"new" is a verb - it is used for a button at the bottom of the task overlay
"destroyAllTasks":null, // "clear" is a verb - it is used on the button that clears all tasks at the bottom of the task overlay
"defaultTaskName": "Dimenze %n", //this is the name used for newly-created tasks; %n is replaced with a number ("task 1", "task 2", etc)
"taskDeleteWarning": {
"unsafeHTML": "Dimenze uzavřena. <a>Zpět?</a>"
Expand Down
1 change: 1 addition & 0 deletions localization/languages/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
/* task overlay */
"viewTasks": "Aufgaben anzeigen",
"newTask": "Neue Aufgabe", //"new" is a verb - it is used for a button at the bottom of the task overlay
"destroyAllTasks":null, // "clear" is a verb - it is used on the button that clears all tasks at the bottom of the task overlay
"defaultTaskName": "Aufgabe %n", //this is the name used for newly-created tasks; %n is replaced with a number ("task 1", "task 2", etc)
"taskDeleteWarning": {
"unsafeHTML": "Aufgabe gelöscht. <a>Rückgängig machen?</a>"
Expand Down
1 change: 1 addition & 0 deletions localization/languages/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
/* task overlay */
"viewTasks": "View Tasks",
"newTask": "New Task", //"new" is a verb - it is used for a button at the bottom of the task overlay
"destroyAllTasks":"Clear Tasks", // "clear" is a verb - it is used on the button that clears all tasks at the bottom of the task overlay
"defaultTaskName": "Task %n", //this is the name used for newly-created tasks; %n is replaced with a number ("task 1", "task 2", etc)
"taskDeleteWarning": {
"unsafeHTML": "Task deleted. <a>Undo?</a>"
Expand Down
1 change: 1 addition & 0 deletions localization/languages/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
/* task overlay */
"viewTasks": "Ver tareas",
"newTask": "Nueva tarea", //"new" is a verb - it is used for a button at the bottom of the task overlay
"destroyAllTasks":null, // "clear" is a verb - it is used on the button that clears all tasks at the bottom of the task overlay
"defaultTaskName": "Tarea %n", //this is the name used for newly-created tasks; %n is replaced with a number ("task 1", "task 2", etc)
"taskDeleteWarning": {
"unsafeHTML": "Tarea eliminada. <a>¿Deshacer?</a>"
Expand Down
1 change: 1 addition & 0 deletions localization/languages/fa.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
/* task overlay */
"viewTasks": "نمایش وظایف",
"newTask": "وظیفه جدید",
"destroyAllTasks":null, // "clear" is a verb - it is used on the button that clears all tasks at the bottom of the task overlay
"defaultTaskName": "وظیفه %n", //this is the name used for newly-created tasks; %n is replaced with a number ("task 1", "task 2", etc)
"taskDeleteWarning": {
"unsafeHTML": null //missing translation
Expand Down
1 change: 1 addition & 0 deletions localization/languages/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
/* task overlay */
"viewTasks": "Voir les tâches",
"newTask": "Ouvrir une nouvelle tâche", //"new" is a verb - it is used for a button at the bottom of the task overlay
"destroyAllTasks":null, // "clear" is a verb - it is used on the button that clears all tasks at the bottom of the task overlay
"defaultTaskName": "Tâche %n", //this is the name used for newly-created tasks; %n is replaced with a number ("task 1", "task 2", etc)
"taskDeleteWarning": {
"unsafeHTML": "Tâche supprimée. <a>Annuler ?</a>"
Expand Down
1 change: 1 addition & 0 deletions localization/languages/hu.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
/* task overlay */
"viewTasks": "Feladat megtekintése",
"newTask": "Új feladat", //"new" is a verb - it is used for a button at the bottom of the task overlay
"destroyAllTasks":null, // "clear" is a verb - it is used on the button that clears all tasks at the bottom of the task overlay
"defaultTaskName": "Feladat %n", //this is the name used for newly-created tasks; %n is replaced with a number ("task 1", "task 2", etc)
"taskDeleteWarning": {
"unsafeHTML": null //missing translation
Expand Down
1 change: 1 addition & 0 deletions localization/languages/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
/* task overlay */
"viewTasks": "Mostra Task",
"newTask": "Nuovo Task", //"new" is a verb - it is used for a button at the bottom of the task overlay
"destroyAllTasks":null, // "clear" is a verb - it is used on the button that clears all tasks at the bottom of the task overlay
"defaultTaskName": "Task %n", //this is the name used for newly-created tasks; %n is replaced with a number ("task 1", "task 2", etc)
"taskDeleteWarning": {
"unsafeHTML": "Task eliminato. <a>Annullare?</a>"
Expand Down
1 change: 1 addition & 0 deletions localization/languages/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
/* task overlay */
"viewTasks": "タスクを表示",
"newTask": "新規タスク", //"new" is a verb - it is used for a button at the bottom of the task overlay
"destroyAllTasks":null, // "clear" is a verb - it is used on the button that clears all tasks at the bottom of the task overlay
"defaultTaskName": "タスク %n", //this is the name used for newly-created tasks; %n is replaced with a number ("task 1", "task 2", etc)
"taskDeleteWarning": {
"unsafeHTML": "タスクは削除されます。 <a>キャンセル?</a>"
Expand Down
1 change: 1 addition & 0 deletions localization/languages/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
/* task overlay */
"viewTasks": "작업장 보기",
"newTask": "새 작업장", //"new" is a verb - it is used for a button at the bottom of the task overlay
"destroyAllTasks":null, // "clear" is a verb - it is used on the button that clears all tasks at the bottom of the task overlay
"defaultTaskName": "작업장 %n", //this is the name used for newly-created tasks; %n is replaced with a number ("task 1", "task 2", etc)
"taskDeleteWarning": {
"unsafeHTML": "작업장을 제거했습니다. <a>되돌릴까요?</a>"
Expand Down
1 change: 1 addition & 0 deletions localization/languages/lt.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
/* task overlay */
"viewTasks": "Rodyti užduotis",
"newTask": "Nauja užduotis", //"new" is a verb - it is used for a button at the bottom of the task overlay
"destroyAllTasks":null, // "clear" is a verb - it is used on the button that clears all tasks at the bottom of the task overlay
"defaultTaskName": "Užduotis %n", //this is the name used for newly-created tasks; %n is replaced with a number ("task 1", "task 2", etc)
"taskDeleteWarning": {
"unsafeHTML": null //missing translation
Expand Down
1 change: 1 addition & 0 deletions localization/languages/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
/* task overlay */
"viewTasks": "Wyświetl zadania",
"newTask": "Nowe zadanie", //"new" is a verb - it is used for a button at the bottom of the task overlay
"destroyAllTasks":null, // "clear" is a verb - it is used on the button that clears all tasks at the bottom of the task overlay
"defaultTaskName": "Zadanie %n", //this is the name used for newly-created tasks; %n is replaced with a number ("task 1", "task 2", etc)
"taskDeleteWarning": {
"unsafeHTML": "Zadanie usunięte. <a>Cofnąć?</a>"
Expand Down
1 change: 1 addition & 0 deletions localization/languages/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
/* task overlay */
"viewTasks": "Ver tarefas",
"newTask": "Nova Tarefa", //"new" is a verb - it is used for a button at the bottom of the task overlay
"destroyAllTasks":null, // "clear" is a verb - it is used on the button that clears all tasks at the bottom of the task overlay
"defaultTaskName": "Tarefa %n", //this is the name used for newly-created tasks; %n is replaced with a number ("task 1", "task 2", etc)
"taskDeleteWarning": {
"unsafeHTML": "Tarefa deletada! <a> desfazer?</a>"
Expand Down
1 change: 1 addition & 0 deletions localization/languages/pt-PT.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
/* task overlay */
"viewTasks": "Ver tarefas",
"newTask": "Nova tarefa", //"new" is a verb - it is used for a button at the bottom of the task overlay
"destroyAllTasks":null, // "clear" is a verb - it is used on the button that clears all tasks at the bottom of the task overlay
"defaultTaskName": "Tarefa %n", //this is the name used for newly-created tasks; %n is replaced with a number ("task 1", "task 2", etc)
"taskDeleteWarning": {
"unsafeHTML": "Tarefa eliminada. <a>Desfazer</a>?"
Expand Down
1 change: 1 addition & 0 deletions localization/languages/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
/* task overlay */
"viewTasks": "Показать задачи",
"newTask": "Новая задача", //"new" is a verb - it is used for a button at the bottom of the task overlay
"destroyAllTasks":null, // "clear" is a verb - it is used on the button that clears all tasks at the bottom of the task overlay
"defaultTaskName": "Задача %n", //this is the name used for newly-created tasks; %n is replaced with a number ("task 1", "task 2", etc)
"taskDeleteWarning": {
"unsafeHTML": "Задача удалена. <a>Отменить?</a>"
Expand Down
1 change: 1 addition & 0 deletions localization/languages/tr.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
/* task overlay */
"viewTasks": "Görevleri Görüntüle",
"newTask": "Yeni Görev", //"new" is a verb - it is used for a button at the bottom of the task overlay
"destroyAllTasks":null, // "clear" is a verb - it is used on the button that clears all tasks at the bottom of the task overlay
"defaultTaskName": "Görev %n", //this is the name used for newly-created tasks; %n is replaced with a number ("task 1", "task 2", etc)
"taskDeleteWarning": {
"unsafeHTML": "Görev silindi. <a>Geri?</a>"
Expand Down
1 change: 1 addition & 0 deletions localization/languages/uk.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
/* task overlay */
"viewTasks": "Переглянути завдання",
"newTask": "Нове завдання", //"new" is a verb - it is used for a button at the bottom of the task overlay
"destroyAllTasks":null, // "clear" is a verb - it is used on the button that clears all tasks at the bottom of the task overlay
"defaultTaskName": "Завдання %n", //this is the name used for newly-created tasks; %n is replaced with a number ("task 1", "task 2", etc)
"taskDeleteWarning": {
"unsafeHTML": "Завдання видалено. <a>Скасувати?</a>"
Expand Down
1 change: 1 addition & 0 deletions localization/languages/uz.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
/* task overlay */
"viewTasks": "Vazifalarni ko'rish",
"newTask": "Yangi vazfa", //"new" is a verb - it is used for a button at the bottom of the task overlay
"destroyAllTasks":null, // "clear" is a verb - it is used on the button that clears all tasks at the bottom of the task overlay
"defaultTaskName": "Vazifa %n", //this is the name used for newly-created tasks; %n is replaced with a number ("task 1", "task 2", etc)
"taskDeleteWarning": {
"unsafeHTML": "Vazifa o'chirildi. <a>Bekor qilasizmi?</a>"
Expand Down
1 change: 1 addition & 0 deletions localization/languages/vi.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
/* task overlay */
"viewTasks": "Xem quá trình",
"newTask": "Tao quá trình", //"new" is a verb - it is used for a button at the bottom of the task overlay
"destroyAllTasks":null, // "clear" is a verb - it is used on the button that clears all tasks at the bottom of the task overlay
"defaultTaskName": "Quá trình %n", //this is the name used for newly-created tasks; %n is replaced with a number ("task 1", "task 2", etc)
/* find in page toolbar */
"searchInPage": "Tìm kiếm trong trang", //this is used as the placeholder text for the textbox in the find in page toolbar
Expand Down
1 change: 1 addition & 0 deletions localization/languages/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
/* task overlay */
"viewTasks": "查看标签组",
"newTask": "新建标签组", //"new" is a verb - it is used for a button at the bottom of the task overlay
"destroyAllTasks":null, // "clear" is a verb - it is used on the button that clears all tasks at the bottom of the task overlay
"defaultTaskName": "标签组 %n", //this is the name used for newly-created tasks; %n is replaced with a number ("task 1", "task 2", etc)
"taskDeleteWarning": {
"unsafeHTML": "标签组已删除 <a>恢复?</a>"
Expand Down
1 change: 1 addition & 0 deletions localization/languages/zh-TW.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
/* task overlay */
"viewTasks": "查看工作",
"newTask": "新增工作", //"new" is a verb - it is used for a button at the bottom of the task overlay
"destroyAllTasks":null, // "clear" is a verb - it is used on the button that clears all tasks at the bottom of the task overlay
"defaultTaskName": "工作 %n", //this is the name used for newly-created tasks; %n is replaced with a number ("task 1", "task 2", etc)
"taskDeleteWarning": {
"unsafeHTML": "工作已刪除 <a>復原</a>"
Expand Down