Compare commits
62 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f82837ac4f | ||
|
|
6c1edd0a98 | ||
|
|
72516bd2fd | ||
|
|
38a4db3538 | ||
|
|
aab2397043 | ||
|
|
034e2f36c3 | ||
|
|
b44ee69787 | ||
|
|
0ba2721ea3 | ||
|
|
d2ed102ccc | ||
|
|
dd8110479b | ||
|
|
848e93ae09 | ||
|
|
1625a46529 | ||
|
|
1526a81d1c | ||
|
|
5b4db16b64 | ||
|
|
0e02c64999 | ||
|
|
9d2b63fedb | ||
|
|
15d339d7f9 | ||
|
|
ec12b02d7e | ||
|
|
e003c64444 | ||
|
|
e680f8eb37 | ||
|
|
1e1828b3f2 | ||
|
|
a9d63d7325 | ||
|
|
95e14db4f8 | ||
|
|
6a294dadd0 | ||
|
|
f42c6c80b2 | ||
|
|
72ddfe7b62 | ||
|
|
5a70499ad0 | ||
|
|
2a0b175c78 | ||
|
|
5f69e53123 | ||
|
|
1ef0457246 | ||
|
|
38f04012b5 | ||
|
|
b708b9e0e2 | ||
|
|
5c1421f3bb | ||
|
|
2997e82cad | ||
|
|
924183dc84 | ||
|
|
71557c205c | ||
|
|
401ba1c879 | ||
|
|
e788a933d5 | ||
|
|
803c9bde90 | ||
|
|
98f0a57307 | ||
|
|
cf8ee83edc | ||
|
|
406b7041f2 | ||
|
|
8b3103c318 | ||
|
|
b0746d48ec | ||
|
|
ac4d21cdf9 | ||
|
|
2f82a165f8 | ||
|
|
122c78cb92 | ||
|
|
bec002d50a | ||
|
|
c417702de6 | ||
|
|
cecd797ee2 | ||
|
|
9da7d35d0e | ||
|
|
7826a40187 | ||
|
|
5ceccb3510 | ||
|
|
97ac91b64a | ||
|
|
10da125fed | ||
|
|
b3d857f095 | ||
|
|
3deb15080f | ||
|
|
8a2e48c3c0 | ||
|
|
8b72100ae4 | ||
|
|
fe1e564dff | ||
|
|
f4b9f6d421 | ||
|
|
4c2effbbd4 |
@@ -1,5 +0,0 @@
|
||||
yarn.lock
|
||||
node_modules/
|
||||
docs/
|
||||
.github/
|
||||
README.md
|
||||
15
.eslintrc.js
@@ -1,15 +0,0 @@
|
||||
module.exports = {
|
||||
"env": {
|
||||
"commonjs": true,
|
||||
"es2021": true,
|
||||
"node": true
|
||||
},
|
||||
"extends": "eslint:recommended",
|
||||
"overrides": [
|
||||
],
|
||||
"parserOptions": {
|
||||
"ecmaVersion": "latest"
|
||||
},
|
||||
"rules": {
|
||||
}
|
||||
}
|
||||
2
.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
github: agam778
|
||||
ko_fi: agam778
|
||||
2
.github/workflows/build.yml
vendored
@@ -12,7 +12,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v1
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Install Node.js, NPM and Yarn
|
||||
uses: actions/setup-node@v3
|
||||
|
||||
49
.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
name: CI
|
||||
|
||||
on: workflow_dispatch
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
os: [macos-latest, ubuntu-latest, windows-latest]
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Install Node.js, NPM and Yarn
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: latest
|
||||
|
||||
- name: Build with Electron Builder
|
||||
run: |
|
||||
export GH_TOKEN=${{ secrets.GITHUB_TOKEN }}
|
||||
yarn
|
||||
if [ "$RUNNER_OS" == "Linux" ]; then
|
||||
yarn dist --publish never
|
||||
elif [ "$RUNNER_OS" == "Windows" ]; then
|
||||
yarn dist --publish never
|
||||
elif [ "$RUNNER_OS" == "macOS" ]; then
|
||||
yarn dist -m --x64 --arm64 --publish never
|
||||
else
|
||||
echo "$RUNNER_OS not supported"
|
||||
exit 1
|
||||
fi
|
||||
shell: bash
|
||||
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ matrix.os }}-dist
|
||||
path: |
|
||||
release/*.exe
|
||||
release/*.dmg
|
||||
release/*.deb
|
||||
release/*.snap
|
||||
release/*.tar.gz
|
||||
release/*.AppImage
|
||||
release/*.rpm
|
||||
50
.github/workflows/eslint.yml
vendored
@@ -1,50 +0,0 @@
|
||||
# This workflow uses actions that are not certified by GitHub.
|
||||
# They are provided by a third-party and are governed by
|
||||
# separate terms of service, privacy policy, and support
|
||||
# documentation.
|
||||
# ESLint is a tool for identifying and reporting on patterns
|
||||
# found in ECMAScript/JavaScript code.
|
||||
# More details at https://github.com/eslint/eslint
|
||||
# and https://eslint.org
|
||||
|
||||
name: ESLint
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "main" ]
|
||||
pull_request:
|
||||
# The branches below must be a subset of the branches above
|
||||
branches: [ "main" ]
|
||||
schedule:
|
||||
- cron: '16 11 * * 0'
|
||||
|
||||
jobs:
|
||||
eslint:
|
||||
name: Run eslint scanning
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
security-events: write
|
||||
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Install ESLint
|
||||
run: |
|
||||
npm install eslint@8.10.0
|
||||
npm install @microsoft/eslint-formatter-sarif@2.1.7
|
||||
|
||||
- name: Run ESLint
|
||||
run: npx eslint .
|
||||
--config .eslintrc.js
|
||||
--ext .js,.jsx,.ts,.tsx
|
||||
--format @microsoft/eslint-formatter-sarif
|
||||
--output-file eslint-results.sarif
|
||||
continue-on-error: true
|
||||
|
||||
- name: Upload analysis results to GitHub
|
||||
uses: github/codeql-action/upload-sarif@v2
|
||||
with:
|
||||
sarif_file: eslint-results.sarif
|
||||
wait-for-processing: true
|
||||
@@ -1,3 +0,0 @@
|
||||
yarn.lock
|
||||
node_modules/
|
||||
README.md
|
||||
BIN
.yarn/cache/@cliqz-adblocker-content-npm-1.26.6-14464c4427-a24dded5d5.zip
vendored
Normal file
BIN
.yarn/cache/@cliqz-adblocker-electron-npm-1.26.6-0d9e80d931-a1312d92e9.zip
vendored
Normal file
BIN
.yarn/cache/@cliqz-adblocker-electron-preload-npm-1.26.6-1c59bb8e18-4fadea3544.zip
vendored
Normal file
BIN
.yarn/cache/@cliqz-adblocker-extended-selectors-npm-1.26.6-93a49554d0-b5f2cb61cf.zip
vendored
Normal file
BIN
.yarn/cache/@cliqz-adblocker-npm-1.26.6-55189e27c2-95a4732f1d.zip
vendored
Normal file
BIN
.yarn/cache/@eslint-community-eslint-utils-npm-4.3.0-4ed2f1d6c5-f487760a69.zip
vendored
Normal file
BIN
.yarn/cache/@eslint-community-regexpp-npm-4.4.1-44c7391499-db97d8d08e.zip
vendored
Normal file
BIN
.yarn/cache/@eslint-js-npm-8.42.0-820f8f50f7-750558843a.zip
vendored
Normal file
BIN
.yarn/cache/@humanwhocodes-config-array-npm-0.11.10-7b63df9e7f-1b1302e240.zip
vendored
Normal file
BIN
.yarn/cache/@remusao-guess-url-type-npm-1.2.1-31ad9dc138-37a5142c97.zip
vendored
Normal file
BIN
.yarn/cache/@remusao-small-npm-1.2.1-313b1c5a80-e9c6a6d117.zip
vendored
Normal file
BIN
.yarn/cache/@remusao-smaz-compress-npm-1.9.1-8fa01d9c00-e01875f4bb.zip
vendored
Normal file
BIN
.yarn/cache/@remusao-smaz-decompress-npm-1.9.1-d871d6acb1-6abc127dd3.zip
vendored
Normal file
BIN
.yarn/cache/@remusao-smaz-npm-1.9.1-4eb80bed3a-0a7607dacc.zip
vendored
Normal file
BIN
.yarn/cache/@remusao-trie-npm-1.4.1-d803036c35-0df106a649.zip
vendored
Normal file
BIN
.yarn/cache/@types-chrome-npm-0.0.228-92b415dee9-7878706b04.zip
vendored
Normal file
BIN
.yarn/cache/@types-filesystem-npm-0.0.32-f9e6035fd6-4b9079d200.zip
vendored
Normal file
BIN
.yarn/cache/@types-filewriter-npm-0.0.29-08151cd903-0c58aa875c.zip
vendored
Normal file
BIN
.yarn/cache/@types-firefox-webext-browser-npm-111.0.1-7006d76748-1730c2e303.zip
vendored
Normal file
BIN
.yarn/cache/@types-har-format-npm-1.2.11-fe724cabda-f36add1ac2.zip
vendored
Normal file
BIN
.yarn/cache/@types-node-npm-18.16.16-8a41330dc3-0efad726dd.zip
vendored
Normal file
BIN
.yarn/cache/@xhayper-discord-rpc-npm-1.0.17-a35e6bd739-6b7f4d2590.zip
vendored
Normal file
BIN
.yarn/cache/axios-npm-1.4.0-4d7ce8ca3e-7fb6a4313b.zip
vendored
Normal file
BIN
.yarn/cache/cross-fetch-npm-3.1.6-cdb982d446-704b3519ab.zip
vendored
Normal file
BIN
.yarn/cache/discord-api-types-npm-0.37.43-26a217da1d-716bafb6b2.zip
vendored
Normal file
BIN
.yarn/cache/electron-npm-25.1.0-440bced844-411af45997.zip
vendored
Normal file
BIN
.yarn/cache/eslint-npm-8.42.0-593c3ddde5-07105397b5.zip
vendored
Normal file
BIN
.yarn/cache/eslint-scope-npm-7.2.0-88784f5a38-64591a2d8b.zip
vendored
Normal file
BIN
.yarn/cache/eslint-visitor-keys-npm-3.4.1-a5d0a58208-f05121d868.zip
vendored
Normal file
BIN
.yarn/cache/espree-npm-9.5.2-5fc9506cda-6506289d6e.zip
vendored
Normal file
BIN
.yarn/cache/esquery-npm-1.5.0-d8f8a06879-aefb0d2596.zip
vendored
Normal file
BIN
.yarn/cache/graphemer-npm-1.4.0-0627732d35-bab8f0be9b.zip
vendored
Normal file
BIN
.yarn/cache/node-fetch-npm-2.6.11-160e4174c3-249d0666a9.zip
vendored
Normal file
BIN
.yarn/cache/tldts-core-npm-6.0.5-98ebdb282e-8f63ff15f0.zip
vendored
Normal file
BIN
.yarn/cache/tldts-experimental-npm-6.0.5-7e711a1465-4351a38459.zip
vendored
Normal file
BIN
.yarn/cache/ws-npm-7.5.7-6cc440864a-5c1f669a16.zip
vendored
BIN
.yarn/cache/ws-npm-8.13.0-26ffa3016a-53e991bbf9.zip
vendored
Normal file
873
.yarn/releases/yarn-3.4.1.cjs
vendored
874
.yarn/releases/yarn-3.6.0.cjs
vendored
Executable file
@@ -4,4 +4,4 @@ plugins:
|
||||
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
|
||||
spec: "@yarnpkg/plugin-interactive-tools"
|
||||
|
||||
yarnPath: .yarn/releases/yarn-3.4.1.cjs
|
||||
yarnPath: .yarn/releases/yarn-3.6.0.cjs
|
||||
|
||||
1
LICENSE
@@ -1,6 +1,7 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2021-2023 Agampreet Singh
|
||||
Microsoft 365, the name, website, images/icons are the intellectual properties of Microsoft.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
33
README.md
@@ -1,4 +1,4 @@
|
||||
<p align="center"><img src="https://github.com/agam778/MS-365-Electron/blob/main/Intro_Image.png?raw=true" alt="Intro Image"></p>
|
||||
<p align="center"><img src="https://github.com/agam778/MS-365-Electron/blob/main/assets/banner.png?raw=true" alt="Intro Image"></p>
|
||||
<p align="center">Thanks a lot to <a href="https://t.me/NextWorksGFX">@NextWorksGFX</a> for this amazing banner!</p>
|
||||
<p align="center">Unofficial Microsoft 365 Web Desktop Wrapper made with Electron</p>
|
||||
|
||||
@@ -72,7 +72,13 @@ Supported Platforms
|
||||
|
||||
# List of Features
|
||||
|
||||
- Discord Rich Presence
|
||||
- Discord RPC
|
||||
- Dynamic Icons:
|
||||
- For macOS: Change icon in dock according to the app you've opened [[Preview]](https://github-production-user-asset-6210df.s3.amazonaws.com/68941022/245203309-3d0dfc1b-02e9-43a8-85d7-9493a2b86b56.mp4)
|
||||
- For Windows: Set overlay icon [[Preview]](https://github.com/agam778/MS-365-Electron/assets/68941022/791b661b-2b7d-43a6-96df-ee9c30c9b18a)
|
||||
- For Linux: Nothing, yet
|
||||
- Block Ads within the app
|
||||
- Directly open apps from the menu
|
||||
- Ability to use useragent strings of Windows, macOS or Linux
|
||||
- Switch between normal and enterprise/education/developer account in the same app
|
||||
- Back, Forward, Reload, and Home buttons
|
||||
@@ -92,8 +98,8 @@ For Installing this app on Windows:
|
||||
|
||||
<details>
|
||||
<summary>Click to expand</summary>
|
||||
<img src="https://github.com/agam778/MS-365-Electron/blob/main/Preview/windows_1.png?raw=true" alt="Windows Preview - 1">
|
||||
<img src="https://github.com/agam778/MS-365-Electron/blob/main/Preview/windows_2.png?raw=true" alt="Windows Preview - 2">
|
||||
<img src="https://github.com/agam778/MS-365-Electron/blob/main/assets/screenshots/windows_1.png?raw=true" alt="Windows Preview - 1">
|
||||
<img src="https://github.com/agam778/MS-365-Electron/blob/main/assets/screenshots/windows_2.png?raw=true" alt="Windows Preview - 2">
|
||||
</details>
|
||||
|
||||
# macOS
|
||||
@@ -106,6 +112,13 @@ For Installing this app on Mac :-
|
||||
2. Scroll down and click the `.dmg` file (according to your system architecture).
|
||||
3. After it downloads, click on the file and mount it on your system. Now drag my app to the Applications Folder (There will be a shortcut in the opened window too) and your app will be installed. Open from Launchpad and enjoy.
|
||||
|
||||
## 📸 macOS Preview
|
||||
|
||||
<details>
|
||||
<summary>Click to expand</summary>
|
||||
<img src="https://github.com/agam778/MS-365-Electron/assets/68941022/fcc24409-7e4b-4802-9f3f-a7c420c0edcb" alt="macOS Preview">
|
||||
</details>
|
||||
|
||||
# Linux
|
||||
|
||||
## 💿 Installation on Linux
|
||||
@@ -160,20 +173,8 @@ For Installing in Red Hat/Fedora based distribution :-
|
||||
sudo emerge -a ms-office-electron
|
||||
```
|
||||
|
||||
## 📸 Ubuntu Preview
|
||||
|
||||
[Click Here](https://github.com/agam778/MS-365-Electron/blob/main/Preview/Ubuntu%20Preview.png?raw=true)
|
||||
|
||||
# 💻 Developing Locally
|
||||
To build the app locally:<br>
|
||||
Run this script to automatically install `nodejs`, `yarn` and all the dependencies, and automatically start/build the app (it will show options) (Note: for Linux and macOS Only!):
|
||||
```bash
|
||||
git clone https://github.com/agam778/MS-365-Electron.git
|
||||
cd MS-365-Electron
|
||||
bash build.sh
|
||||
```
|
||||
<br>
|
||||
Or:<br>
|
||||
Run the following commands to clone the repository and install the dependencies
|
||||
|
||||
```bash
|
||||
|
||||
344
app/main.js
Normal file
@@ -0,0 +1,344 @@
|
||||
const { app, Menu, BrowserWindow, dialog, nativeImage } = require("electron");
|
||||
const { autoUpdater } = require("electron-updater");
|
||||
const checkInternetConnected = require("check-internet-connected");
|
||||
const ElectronDl = require("electron-dl");
|
||||
const contextMenu = require("electron-context-menu");
|
||||
const path = require("path");
|
||||
const log = require("electron-log");
|
||||
const { setActivity, loginToRPC, clearActivity } = require("./rpc");
|
||||
const useragents = require("./useragents.json");
|
||||
const { ElectronBlocker } = require("@cliqz/adblocker-electron");
|
||||
const { getValue } = require("./store");
|
||||
const { menulayout } = require("./menu");
|
||||
|
||||
log.transports.file.level = "verbose";
|
||||
console.log = log.log;
|
||||
Object.assign(console, log.functions);
|
||||
|
||||
function createWindow() {
|
||||
const win = new BrowserWindow({
|
||||
width: 1181,
|
||||
height: 670,
|
||||
icon: path.join(__dirname, "/assets/icons/png/1024x1024.png"),
|
||||
show: false,
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
devTools: true,
|
||||
},
|
||||
});
|
||||
|
||||
if (getValue("autohide-menubar") === "true") {
|
||||
win.setAutoHideMenuBar(true);
|
||||
} else {
|
||||
win.setAutoHideMenuBar(false);
|
||||
}
|
||||
|
||||
const splash = new BrowserWindow({
|
||||
width: 810,
|
||||
height: 610,
|
||||
transparent: true,
|
||||
frame: false,
|
||||
alwaysOnTop: true,
|
||||
icon: path.join(__dirname, "/assets/icons/png/1024x1024.png"),
|
||||
});
|
||||
|
||||
splash.loadURL(`https://agam778.github.io/MS-365-Electron/loading`);
|
||||
win.loadURL(
|
||||
`${getValue("enterprise-or-normal") || "https://microsoft365.com/?auth=1"}`,
|
||||
{
|
||||
userAgent: getValue("useragentstring") || useragents.Windows,
|
||||
}
|
||||
);
|
||||
|
||||
win.webContents.on("did-finish-load", () => {
|
||||
splash.destroy();
|
||||
win.show();
|
||||
if (getValue("discordrpcstatus") === "true") {
|
||||
setActivity(`On "${win.webContents.getTitle()}"`);
|
||||
}
|
||||
if (getValue("blockadsandtrackers") === "true") {
|
||||
ElectronBlocker.fromPrebuiltAdsAndTracking(fetch).then((blocker) => {
|
||||
blocker.enableBlockingInSession(win.webContents.session);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ElectronDl({
|
||||
dlPath: "./downloads",
|
||||
onStarted: (item) => {
|
||||
BrowserWindow.getAllWindows().forEach((window) => {
|
||||
window.setOverlayIcon(
|
||||
__dirname + "/assets/icons/download.png",
|
||||
"Downloading"
|
||||
);
|
||||
});
|
||||
dialog.showMessageBox({
|
||||
type: "info",
|
||||
title: "Downloading File",
|
||||
message: `Downloading "${item.getFilename()}" to "${item.getSavePath()}"`,
|
||||
buttons: ["OK"],
|
||||
});
|
||||
},
|
||||
onCompleted: () => {
|
||||
BrowserWindow.getAllWindows().forEach((window) => {
|
||||
window.setOverlayIcon(
|
||||
__dirname + "/assets/icons/download-success.png",
|
||||
"Download Successful"
|
||||
);
|
||||
});
|
||||
dialog.showMessageBox({
|
||||
type: "info",
|
||||
title: "Download Completed",
|
||||
message: `Downloading Completed! Please check your "Downloads" folder.`,
|
||||
buttons: ["OK"],
|
||||
});
|
||||
setTimeout(() => {
|
||||
BrowserWindow.getAllWindows().forEach((window) => {
|
||||
window.setOverlayIcon(null, "");
|
||||
});
|
||||
}, 7000);
|
||||
},
|
||||
onError: (item) => {
|
||||
dialog.showMessageBox({
|
||||
type: "error",
|
||||
title: "Download failed",
|
||||
message: `Downloading "${item.getFilename()}" failed :(`,
|
||||
buttons: ["OK"],
|
||||
});
|
||||
BrowserWindow.getAllWindows().forEach((window) => {
|
||||
window.setOverlayIcon(
|
||||
__dirname + "/download-fail.png",
|
||||
"Download Failed"
|
||||
);
|
||||
});
|
||||
setTimeout(() => {
|
||||
BrowserWindow.getAllWindows().forEach((window) => {
|
||||
window.setOverlayIcon(null, "");
|
||||
});
|
||||
}, 7000);
|
||||
},
|
||||
});
|
||||
|
||||
contextMenu({
|
||||
showInspectElement: false,
|
||||
showServices: false,
|
||||
});
|
||||
|
||||
Menu.setApplicationMenu(Menu.buildFromTemplate(menulayout));
|
||||
|
||||
app.on("ready", () => {
|
||||
createWindow();
|
||||
});
|
||||
|
||||
app.on("web-contents-created", (event, contents) => {
|
||||
contents.setWindowOpenHandler(({ url }) => {
|
||||
if (getValue("websites-in-new-window") === "false") {
|
||||
if (url.includes("page=Download")) {
|
||||
return { action: "allow" };
|
||||
} else {
|
||||
BrowserWindow.getFocusedWindow().loadURL(url);
|
||||
if (getValue("discordrpcstatus") === "true") {
|
||||
setActivity(
|
||||
`On "${BrowserWindow.getFocusedWindow().webContents.getTitle()}"`
|
||||
);
|
||||
}
|
||||
return { action: "deny" };
|
||||
}
|
||||
} else {
|
||||
if (getValue("discordrpcstatus") === "true") {
|
||||
setActivity(
|
||||
`On "${BrowserWindow.getFocusedWindow().webContents.getTitle()}"`
|
||||
);
|
||||
}
|
||||
return { action: "allow" };
|
||||
}
|
||||
});
|
||||
contents.on("did-finish-load", () => {
|
||||
if (getValue("dynamicicons") === "true") {
|
||||
if (BrowserWindow.getFocusedWindow()) {
|
||||
if (
|
||||
BrowserWindow.getFocusedWindow()
|
||||
.webContents.getURL()
|
||||
.includes("&ithint=file%2cpptx")
|
||||
) {
|
||||
if (process.platform === "darwin") {
|
||||
app.dock.setIcon(
|
||||
path.join(__dirname, "../assets/icons/apps/powerpoint-mac.png")
|
||||
);
|
||||
} else if (process.platform === "win32") {
|
||||
let nimage = nativeImage.createFromPath(
|
||||
path.join(__dirname, "../assets/icons/apps/powerpoint.png")
|
||||
);
|
||||
BrowserWindow.getAllWindows().forEach((window) => {
|
||||
window.setOverlayIcon(nimage, "PowerPoint");
|
||||
});
|
||||
}
|
||||
} else if (
|
||||
BrowserWindow.getFocusedWindow()
|
||||
.webContents.getURL()
|
||||
.includes("&ithint=file%2cdocx")
|
||||
) {
|
||||
if (process.platform === "darwin") {
|
||||
app.dock.setIcon(
|
||||
path.join(__dirname, "../assets/icons/apps/word-mac.png")
|
||||
);
|
||||
} else if (process.platform === "win32") {
|
||||
let nimage = nativeImage.createFromPath(
|
||||
path.join(__dirname, "../assets/icons/apps/word.png")
|
||||
);
|
||||
BrowserWindow.getAllWindows().forEach((window) => {
|
||||
window.setOverlayIcon(nimage, "Word");
|
||||
});
|
||||
}
|
||||
} else if (
|
||||
BrowserWindow.getFocusedWindow()
|
||||
.webContents.getURL()
|
||||
.includes("&ithint=file%2cxlsx")
|
||||
) {
|
||||
if (process.platform === "darwin") {
|
||||
app.dock.setIcon(
|
||||
path.join(__dirname, "../assets/icons/apps/excel-mac.png")
|
||||
);
|
||||
} else if (process.platform === "win32") {
|
||||
let nimage = nativeImage.createFromPath(
|
||||
path.join(__dirname, "../assets/icons/apps/excel.png")
|
||||
);
|
||||
BrowserWindow.getAllWindows().forEach((window) => {
|
||||
window.setOverlayIcon(nimage, "Excel");
|
||||
});
|
||||
}
|
||||
} else if (
|
||||
BrowserWindow.getFocusedWindow()
|
||||
.webContents.getURL()
|
||||
.includes("outlook.live.com")
|
||||
) {
|
||||
if (process.platform === "darwin") {
|
||||
app.dock.setIcon(
|
||||
path.join(__dirname, "../assets/icons/apps/outlook-mac.png")
|
||||
);
|
||||
} else if (process.platform === "win32") {
|
||||
let nimage = nativeImage.createFromPath(
|
||||
path.join(__dirname, "../assets/icons/apps/outlook.png")
|
||||
);
|
||||
BrowserWindow.getAllWindows().forEach((window) => {
|
||||
window.setOverlayIcon(nimage, "Outlook");
|
||||
});
|
||||
}
|
||||
} else if (
|
||||
BrowserWindow.getFocusedWindow()
|
||||
.webContents.getURL()
|
||||
.includes("onedrive.live.com")
|
||||
) {
|
||||
if (process.platform === "darwin") {
|
||||
app.dock.setIcon(
|
||||
path.join(__dirname, "../assets/icons/apps/onedrive-mac.png")
|
||||
);
|
||||
} else if (process.platform === "win32") {
|
||||
let nimage = nativeImage.createFromPath(
|
||||
path.join(__dirname, "../assets/icons/apps/onedrive.png")
|
||||
);
|
||||
BrowserWindow.getAllWindows().forEach((window) => {
|
||||
window.setOverlayIcon(nimage, "OneDrive");
|
||||
});
|
||||
}
|
||||
} else if (
|
||||
BrowserWindow.getFocusedWindow()
|
||||
.webContents.getURL()
|
||||
.includes("teams.live.com")
|
||||
) {
|
||||
if (process.platform === "darwin") {
|
||||
app.dock.setIcon(
|
||||
path.join(__dirname, "../assets/icons/apps/teams-mac.png")
|
||||
);
|
||||
} else if (process.platform === "win32") {
|
||||
let nimage = nativeImage.createFromPath(
|
||||
path.join(__dirname, "../assets/icons/apps/teams.png")
|
||||
);
|
||||
BrowserWindow.getAllWindows().forEach((window) => {
|
||||
window.setOverlayIcon(nimage, "Teams");
|
||||
});
|
||||
}
|
||||
} else if (
|
||||
BrowserWindow.getFocusedWindow()
|
||||
.webContents.getURL()
|
||||
.includes("&ithint=onenote")
|
||||
) {
|
||||
if (process.platform === "darwin") {
|
||||
app.dock.setIcon(
|
||||
path.join(__dirname, "../assets/icons/apps/onenote-mac.png")
|
||||
);
|
||||
} else if (process.platform === "win32") {
|
||||
let nimage = nativeImage.createFromPath(
|
||||
path.join(__dirname, "../assets/icons/apps/onenote.png")
|
||||
);
|
||||
BrowserWindow.getAllWindows().forEach((window) => {
|
||||
window.setOverlayIcon(nimage, "OneNote");
|
||||
});
|
||||
}
|
||||
} else {
|
||||
if (process.platform === "darwin") {
|
||||
app.dock.setIcon(null);
|
||||
} else {
|
||||
BrowserWindow.getAllWindows().forEach((window) => {
|
||||
window.setOverlayIcon(null, "");
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
app.on("browser-window-created", (event, window) => {
|
||||
window.webContents.on("did-finish-load", () => {
|
||||
if (getValue("discordrpcstatus") === "true") {
|
||||
setActivity(`On "${window.webContents.getTitle()}"`);
|
||||
}
|
||||
});
|
||||
if (getValue("blockadsandtrackers") === "true") {
|
||||
ElectronBlocker.fromPrebuiltAdsAndTracking(fetch).then((blocker) => {
|
||||
blocker.enableBlockingInSession(window.webContents.session);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
app.on("window-all-closed", () => {
|
||||
if (process.platform !== "darwin") {
|
||||
app.quit();
|
||||
}
|
||||
if (process.platform === "darwin") {
|
||||
app.dock.setIcon(null);
|
||||
}
|
||||
clearActivity();
|
||||
});
|
||||
|
||||
app.on("activate", () => {
|
||||
if (BrowserWindow.getAllWindows().length === 0) {
|
||||
createWindow();
|
||||
}
|
||||
});
|
||||
|
||||
app.on("ready", function () {
|
||||
checkInternetConnected().catch(() => {
|
||||
const options = {
|
||||
type: "warning",
|
||||
buttons: ["Ok"],
|
||||
defaultId: 2,
|
||||
title: "Warning",
|
||||
message: "You appear to be offline!",
|
||||
detail:
|
||||
"Please check your Internet Connectivity. This app cannot run without an Internet Connection!",
|
||||
};
|
||||
dialog.showMessageBox(null, options, (response) => {
|
||||
console.log(response);
|
||||
});
|
||||
});
|
||||
if (getValue("autoupdater") === "true") {
|
||||
autoUpdater.checkForUpdatesAndNotify();
|
||||
}
|
||||
if (getValue("discordrpcstatus") === "true") {
|
||||
loginToRPC();
|
||||
setActivity(`Opening Microsoft 365...`);
|
||||
}
|
||||
});
|
||||
1229
app/menu.js
Normal file
57
app/rpc.js
Normal file
@@ -0,0 +1,57 @@
|
||||
const { Client } = require("@xhayper/discord-rpc");
|
||||
const { dialog, BrowserWindow } = require("electron");
|
||||
const { setValue } = require("./store");
|
||||
|
||||
const client = new Client({
|
||||
clientId: "942637872530460742",
|
||||
});
|
||||
|
||||
async function rpcError(status) {
|
||||
const rpcerror = dialog.showMessageBoxSync(BrowserWindow.getFocusedWindow(), {
|
||||
type: "error",
|
||||
title: "Discord RPC Error",
|
||||
message: `Oops! An Error occured while ${status} Discord RPC.`,
|
||||
buttons: ["Close", "Disable Discord RPC"],
|
||||
});
|
||||
|
||||
if (rpcerror === 1) {
|
||||
setValue("discordrpcstatus", "false");
|
||||
}
|
||||
}
|
||||
|
||||
async function clearActivity() {
|
||||
await client.user?.clearActivity().catch((err) => {
|
||||
rpcError("clearing");
|
||||
console.error(err);
|
||||
});
|
||||
}
|
||||
|
||||
async function setActivity(details) {
|
||||
if (!client.user) {
|
||||
await loginToRPC();
|
||||
}
|
||||
await client.user
|
||||
?.setActivity({
|
||||
details: details,
|
||||
startTimestamp: Date.now(),
|
||||
largeImageKey: "icon",
|
||||
largeImageText: "MS-365-Electron",
|
||||
})
|
||||
.catch((err) => {
|
||||
rpcError("setting");
|
||||
console.error(err);
|
||||
});
|
||||
}
|
||||
|
||||
async function loginToRPC() {
|
||||
await client.login().catch((err) => {
|
||||
rpcError("logging into");
|
||||
console.error(err);
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
clearActivity,
|
||||
setActivity,
|
||||
loginToRPC,
|
||||
};
|
||||
21
app/store.js
Normal file
@@ -0,0 +1,21 @@
|
||||
const Store = require("electron-store");
|
||||
const store = new Store();
|
||||
|
||||
function getValue(key) {
|
||||
return store.get(key);
|
||||
}
|
||||
|
||||
function setValue(key, value) {
|
||||
store.set(key, value);
|
||||
}
|
||||
|
||||
function getValueOrDefault(key, defaultValue) {
|
||||
const value = store.get(key);
|
||||
if (value === undefined) {
|
||||
store.set(key, defaultValue);
|
||||
return defaultValue;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
module.exports = { getValue, setValue, getValueOrDefault };
|
||||
5
app/useragents.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"Windows": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
|
||||
"macOS": "Mozilla/5.0 (Macintosh; Intel Mac OS X 13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
|
||||
"Linux": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"
|
||||
}
|
||||
BIN
assets/about.png
Normal file
|
After Width: | Height: | Size: 228 KiB |
|
Before Width: | Height: | Size: 2.2 MiB After Width: | Height: | Size: 2.2 MiB |
BIN
assets/icons/apps/excel-mac.png
Normal file
|
After Width: | Height: | Size: 207 KiB |
BIN
assets/icons/apps/excel.png
Normal file
|
After Width: | Height: | Size: 37 KiB |
BIN
assets/icons/apps/onedrive-mac.png
Normal file
|
After Width: | Height: | Size: 208 KiB |
BIN
assets/icons/apps/onedrive.png
Normal file
|
After Width: | Height: | Size: 28 KiB |
BIN
assets/icons/apps/onenote-mac.png
Normal file
|
After Width: | Height: | Size: 203 KiB |
BIN
assets/icons/apps/onenote.png
Normal file
|
After Width: | Height: | Size: 30 KiB |
BIN
assets/icons/apps/outlook-mac.png
Normal file
|
After Width: | Height: | Size: 218 KiB |
BIN
assets/icons/apps/outlook.png
Normal file
|
After Width: | Height: | Size: 57 KiB |
BIN
assets/icons/apps/powerpoint-mac.png
Normal file
|
After Width: | Height: | Size: 210 KiB |
BIN
assets/icons/apps/powerpoint.png
Normal file
|
After Width: | Height: | Size: 52 KiB |
BIN
assets/icons/apps/teams-mac.png
Normal file
|
After Width: | Height: | Size: 215 KiB |
BIN
assets/icons/apps/teams.png
Normal file
|
After Width: | Height: | Size: 41 KiB |
BIN
assets/icons/apps/word-mac.png
Normal file
|
After Width: | Height: | Size: 208 KiB |
BIN
assets/icons/apps/word.png
Normal file
|
After Width: | Height: | Size: 36 KiB |
|
Before Width: | Height: | Size: 209 KiB After Width: | Height: | Size: 209 KiB |
|
Before Width: | Height: | Size: 1.7 MiB After Width: | Height: | Size: 1.7 MiB |
|
Before Width: | Height: | Size: 1.6 MiB After Width: | Height: | Size: 1.6 MiB |
224
build.sh
@@ -1,224 +0,0 @@
|
||||
#!/bin/bash
|
||||
# This script helps you to start/build the MS-Office-Electron app
|
||||
if ! [ -x "$(command -v node)" ]; then
|
||||
echo 'Error: nodejs is not installed.' >&2
|
||||
echo 'Installing nodejs now; this may take a while.'
|
||||
if [ "$(uname)" == "Linux" ]; then
|
||||
if [ "$(id -u)" != "0" ]; then
|
||||
if [ -f /etc/debian_version ]; then
|
||||
curl -fsSL https://deb.nodesource.com/setup_17.x | sudo -E bash -
|
||||
sudo apt-get install -y nodejs
|
||||
sudo apt-get install rpm -y # for rpm build.
|
||||
elif [ -f /etc/redhat-release ]; then
|
||||
sudo yum install nodejs
|
||||
elif [ -f /etc/arch-release ]; then
|
||||
sudo pacman -S nodejs
|
||||
elif [ -f /etc/gentoo-release ]; then
|
||||
sudo emerge nodejs
|
||||
elif [ -f /etc/SuSE-release ]; then
|
||||
sudo zypper install nodejs
|
||||
elif [ -f /etc/fedora-release ]; then
|
||||
sudo dnf install nodejs
|
||||
elif [ -f /etc/centos-release ]; then
|
||||
sudo yum install nodejs
|
||||
elif [ -f /etc/nixos ]; then
|
||||
sudo nix-env -iA nodejs
|
||||
fi
|
||||
else
|
||||
if [ -f /etc/debian_version ]; then
|
||||
curl -fsSL https://deb.nodesource.com/setup_17.x | bash -
|
||||
apt-get install -y nodejs
|
||||
elif [ -f /etc/redhat-release ]; then
|
||||
yum install nodejs
|
||||
elif [ -f /etc/arch-release ]; then
|
||||
pacman -S nodejs
|
||||
elif [ -f /etc/gentoo-release ]; then
|
||||
emerge nodejs
|
||||
elif [ -f /etc/SuSE-release ]; then
|
||||
zypper install nodejs
|
||||
elif [ -f /etc/fedora-release ]; then
|
||||
dnf install nodejs
|
||||
elif [ -f /etc/centos-release ]; then
|
||||
yum install nodejs
|
||||
elif [ -f /etc/nixos ]; then
|
||||
nix-env -iA nodejs
|
||||
fi
|
||||
fi
|
||||
elif [ "$(uname)" == "Darwin" ]; then
|
||||
brew install node
|
||||
elif [ "$(uname)" == "MINGW32_NT-10.0" ]; then
|
||||
echo 'Error: nodejs is not installed.' >&2
|
||||
echo 'Please install nodejs manually.'
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
if ! [ -x "$(command -v yarn)" ]; then
|
||||
echo 'Error: yarn is not installed.' >&2
|
||||
echo 'Installing yarn now; this may take a while.'
|
||||
if [ "$(uname)" == "Linux" ]; then
|
||||
if [ "$(id -u)" != "0" ]; then
|
||||
if [ -f /etc/debian_version ]; then
|
||||
sudo apt-get install -y yarn
|
||||
elif [ -f /etc/redhat-release ]; then
|
||||
sudo yum install yarn
|
||||
elif [ -f /etc/arch-release ]; then
|
||||
sudo pacman -S yarn
|
||||
elif [ -f /etc/gentoo-release ]; then
|
||||
sudo emerge yarn
|
||||
elif [ -f /etc/SuSE-release ]; then
|
||||
sudo zypper install yarn
|
||||
elif [ -f /etc/fedora-release ]; then
|
||||
sudo dnf install yarn
|
||||
elif [ -f /etc/centos-release ]; then
|
||||
sudo yum install yarn
|
||||
elif [ -f /etc/nixos ]; then
|
||||
sudo nix-env -iA yarn
|
||||
fi
|
||||
else
|
||||
if [ -f /etc/debian_version ]; then
|
||||
apt-get install -y yarn
|
||||
elif [ -f /etc/redhat-release ]; then
|
||||
yum install yarn
|
||||
elif [ -f /etc/arch-release ]; then
|
||||
pacman -S yarn
|
||||
elif [ -f /etc/gentoo-release ]; then
|
||||
emerge yarn
|
||||
elif [ -f /etc/SuSE-release ]; then
|
||||
zypper install yarn
|
||||
elif [ -f /etc/fedora-release ]; then
|
||||
dnf install yarn
|
||||
elif [ -f /etc/centos-release ]; then
|
||||
yum install yarn
|
||||
elif [ -f /etc/nixos ]; then
|
||||
nix-env -iA yarn
|
||||
fi
|
||||
fi
|
||||
elif [ "$(uname)" == "Darwin" ]; then
|
||||
brew install yarn
|
||||
elif [ "$(uname)" == "MINGW32_NT-10.0" ]; then
|
||||
echo 'Error: yarn is not installed.' >&2
|
||||
echo 'Please install yarn manually.'
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -d "./.git" ]; then
|
||||
echo "Detected a cloned repository, Continuing..."
|
||||
else
|
||||
echo "Repository not found, cloning now..."
|
||||
if ! [ -x "$(command -v git)" ]; then
|
||||
echo 'Error: git is not installed.' >&2
|
||||
echo 'Installing git now; this may take a while.'
|
||||
if [ "$(uname)" == "Linux" ]; then
|
||||
if [ "$(id -u)" == "0" ]; then
|
||||
if [ -f /etc/debian_version ]; then
|
||||
apt-get install git
|
||||
elif [ -f /etc/redhat-release ]; then
|
||||
yum install git
|
||||
elif [ -f /etc/arch-release ]; then
|
||||
pacman -S git
|
||||
elif [ -f /etc/gentoo-release ]; then
|
||||
emerge git
|
||||
elif [ -f /etc/SuSE-release ]; then
|
||||
zypper install git
|
||||
elif [ -f /etc/fedora-release ]; then
|
||||
dnf install git
|
||||
elif [ -f /etc/centos-release ]; then
|
||||
yum install git
|
||||
elif [ -f /etc/nixos ]; then
|
||||
nix-env -iA git
|
||||
fi
|
||||
else
|
||||
if [ -f /etc/debian_version ]; then
|
||||
sudo apt-get install git
|
||||
elif [ -f /etc/redhat-release ]; then
|
||||
sudo yum install git
|
||||
elif [ -f /etc/arch-release ]; then
|
||||
sudo pacman -S git
|
||||
elif [ -f /etc/gentoo-release ]; then
|
||||
sudo emerge git
|
||||
elif [ -f /etc/SuSE-release ]; then
|
||||
sudo zypper install git
|
||||
elif [ -f /etc/fedora-release ]; then
|
||||
sudo dnf install git
|
||||
elif [ -f /etc/centos-release ]; then
|
||||
sudo yum install git
|
||||
elif [ -f /etc/nixos ]; then
|
||||
sudo nix-env -iA git
|
||||
fi
|
||||
fi
|
||||
elif [ "$(uname)" == "Darwin" ]; then
|
||||
brew install git
|
||||
elif [ "$(uname)" == "MINGW32_NT-10.0" ]; then
|
||||
echo 'Error: git is not installed.' >&2
|
||||
echo 'Please install git manually.'
|
||||
fi
|
||||
fi
|
||||
git clone --depth=1 https://github.com/agam778/MS-Office-Electron; cd MS-Office-Electron || echo "Failed to change directory." && return 1
|
||||
echo 'Cloned the repository'
|
||||
fi
|
||||
|
||||
clear
|
||||
echo 'Installing Dependencies'
|
||||
if [ "$(id -u)" != "0" ]; then
|
||||
sudo yarn install
|
||||
else
|
||||
yarn install
|
||||
fi
|
||||
|
||||
clear
|
||||
echo 'What do you want to do?'
|
||||
echo '1. Run the app without building'
|
||||
echo '2. Build the app'
|
||||
echo '3. Build and install the app'
|
||||
echo '4. Exit'
|
||||
echo 'Enter your choice:'; read choice;
|
||||
if [ "$choice" -eq "1" ]; then
|
||||
echo 'Running the app...'
|
||||
yarn start
|
||||
elif [ "$choice" -eq "2" ]; then
|
||||
echo 'Building the app...'
|
||||
if [ "$(id -u)" != "0" ]; then
|
||||
if [ "$(uname -m)" == "arm64" ]; then
|
||||
sudo yarn dist --arm64
|
||||
elif [ "$(uname -m)" == "x86_64" ]; then
|
||||
sudo yarn dist --x64
|
||||
fi
|
||||
else
|
||||
if [ "$(uname -m)" == "arm64" ]; then
|
||||
yarn dist --arm64
|
||||
elif [ "$(uname -m)" == "x86_64" ]; then
|
||||
yarn dist --x64
|
||||
fi
|
||||
fi
|
||||
elif [ "$choice" -eq "3" ]; then
|
||||
echo 'Building and installing the app...'
|
||||
if ! [ -f /etc/debian_version ]; then
|
||||
echo 'Error: "Build and install the app" option is only supported on Debian-based systems for now.' >&2
|
||||
exit 0
|
||||
fi
|
||||
if [ "$(id -u)" != "0" ]; then
|
||||
if [ "$(uname -m)" == "arm64" ]; then
|
||||
sudo yarn dist --arm64
|
||||
sudo apt install -y -f ./release/MS-Office-Electron*.deb
|
||||
elif [ "$(uname -m)" == "x86_64" ]; then
|
||||
sudo yarn dist --x64
|
||||
sudo apt install -y -f ./release/MS-Office-Electron*.deb
|
||||
fi
|
||||
else
|
||||
if [ "$(uname -m)" == "arm64" ]; then
|
||||
yarn dist --arm64
|
||||
apt install -y -f ./release/MS-Office-Electron*.deb
|
||||
elif [ "$(uname -m)" == "x86_64" ]; then
|
||||
yarn dist --x64
|
||||
apt install -y -f ./release/MS-Office-Electron*.deb
|
||||
fi
|
||||
fi
|
||||
elif [ "$choice" -eq "4" ]; then
|
||||
echo 'Exiting...'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo 'Finished successfully! 🎉 '
|
||||
exit 0
|
||||
@@ -1,7 +0,0 @@
|
||||
# MS-Office-Electron
|
||||
|
||||
A Microsoft Office Online Desktop Client made with Electron. Free of Cost.
|
||||
|
||||
# Website
|
||||
|
||||
Just a website for the MS-Office-Electron App, nothing much
|
||||
4398
docs/assets/css/fontawesome-all.min.css
vendored
|
Before Width: | Height: | Size: 17 KiB |
150
docs/assets/js/breakpoints.min.js
vendored
@@ -1,150 +0,0 @@
|
||||
/* breakpoints.js v1.0 | @ajlkn | MIT licensed */
|
||||
var breakpoints = (function () {
|
||||
"use strict";
|
||||
function e(e) {
|
||||
t.init(e);
|
||||
}
|
||||
var t = {
|
||||
list: null,
|
||||
media: {},
|
||||
events: [],
|
||||
init: function (e) {
|
||||
(t.list = e),
|
||||
window.addEventListener("resize", t.poll),
|
||||
window.addEventListener("orientationchange", t.poll),
|
||||
window.addEventListener("load", t.poll),
|
||||
window.addEventListener("fullscreenchange", t.poll);
|
||||
},
|
||||
active: function (e) {
|
||||
var n, a, s, i, r, d, c;
|
||||
if (!(e in t.media)) {
|
||||
if (
|
||||
(">=" == e.substr(0, 2)
|
||||
? ((a = "gte"), (n = e.substr(2)))
|
||||
: "<=" == e.substr(0, 2)
|
||||
? ((a = "lte"), (n = e.substr(2)))
|
||||
: ">" == e.substr(0, 1)
|
||||
? ((a = "gt"), (n = e.substr(1)))
|
||||
: "<" == e.substr(0, 1)
|
||||
? ((a = "lt"), (n = e.substr(1)))
|
||||
: "!" == e.substr(0, 1)
|
||||
? ((a = "not"), (n = e.substr(1)))
|
||||
: ((a = "eq"), (n = e)),
|
||||
n && n in t.list)
|
||||
)
|
||||
if (((i = t.list[n]), Array.isArray(i))) {
|
||||
if (((r = parseInt(i[0])), (d = parseInt(i[1])), isNaN(r))) {
|
||||
if (isNaN(d)) return;
|
||||
c = i[1].substr(String(d).length);
|
||||
} else c = i[0].substr(String(r).length);
|
||||
if (isNaN(r))
|
||||
switch (a) {
|
||||
case "gte":
|
||||
s = "screen";
|
||||
break;
|
||||
case "lte":
|
||||
s = "screen and (max-width: " + d + c + ")";
|
||||
break;
|
||||
case "gt":
|
||||
s = "screen and (min-width: " + (d + 1) + c + ")";
|
||||
break;
|
||||
case "lt":
|
||||
s = "screen and (max-width: -1px)";
|
||||
break;
|
||||
case "not":
|
||||
s = "screen and (min-width: " + (d + 1) + c + ")";
|
||||
break;
|
||||
default:
|
||||
s = "screen and (max-width: " + d + c + ")";
|
||||
}
|
||||
else if (isNaN(d))
|
||||
switch (a) {
|
||||
case "gte":
|
||||
s = "screen and (min-width: " + r + c + ")";
|
||||
break;
|
||||
case "lte":
|
||||
s = "screen";
|
||||
break;
|
||||
case "gt":
|
||||
s = "screen and (max-width: -1px)";
|
||||
break;
|
||||
case "lt":
|
||||
s = "screen and (max-width: " + (r - 1) + c + ")";
|
||||
break;
|
||||
case "not":
|
||||
s = "screen and (max-width: " + (r - 1) + c + ")";
|
||||
break;
|
||||
default:
|
||||
s = "screen and (min-width: " + r + c + ")";
|
||||
}
|
||||
else
|
||||
switch (a) {
|
||||
case "gte":
|
||||
s = "screen and (min-width: " + r + c + ")";
|
||||
break;
|
||||
case "lte":
|
||||
s = "screen and (max-width: " + d + c + ")";
|
||||
break;
|
||||
case "gt":
|
||||
s = "screen and (min-width: " + (d + 1) + c + ")";
|
||||
break;
|
||||
case "lt":
|
||||
s = "screen and (max-width: " + (r - 1) + c + ")";
|
||||
break;
|
||||
case "not":
|
||||
s =
|
||||
"screen and (max-width: " +
|
||||
(r - 1) +
|
||||
c +
|
||||
"), screen and (min-width: " +
|
||||
(d + 1) +
|
||||
c +
|
||||
")";
|
||||
break;
|
||||
default:
|
||||
s =
|
||||
"screen and (min-width: " +
|
||||
r +
|
||||
c +
|
||||
") and (max-width: " +
|
||||
d +
|
||||
c +
|
||||
")";
|
||||
}
|
||||
} else s = "(" == i.charAt(0) ? "screen and " + i : i;
|
||||
t.media[e] = !!s && s;
|
||||
}
|
||||
return t.media[e] !== !1 && window.matchMedia(t.media[e]).matches;
|
||||
},
|
||||
on: function (e, n) {
|
||||
t.events.push({ query: e, handler: n, state: !1 }), t.active(e) && n();
|
||||
},
|
||||
poll: function () {
|
||||
var e, n;
|
||||
for (e = 0; e < t.events.length; e++)
|
||||
(n = t.events[e]),
|
||||
t.active(n.query)
|
||||
? n.state || ((n.state = !0), n.handler())
|
||||
: n.state && (n.state = !1);
|
||||
},
|
||||
};
|
||||
return (
|
||||
(e._ = t),
|
||||
(e.on = function (e, n) {
|
||||
t.on(e, n);
|
||||
}),
|
||||
(e.active = function (e) {
|
||||
return t.active(e);
|
||||
}),
|
||||
e
|
||||
);
|
||||
})();
|
||||
!(function (e, t) {
|
||||
"function" == typeof define && define.amd
|
||||
? define([], t)
|
||||
: "object" == typeof exports
|
||||
? (module.exports = t())
|
||||
: (e.breakpoints = t());
|
||||
})(this, function () {
|
||||
return breakpoints;
|
||||
});
|
||||