Skip to content

Commit 776f5c2

Browse files
committed
feat(GyazoDirectLink): enhance tooltip creation logic to prevent duplicate elements
1 parent da1b83d commit 776f5c2

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

GyazoDirectLink.user.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,18 @@
5555
'core-styles-module_show__Nt9eE',
5656
'react-tooltip__show',
5757
);
58-
tooltip.style.cssText = 'z-index: 2147483647; font-size: 14px; padding: 6px 10px; max-width: 250px; display: none; position: absolute;';
58+
tooltip.style.zIndex = '2147483647';
59+
tooltip.style.fontSize = '14px';
60+
tooltip.style.padding = '6px 10px';
61+
tooltip.style.maxWidth = '250px';
62+
tooltip.style.display = 'none';
63+
tooltip.style.position = 'absolute';
5964
tooltip.innerHTML =
6065
'Direct Link<div class="react-tooltip-arrow core-styles-module_arrow__cvMwQ styles-module_arrow__K0L3T" style="left: 38px; top: -4px;"></div>';
6166

62-
document.body.appendChild(tooltip);
67+
if (!document.getElementById('tooltip-direct-video-link-button')) {
68+
document.body.appendChild(tooltip);
69+
}
6370

6471
console.log('Tooltip element created', tooltip);
6572
return tooltip;

0 commit comments

Comments
 (0)