logUsage

Logs the dates and times of usage

此腳本不應該直接安裝,它是一個供其他腳本使用的函式庫。欲使用本函式庫,請在腳本 metadata 寫上: // @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或关注我们的公众号极客氢云获取最新地址