Logs the dates and times of usage
이 스크립트는 직접 설치하는 용도가 아닙니다. 다른 스크립트에서 메타 지시문 // @require https://update.greasyfork.org/scripts/500217/1408738/logUsage.js을(를) 사용하여 포함하는 라이브러리입니다.
// ==UserScript==
// @name logUsage
// @namespace http://tampermonkey.net/
// @version 1.0
// @description Logs the dates and times of usage
// @author IgnaV
// IMPORTANT. Remember to add these lines to your main script:
// @grant GM_getValue
// @grant GM_setValue
// ==/UserScript==
function logUsage(maxRecords = 10) {
const key = 'logUsage';
const currentDateTime = new Date().toISOString().slice(0, 19).replace('T', ' ');
let data = GM_getValue(key, []);
data.push(currentDateTime);
if (data.length > maxRecords) {
data = data.slice(data.length - maxRecords);
}
GM_setValue(key, data);
};