-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 72b1e34
Showing
11 changed files
with
7,004 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
WEB_EXT_API_KEY= | ||
WEB_EXT_API_SECRET= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.env | ||
node_modules/ | ||
web-ext-artifacts/ | ||
.web-extension-id |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
# NUTabs | ||
|
||
A browser extension which allows students to open job postings in a new tab since NUworks/Symplicity doesn't make this possible currently on the [Job Search Page](https://northeastern-csm.symplicity.com/students/app/jobs/search). | ||
|
||
Works by replacing the job title `div` tags with `anchor` tags and linking them to where the job posting link would be. | ||
|
||
Previous Behavior: | ||
|
||
![Previous Behavior](https://media.giphy.com/media/hGDkI9xANHf7PRc2H1/giphy.gif) | ||
|
||
With Extension: | ||
|
||
![With Extension](https://media.giphy.com/media/L8TGpHcnrnwc4atwgB/giphy.gif) | ||
|
||
Tested On: | ||
|
||
- Firefox Browser Developer Edition (82.0b9 [64-bit]) | ||
- Google Chome (86.0.4240.80 [Official Build] [x86_64]) | ||
|
||
If for some reason it doesn't seem to work, try reloading the page. If it still doesn't work you can [create an issue](https://github.com/VishalRamesh50/NUTabs/issues) describing the problem. | ||
|
||
## How Do I Add This to My Browser? | ||
|
||
### Firefox | ||
|
||
1. Download the [latest release](https://github.com/VishalRamesh50/NUTabs/releases/latest) `nutabs-version-an+fx.xpi` file from GitHub releases. If you download this while you're using Firefox it should ask you to add the extension right there. Give it permission to allow GitHub to install the extension, proceed, and you're done! If it didn't ask this, follow the next steps. | ||
2. Open Firefox and type `about:addons` in your address bar. | ||
3. Either drag and drop your `.xpi` file in the browser or click the gear icon for settings in the top right > Install add-on From File... and select the `.xpi` file. | ||
4. Click the Add button when prompted. | ||
|
||
### Google Chrome | ||
|
||
1. Download the [latest release](https://github.com/VishalRamesh50/NUTabs/releases/latest) `nutabs-version.zip` file from GitHub releases. | ||
2. Open Google Chrome and type `chrome://extensions/` in your address bar. | ||
3. Make sure Developer Mode is toggled on in the top right. | ||
4. Drag and drop the `.zip` file onto the browser and you're done! \ | ||
_If you see the warning/error:_ `Unrecognized manifest key: 'browser_specific_settings'` _you can safely ignore this. It will still work._ | ||
|
||
## How to Test Locally | ||
|
||
_These notes are only if you are trying to develop for this extension. Ignore otherwise._ | ||
|
||
### Firefox | ||
|
||
1. Install all dependencies | ||
|
||
```sh | ||
npm install | ||
``` | ||
|
||
2. Run the extension with the right version of firefox. | ||
|
||
```sh | ||
npm run start[:nightly|:beta|:dev] | ||
``` | ||
|
||
This means that if you want to run with the normal Firefox version you can do | ||
|
||
```sh | ||
npm run start | ||
``` | ||
|
||
but if you want to run with a different version, for example, the DeveloperEdition Build you need to use | ||
|
||
```sh | ||
npm run start:dev | ||
``` | ||
|
||
3. That's it! Any changes you make and save to the extension file should be reflected in the browser automatically. | ||
|
||
Alternatively you could add it as a [temporary extension](https://extensionworkshop.com/documentation/develop/temporary-installation-in-firefox/) and test it that way. | ||
|
||
### Google Chrome | ||
|
||
Follow the steps to [add the extension normally](#google-chrome) but use the current working directory instead of the `.zip` file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// Whenever a response from the job API is gotten, assume a job search has been | ||
// performed and tell the content script to add its script to the page. | ||
chrome.runtime.onConnect.addListener((p) => { | ||
chrome.webRequest.onResponseStarted.addListener(() => p.postMessage({}), { | ||
urls: ["https://northeastern-csm.symplicity.com/api/v2/jobs*"], | ||
types: ["xmlhttprequest"], | ||
}); | ||
}); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
const SCRIPT_ID = "nutabs-script"; | ||
const BASE_URL = | ||
"https://northeastern-csm.symplicity.com/students/app/jobs/search"; | ||
const addJobLinks = () => { | ||
// only attempt to do anything if it is on the base URL | ||
if (!location.href.startsWith(BASE_URL)) { | ||
return; | ||
} | ||
console.debug("NUTabs Script Triggered"); | ||
// remove an instance of a previously inserted NUTabs script if it exists | ||
const prevScript = document.getElementById(SCRIPT_ID); | ||
if (prevScript !== null) { | ||
prevScript.remove(); | ||
} | ||
const s = document.createElement("script"); | ||
s.type = "text/javascript"; | ||
s.id = SCRIPT_ID; | ||
const code = ` | ||
(function getJobElements() { | ||
const noJobResults = document.getElementsByClassName("empty-state ng-scope").length !== 0; | ||
const loadingBar = document.getElementById('loading-bar'); | ||
const jobElements = document.getElementsByClassName('list-item-body') || []; | ||
/* Wait for job results to appear. | ||
If there are no results for this search result stop waiting. */ | ||
if ((jobElements.length === 0 || loadingBar) && !noJobResults) { | ||
setTimeout(getJobElements, 1000); | ||
} else { | ||
/* Replace all job title with an anchor tags and add the job URLs to it */ | ||
for (const job of jobElements) { | ||
const jobID = angular.element(job).scope().$ctrl.job.job_id; | ||
const jobURL = "https://northeastern-csm.symplicity.com/students/app/jobs/detail/" + jobID; | ||
const orgHTML = job.outerHTML.substring(4, job.outerHTML.length - 6); | ||
const newHTML = "<a id='nutabs' href=" + '"' + jobURL + '"' + orgHTML + "</a>"; | ||
job.outerHTML = newHTML; | ||
} | ||
} | ||
})();`; | ||
// add script to page | ||
try { | ||
s.append(document.createTextNode(code)); | ||
(document.head || document.documentElement).appendChild(s); | ||
} catch (e) { | ||
console.error(e); | ||
s.text = code; | ||
document.body.appendChild(s); | ||
} | ||
}; | ||
|
||
// Whenever the background script says a job search was performed execute the job script | ||
chrome.runtime.connect({ name: "nutabs" }).onMessage.addListener(addJobLinks); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"manifest_version": 2, | ||
"name": "NUTabs", | ||
"version": "0.1.0", | ||
"description": "Adds ability to open job postings from NUworks in a new tab.", | ||
"icons": { | ||
"512": "icons/new-tab.png" | ||
}, | ||
"content_scripts": [ | ||
{ | ||
"matches": [ | ||
"https://northeastern-csm.symplicity.com/students/app/jobs/*" | ||
], | ||
"js": ["jobTabs.js"] | ||
} | ||
], | ||
"background": { | ||
"scripts": ["background.js"] | ||
}, | ||
"browser_specific_settings": { | ||
"gecko": { | ||
"update_url": "https://raw.githubusercontent.com/VishalRamesh50/NUTabs/master/updates.json" | ||
} | ||
}, | ||
"permissions": [ | ||
"webRequest", | ||
"https://northeastern-csm.symplicity.com/students/app/jobs/*" | ||
] | ||
} |
Oops, something went wrong.