Kemono访问时间记录

记录和展示上次的访问时间,仅限关注(favorites)页面

// ==UserScript==
// @name         Kemono访问时间记录
// @namespace    https://greasyfork.org/users/325815
// @version      1.5
// @description  记录和展示上次的访问时间,仅限关注(favorites)页面
// @author       monat151
// @match        http*://kemono.su/favorites*
// @match        http*://kemono.su/account/favorites/artists*
// @grant        GM_setValue
// @grant        GM_getValue
// ==/UserScript==

(function() {
    'use strict';
    const _vd_valueKey = 'kemono_monat_last_visit'

    setTimeout(() => {
        let lastVisitDate = GM_getValue(_vd_valueKey) ?? '';
        var currDate = new Date();
        let currDateString = currDate.toLocaleString();
        GM_setValue(_vd_valueKey, currDateString);
        const _element = document.createElement('div');
        _element.style = 'justify-content: center; display: grid; margin-top: 3px;'
        _element.innerHTML = `<label>- Last Visit: ${lastVisitDate} -</label>`;
        const target = document.location.href.includes('account/favorites/artists') ? document.getElementById('filter-favorites') : document.getElementsByClassName('dropdowns')[0]
        target?.after(_element)
    }, 500);
})();