您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Parse information on greasyforks.org
当前为
此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.greasyforks.org/scripts/445697/1055427/Greasy%20Fork%20API.js
Parse information on greasyforks.org
Let's start with adding @require
in your script meta section!
Add in your script this:
// @require https://greasyforks.org/scripts/SCRIPT_ID/code/index.js
So in final you are going to get something like this:
// ==UserScript==
// @name New Userscript (Example)
// @namespace -
// @description try to take over world!
// @author Example
// @include *example.com/*
// @require https://greasyforks.org/scripts/SCRIPT_ID/code/index.js
// @license GPL-3.0-or-later
// @grant none
// ==/UserScript==
Next, you need to add a variable that with equal to class GreasyFork
. Example:
const GF = new GreasyFork
Returns properties of script element if it exists, such as: Name, ID, version, language, installs etc.
var myScript = GF.parseScriptElement(document.querySelector('[data-script-id]'))
console.log(myScript.id) // some number
Returns array with script meta blocks and their values, example:
GF.parseScriptCodeMeta(`
// ==UserScript==
// @name New Userscript (Example)
// @description try to take over world!
// ==/UserScript==
`)
/* will return this:
[{
meta: "@name",
value: "New Userscript (Example)"
},
{
meta: "@description",
value: "try to take over world!"
}]
*/
Returns object with scripts, libraries and browsed script if they exist.
GF.ls()
/* will return
{
browsed: [...],
libraries: [...],
scripts: [...]
}
if function can't find elements to parse, then it returns null.
*/
This is the parent function that returns an object with different functions.
GF.get()
This is the parent function that returns an object with different functions.
GF.get().script()
install
GF.action('install', {
id: 439627,
lang: 'css'
})
signout
GF.action('signout')
Returns script code.
var code = await GF.get().script().code(437291)
console.log(code)
Note: Can be user with parseScriptCodeMeta
:
var code = await GF.get().script().code(437291)
console.log(GF.parseScriptCodeMeta(code))
Returns script versions, time of versions and descriptions.
await GF.get().script().history(437291)
Returns script feedback: rating, text and meta info.
await GF.get().script().feedback(437291)
Returns script stats (installs and update checks) in different days.
await GF.get().script().stats(437291)
Returns script information from itself main page.
await GF.get().script().info(437291)
Returns result from script set.
await GF.get().script().set(10699, {
locale: 'zh-CN',
page: 1
})
Also you can turn off locale filter:
await GF.get().script().set(10699, {
localeFilter: 0,
page: 1
})
Returns user's information such as:
ID, Nickname, scripts, libaries, script sets, recent comments etc.
await GF.get().user(824432)
Returns search result of some content types.
script
await GF.get().search('Open Redirector', 'script', {
locale: 'ro',
sort: 'daily_installs',
page: 1
})
library
await GF.get().search('Random - Lib', 'library', {
sort: 'name'
})
user
await GF.get().search('NotYou', 'user', {
asJSON: true
})
list
await GF.get().search('', 'list') // ["script", "library", "user", "list"]