widget.js 591 B

1234567891011121314151617
  1. /* This Source Code Form is subject to the terms of the Mozilla Public
  2. * License, v. 2.0. If a copy of the MPL was not distributed with this
  3. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  4. /*
  5. Listen for left and right click events and send the corresponding message
  6. to the content script.
  7. */
  8. this.addEventListener('click', function(event) {
  9. if(event.button == 0 && event.shiftKey == false)
  10. self.port.emit('left-click');
  11. if(event.button == 2 || (event.button == 0 && event.shiftKey == true))
  12. self.port.emit('right-click');
  13. event.preventDefault();
  14. }, true);