summaryrefslogtreecommitdiff
path: root/crsq.js
diff options
context:
space:
mode:
authorAlex Xu (Hello71) <alex_y_xu@yahoo.ca>2018-10-04 18:57:41 -0400
committerAlex Xu (Hello71) <alex_y_xu@yahoo.ca>2018-10-04 18:57:41 -0400
commitd908f4c81e71ef7db4d086afcf72af84f34b9cdb (patch)
tree29577fed160da298ff41f4b1042158eadc2b67d4 /crsq.js
parent3fe25fa48f199538ddbdfc1c7ac8e966075b27f9 (diff)
downloadyorku-web-helper-master.tar.xz
yorku-web-helper-master.zip
Diffstat (limited to 'crsq.js')
-rw-r--r--crsq.js14
1 files changed, 6 insertions, 8 deletions
diff --git a/crsq.js b/crsq.js
index 289a739..1b1e186 100644
--- a/crsq.js
+++ b/crsq.js
@@ -34,7 +34,7 @@ xhr.onreadystatechange = function () {
// emulate document.write script
// use if statement instead of conditional operator to pacify AMO auto reviewer
var s = xhr.responseXML.body.querySelector("script").parentNode;
- if (/(?:mayaauth|mayaanyoneauth)/.test(document.cookie)) {
+ if (/(?:mayaauth|mayaanyoneauth)=/.test(document.cookie)) {
s.innerHTML = '<TABLE width="200" cellpadding="5" cellspacing="0" border="0"><TR><TD><P><a href="https://passportyork.yorku.ca/ppylogin/ppylogout"><IMG src="https://w2prod.sis.yorku.ca/WebObjects/YorkUimages/logout.gif" width="154" height="45" border="0"></a><BR><SPAN class="smallbodytext"><A href="http://www.yorku.ca/yorkweb/currentstudents/ppystudents.html">All About Passport York</A></SPAN></P></TD></TR></TABLE>';
} else {
s.innerHTML = '<TABLE border="0"><TR><TD><img src="https://w2prod.sis.yorku.ca/WebObjects/YorkUimages/passportyorksmall2.gif" width="73" height="42"></TD><TD><B>New Student?</B><BR><a href="http://www.yorku.ca/yorkweb/currentstudents/ppystudents.html">All about Passport&nbsp;York</a></TD></TR></TABLE>';
@@ -43,7 +43,7 @@ xhr.onreadystatechange = function () {
var avs = xhr
.responseXML
.evaluate(
- '//a[contains(text(), "Please click here to see availability.")]',
+ '//a[contains(text(), "Please click here to see availability")]',
xhr.responseXML.body
);
var avsa = [];
@@ -51,12 +51,10 @@ xhr.onreadystatechange = function () {
while ((av = avs.iterateNext()))
avsa.push(av);
avsa.forEach(function (av) {
- var newHref = av.href
- .replace(/(https?:\/\/[^.\/]*\.sis\.yorku\.ca\/Apps\/WebObjects\/cdm\.woa\/wa\/loginppy\?url=).*/,
- "$1" + encodeURIComponent(location.pathname + location.search + location.hash)
- );
- if (newHref != av.href)
- av.href = newHref;
+ var newSearch = av.search.replace(/url=[^&]*/,
+ "url=" + encodeURIComponent(location.pathname + location.search + location.hash));
+ if (newSearch != av.search)
+ av.search = newSearch;
});
document.body.replaceChild(xhr.responseXML.body.children[0], document.body.children[0]);