Skip to content

Instantly share code, notes, and snippets.

@markd2
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save markd2/67f643e6cafdd95a7534 to your computer and use it in GitHub Desktop.
Save markd2/67f643e6cafdd95a7534 to your computer and use it in GitHub Desktop.
var ExtractSelectedText = function() {};
ExtractSelectedText.prototype = {
run: function(options) {
var selectedText = "No Selection";
if (window.getSelection) {
selectedText = window.getSelection().getRangeAt(0).toString();
} else {
selectedText = document.getSelection().getRangeAt(0).toString();
}
var results = {
"selectedText" : selectedText
};
options.completionFunction(results);
},
finalize: function(options) {
// This method is run after the native code completes.
}
};
var ExtensionPreprocessingJS = new ExtractSelectedText
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment