try to take over the world!
目前為
此腳本不應該直接安裝,它是一個供其他腳本使用的函式庫。欲使用本函式庫,請在腳本 metadata 寫上: // @require https://update.cn-greasyfork.org/scripts/404600/812002/My_General_Utils.js
// ==UserScript==
// @name My_General_Utils
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://greasyfork.org/en/script_versions/new
// @grant none
// ==/UserScript==
//general utils.js
//Takes strings of html elements and appendeds it to the selector
function createElements(elements, selector) {
log("createElements Enter", true);
//append element to selector
$(selector).append(elements);
}
//waits for a jQuery element to exist then runs callback function
//syntax waitForElement(jQuery selector, function onec element exists, timout in milliseconds)
function waitForElement(selector, callback) {
log("waitForElement Enter", true);
if ($(selector).length) {
callback(selector);
} else {
setTimeout(function () {
waitForElement(selector, callback);
}, ms);
}
}
//Feed class string for html elemnt, returns array of all matching elements
function arryElements(element) {
//log("arryElements Enter", true);
//Create an array of all (...) settings buttons
var elemCount = $(element).length;
var elemArr = new Array(elemCount);
elemArr = $(element).each($).toArray();
return elemArr;
}