MyFirstUserScript_Aaron

testing SNOW

Versión del día 20/08/2021. Echa un vistazo a la versión más reciente.

// ==UserScript==
// @name         MyFirstUserScript_Aaron
// @namespace    AaronLong
// @version      1.4
// @description  testing SNOW
// @author       AaronLong
// @match        https://sap.service-now.com/*
// @match        https://test.itsm.services.sap/*
// @match        https://itsm.services.sap/*
// @icon         https://www.google.com/s2/favicons?domain=services.sap
// ==/UserScript==

 (function() {
     'use strict';
 
 function addButton(text, clickFunc, cssObj) {
     cssObj = cssObj || {fontWeight: '600', fontSize: '14px', backgroundColor: '#00cccc', color: 'white', border: 'none', padding: '10px 20px', };
     let div = document.createElement('div');
     let button = document.createElement('button'), btnStyle = button.style	; 
     let click_att = document.createAttribute("onclick");       // Create a "class" attribute
     click_attatt.value = clickFunc;
     button.setAttributeNode(click_att)                      
     button.innerHTML = text;
     Object.keys(cssObj).forEach(key => btnStyle[key] = cssObj[key]);
     document.body.appendChild(div).appendChild(button);
     return button;
 }
 
var onclick_testFunction ="function(){alert('Testing click!!!');return false;}";

var calBtn = addButton('CalcProcessingTime',onclick_testFunction,);
 
 })();