Machinemetrics Reports on load click today drop down

This is an example for Machine Metrics reports, to automatically set the desired report view, hide the graph, expand two machines, and to reload the page on an interval.

目前為 2023-05-03 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Machinemetrics Reports on load click today drop down
// @namespace    https://app.machinemetrics.com/
// @version      0.11
// @description  This is an example for Machine Metrics reports, to automatically set the desired report view, hide the graph, expand two machines, and to reload the page on an interval.
// @require      https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0-alpha1/jquery.js
// @author       rickzabel
// @match        https://app.machinemetrics.com/app/reports/builder?id=3056
// @grant        none
// @license MIT
// @run-at       document-start
// ==/UserScript==

(function() {
    const myInterval = setInterval(myTimer, 3000);
    const myInterval2 = setInterval(myTimer2, 3000);

    function myTimer() {
        var x = document.querySelector('.SelectBase__MenuItem-sc-1p5n5sa-7');
        if (x != null) {

            //call function to stop timer
            myStopFunction()

            //click the dropdown for the desired date range
            document.querySelector('#today.SelectBase__MenuItem-sc-1p5n5sa-7').click();
            //document.querySelector('#last-2-days.SelectBase__MenuItem-sc-1p5n5sa-7').click();
            //document.querySelector('#last-month.SelectBase__MenuItem-sc-1p5n5sa-7').click();

        }
    }

    function myStopFunction() {
        clearInterval(myInterval);
    }

    function myTimer2() {
       var x2 = document.querySelector('#table-row-undefined div div .Cells__EntityText-sc-1o23ezk-3.bIOdKK');

        if (x2 != null) {
            //stop timer
             myStopFunction2()
        }

        //Hide the chart
        document.querySelector('#hide-chart').click();

        //expand first shift
        document.querySelector("#table-row-undefined div div .Cells__EntityText-sc-1o23ezk-3.bIOdKK").click();

        //expand 2nd shift
        document.querySelector("#table-row-undefined ~ div div div .Cells__EntityText-sc-1o23ezk-3.bIOdKK").click();
    }

    function myStopFunction2() {
        clearInterval(myInterval2);
    }


    //reload ever 24 hours
    //setTimeout(MyReload, 86400);

    //clear reload parge and cache
    function MyReload(){
        // location.reload(true)
    }

})();