middleware.js 308 Bytes
window.addEventListener('load', function() {
  chrome.runtime.onMessage.addListener(
    function(request, sender, sendResponse) {
      if (request.selectedText === undefined) return;

      VLibrasPlugin.translate(encodeURI(request.selectedText));
    });

  chrome.runtime.sendMessage({ready: true});
});