您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Refactor GM_config, this version uses lz-string to access data for a Library script
当前为
此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.greatest.deepsurf.us/scripts/372760/633316/GM_config_lz-string.js
// ==UserScript== // @namespace http://tampermonkey.net/ // @exclude * // ==UserLibrary== // @name GM_config_lz-string // @description Refactor GM_config, this version uses lz-string to access data for a Library script // @author avan // @license MIT // @version 0.1 // ==/UserScript== // ==/UserLibrary== GM_configStruct.prototype.read = function (store) { var rval, cKey, dValue; try { cKey = LZString.compressToUTF16(store || this.id); dValue = LZString.decompressFromUTF16(this.getValue(cKey, '{}')); rval = this.parser(dValue); } catch(e) { this.log("GM_config failed to read saved settings!"); rval = {}; } return rval; }; GM_configStruct.prototype.write = function (store, obj) { if (!obj) { var values = {}, forgotten = {}, fields = this.fields; for (var id in fields) { var field = fields[id]; var value = field.toValue(); if (field.save) { if (value !== null) { values[id] = value; field.value = value; } else values[id] = field.value; } else forgotten[id] = value; } } try { var cKey = LZString.compressToUTF16(store || this.id), cValue = LZString.compressToUTF16(this.stringify(obj || values)); this.setValue(cKey, cValue); } catch(e) { this.log("GM_config failed to save settings!"); } return forgotten; };