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 提交的版本。查看 最新版本

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

})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址