Greasy Fork is available in English.
自用函数
Version au
Ce script ne doit pas être installé directement. C'est une librairie destinée à être incluse dans d'autres scripts avec la méta-directive // @require https://update.greasyfork.org/scripts/449412/1080639/Basic%20Functions.js
DoLog([LogLevel,] content[, logAsObject])
: Log message or object to console with loglevel$([this,] querySelector)
: querySelector$All([this,] querySelector)
: querySelectorAll$CrE([this,] tagName)
: createElementcopyProp(obj1, obj2, prop)
: copy prop form obj1 to obj2 if prop exist on obj1 as its own propertycopyProps(obj1, obj2, props)
: copy All obj1's own properties to obj2destroyEvent(e)
: Just stopPropagation and preventDefaultGMXHRHook(maxXHR = 5)
: Hook GM_xmlhttpRequest to make it only runs amount under maxXHR of xhrs at the same timegetUrlArgv(details)
: Get a url argument from lacation.href; Args: {url=location.href, name, dealFunc=((a)=>{return a;}), defaultValue=null} or 'name'addStyle
: Append a style text to document() with a <style> elementsaveFile(dataURL, filename)
: Save dataURL to filedownloadFile(details)
: File download function; details looks like the detail of GM_xmlhttpRequest but need name as filenamegetAPI(url = location.href)
: get '/' splited API array from a urlgetHost(url = location.href)
: get host part from a url(includes '^https://', '/$')AsyncManager()
: Manage async tasks and call onfinish callback(if exist) when all tasks finished and finishEvent is truepolyfill_replaceAll()
: A Simple String.prototype.replaceAll's polyfillrandint(min, max)
: random integer in range min -> max. Both min and max are includeddelItem(arr, delIndex)
: remove an item from arr at delIndex