diff --git a/following-list-tracker.user.js b/following-list-tracker.user.js index bba1ad2..1e45674 100644 --- a/following-list-tracker.user.js +++ b/following-list-tracker.user.js @@ -4,15 +4,23 @@ // @match https://cohost.org/rc/project/following* // @grant GM.getValue // @grant GM.setValue -// @version 1.0 +// @version 1.1 // @author snow flurry <snow@datagirl.xyz> // @description Puts a dot next to users you follow with unread posts. // ==/UserScript== +// Changelog: +// 1.1: +// - Default to showing "unknown" followed users as unread. +// - If you want the previous setting, set "unreadForUnknown" +// to false in the script's Values tab. + (async () => { // Used by GM.getValue/GM.setValue const gmvalLastViewed = "lastViewed"; const notifyDotClass = "__x-notify-dot"; + // Whether to show "unknown" users as unread by default + const unreadForUnknown = GM.getValue("unreadForUnknown", true); // Stolen from the notification dot on the "refresh" button :3 const dotSvgPath = ` <path d="M29.9375 34.712c-4.5219 1.3518-8.8029 1.9644-12.843 @@ -108,12 +116,19 @@ const projId = liProps.project.projectId.toString(); if (!(projId in latest)) { - // No latest post! We won't show a dot, but will note this - // for later. - latest[projId] = { - id: liProps.latestPost.postId, - date: liProps.latestPost.publishedAt - }; + // No latest post! Use unreadForUnknown to figure + // out what to do. + if (unreadForUnknown) { + latest[projId] = { + id: 0, + date: "1970-01-01T00:00:00.000Z" + }; + } else { + latest[projId] = { + id: liProps.latestPost.postId, + date: liProps.latestPost.publishedAt + }; + } } if (li.querySelector(`svg.${notifyDotClass}`) != null) {