MediaWiki:ASBSearch.js: Difference between revisions
From HorizonXI Wiki
Starfox9507 (talk | contribs) (Created page with "→Copy to Clipboard helper for ASBSearch: function copyURLToClipboard() { url = document.location.href; navigator.clipboard.writeText(url).then(function() { console.log('copyURLToClipboard(): Copied!'); }, function() { alert("Error copying to clipboard. Please report on our Discord."); console.log('copyURLToClipboard(): Copy error'); }); };") |
Starfox9507 (talk | contribs) No edit summary |
||
Line 6: | Line 6: | ||
navigator.clipboard.writeText(url).then(function() { | navigator.clipboard.writeText(url).then(function() { | ||
console.log('copyURLToClipboard(): Copied!'); | console.log('copyURLToClipboard(): Copied!'); | ||
mw.notify( 'Copied to Clipboard !', { autoHide: true, type: 'warn' } ); | |||
}, function() { | }, function() { | ||
mw.notify( 'Error copying to clipboard. Please report on our Discord.', { autoHide: true, type: 'error' } ); | |||
console.log('copyURLToClipboard(): Copy error'); | console.log('copyURLToClipboard(): Copy error'); | ||
}); | }); | ||
}; | }; |
Latest revision as of 16:50, 17 March 2024
/* Copy to Clipboard helper for ASBSearch */ function copyURLToClipboard() { url = document.location.href; navigator.clipboard.writeText(url).then(function() { console.log('copyURLToClipboard(): Copied!'); mw.notify( 'Copied to Clipboard !', { autoHide: true, type: 'warn' } ); }, function() { mw.notify( 'Error copying to clipboard. Please report on our Discord.', { autoHide: true, type: 'error' } ); console.log('copyURLToClipboard(): Copy error'); }); };