Skip to content

Commit

Permalink
ControlSet tooltips.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dr. Off committed Apr 22, 2021
1 parent dbb1922 commit 9b25482
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 14 deletions.
5 changes: 4 additions & 1 deletion js/classes/ControlSet.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@ class ControlSet
this.element = controlSet;
}

addControl(controlText, onClick)
addControl(controlText, tooltip, onClick)
{
const control = document.createElement("li");

if(tooltip != undefined)
control.title = tooltip;

{
const link = document.createElement("a");

Expand Down
10 changes: 5 additions & 5 deletions js/classes/Modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class Modal

let controlSet = new ControlSet();

controlSet.addControl(browser.i18n.getMessage("confirm"), function()
controlSet.addControl(browser.i18n.getMessage("confirm"), undefined, function()
{
Modal.close();

Expand All @@ -97,14 +97,14 @@ class Modal

let controlSet = new ControlSet();

controlSet.addControl(browser.i18n.getMessage("confirm"), function()
controlSet.addControl(browser.i18n.getMessage("confirm"), undefined, function()
{
Modal.close();

resolve(true);
});

controlSet.addControl(browser.i18n.getMessage("cancel"), function()
controlSet.addControl(browser.i18n.getMessage("cancel"), undefined, function()
{
Modal.close();

Expand Down Expand Up @@ -137,14 +137,14 @@ class Modal

let controlSet = new ControlSet();

controlSet.addControl(browser.i18n.getMessage("confirm"), function()
controlSet.addControl(browser.i18n.getMessage("confirm"), undefined, function()
{
resolve(input.value);

Modal.close();
});

controlSet.addControl(browser.i18n.getMessage("cancel"), function()
controlSet.addControl(browser.i18n.getMessage("cancel"), undefined, function()
{
resolve(null);

Expand Down
3 changes: 2 additions & 1 deletion js/features/comment-box.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ async function insertSelection(textarea)
if(!settings.cb_hide_html_footnote)
controlSet.element.classList.add("aes-footnote-offset");

const insert = controlSet.addControl("Insert Selection", function(event)
// TODO: tooltip
const insert = controlSet.addControl("Insert Selection", undefined, function(event)
{
insertSelection(textarea);
});
Expand Down
3 changes: 2 additions & 1 deletion js/features/hide-works.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,8 @@

let controlSet = new ControlSet();

controlSet.addControl("Show", function(event, link)
// TODO: tooltip?
controlSet.addControl("Show", undefined, function(event, link)
{
hiddenContainer.classList.toggle("aes-hidden");

Expand Down
4 changes: 2 additions & 2 deletions js/features/search-presets.js
Original file line number Diff line number Diff line change
Expand Up @@ -403,12 +403,12 @@
{
const controlSet = new ControlSet();

controlSet.addControl(browser.i18n.getMessage("delete_currently_selected_preset"), function(event)
controlSet.addControl(browser.i18n.getMessage("delete_currently_selected_preset"), undefined, function(event)
{
deleteCurrentlySelectedPreset();
});

controlSet.addControl(browser.i18n.getMessage("save_current_settings_as_preset"), function(event)
controlSet.addControl(browser.i18n.getMessage("save_current_settings_as_preset"), undefined, function(event)
{
saveCurrentSettingsAsPreset();
});
Expand Down
8 changes: 4 additions & 4 deletions js/nav-dropdown/manage-extension-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@

const controlSet = new ControlSet();

controlSet.addControl(browser.i18n.getMessage("reset_all_data"), async function(event)
controlSet.addControl(browser.i18n.getMessage("reset_all_data"), browser.i18n.getMessage("reset_all_data_tooltip"), async function(event)
{
Modal.close();

Expand All @@ -166,14 +166,14 @@
}
});

controlSet.addControl(browser.i18n.getMessage("import_all_data"), async function(event)
controlSet.addControl(browser.i18n.getMessage("import_all_data"), browser.i18n.getMessage("import_all_data_tooltip"), async function(event)
{
fileInput.click();
});

// TODO: add tooltip browser.i18n.getMessage("export_all_data_tooltip")
// TODO: add tooltip
// Probably modify this function to take a tooltip arg
controlSet.addControl(browser.i18n.getMessage("export_all_data"), async function(event)
controlSet.addControl(browser.i18n.getMessage("export_all_data"), browser.i18n.getMessage("export_all_data_tooltip"), async function(event)
{
browser.runtime.sendMessage("export-all-data");
});
Expand Down

0 comments on commit 9b25482

Please sign in to comment.