Skip to content

Commit

Permalink
Fix download error, sanitized inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
Presto412 committed Oct 23, 2018
1 parent 43a0a6a commit df1d1fd
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ The source code for the chrome extension that fixes a bunch of errors and adds s

## Web Store Link

- Current Version - 3.6
- Current Version - 3.7
- Find it in the chrome web store [here](https://chrome.google.com/webstore/detail/enhancer-for-vit-vellore/hafeeaangmkbibcaahfjdmmmeappjbbp?hl=en)

## Contributing
Expand Down
6 changes: 6 additions & 0 deletions src/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ chrome.downloads.onDeterminingFilename.addListener((item, suggest) => {
facultySlotName)
) {
const title = getDownloadFileName(item.filename, item.url);
console.log(
"Filename is:",
"VIT Downloads/" + course + "/" + facultySlotName + "/" + title
);
suggest({
filename: "VIT Downloads/" + course + "/" + facultySlotName + "/" + title
});
Expand Down Expand Up @@ -149,6 +153,8 @@ chrome.webRequest.onCompleted.addListener(
* Fires when a message is received from the content script
*/
chrome.extension.onMessage.addListener(request => {
console.log("Message recd: ", request.message);

// alert("Background script has received a message from contentscript:'" + request.message + "'");
if (request.message == "YesClearCookiePls") {
chrome.cookies.remove(
Expand Down
12 changes: 6 additions & 6 deletions src/coursepage.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ const getLinkInfo = (linkElement, index) => {
if (linkParent.outerText.indexOf("_") === -1) {
const description = jQuery(linkParent)
.closest("td")
.prev()[0].innerText;
.prev()[0].innerText.trim();

const date = jQuery(linkParent)
.closest("td")
.prev()
.prev()
.prev()[0].innerText;
.prev()[0].innerText.trim();

let title = (
(index + 1).toString() +
Expand Down Expand Up @@ -74,16 +74,16 @@ const downloadFiles = type => {

const syllabusButton = jQuery(".btn-primary")[0];

const course = detailsTable[7].innerText + "-" + detailsTable[8].innerText;
const course = detailsTable[7].innerText.trim() + "-" + detailsTable[8].innerText.trim();

const facultySlotName = (
detailsTable[12].innerText +
detailsTable[12].innerText.trim() +
"-" +
detailsTable[11].innerText
detailsTable[11].innerText.trim()
).replace(/[/:*?"<>|]/g, "-");

const syllabusLink =
syllabusButton.innerText === "Download" ? syllabusButton.href : false;
syllabusButton.innerText.trim() === "Download" ? syllabusButton.href : false;

let allLinks = [...jQuery(".sexy-input")];
allLinks = allLinks
Expand Down
2 changes: 1 addition & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"manifest_version": 2,
"name": "Enhancer for VIT Vellore Academics",
"description": "Easier and user-friendly vtopbeta",
"version": "3.6",
"version": "3.7",
"author": "Priyansh Jain",
"permissions": [
"webRequest",
Expand Down

0 comments on commit df1d1fd

Please sign in to comment.