22 lines
844 B
JavaScript
22 lines
844 B
JavaScript
/**
|
|
* This JavaScript function takes a string, decodes it using decodeURIComponent,
|
|
* alerts the decoded string, and copies the result to the clipboard.
|
|
*
|
|
* The function works as follows:
|
|
* 1. Takes a string as input.
|
|
* 2. Decodes the string using decodeURIComponent.
|
|
* 3. Alerts the decoded string.
|
|
* 4. Copies the decoded string to the clipboard.
|
|
*
|
|
* Note: This function uses the Clipboard API which might not be fully supported in all browsers.
|
|
*
|
|
* Requires the use of utils/bookmarkletMaker.js to generate the bookmarklet.
|
|
*/
|
|
let answer = prompt("Enter the HashID");
|
|
let decodedStr = decodeURIComponent(answer);
|
|
alert(decodedStr);
|
|
|
|
navigator.clipboard.writeText(decodedStr)
|
|
.then(() => console.log('Decoded string copied to clipboard'))
|
|
.catch(err => console.error('Error in copying decoded string to clipboard: ', err));
|