Greasy Fork is available in English.

GMLibrary

GMLibary

Version vom 10.12.2022. Aktuellste Version

Dieses Skript sollte nicht direkt installiert werden. Es handelt sich hier um eine Bibliothek für andere Skripte, welche über folgenden Befehl in den Metadaten eines Skriptes eingebunden wird // @require https://update.greasyfork.org/scripts/456410/1127016/GMLibrary.js

// ==UserScript==
// @name         GMLibrary
// @namespace    https://greasyfork.org/users/28298
// @version      1.0
// @description  GMLibary
// @author       Jerry
// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant        GM_setClipboard
// @grant        GM_download
// @grant        GM_addStyle
// @grant        GM_notification
// @noframes
// @license      GNU GPLv3
// ==/UserScript==

// match violentmonkey supports * anywhere in url
// GM_notification requires macOS to turn on notification for browser
// https://violentmonkey.github.io/api/gm/
// https://www.tampermonkey.net/documentation.php?ext=dhdg
function addbutton(text,func,top,left,width) {
    // https://stackoverflow.com/a/1535421/2292993
    if (window.top != window.self) {
        return;
    }   //don't run on frames or iframes

    let btn = document.createElement("button");
    btn.innerHTML = text;
    document.body.appendChild(btn);
    btn.addEventListener("click", func);

    btn.style.cssText = "border-radius: 5px; border:1px solid black; background-color:#D3D3D3; height:25px; color:black";
    btn.style.position = 'absolute';
    btn.style.top = top;
    btn.style.left = left;
    if (width !== undefined) {btn.style.width = width;}
    console.log("top: " + top + " left: " + left);
}

// // must call with await in async function; otherwise not working
// function sleep(ms) {
//     setTimeout(()=>{console.log("Sleeping...");},3000);
//     return new Promise(resolve => setTimeout(resolve, ms));
// }
function sleep(millis) {
    var date = new Date();
    var curDate = null;
    do { curDate = new Date(); }
    while(curDate-date < millis);
}