// Menu: Spongebob Mocking! // Description: Copy, run and paste! // Author: Ambushfall // Shortcut: ctrl shift x import '@johnlindquist/kit' const str = await getSelectedText() || await clipboard.readText(); const splitStr = str.split(' ') var newString = '' for (let i = 0; i < splitStr.length; i++) { for (let j = 0; j < splitStr[i].length; j++) { // get last char index const lastIndexOfSplit = splitStr[i].length - 1; // If the index matches the current add space const addTrailingSpace = j == lastIndexOfSplit ? ' ' : '' const char = `${splitStr[i][j]}${addTrailingSpace}` const formatChar = j % 2 == 0 ? char.toLowerCase() : char.toUpperCase() newString += formatChar; } } await clipboard.writeText(newString);