Run the browser userscript on file:// pages too
Test and publish / test (push) Successful in 22s
Test and publish / publish (push) Successful in 2m42s

It already matched every http and https page. Local files are labelled
"file". The version bump makes installed copies update.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-10-14 21:34:04 +01:00
co-authored by Claude Opus 5.5
parent 13602272fc
commit 230840cabd
3 changed files with 5 additions and 4 deletions
+3 -2
View File
@@ -1,9 +1,10 @@
// ==UserScript==
// @name Activity Tracker
// @namespace adam-french.co.uk/activity-tracker
// @version 1.0.0
// @version 1.1.0
// @description Records time spent on the focused tab and uploads it to the activity tracker.
// @match *://*/*
// @match file:///*
// @noframes
// @run-at document-start
// @grant GM_xmlhttpRequest
@@ -72,7 +73,7 @@
if (document.visibilityState !== 'visible' || !document.hasFocus()) return null;
if (mediaPlaying()) lastActive = now;
if (now - lastActive > c.idleMinutes * 60e3) return null;
const host = location.hostname.replace(/^www\./, '');
const host = location.protocol === 'file:' ? 'file' : location.hostname.replace(/^www\./, '');
if (!host) return null;
if (c.ignore) {
try { if (new RegExp(c.ignore, 'i').test(host)) return null; } catch (_) { /* bad regexp: ignore nothing */ }