Guys, I'm doing Chrome extension and I need:
- Get highligheted text;
- Count it and edit number in real-time;
- Get this number in popup or tooltip over mouse for 1 or few seconds.
- Maybe will have a limitation of characters like 3 or 4-digits numbers.
Please, need your help.
What I`ve got with Google and others:
For (1) I need this:
chrome.extension.onRequest.addListener(function(request, sender, sendResponse) {
if (request.method == "getSelection")
sendResponse({data: window.getSelection().toString()});
else
sendResponse({}); // snub them. });
Am I right?
For (2) I think I'd use String length but I dont understand how it
ll get text from (1) and how send it to (3).
And where'd I paste limitation code for (4)?
Thanks for help.