FellowshipOne Report Queue: Auto refresh

Refreshes Page every 5 seconds until the latest report in the queue is complete. Will beep when report is complete.

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 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         FellowshipOne Report Queue: Auto refresh
// @namespace    [email protected]
// @version      0.5
// @description  Refreshes Page every 5 seconds until the latest report in the queue is complete. Will beep when report is complete.
// @author       Tony Visconti
// @match        https://reportlibrary.fellowshipone.com/ReportLibrary/ReportsQueue/Index.aspx*
// @grant        none
// ==/UserScript==

function reloadPage() {
    setTimeout(function()
      {
        window.location.href = 'https://reportlibrary.fellowshipone.com/ReportLibrary/ReportsQueue/Index.aspx?refresh=true';
      }, 5000);
}

var img = document.querySelector("#ctl00_MainContent_grdReports > tbody > tr:nth-child(2) > td:nth-child(1) > img");

if(img !== null &&(img.alt === "Pending" || img.alt === "Submitted"))
{
    console.log("Page Reloading");
    reloadPage();
}
else
{
    if(window.location.href.includes('refresh'))
    {
        console.log("Report Complete");
        document.querySelector("body").innerHTML += '<audio id="audio" src="https://www.soundjay.com/button/beep-07.wav" autoplay="true" ></audio>';
    }
}