All pastes #2096721 Raw Edit

RAMSS popup killer

public text v1 · immutable
#2096721 ·published 2011-12-28 05:54 UTC
rendered paste body
// ==UserScript==
// @name       RAMSS new window killer
// @namespace  aCoolNameSpace
// @version    .01
// @description  gets rid of the annoying new window 
// @include    https://courses.ryerson.ca/webapps/ccs-SASLogin-bb_bb60/links/redirectSAS.jsp
// @Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
// ==/UserScript==

function launchService(token, url) {
    killCookies();
    var expirationDate = (new Date("January 1, 1970")).toGMTString();
    document.cookie = "WebLogicSession=;path=/;domain=ryerson.ca;expires=" + expirationDate;
    document.cookie = "BB_TOKEN=" + token + ";path=/;domain=ryerson.ca";
    subWin = window.open(url, "_self");
}

function embedFunction(s) {
    document.body.appendChild(document.createElement('script'))
    .innerHTML=s.toString().replace(/([\s\S]*?return;){2}([\s\S]*)}/,'$2');
}

embedFunction(launchService);

window.onbeforeunload = function (e) {
    //RAMSS is... no comment
};

function embedFunction(s) {
    document.body.appendChild(document.createElement('script'))
    .innerHTML=s.toString().replace(/([\s\S]*?return;){2}([\s\S]*)}/,'$2');
}

embedFunction(onbeforeunload);