Skip to content

Commit 95ff1a7

Browse files
committed
feat: Add Garmin Connect Auto-Paste UserScript
- Introduced a new UserScript "Garmin Connect - Auto-Paste on Right Click" that automatically pastes clipboard content into specific input fields on right-click. - Updated package.json to reflect dependency version changes and removed unused dependencies.
1 parent 17ed2fe commit 95ff1a7

3 files changed

Lines changed: 1199 additions & 6688 deletions

File tree

GarminAutoPaste.user.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// ==UserScript==
2+
// @name Garmin Connect - Auto-Paste on Right Click
3+
// @namespace typpi.online
4+
// @version 1.4
5+
// @description Automatically pastes clipboard content into specific input fields on right-click
6+
// @author Nick2bad4u
7+
// @match *://connect.garmin.com/*
8+
// @license UnLicense
9+
// @tag garmin
10+
// @icon https://www.google.com/s2/favicons?sz=64&domain=connect.garmin.com
11+
// @grant none
12+
// @run-at document-end
13+
// @homepageURL https://github.com/Nick2bad4u/UserStyles
14+
// @supportURL https://github.com/Nick2bad4u/UserStyles/issues
15+
16+
// @downloadURL
17+
// @updateURL
18+
// ==/UserScript==
19+
20+
(function() {
21+
'use strict';
22+
23+
document.body.addEventListener('contextmenu', async function(event) {
24+
const target = event.target;
25+
26+
// Check if right-clicked element is one of the target input fields
27+
if (target.matches('input[name="elev-gain"], input[name="elev-loss"], input[name="youtubeUrl"]')) {
28+
event.preventDefault(); // Prevent default right-click menu
29+
30+
try {
31+
// Use clipboard API to read the text and paste it
32+
const clipboardText = await navigator.clipboard.readText();
33+
target.value = clipboardText; // Paste clipboard content into the field
34+
} catch (err) {
35+
console.error('Clipboard read error:', err);
36+
alert('Failed to access clipboard. Try using Ctrl+V manually.');
37+
}
38+
}
39+
});
40+
})();

0 commit comments

Comments
 (0)