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

Use webpack for the build step #165

Merged
merged 8 commits into from
Jul 19, 2024
Merged
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
11 changes: 10 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,13 @@ bundle/safari
.vscode

# Xcode project
xcuserdata/
xcuserdata/

# Yarn
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
# !.yarn/sdks
!.yarn/versions
39 changes: 18 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,33 @@
## Development / Building / Bundling the Extension
## Development

First, you must have [yarn](https://classic.yarnpkg.com/lang/en/docs/install) installed.

Run
Install dependencies:

```sh
yarn && yarn bundle [all | firefox | chrome | safari]
yarn install
```
at the root directory and you'll get a bundle directory that looks like this:

To develop choose your favorite browser.
```sh
yarn run dev:firefox
```
📂 bundle
└ 📁 chrome
└ 📁 firefox
└ 📁 safari
└ 🗄️ chrome.zip
└ 🗄️ firefox.zip
└ 🗄️ safari.zip
or
```sh
yarn run dev:chrome
```

## Watch for changes
This command will initialize a browser window and load the extension, watching for changes.

```sh
sudo yarn watch [firefox | chrome | safari]
```
You read to start!

The extension polls the watch webserver for changes, if the page doesn't reload automatically, reload the extension and if that doesn't work, see the service worker/background script console for errors.
## Building a bundle

## Load Extension
```sh
yarn build
```

You can bundle the extension for `Chrome`, `Firefox`, and `Safari`:
## Load a bundle

<table>
<tr>
Expand Down Expand Up @@ -60,6 +59,4 @@ You can bundle the extension for `Chrome`, `Firefox`, and `Safari`:
</ol>
</td>
</tr>
</table>

#### This respository was based on the [typefully/minimal-twitter](https://github.com/typefully/minimal-twitter) extension repository
</table>
15 changes: 10 additions & 5 deletions background.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,17 @@ const popupOptions = {
font: "on",
};

const reloadFEUPSigarraPages = () => {
chrome.tabs.query({ url: "*://sigarra.up.pt/feup/*" }, (tabs) => {
tabs.forEach((tab) => {
chrome.tabs.reload(tab.id);
});
});
}

chrome.runtime.onInstalled.addListener((object) => {
if (object.reason === "install") {
chrome.tabs.query({ url: "*://sigarra.up.pt/feup/*" }, (tabs) => {
tabs.forEach((tab) => {
chrome.tabs.reload(tab.id);
});
});
reloadFEUPSigarraPages()

if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1) {
chrome.tabs.create({
Expand All @@ -30,6 +34,7 @@ chrome.runtime.onInstalled.addListener((object) => {
}

if (object.reason === "update") {
reloadFEUPSigarraPages();
for (const opt in popupOptions) {
if (chrome.storage.local.get(opt) == null)
chrome.storage.local.set({[opt]: popupOptions[opt]});
Expand Down
256 changes: 0 additions & 256 deletions bundle-script.js

This file was deleted.

2 changes: 1 addition & 1 deletion content-scripts/src/pages/teacher_page.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {groupSectionTitleAndContent, groupChildrenBySelector, moveChildrenToAncestor, moveChildrenToAncestor, removeTwoColumnTable} from "../modules/utilities/pageUtils"
import {groupSectionTitleAndContent, groupChildrenBySelector, moveChildrenToAncestor, removeTwoColumnTable} from "../modules/utilities/pageUtils"


const publicationWebsites = {
Expand Down
24 changes: 0 additions & 24 deletions dev/background.js

This file was deleted.

Loading