2020-04-04 18:02:35 +02:00
|
|
|
var SysTrayX = {
|
2020-04-11 20:13:11 +02:00
|
|
|
platformInfo: undefined,
|
|
|
|
|
|
2020-04-04 18:02:35 +02:00
|
|
|
version: 0,
|
|
|
|
|
};
|
2020-01-22 23:14:46 +01:00
|
|
|
|
|
|
|
|
SysTrayX.SaveOptions = {
|
2020-04-04 18:02:35 +02:00
|
|
|
start: function (e) {
|
2020-01-22 23:14:46 +01:00
|
|
|
e.preventDefault();
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// Save accounts and filters
|
|
|
|
|
//
|
2020-01-23 23:28:52 +01:00
|
|
|
const treeBase = document.getElementById("accountsTree");
|
|
|
|
|
const inputs = treeBase.querySelectorAll("input");
|
2020-01-22 23:14:46 +01:00
|
|
|
let accounts = [];
|
|
|
|
|
let filters = [];
|
|
|
|
|
for (let i = 0; i < inputs.length; ++i) {
|
2020-01-23 23:28:52 +01:00
|
|
|
const account = JSON.parse(inputs[i].value);
|
|
|
|
|
const checked = inputs[i].checked;
|
2020-01-22 23:14:46 +01:00
|
|
|
accounts.push({ ...account, checked: checked });
|
|
|
|
|
|
|
|
|
|
if (checked) {
|
2020-04-04 18:02:35 +02:00
|
|
|
let inboxMailFolder = account.folders.find(
|
|
|
|
|
(obj) => obj.type === "inbox"
|
|
|
|
|
);
|
2020-01-22 23:14:46 +01:00
|
|
|
|
|
|
|
|
if (inboxMailFolder) {
|
|
|
|
|
filters.push({
|
|
|
|
|
unread: true,
|
2020-04-04 18:02:35 +02:00
|
|
|
folder: inboxMailFolder,
|
2020-01-22 23:14:46 +01:00
|
|
|
});
|
|
|
|
|
}
|
2020-01-12 01:15:19 +01:00
|
|
|
}
|
|
|
|
|
}
|
2020-01-22 23:14:46 +01:00
|
|
|
|
|
|
|
|
// Store accounts
|
|
|
|
|
browser.storage.sync.set({
|
2020-04-04 18:02:35 +02:00
|
|
|
accounts: accounts,
|
2020-01-22 23:14:46 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Store query filters
|
|
|
|
|
browser.storage.sync.set({
|
2020-04-04 18:02:35 +02:00
|
|
|
filters: filters,
|
2020-01-22 23:14:46 +01:00
|
|
|
});
|
|
|
|
|
|
2020-04-01 23:33:08 +02:00
|
|
|
//
|
|
|
|
|
// Save poll startup delay state
|
|
|
|
|
//
|
|
|
|
|
const pollStartupDelay = document.querySelector(
|
|
|
|
|
'input[name="pollStartupDelay"]'
|
|
|
|
|
).value;
|
|
|
|
|
browser.storage.sync.set({
|
2020-04-04 18:02:35 +02:00
|
|
|
pollStartupDelay: pollStartupDelay,
|
2020-04-01 23:33:08 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// Save poll interval state
|
|
|
|
|
//
|
|
|
|
|
const pollInterval = document.querySelector('input[name="pollInterval"]')
|
|
|
|
|
.value;
|
|
|
|
|
browser.storage.sync.set({
|
2020-04-04 18:02:35 +02:00
|
|
|
pollInterval: pollInterval,
|
2020-04-01 23:33:08 +02:00
|
|
|
});
|
|
|
|
|
|
2020-01-22 23:14:46 +01:00
|
|
|
//
|
|
|
|
|
// Save debug state
|
|
|
|
|
//
|
|
|
|
|
let debug = document.querySelector('input[name="debug"]').checked;
|
|
|
|
|
browser.storage.sync.set({
|
2020-04-04 18:02:35 +02:00
|
|
|
debug: `${debug}`,
|
2020-01-22 23:14:46 +01:00
|
|
|
});
|
|
|
|
|
|
2020-04-07 17:19:02 +02:00
|
|
|
//
|
|
|
|
|
// Save minimize preferences
|
|
|
|
|
//
|
2020-04-11 20:13:11 +02:00
|
|
|
const minimizeType = document.querySelector(
|
|
|
|
|
'input[name="minimizeType"]:checked'
|
|
|
|
|
).value;
|
2020-04-07 17:19:02 +02:00
|
|
|
|
|
|
|
|
// Store minimize preferences
|
|
|
|
|
browser.storage.sync.set({
|
|
|
|
|
minimizeType: minimizeType,
|
|
|
|
|
});
|
|
|
|
|
|
2020-02-29 19:04:43 +01:00
|
|
|
//
|
|
|
|
|
// Save start minimized state
|
|
|
|
|
//
|
|
|
|
|
let startMinimized = document.querySelector('input[name="startMinimized"]')
|
|
|
|
|
.checked;
|
|
|
|
|
browser.storage.sync.set({
|
2020-04-04 18:02:35 +02:00
|
|
|
startMinimized: `${startMinimized}`,
|
2020-02-29 19:04:43 +01:00
|
|
|
});
|
2020-02-18 00:24:31 +01:00
|
|
|
|
2020-01-22 23:14:46 +01:00
|
|
|
//
|
|
|
|
|
// Save icon preferences
|
|
|
|
|
//
|
2020-01-23 23:28:52 +01:00
|
|
|
const iconType = document.querySelector('input[name="iconType"]:checked')
|
2020-01-22 23:14:46 +01:00
|
|
|
.value;
|
|
|
|
|
|
|
|
|
|
// Store icon type
|
|
|
|
|
browser.storage.sync.set({
|
2020-04-04 18:02:35 +02:00
|
|
|
iconType: iconType,
|
2020-01-22 23:14:46 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
let iconDiv = document.getElementById("icon");
|
|
|
|
|
let iconBase64 = iconDiv.getAttribute("data-icon");
|
|
|
|
|
let iconMime = iconDiv.getAttribute("data-icon-mime");
|
|
|
|
|
|
|
|
|
|
// Store icon (base64)
|
|
|
|
|
browser.storage.sync.set({
|
|
|
|
|
iconMime: iconMime,
|
2020-04-04 18:02:35 +02:00
|
|
|
icon: iconBase64,
|
2020-01-22 23:14:46 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Mark add-on preferences changed
|
|
|
|
|
browser.storage.sync.set({
|
2020-04-04 18:02:35 +02:00
|
|
|
addonprefchanged: true,
|
2020-01-22 23:14:46 +01:00
|
|
|
});
|
2020-04-05 14:39:19 +02:00
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// Save enable number state
|
|
|
|
|
//
|
|
|
|
|
let showNumber = document.querySelector('input[name="showNumber"]').checked;
|
|
|
|
|
browser.storage.sync.set({
|
|
|
|
|
showNumber: `${showNumber}`,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// Save number color
|
|
|
|
|
//
|
|
|
|
|
let numberColor = document.querySelector('input[name="numberColor"]').value;
|
|
|
|
|
browser.storage.sync.set({
|
|
|
|
|
numberColor: `${numberColor}`,
|
|
|
|
|
});
|
2020-04-04 18:02:35 +02:00
|
|
|
},
|
2020-01-22 23:14:46 +01:00
|
|
|
};
|
2020-01-11 17:17:01 +01:00
|
|
|
|
2020-01-22 23:14:46 +01:00
|
|
|
SysTrayX.RestoreOptions = {
|
2020-04-04 18:02:35 +02:00
|
|
|
start: function () {
|
2020-01-22 23:14:46 +01:00
|
|
|
//
|
|
|
|
|
// Restore debug state
|
|
|
|
|
//
|
2020-01-23 23:28:52 +01:00
|
|
|
const getDebug = browser.storage.sync.get("debug");
|
2020-01-22 23:14:46 +01:00
|
|
|
getDebug.then(
|
|
|
|
|
SysTrayX.RestoreOptions.setDebug,
|
|
|
|
|
SysTrayX.RestoreOptions.onDebugError
|
|
|
|
|
);
|
|
|
|
|
|
2020-04-07 17:19:02 +02:00
|
|
|
//
|
|
|
|
|
// Restore minimize type
|
|
|
|
|
//
|
|
|
|
|
const getMinimizeType = browser.storage.sync.get("minimizeType");
|
|
|
|
|
getMinimizeType.then(
|
|
|
|
|
SysTrayX.RestoreOptions.setMinimizeType,
|
|
|
|
|
SysTrayX.RestoreOptions.onMinimizeTypeError
|
|
|
|
|
);
|
|
|
|
|
|
2020-02-29 19:04:43 +01:00
|
|
|
//
|
|
|
|
|
// Restore start minimized
|
|
|
|
|
//
|
|
|
|
|
const getStartMinimized = browser.storage.sync.get("startMinimized");
|
|
|
|
|
getStartMinimized.then(
|
|
|
|
|
SysTrayX.RestoreOptions.setStartMinimized,
|
|
|
|
|
SysTrayX.RestoreOptions.onStartMinimizedError
|
2020-02-18 00:24:31 +01:00
|
|
|
);
|
|
|
|
|
|
2020-01-22 23:14:46 +01:00
|
|
|
//
|
|
|
|
|
// Restore icon type
|
|
|
|
|
//
|
2020-01-23 23:28:52 +01:00
|
|
|
const getIconType = browser.storage.sync.get("iconType");
|
2020-01-22 23:14:46 +01:00
|
|
|
getIconType.then(
|
|
|
|
|
SysTrayX.RestoreOptions.setIconType,
|
|
|
|
|
SysTrayX.RestoreOptions.onIconTypeError
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// Restore icon
|
|
|
|
|
//
|
2020-01-23 23:28:52 +01:00
|
|
|
const getIcon = browser.storage.sync.get(["iconMime", "icon"]);
|
2020-01-22 23:14:46 +01:00
|
|
|
getIcon.then(
|
|
|
|
|
SysTrayX.RestoreOptions.setIcon,
|
|
|
|
|
SysTrayX.RestoreOptions.onIconError
|
|
|
|
|
);
|
2020-04-01 23:33:08 +02:00
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// Restore poll startup delay state
|
|
|
|
|
//
|
|
|
|
|
const getPollStartupDelay = browser.storage.sync.get("pollStartupDelay");
|
|
|
|
|
getPollStartupDelay.then(
|
|
|
|
|
SysTrayX.RestoreOptions.setPollStartupDelay,
|
|
|
|
|
SysTrayX.RestoreOptions.onPollStartupDelayError
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// Restore poll interval state
|
|
|
|
|
//
|
|
|
|
|
const getPollInterval = browser.storage.sync.get("pollInterval");
|
|
|
|
|
getPollInterval.then(
|
|
|
|
|
SysTrayX.RestoreOptions.setPollInterval,
|
|
|
|
|
SysTrayX.RestoreOptions.onPollIntervalError
|
|
|
|
|
);
|
2020-04-05 14:39:19 +02:00
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// Restore enable number state
|
|
|
|
|
//
|
|
|
|
|
const getShowNumber = browser.storage.sync.get("showNumber");
|
|
|
|
|
getShowNumber.then(
|
|
|
|
|
SysTrayX.RestoreOptions.setShowNumber,
|
|
|
|
|
SysTrayX.RestoreOptions.onShowNumberError
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// Restore number color
|
|
|
|
|
//
|
|
|
|
|
const getNumberColor = browser.storage.sync.get("numberColor");
|
|
|
|
|
getNumberColor.then(
|
|
|
|
|
SysTrayX.RestoreOptions.setNumberColor,
|
|
|
|
|
SysTrayX.RestoreOptions.onNumberColorError
|
|
|
|
|
);
|
2020-01-22 23:14:46 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// Restore debug state callbacks
|
|
|
|
|
//
|
2020-04-04 18:02:35 +02:00
|
|
|
setDebug: function (result) {
|
2020-01-23 23:28:52 +01:00
|
|
|
const debug = result.debug || "false";
|
2020-01-22 23:14:46 +01:00
|
|
|
|
2020-01-23 23:28:52 +01:00
|
|
|
const checkbox = document.querySelector(`input[name="debug"]`);
|
|
|
|
|
checkbox.checked = debug === "true";
|
2020-01-22 23:14:46 +01:00
|
|
|
},
|
|
|
|
|
|
2020-04-04 18:02:35 +02:00
|
|
|
onDebugError: function (error) {
|
2020-01-22 23:14:46 +01:00
|
|
|
console.log(`Debug Error: ${error}`);
|
|
|
|
|
},
|
|
|
|
|
|
2020-04-07 17:19:02 +02:00
|
|
|
//
|
|
|
|
|
// Restore minimize type callbacks
|
|
|
|
|
//
|
|
|
|
|
setMinimizeType: function (result) {
|
2020-04-11 20:13:11 +02:00
|
|
|
const minimizeType = result.minimizeType || "1";
|
|
|
|
|
const radioButton = document.querySelector(
|
|
|
|
|
`input[name="minimizeType"][value="${minimizeType}"]`
|
|
|
|
|
);
|
2020-04-07 17:19:02 +02:00
|
|
|
radioButton.checked = true;
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
onMinimizeTypeError: function (error) {
|
|
|
|
|
console.log(`Minimize type Error: ${error}`);
|
|
|
|
|
},
|
|
|
|
|
|
2020-02-29 19:04:43 +01:00
|
|
|
//
|
|
|
|
|
// Restore hide on minimize callbacks
|
|
|
|
|
//
|
2020-04-04 18:02:35 +02:00
|
|
|
setStartMinimized: function (result) {
|
2020-03-01 21:15:41 +01:00
|
|
|
const startMinimized = result.startMinimized || "false";
|
2020-02-29 19:04:43 +01:00
|
|
|
|
|
|
|
|
const checkbox = document.querySelector(`input[name="startMinimized"]`);
|
|
|
|
|
checkbox.checked = startMinimized === "true";
|
|
|
|
|
},
|
|
|
|
|
|
2020-04-04 18:02:35 +02:00
|
|
|
onStartMinimizedError: function (error) {
|
2020-02-29 19:04:43 +01:00
|
|
|
console.log(`startMinimized Error: ${error}`);
|
2020-02-18 00:24:31 +01:00
|
|
|
},
|
|
|
|
|
|
2020-01-22 23:14:46 +01:00
|
|
|
//
|
|
|
|
|
// Restore icon type callbacks
|
|
|
|
|
//
|
2020-04-04 18:02:35 +02:00
|
|
|
setIconType: function (result) {
|
2020-01-23 23:28:52 +01:00
|
|
|
const iconType = result.iconType || "0";
|
2020-04-11 20:13:11 +02:00
|
|
|
const radioButton = document.querySelector(
|
|
|
|
|
`input[name="iconType"][value="${iconType}"]`
|
|
|
|
|
);
|
2020-01-22 23:14:46 +01:00
|
|
|
radioButton.checked = true;
|
|
|
|
|
},
|
|
|
|
|
|
2020-04-04 18:02:35 +02:00
|
|
|
onIconTypeError: function (error) {
|
2020-01-22 23:14:46 +01:00
|
|
|
console.log(`Icon type Error: ${error}`);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// Restore icon
|
|
|
|
|
//
|
2020-04-04 18:02:35 +02:00
|
|
|
setIconMime: function (result) {
|
2020-01-23 23:28:52 +01:00
|
|
|
const iconMime = result.iconMime || "";
|
2020-01-22 23:14:46 +01:00
|
|
|
|
2020-01-23 23:28:52 +01:00
|
|
|
const valid = iconMime !== "";
|
|
|
|
|
if (valid) {
|
|
|
|
|
const iconDiv = document.getElementById("icon");
|
|
|
|
|
iconDiv.setAttribute("data-icon-mime", iconMime);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return valid;
|
2020-01-22 23:14:46 +01:00
|
|
|
},
|
|
|
|
|
|
2020-04-04 18:02:35 +02:00
|
|
|
setIconData: function (result) {
|
2020-01-23 23:28:52 +01:00
|
|
|
const iconBase64 = result.icon || "";
|
2020-01-22 23:14:46 +01:00
|
|
|
|
2020-01-23 23:28:52 +01:00
|
|
|
const valid = iconBase64 !== "";
|
|
|
|
|
if (valid) {
|
|
|
|
|
const iconDiv = document.getElementById("icon");
|
|
|
|
|
iconDiv.setAttribute("data-icon", iconBase64);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return valid;
|
2020-01-22 23:14:46 +01:00
|
|
|
},
|
|
|
|
|
|
2020-04-04 18:02:35 +02:00
|
|
|
updateIconImage: function () {
|
2020-01-23 23:28:52 +01:00
|
|
|
const iconDiv = document.getElementById("icon");
|
2020-01-22 23:14:46 +01:00
|
|
|
icon_mime = iconDiv.getAttribute("data-icon-mime");
|
|
|
|
|
icon_data = iconDiv.getAttribute("data-icon");
|
|
|
|
|
|
2020-01-23 23:28:52 +01:00
|
|
|
const image = document.getElementById("customIconImage");
|
2020-01-22 23:14:46 +01:00
|
|
|
image.setAttribute("src", `data:${icon_mime};base64,${icon_data}`);
|
|
|
|
|
},
|
|
|
|
|
|
2020-04-04 18:02:35 +02:00
|
|
|
setIcon: function (result) {
|
2020-01-23 23:28:52 +01:00
|
|
|
const validMime = SysTrayX.RestoreOptions.setIconMime(result);
|
|
|
|
|
const validData = SysTrayX.RestoreOptions.setIconData(result);
|
2020-01-22 23:14:46 +01:00
|
|
|
|
2020-01-23 23:28:52 +01:00
|
|
|
if (validMime && validData) {
|
|
|
|
|
SysTrayX.RestoreOptions.updateIconImage();
|
|
|
|
|
}
|
2020-01-22 23:14:46 +01:00
|
|
|
},
|
|
|
|
|
|
2020-04-04 18:02:35 +02:00
|
|
|
onIconError: function (error) {
|
2020-01-22 23:14:46 +01:00
|
|
|
console.log(`Icon Error: ${error}`);
|
2020-04-01 23:33:08 +02:00
|
|
|
},
|
|
|
|
|
|
2020-04-05 14:39:19 +02:00
|
|
|
//
|
|
|
|
|
// Restore enable number state
|
|
|
|
|
//
|
|
|
|
|
setShowNumber: function (result) {
|
|
|
|
|
const showNumber = result.showNumber || "true";
|
|
|
|
|
|
|
|
|
|
const checkbox = document.querySelector(`input[name="showNumber"]`);
|
|
|
|
|
checkbox.checked = showNumber === "true";
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
onShowNumberError: function (error) {
|
|
|
|
|
console.log(`showNumber Error: ${error}`);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// Restore number color
|
|
|
|
|
//
|
|
|
|
|
setNumberColor: function (result) {
|
|
|
|
|
const numberColor = result.numberColor || "#000000";
|
|
|
|
|
|
|
|
|
|
const input = document.querySelector(`input[name="numberColor"]`);
|
|
|
|
|
input.value = numberColor;
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
onNumberColorError: function (error) {
|
|
|
|
|
console.log(`numberColor Error: ${error}`);
|
|
|
|
|
},
|
|
|
|
|
|
2020-04-01 23:33:08 +02:00
|
|
|
//
|
|
|
|
|
// Restore poll startup delay state callbacks
|
|
|
|
|
//
|
2020-04-04 18:02:35 +02:00
|
|
|
setPollStartupDelay: function (result) {
|
2020-04-01 23:33:08 +02:00
|
|
|
const pollStartupDelay = result.pollStartupDelay || 5;
|
|
|
|
|
|
|
|
|
|
const input = document.querySelector(`input[name="pollStartupDelay"]`);
|
|
|
|
|
input.value = pollStartupDelay;
|
|
|
|
|
},
|
|
|
|
|
|
2020-04-04 18:02:35 +02:00
|
|
|
onPollStartupDelayError: function (error) {
|
2020-04-01 23:33:08 +02:00
|
|
|
console.log(`Poll startup delay Error: ${error}`);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// Restore poll interval state callbacks
|
|
|
|
|
//
|
2020-04-04 18:02:35 +02:00
|
|
|
setPollInterval: function (result) {
|
2020-04-01 23:33:08 +02:00
|
|
|
const pollInterval = result.pollInterval || 5;
|
|
|
|
|
|
|
|
|
|
const input = document.querySelector(`input[name="pollInterval"]`);
|
|
|
|
|
input.value = pollInterval;
|
|
|
|
|
},
|
|
|
|
|
|
2020-04-04 18:02:35 +02:00
|
|
|
onPollPollInterval: function (error) {
|
2020-04-01 23:33:08 +02:00
|
|
|
console.log(`Poll interval Error: ${error}`);
|
2020-04-04 18:02:35 +02:00
|
|
|
},
|
2020-01-22 23:14:46 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
SysTrayX.StorageChanged = {
|
2020-04-04 18:02:35 +02:00
|
|
|
changed: function (changes, area) {
|
2020-01-22 23:14:46 +01:00
|
|
|
// Try to keep the preferences of the add-on and the app in sync
|
2020-01-23 23:28:52 +01:00
|
|
|
const changedItems = Object.keys(changes);
|
2020-01-22 23:14:46 +01:00
|
|
|
|
|
|
|
|
let changed_icon = false;
|
|
|
|
|
let changed_icon_mime = false;
|
|
|
|
|
for (let item of changedItems) {
|
|
|
|
|
if (item === "iconMime") {
|
|
|
|
|
SysTrayX.RestoreOptions.setIconMime({
|
2020-04-04 18:02:35 +02:00
|
|
|
iconMime: changes[item].newValue,
|
2020-01-22 23:14:46 +01:00
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
if (item === "icon") {
|
|
|
|
|
SysTrayX.RestoreOptions.setIcon({ icon: changes[item].newValue });
|
|
|
|
|
changed_icon = true;
|
|
|
|
|
}
|
|
|
|
|
if (item === "iconType") {
|
|
|
|
|
SysTrayX.RestoreOptions.setIconType({
|
2020-04-04 18:02:35 +02:00
|
|
|
iconType: changes[item].newValue,
|
2020-01-22 23:14:46 +01:00
|
|
|
});
|
|
|
|
|
changed_icon_mime = true;
|
|
|
|
|
}
|
2020-04-05 14:39:19 +02:00
|
|
|
if (item === "showNumber") {
|
|
|
|
|
SysTrayX.RestoreOptions.setShowNumber({
|
|
|
|
|
showNumber: changes[item].newValue,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
if (item === "numberColor") {
|
|
|
|
|
SysTrayX.RestoreOptions.setNumberColor({
|
|
|
|
|
numberColor: changes[item].newValue,
|
|
|
|
|
});
|
|
|
|
|
}
|
2020-04-07 17:19:02 +02:00
|
|
|
if (item === "minimizeType") {
|
|
|
|
|
SysTrayX.RestoreOptions.setMinimizeType({
|
|
|
|
|
minimizeType: changes[item].newValue,
|
|
|
|
|
});
|
|
|
|
|
}
|
2020-02-29 19:04:43 +01:00
|
|
|
if (item === "startMinimized") {
|
|
|
|
|
SysTrayX.RestoreOptions.setStartMinimized({
|
2020-04-04 18:02:35 +02:00
|
|
|
startMinimized: changes[item].newValue,
|
2020-02-18 00:24:31 +01:00
|
|
|
});
|
|
|
|
|
}
|
2020-04-01 23:33:08 +02:00
|
|
|
if (item === "pollStartupDelay") {
|
|
|
|
|
SysTrayX.RestoreOptions.setPollStartupDelay({
|
2020-04-04 18:02:35 +02:00
|
|
|
pollStartupDelay: changes[item].newValue,
|
2020-04-01 23:33:08 +02:00
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
if (item === "pollInterval") {
|
|
|
|
|
SysTrayX.RestoreOptions.setPollInterval({
|
2020-04-04 18:02:35 +02:00
|
|
|
pollInterval: changes[item].newValue,
|
2020-04-01 23:33:08 +02:00
|
|
|
});
|
|
|
|
|
}
|
2020-01-22 23:14:46 +01:00
|
|
|
if (item === "debug") {
|
|
|
|
|
SysTrayX.RestoreOptions.setDebug({
|
2020-04-04 18:02:35 +02:00
|
|
|
debug: changes[item].newValue,
|
2020-01-22 23:14:46 +01:00
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-01-05 00:54:40 +01:00
|
|
|
|
2020-01-22 23:14:46 +01:00
|
|
|
if (changed_icon_mime && changed_icon) {
|
|
|
|
|
SysTrayX.RestoreOptions.updateIconImage();
|
|
|
|
|
}
|
2020-01-09 21:03:06 +01:00
|
|
|
|
2020-01-22 23:14:46 +01:00
|
|
|
//
|
|
|
|
|
// Update element
|
|
|
|
|
//
|
|
|
|
|
document.getElementById("debugselect").className = "active";
|
|
|
|
|
document.getElementById("iconselect").className = "active";
|
2020-04-07 17:19:02 +02:00
|
|
|
document.getElementById("minimizeselect").className = "active";
|
2020-04-04 18:02:35 +02:00
|
|
|
},
|
2020-01-22 23:14:46 +01:00
|
|
|
};
|
2020-01-05 00:54:40 +01:00
|
|
|
|
2020-01-23 23:28:52 +01:00
|
|
|
//
|
|
|
|
|
// Main
|
|
|
|
|
//
|
2020-04-04 18:02:35 +02:00
|
|
|
|
2020-04-11 20:13:11 +02:00
|
|
|
// Set platform
|
|
|
|
|
//SysTrayX.platformInfo = await browser.runtime
|
|
|
|
|
// .getPlatformInfo()
|
|
|
|
|
// .then((info) => info);
|
|
|
|
|
/*
|
|
|
|
|
// Tweak options for platform
|
|
|
|
|
if (SysTrayX.platformInfo.os === "win") {
|
|
|
|
|
console.debug("Win");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (SysTrayX.platformInfo.os === "linux") {
|
|
|
|
|
console.debug("Linux");
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
document.getElementById("minimizemethod1label").innerHTML =
|
|
|
|
|
"Minimize to tray";
|
|
|
|
|
document
|
|
|
|
|
.getElementById("minimizemethod2")
|
|
|
|
|
.setAttribute("style", "display:none;");
|
|
|
|
|
|
2020-04-04 18:02:35 +02:00
|
|
|
// Get addon version
|
|
|
|
|
SysTrayX.version = browser.runtime.getManifest().version;
|
|
|
|
|
document.getElementById("VersioHomeLink").href =
|
|
|
|
|
"https://github.com/Ximi1970/systray-x/releases/tag/" + SysTrayX.version;
|
|
|
|
|
|
2020-01-22 23:14:46 +01:00
|
|
|
document.addEventListener("DOMContentLoaded", SysTrayX.RestoreOptions.start);
|
2020-01-09 21:03:06 +01:00
|
|
|
document
|
|
|
|
|
.querySelector('[name="saveform"]')
|
2020-01-22 23:14:46 +01:00
|
|
|
.addEventListener("submit", SysTrayX.SaveOptions.start);
|
|
|
|
|
|
|
|
|
|
browser.storage.onChanged.addListener(SysTrayX.StorageChanged.changed);
|
2020-04-11 20:13:11 +02:00
|
|
|
|