Skip to content

Conversation

shraiysh
Copy link

@shraiysh shraiysh commented Sep 2, 2020

Fixes #5

@shraiysh shraiysh changed the title Showing an error message on invalid URLs. Solves #5 Showing an error message on invalid URLs Sep 2, 2020
}, function () {
if (chrome.runtime.lastError) {
switch (chrome.runtime.lastError.message) {
case "Cannot access a chrome:// URL":
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could not find error code in the chrome.runtime.lastError. Let me know if there is a better way to do this.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks fine. However, I don't see the need for both an if and a switch here. Maybe you can do some refactoring?

@@ -58,7 +58,11 @@
</head>
<body>
<div class="heading"><p>aims helper<p></div>
<p class="status" style="display: none">You are not on the AIMS Page. </p> <!-- Replace with JS checker later. -->
<p class="status" id="error-message" style="display: none;">You are probably not on the appropriate AIMS page. Goto <a
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove "probably". Add "please" before Goto.

@@ -1,4 +1,9 @@
function activate() {

if (!(document.location.href === "https://aims.iith.ac.in/aims/courseReg/studentRegForm/44")) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This URL may very well change, so use a constant variable here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Throw error if used on other websites
2 participants