Scope Keep Alive

STOP SIGNING ME OUT!

As of 2024-05-21. See the latest version.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Scope Keep Alive
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  STOP SIGNING ME OUT!
// @author       You
// @match        https://scope.sciencecoop.ubc.ca/*
// @icon         https://scope.sciencecoop.ubc.ca/content/documents/themeUploads/2019-07-23/r16880205961767347468316334133875406397008582841013r/SCOPE_faviconr689394366556340227034068220847248902920373181207r.png
// @grant        none
// @license      MIT
// ==/UserScript==

function sleep(ms) {
    return new Promise(resolve => setTimeout(resolve, ms));
}

(function() {
    'use strict';
    console.log("Scope Keep Alive Successfully Injected");
    const refreshTime = 2 // minutes
    function makeRequest() {
        fetch("https://scope.sciencecoop.ubc.ca/keepAlive.htm?rand=" + Math.floor(10000 + Math.random() * 90000).toString(), {
            "referrerPolicy": "strict-origin-when-cross-origin",
            "body": null,
            "method": "GET",
            "mode": "cors",
            "credentials": "include"
        });
        console.log("Scope Keep Alive: Sent keep alive request")
    }
    setInterval(makeRequest, refreshTime * 60 * 1000);
})();