Common.Utils

Classes for your scripts

目前為 2020-07-02 提交的版本,檢視 最新版本

此腳本不應該直接安裝,它是一個供其他腳本使用的函式庫。欲使用本函式庫,請在腳本 metadata 寫上: // @require https://update.gf.qytechs.cn/scripts/389765/822474/CommonUtils.js

作者
Anton Shevchuk
版本
0.0.4
建立日期
2019-09-04
更新日期
2020-07-02
尺寸
4.8 KB
授權條款
MIT

Common Utils

Require Script

// @require https://gf.qytechs.cn/scripts/389765-common-utils/code/CommonUtils.js?version=XXX

See last available version on the GreasyFork homepage

Container

Cache

let CacheInstance = new SimpleCache();
let result = null;
if (CacheInstance.has('key')) {
  result = CacheInstance.get('key');
} else {
  result = await $.ajax('url');
  CacheInstance.set('key', result);
}

Settings

Load settings

let SettingsInstance = new Settings('script name', {'default':'settings'});

Save settings

With jQuery:

$(window).on('beforeunload', () => SettingsInstance.save() );

Tools

Copy to clipboard

Tools.copyToClipboard('some text')

Links

Author homepage: http://anton.shevchuk.name/
Script homepage: https://github.com/AntonShevchuk/common.utils
GreasyFork: https://gf.qytechs.cn/uk/scripts/389765-common-utils

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址