I often email responses inline to questions. In order to differentiate my response, I like to give them a colour.
This is quite onerous in Gmail, with about 3 clicks to get a colour applied.
I would love a keyboard shortcut or browser bar on click Javascript hack to do this… so question is, how to figure this out.
1.
Javascript edit the HTML by adding the tag around the selected words
<font color="#ff9900">The words to be changed</font>
Maybe using the .wrap() function – but difficult to work out the selector for some selected text
2.
Track the Gmail function that fires when the colour is selected in the Text Styling menu
– who to track a function in Javascript? Hmmm stuck too. Then setting it off with a keyboard shortcut somehow?
- ??
Would love some help here. I am sure others would benefit from this hack too.
Best Answer
Inspired by https://stackoverflow.com/questions/5393922/javascript-replace-selection-all-browsers by @tim-down
Getting close, but needs a tweak if you see it, maybe edit my answer here:
https://jsfiddle.net/craiglambie/0em6wkz4/23/