Skip to content

Showing an error message on invalid URLs#16

Open
shraiysh wants to merge 1 commit into
LambdaIITH:masterfrom
shraiysh:master
Open

Showing an error message on invalid URLs#16
shraiysh wants to merge 1 commit into
LambdaIITH:masterfrom
shraiysh:master

Conversation

@shraiysh

@shraiysh shraiysh commented Sep 2, 2020

Copy link
Copy Markdown

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
Comment thread src/popup/popup.js
}, function () {
if (chrome.runtime.lastError) {
switch (chrome.runtime.lastError.message) {
case "Cannot access a chrome:// URL":

Copy link
Copy Markdown
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
Copy Markdown
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?

Comment thread src/popup/popup.html
<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
Copy Markdown
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
Copy Markdown
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