// ==UserScript== // @name Status.io Selector 2 // @namespace https://status.io // @description Effort to simplify configuration of incidents/maintenance windows // @require http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js // @require http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.1/jquery-ui.min.js // @require https://gist.github.com/raw/2625891/waitForKeyElements.js // @grant GM_addStyle // @grant GM_setClipboard // @version 0.0.1 // ==/UserScript== //console.log($("div.clearfix.prettycheckbox.labelright.blue").filter(":contains('West US 2')") // // function getAllMethods(obj = this) { return Object.keys(obj) .filter((key) => typeof obj[key] === 'function') .map((key) => obj[key]); } var apiGroup = $("div.form-group").filter(":contains('API Service')") var authGroup = $("div.form-group").filter(":contains('Authentication')") var computeGroup = $("div.form-group").filter(":contains('Compute Service')") var jobsGroup = $("div.form-group").filter(":contains('Jobs Service')") var odbcGroup = $("div.form-group").filter(":contains('ODBC/JDBC Service')") var webappGroup = $("div.form-group").filter(":contains('User Interface')") var componentArray = [] var testObj = apiGroup.find('*').filter(":contains('canadacentral')").filter("div.clearfix.prettycheckbox.labelright.blue").children().filter("A")[0] console.log(Object.keys(testObj)) console.log(testObj) var zNode = document.createElement ('div'); zNode.innerHTML = '' + '' + '

' ; zNode.setAttribute ('id', 'myContainer'); document.body.appendChild (zNode); document.getElementById ("apiButton").addEventListener("click", apiButtonClickAction, false); //--- Activate the newly added button. document.getElementById ("canadaCentralButton").addEventListener ( "click", canadaCentralButtonClickAction, false ); document.getElementById ("jarvisButton").addEventListener ( "click", jarvisButtonClickAction, false ); document.getElementById ("ascButton").addEventListener ( "click", ascButtonClickAction, false ); document.getElementById ("kustoButton").addEventListener ( "click", kustoButtonClickAction, false ); document.getElementById ("printArrayButton").addEventListener ( "click", printArrayClickAction, false ); function checkBoxToggle(box) { if (box.getAttribute("class") == "checked") { box.setAttribute("class", "") } else { box.setAttribute("class", "checked") } } function apiButtonClickAction (zEvent) { componentArray.push(apiGroup) } function canadaCentralButtonClickAction (zEvent) { checkBoxToggle(testObj); } function jarvisButtonClickAction (zEvent) { window.open(jarvisURL, "_blank"); } function ascButtonClickAction (zEvent) { window.open(ascURL, "_blank"); } function kustoButtonClickAction (zEvent) { GM_setClipboard(template, "kusto queries"); alert(`Kusto queries for ${cluster} have been copied to clipboard!`); } function printArrayClickAction (zEvent) { console.log(componentArray) } //--- Style our newly added elements using CSS. GM_addStyle ( multilineStr ( function () {/*! #myContainer { position: fixed; bottom: 0; right: 0; font-size: 14px; background: orange; border: 3px outset black; margin: 3px; opacity: 0.7; z-index: 222; padding: 5px 5px; } #myButton { cursor: pointer; } #myContainer p { color: red; background: white; } */} ) ); function multilineStr (dummyFunc) { var str = dummyFunc.toString (); str = str.replace (/^[^\/]+\/\*!?/, '') // Strip function () { /*! .replace (/\s*\*\/\s*\}\s*$/, '') // Strip */ } .replace (/\/\/.+$/gm, '') // Double-slash comments wreck CSS. Strip them. ; return str; }