Scope Keep Alive

STOP SIGNING ME OUT!

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

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

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

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.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==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);
})();