javascript - listen to selected text drag event in chrome extension -



javascript - listen to selected text drag event in chrome extension -

i want extension hear event when text selected (highlighted) , dragged. opening new tab dragging url tab box. have seen reply this reply gets text highlighted when icon clicked want function foo() fire automatically when text selected , dragged. can 1 help me please.

so first, you'll want create handler function:

function highlighthandler(e) { // highlighted text var text = document.getselection(); // check if highlighted if(text !== '') { // we've got highlight, stuff here dostuff(text); } }

and then, you'll need bind document:

document.onmouseup = highlighthandler;

and finally, write dostuff function want do:

function dostuff(text) { // cool }

javascript google-chrome google-chrome-extension

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -