Greasy Fork 支持简体中文。

libs

JavaScript 库函数,以便调用

目前為 2024-04-08 提交的版本,檢視 最新版本

此腳本不應該直接安裝,它是一個供其他腳本使用的函式庫。欲使用本函式庫,請在腳本 metadata 寫上: // @require https://update.cn-greasyfork.org/scripts/491971/1356549/libs.js

作者
Essence
版本
0.1
建立日期
2024-04-08
更新日期
2024-04-08
尺寸
1.9 KB
授權條款
未知

库函数

使用

sleep

等待毫秒数

await sleep(3000)

waitElem

等待指定元素出现时,执行回调

  const click = (elem) => {
    console.log(TAG, "人机验证的选择框", elem)
    elem.click()
  }

  waitElem("div#challenge-stage span.mark", click)

readLocalStorageValues

读取所有本地存储LocalStorage的数据,可用正则排除键

const history = readLocalStorageValues(/^Hm_lvt/)

restoreLocalStorageValues

恢复备份的JSON数据到 LocalStorage

const json = `{"a": 123, "b": "test"}`

restoreLocalStorageValues(json)

containerToRow

让容器以 flex row 显示子元素

const root = document.querySelector("body")

containerToRow(root)