Skip to content

Conversation

@jake-378
Copy link

I figured this would be a nice addition, to someone who enters a url without the https:// part into the panic url box. This will prevent errors and any confusion by simply just adding it for them :). Without adding it, you goto an invalid url that looks like this "https://artclass.site/google.com".

Adds a check for when someone may enter just a url into the panic form that doesn't contain https://. If this happens it will add https:// to it and prevent the program from not working.

Adds a check for when someone may enter just a url into the panic form that doesn't contain https://. If this happens it will add https:// to it and prevent the program from not working.
if (localStorage.getItem('panickey') && localStorage.getItem('panickey') == e.key) window.parent.window.location.replace(localStorage.getItem('panicurl') || 'https://classroom.google.com/h')
})
let panicurl = localStorage.getItem('panicurl');
panicurl = (panicurl && (!panicurl.includes("https://") && !panicurl.includes("http://"))) ? "https://"+panicurl : panicurl;

Choose a reason for hiding this comment

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

This should be formatted better (spaces between plus, etc). I note that you could save an 'includes' statement by using a regexp and the test function. Overall could be done better, 6/10.

Copy link
Author

Choose a reason for hiding this comment

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

Okay well to be fair I wasn't competing for a coding competition and trying to minify the code to the exact required lines and pretty spaces, I was simply just pitching an idea and I also decided to stack the code on one line since it was formatted that way originally. I wasn't formatting it for read quality, and the original code was also not that way. Not like every line needs to be fully minified and perfect, i'm sure you could fine multiple errors looking in files. lol

Copy link
Author

Choose a reason for hiding this comment

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

This should be formatted better (spaces between plus, etc). I note that you could save an 'includes' statement by using a regexp and the test function. Overall could be done better, 6/10.

I also simply left the first line of the panic code the part for the listener since I was not trying to rewrite it all, just add a nice function lol

Copy link
Author

Choose a reason for hiding this comment

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

hey but at the end of the day i'm all for learning new methods and ways others do things, sorry if the first reply's came off rude.

Copy link
Author

Choose a reason for hiding this comment

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

If you can i'd be more than happy to see how you would've went about it.

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.

2 participants