logUsage

Logs the dates and times of usage

目前为 2024-07-10 提交的版本。查看 最新版本

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

  1. // ==UserScript==
  2. // @name logUsage
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.0
  5. // @description Logs the dates and times of usage
  6. // @author IgnaV
  7.  
  8. // IMPORTANT. Remember to add these lines to your main script:
  9. // @grant GM_getValue
  10. // @grant GM_setValue
  11. // ==/UserScript==
  12.  
  13. function logUsage(maxRecords = 10) {
  14. const key = 'logUsage';
  15. const currentDateTime = new Date().toISOString().slice(0, 19).replace('T', ' ');
  16. let data = GM_getValue(key, []);
  17.  
  18. data.push(currentDateTime);
  19.  
  20. if (data.length > maxRecords) {
  21. data = data.slice(data.length - maxRecords);
  22. }
  23.  
  24. GM_setValue(key, data);
  25. };

QingJ © 2025

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