Skip to content

Commit

Permalink
0.1.1 (#1)
Browse files Browse the repository at this point in the history
* Replace job title div with anchor tag more reliably

- Previously the substring indices were hardcoded assuming that the element would be the unmodified div tag.
- However, the script might trigger twice on the same page thus replacing the same element twice even after it's been initially changed.
- This just happened to have no breaking consequences since it cut the string in a way such that the beginning excess from the previous anchor tag was just ignored in the HTML element and the comments towards the end of the element were the only excess cut off.
- However, that is very brittle and this regex matching is a much safer way to do this. It will only replace the div at the end and the beginning with the right information if it exists. So if it's called again, it will just return the unmodified string.

* Bump version to 0.1.1
  • Loading branch information
VishalRamesh50 authored Nov 2, 2020
1 parent fc0b797 commit f60cebf
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
4 changes: 1 addition & 3 deletions jobTabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ const addJobLinks = () => {
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;
job.outerHTML = job.outerHTML.replace(/^<div/, "<a id='nutabs' href='" + jobURL + "'").replace(new RegExp("</div>$"), "</a>");
}
}
})();`;
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "NUTabs",
"version": "0.1.0",
"version": "0.1.1",
"description": "Adds ability to open job postings from NUworks in a new tab.",
"icons": {
"512": "icons/new-tab.png"
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nutabs",
"version": "0.1.0",
"version": "0.1.1",
"description": "Bowser extension which adds ability to open job postings from NUworks in a new tab",
"main": "jobTabs.js",
"scripts": {
Expand Down
4 changes: 4 additions & 0 deletions updates.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
{
"version": "0.1.0",
"update_link": "https://github.com/VishalRamesh50/NUTabs/releases/download/0.1.0/nutabs-0.1.0-an+fx.xpi"
},
{
"version": "0.1.1",
"update_link": "https://github.com/VishalRamesh50/NUTabs/releases/download/0.1.1/nutabs-0.1.1-an+fx.xpi"
}
]
}
Expand Down

0 comments on commit f60cebf

Please sign in to comment.