Skip to content

Commit 5f07f89

Browse files
committed
feat(GyazoDirectLink): bump version to 3.5 and enhance removal logic for redirect button and tooltip
1 parent 1120daf commit 5f07f89

1 file changed

Lines changed: 12 additions & 11 deletions

File tree

GyazoDirectLink.user.js

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// ==UserScript==
22
// @name Gyazo Gif and Video Direct Link Button
33
// @namespace typpi.online
4-
// @version 3.4
4+
// @version 3.5
55
// @description Adds a link button to redirect to the direct video or gif link on Gyazo
66
// @author Nick2bad4u
77
// @license UnLicense
@@ -161,19 +161,20 @@
161161
findTargetElement();
162162
}
163163

164+
// Removes the redirect button and tooltip from the DOM if they exist
164165
function removeRedirectButton() {
165-
if (!location.href.includes('https://gyazo.com/captures')) {
166-
console.log('Not removing redirect button since not on captures page');
167-
return;
168-
}
169-
170-
console.log('Removing redirect button');
166+
console.log('Removing redirect button if it exists');
171167
const existingButton = document.getElementById('direct-video-link-button');
172-
if (existingButton !== null) {
168+
if (existingButton) {
173169
console.log('Existing button found, removing it');
174170
existingButton.remove();
175171
}
176-
console.log('Redirect button removed');
172+
const existingTooltip = document.getElementById('tooltip-direct-video-link-button');
173+
if (existingTooltip) {
174+
console.log('Existing tooltip found, removing it');
175+
existingTooltip.remove();
176+
}
177+
console.log('Redirect button and tooltip removed');
177178
}
178179

179180
function handlePageChange() {
@@ -190,7 +191,7 @@
190191
function initialize() {
191192
console.log('Initializing script');
192193

193-
// Remove any existing button to prevent duplicates
194+
// Remove any existing button and tooltip to prevent duplicates
194195
removeRedirectButton();
195196

196197
handlePageChange();
@@ -202,7 +203,7 @@
202203
console.log('URL changed from', window.scriptObserver.lastUrl, 'to', currentUrl);
203204
window.scriptObserver.lastUrl = currentUrl;
204205

205-
// Remove any existing button before handling the page change
206+
// Remove any existing button and tooltip before handling the page change
206207
removeRedirectButton();
207208
handlePageChange();
208209
}

0 commit comments

Comments
 (0)