|
1 | 1 | // ==UserScript== |
2 | 2 | // @name Strava Text Auto-Selector |
3 | 3 | // @namespace typpi.online |
4 | | -// @version 1.0.8 |
| 4 | +// @version 1.0.9 |
5 | 5 | // @description Automatically selects text in specific Strava elements and displays a notification near the cursor. Also allows right-click to copy text. |
6 | 6 | // @author Nick2bad4u |
7 | 7 | // @license UnLicense |
|
10 | 10 | // @include *://*.strava.com/activities/* |
11 | 11 | // @include *://*.strava.com/athlete/training |
12 | 12 | // @icon https://www.google.com/s2/favicons?sz=64&domain=strava.com |
13 | | -// @downloadURL https://update.greasyfork.org/scripts/519370/Strava%20Text%20Auto-Selector.user.js |
14 | | -// @updateURL https://update.greasyfork.org/scripts/519370/Strava%20Text%20Auto-Selector.meta.js |
| 13 | +// @downloadURL https://update.greasyfork.org/scripts/519370/Strava%20Text%20Auto-Selector.user.js |
| 14 | +// @updateURL https://update.greasyfork.org/scripts/519370/Strava%20Text%20Auto-Selector.meta.js |
15 | 15 | // ==/UserScript== |
16 | 16 |
|
17 | 17 | (function () { |
|
37 | 37 | '#heading > div > div.row.no-margins.activity-summary-container > div.spans8.activity-summary.mt-md.mb-md > div.details-container > div > h1', |
38 | 38 | '.ride .segment-effort-detail .effort-details table, .swim .segment-effort-detail .effort-details table', |
39 | 39 | '.activity-description p:only-child', |
| 40 | + '.activity-description p:first-child', |
40 | 41 | ]; |
41 | 42 | const summarySelector = '.summaryGridDataContainer'; |
42 | 43 |
|
|
84 | 85 | // Query elements and add event listeners initially for the first three selectors |
85 | 86 | selectors.forEach((selector) => { |
86 | 87 | const elements = document.querySelectorAll(selector); |
87 | | - console.log( |
88 | | - `Found ${elements.length} elements for selector: ${selector}`, |
89 | | - ); |
| 88 | + console.log(`Found ${elements.length} elements for selector: ${selector}`); |
90 | 89 | elements.forEach(addContextMenuListener); |
91 | 90 | }); |
92 | 91 |
|
93 | 92 | // Function to handle the summaryGridDataContainer elements separately |
94 | 93 | function handleSummaryGridDataContainer() { |
95 | 94 | const elements = document.querySelectorAll(summarySelector); |
96 | | - console.log( |
97 | | - `Found ${elements.length} elements for selector: ${summarySelector}`, |
98 | | - ); |
| 95 | + console.log(`Found ${elements.length} elements for selector: ${summarySelector}`); |
99 | 96 | elements.forEach(addContextMenuListener); |
100 | 97 | } |
101 | 98 |
|
|
107 | 104 | if (node.matches(summarySelector)) { |
108 | 105 | addContextMenuListener(node); |
109 | 106 | } |
110 | | - node |
111 | | - .querySelectorAll(summarySelector) |
112 | | - .forEach(addContextMenuListener); |
| 107 | + node.querySelectorAll(summarySelector).forEach(addContextMenuListener); |
113 | 108 | } |
114 | 109 | }); |
115 | 110 | }); |
|
119 | 114 | childList: true, |
120 | 115 | subtree: true, |
121 | 116 | }); |
122 | | - console.log( |
123 | | - 'MutationObserver set up to monitor the DOM for summaryGridDataContainer.', |
124 | | - ); |
| 117 | + console.log('MutationObserver set up to monitor the DOM for summaryGridDataContainer.'); |
125 | 118 |
|
126 | 119 | // Handle existing summaryGridDataContainer elements initially |
127 | 120 | handleSummaryGridDataContainer(); |
|
0 commit comments