Common.Utils

Classes for your scripts

目前为 2019-10-23 提交的版本。查看 最新版本

此脚本不应直接安装,它是一个供其他脚本使用的外部库。如果您需要使用该库,请在脚本元属性加入:// @require https://update.gf.qytechs.cn/scripts/389765/743285/CommonUtils.js

作者
Anton Shevchuk
版本
0.0.3
创建于
2019-09-04
更新于
2019-10-23
大小
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 Cache();
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或关注我们的公众号极客氢云获取最新地址