diff options
Diffstat (limited to 'crsq.js')
-rw-r--r-- | crsq.js | 14 |
1 files changed, 6 insertions, 8 deletions
@@ -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 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]); |