Skip to content

Instantly share code, notes, and snippets.

@ulternate
Last active February 9, 2022 03:36
Show Gist options
  • Save ulternate/9cbd61a3736bb09ff10266c4fad84a07 to your computer and use it in GitHub Desktop.
Save ulternate/9cbd61a3736bb09ff10266c4fad84a07 to your computer and use it in GitHub Desktop.
Tweak bitbucket comments bookmarklet
javascript:(function() { const editorWrapper = document.getElementsByClassName('ak-editor-content-area')[0]; const editor = editorWrapper.querySelectorAll('[contenteditable="true"]')[0]; const existingText = editor.textContent; const charArray = [...existingText]; const newCharArray = []; charArray.forEach((char) => { if (/[a-zA-Z]/.test(char)) { newCharArray.push(`:regional_indicator_${char.toLowerCase()}:`) } else if (/[0-9#]|10/.test(char))%20{%20switch%20(char.toLowerCase())%20{%20case%20'0':%20newCharArray.push(':zero:');%20break;%20case%20'1':%20newCharArray.push(':one:');%20break;%20case%20'2':%20newCharArray.push(':two:');%20break;%20case%20'3':%20newCharArray.push(':three:');%20break;%20case%20'4':%20newCharArray.push(':four:');%20break;%20case%20'5':%20newCharArray.push(':five:');%20break;%20case%20'6':%20newCharArray.push(':six:');%20break;%20case%20'7':%20newCharArray.push(':seven:');%20break;%20case%20'8':%20newCharArray.push(':eight:');%20break;%20case%20'9':%20newCharArray.push(':nine:');%20break;%20case%20'10':%20newCharArray.push(':keycap_ten:');%20break;%20case%20'#':%20newCharArray.push(':hash:');%20break;%20default:%20break;%20}%20}%20else%20if%20(/[%20]/.test(char))%20{%20newCharArray.push('__');%20}%20else%20{%20newCharArray.push(char);%20}%20});%20const%20newMessageString%20=%20newCharArray.join('%20');%20editor.textContent%20=%20newMessageString;%20})();
@ulternate
Copy link
Author

Change comments in the open comment field to block emoji letters like 🅰️ 🅱️

@ulternate
Copy link
Author

Example
Screen Shot 2022-02-08 at 12 48 17 pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment