Run the browser userscript on file:// pages too
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:
@@ -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 */ }
|
||||
|
||||
Reference in New Issue
Block a user