MediaWiki:ASBSearch.js: Difference between revisions

From HorizonXI Wiki
(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'); }); };")
 
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() {
     alert("Error copying to clipboard. Please report on our Discord.");
     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');
    });
  };