refac: remove more unneeded code
Some checks failed
Build/release / action-release (push) Failing after 51s
Some checks failed
Build/release / action-release (push) Failing after 51s
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -12,5 +12,4 @@ package-lock.json
|
|||||||
!.yarn/releases
|
!.yarn/releases
|
||||||
!.yarn/sdks
|
!.yarn/sdks
|
||||||
!.yarn/versions
|
!.yarn/versions
|
||||||
*.lock
|
|
||||||
.vscode
|
.vscode
|
||||||
|
|||||||
@@ -397,11 +397,11 @@ const commonPreferencesSubmenu = [
|
|||||||
{ type: "separator" },
|
{ type: "separator" },
|
||||||
...(process.platform === "win32" || process.platform === "linux"
|
...(process.platform === "win32" || process.platform === "linux"
|
||||||
? [
|
? [
|
||||||
{
|
{
|
||||||
role: "quit",
|
role: "quit",
|
||||||
accelerator: "Ctrl+Q",
|
accelerator: "Ctrl+Q",
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
: []),
|
: []),
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -411,23 +411,23 @@ const menulayout = [
|
|||||||
submenu: [
|
submenu: [
|
||||||
...(process.platform === "darwin"
|
...(process.platform === "darwin"
|
||||||
? [
|
? [
|
||||||
{ type: "separator" },
|
{ type: "separator" },
|
||||||
{
|
{
|
||||||
label: "Preferences",
|
label: "Preferences",
|
||||||
submenu: commonPreferencesSubmenu,
|
submenu: commonPreferencesSubmenu,
|
||||||
},
|
},
|
||||||
{ role: "services" },
|
{ role: "services" },
|
||||||
{ type: "separator" },
|
{ type: "separator" },
|
||||||
{ label: "Hide MS-365-Electron", role: "hide" },
|
{ label: "Hide MS-365-Electron", role: "hide" },
|
||||||
{ role: "hideOthers" },
|
{ role: "hideOthers" },
|
||||||
{ role: "unhide" },
|
{ role: "unhide" },
|
||||||
{ type: "separator" },
|
{ type: "separator" },
|
||||||
{ label: "Quit MS-365-Electron", role: "quit" },
|
{ label: "Quit MS-365-Electron", role: "quit" },
|
||||||
]
|
]
|
||||||
: [
|
: [
|
||||||
{ type: "separator" },
|
{ type: "separator" },
|
||||||
...commonPreferencesSubmenu,
|
...commonPreferencesSubmenu,
|
||||||
]),
|
]),
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -456,17 +456,17 @@ const menulayout = [
|
|||||||
{ type: "separator" },
|
{ type: "separator" },
|
||||||
...(process.platform === "darwin"
|
...(process.platform === "darwin"
|
||||||
? [
|
? [
|
||||||
{
|
{
|
||||||
label: "Share...",
|
label: "Share...",
|
||||||
click: () => {
|
click: () => {
|
||||||
let sharemenu = new ShareMenu({
|
let sharemenu = new ShareMenu({
|
||||||
urls: [BrowserWindow.getFocusedWindow().webContents.getURL()],
|
urls: [BrowserWindow.getFocusedWindow().webContents.getURL()],
|
||||||
texts: [BrowserWindow.getFocusedWindow().getTitle()],
|
texts: [BrowserWindow.getFocusedWindow().getTitle()],
|
||||||
});
|
});
|
||||||
sharemenu.popup();
|
sharemenu.popup();
|
||||||
},
|
|
||||||
},
|
},
|
||||||
]
|
},
|
||||||
|
]
|
||||||
: []),
|
: []),
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@@ -481,15 +481,15 @@ const menulayout = [
|
|||||||
{ role: "paste" },
|
{ role: "paste" },
|
||||||
...(process.platform === "darwin"
|
...(process.platform === "darwin"
|
||||||
? [
|
? [
|
||||||
{ role: "pasteAndMatchStyle" },
|
{ role: "pasteAndMatchStyle" },
|
||||||
{ role: "delete" },
|
{ role: "delete" },
|
||||||
{ role: "selectAll" },
|
{ role: "selectAll" },
|
||||||
{ type: "separator" },
|
{ type: "separator" },
|
||||||
{
|
{
|
||||||
label: "Speech",
|
label: "Speech",
|
||||||
submenu: [{ role: "startSpeaking" }, { role: "stopSpeaking" }],
|
submenu: [{ role: "startSpeaking" }, { role: "stopSpeaking" }],
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
: [{ role: "delete" }, { type: "separator" }, { role: "selectAll" }]),
|
: [{ role: "delete" }, { type: "separator" }, { role: "selectAll" }]),
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@@ -549,120 +549,63 @@ const menulayout = [
|
|||||||
{
|
{
|
||||||
label: "Word",
|
label: "Word",
|
||||||
click: () => {
|
click: () => {
|
||||||
if (getValue("enterprise-or-normal") === "?auth=2") {
|
if (getValue("websites-in-new-window") === "true") {
|
||||||
if (getValue("websites-in-new-window") === "true") {
|
let wordwindow = new BrowserWindow({
|
||||||
let wordwindow = new BrowserWindow({
|
width: Math.round(getScreenWidth() * (getValue("windowWidth") - 0.07)),
|
||||||
width: Math.round(getScreenWidth() * (getValue("windowWidth") - 0.07)),
|
height: Math.round(getScreenHeight() * (getValue("windowHeight") - 0.07)),
|
||||||
height: Math.round(getScreenHeight() * (getValue("windowHeight") - 0.07)),
|
webPreferences: {
|
||||||
webPreferences: {
|
nodeIntegration: false,
|
||||||
nodeIntegration: false,
|
contextIsolation: true,
|
||||||
contextIsolation: true,
|
partition: "persist:work",
|
||||||
partition: "persist:work",
|
},
|
||||||
},
|
});
|
||||||
});
|
wordwindow.loadURL("https://microsoft365.com/launch/word?auth=2");
|
||||||
wordwindow.loadURL("https://microsoft365.com/launch/word?auth=2");
|
} else {
|
||||||
} else {
|
BrowserWindow.getFocusedWindow().loadURL(
|
||||||
BrowserWindow.getFocusedWindow().loadURL(
|
"https://microsoft365.com/launch/word?auth=2"
|
||||||
"https://microsoft365.com/launch/word?auth=2"
|
);
|
||||||
);
|
|
||||||
}
|
|
||||||
} else if (getValue("enterprise-or-normal") === "?auth=1") {
|
|
||||||
if (getValue("websites-in-new-window") === "true") {
|
|
||||||
let wordwindow = new BrowserWindow({
|
|
||||||
width: Math.round(getScreenWidth() * (getValue("windowWidth") - 0.07)),
|
|
||||||
height: Math.round(getScreenHeight() * (getValue("windowHeight") - 0.07)),
|
|
||||||
webPreferences: {
|
|
||||||
nodeIntegration: false,
|
|
||||||
contextIsolation: true,
|
|
||||||
partition: "persist:personal",
|
|
||||||
},
|
|
||||||
});
|
|
||||||
wordwindow.loadURL("https://microsoft365.com/launch/word?auth=1");
|
|
||||||
} else {
|
|
||||||
BrowserWindow.getFocusedWindow().loadURL(
|
|
||||||
"https://microsoft365.com/launch/word?auth=1"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Excel",
|
label: "Excel",
|
||||||
click: () => {
|
click: () => {
|
||||||
if (getValue("enterprise-or-normal") === "?auth=2") {
|
if (getValue("websites-in-new-window") === "true") {
|
||||||
if (getValue("websites-in-new-window") === "true") {
|
let excelwindow = new BrowserWindow({
|
||||||
let excelwindow = new BrowserWindow({
|
width: Math.round(getScreenWidth() * (getValue("windowWidth") - 0.07)),
|
||||||
width: Math.round(getScreenWidth() * (getValue("windowWidth") - 0.07)),
|
height: Math.round(getScreenHeight() * (getValue("windowHeight") - 0.07)),
|
||||||
height: Math.round(getScreenHeight() * (getValue("windowHeight") - 0.07)),
|
webPreferences: {
|
||||||
webPreferences: {
|
nodeIntegration: false,
|
||||||
nodeIntegration: false,
|
contextIsolation: true,
|
||||||
contextIsolation: true,
|
partition: "persist:work",
|
||||||
partition: "persist:work",
|
},
|
||||||
},
|
});
|
||||||
});
|
excelwindow.loadURL("https://microsoft365.com/launch/excel?auth=2");
|
||||||
excelwindow.loadURL("https://microsoft365.com/launch/excel?auth=2");
|
} else {
|
||||||
} else {
|
BrowserWindow.getFocusedWindow().loadURL(
|
||||||
BrowserWindow.getFocusedWindow().loadURL(
|
"https://microsoft365.com/launch/excel?auth=2"
|
||||||
"https://microsoft365.com/launch/excel?auth=2"
|
);
|
||||||
);
|
|
||||||
}
|
|
||||||
} else if (getValue("enterprise-or-normal") === "?auth=1") {
|
|
||||||
if (getValue("websites-in-new-window") === "true") {
|
|
||||||
let excelwindow = new BrowserWindow({
|
|
||||||
width: Math.round(getScreenWidth() * (getValue("windowWidth") - 0.07)),
|
|
||||||
height: Math.round(getScreenHeight() * (getValue("windowHeight") - 0.07)),
|
|
||||||
webPreferences: {
|
|
||||||
nodeIntegration: false,
|
|
||||||
contextIsolation: true,
|
|
||||||
partition: "persist:personal",
|
|
||||||
},
|
|
||||||
});
|
|
||||||
excelwindow.loadURL("https://microsoft365.com/launch/excel?auth=1");
|
|
||||||
} else {
|
|
||||||
BrowserWindow.getFocusedWindow().loadURL(
|
|
||||||
"https://microsoft365.com/launch/excel?auth=1"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "PowerPoint",
|
label: "PowerPoint",
|
||||||
click: () => {
|
click: () => {
|
||||||
if (getValue("enterprise-or-normal") === "?auth=2") {
|
if (getValue("websites-in-new-window") === "true") {
|
||||||
if (getValue("websites-in-new-window") === "true") {
|
let powerpointwindow = new BrowserWindow({
|
||||||
let powerpointwindow = new BrowserWindow({
|
width: Math.round(getScreenWidth() * (getValue("windowWidth") - 0.07)),
|
||||||
width: Math.round(getScreenWidth() * (getValue("windowWidth") - 0.07)),
|
height: Math.round(getScreenHeight() * (getValue("windowHeight") - 0.07)),
|
||||||
height: Math.round(getScreenHeight() * (getValue("windowHeight") - 0.07)),
|
webPreferences: {
|
||||||
webPreferences: {
|
nodeIntegration: false,
|
||||||
nodeIntegration: false,
|
contextIsolation: true,
|
||||||
contextIsolation: true,
|
partition: "persist:work",
|
||||||
partition: "persist:work",
|
},
|
||||||
},
|
});
|
||||||
});
|
powerpointwindow.loadURL("https://microsoft365.com/launch/powerpoint?auth=2");
|
||||||
powerpointwindow.loadURL("https://microsoft365.com/launch/powerpoint?auth=2");
|
} else {
|
||||||
} else {
|
BrowserWindow.getFocusedWindow().loadURL(
|
||||||
BrowserWindow.getFocusedWindow().loadURL(
|
"https://microsoft365.com/launch/powerpoint?auth=2"
|
||||||
"https://microsoft365.com/launch/powerpoint?auth=2"
|
);
|
||||||
);
|
|
||||||
}
|
|
||||||
} else if (getValue("enterprise-or-normal") === "?auth=1") {
|
|
||||||
if (getValue("websites-in-new-window") === "true") {
|
|
||||||
let powerpointwindow = new BrowserWindow({
|
|
||||||
width: Math.round(getScreenWidth() * (getValue("windowWidth") - 0.07)),
|
|
||||||
height: Math.round(getScreenHeight() * (getValue("windowHeight") - 0.07)),
|
|
||||||
webPreferences: {
|
|
||||||
nodeIntegration: false,
|
|
||||||
contextIsolation: true,
|
|
||||||
partition: "persist:personal",
|
|
||||||
},
|
|
||||||
});
|
|
||||||
powerpointwindow.loadURL("https://microsoft365.com/launch/powerpoint?auth=1");
|
|
||||||
} else {
|
|
||||||
BrowserWindow.getFocusedWindow().loadURL(
|
|
||||||
"https://microsoft365.com/launch/powerpoint?auth=1"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -678,38 +621,38 @@ const menulayout = [
|
|||||||
: [{ role: "close" }]),
|
: [{ role: "close" }]),
|
||||||
...(process.platform === "win32" || process.platform === "linux"
|
...(process.platform === "win32" || process.platform === "linux"
|
||||||
? [
|
? [
|
||||||
{ type: "separator" },
|
{ type: "separator" },
|
||||||
{
|
{
|
||||||
label: "Show Menu Bar",
|
label: "Show Menu Bar",
|
||||||
type: "radio",
|
type: "radio",
|
||||||
click: () => {
|
click: () => {
|
||||||
setValue("autohide-menubar", "false");
|
setValue("autohide-menubar", "false");
|
||||||
dialog.showMessageBoxSync({
|
dialog.showMessageBoxSync({
|
||||||
type: "info",
|
type: "info",
|
||||||
title: "Menu Bar Settings",
|
title: "Menu Bar Settings",
|
||||||
message:
|
message:
|
||||||
"Menu will be visible now. Please restart the app for changes to take effect.",
|
"Menu will be visible now. Please restart the app for changes to take effect.",
|
||||||
buttons: ["OK"],
|
buttons: ["OK"],
|
||||||
});
|
});
|
||||||
},
|
|
||||||
checked: getValue("autohide-menubar") === "false",
|
|
||||||
},
|
},
|
||||||
{
|
checked: getValue("autohide-menubar") === "false",
|
||||||
label: "Hide Menu Bar (ALT to show)",
|
},
|
||||||
type: "radio",
|
{
|
||||||
click: () => {
|
label: "Hide Menu Bar (ALT to show)",
|
||||||
setValue("autohide-menubar", "true");
|
type: "radio",
|
||||||
dialog.showMessageBoxSync({
|
click: () => {
|
||||||
type: "info",
|
setValue("autohide-menubar", "true");
|
||||||
title: "Menu Bar Settings",
|
dialog.showMessageBoxSync({
|
||||||
message:
|
type: "info",
|
||||||
"Menu bar will be automatically hidden now. Please restart the app for changes to take effect.",
|
title: "Menu Bar Settings",
|
||||||
buttons: ["OK"],
|
message:
|
||||||
});
|
"Menu bar will be automatically hidden now. Please restart the app for changes to take effect.",
|
||||||
},
|
buttons: ["OK"],
|
||||||
checked: getValue("autohide-menubar") === "true",
|
});
|
||||||
},
|
},
|
||||||
]
|
checked: getValue("autohide-menubar") === "true",
|
||||||
|
},
|
||||||
|
]
|
||||||
: []),
|
: []),
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ export function getValueOrDefault(key, defaultValue) {
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
getValueOrDefault("enterprise-or-normal", "?auth=2");
|
//getValueOrDefault("enterprise-or-normal", "?auth=2");
|
||||||
getValueOrDefault("websites-in-new-window", "false");
|
getValueOrDefault("websites-in-new-window", "false");
|
||||||
getValueOrDefault("autohide-menubar", "true");
|
getValueOrDefault("autohide-menubar", "true");
|
||||||
getValueOrDefault("useragentstring", useragents.Windows);
|
getValueOrDefault("useragentstring", useragents.Windows);
|
||||||
|
|||||||
Reference in New Issue
Block a user