Backspace navigation fix

Backspace navigation was removed from Chrome. Well let's fix it.

目前为 2016-06-18 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @version 1.0.0
  3. // @author VeadarKin
  4. // @name Backspace navigation fix
  5. // @description Backspace navigation was removed from Chrome. Well let's fix it.
  6. // @include *
  7. // @icon http://i.imgur.com/opiNAGr.png
  8. // @namespace https://greasyfork.org/users/49201
  9. // ==/UserScript==
  10.  
  11. document.addEventListener('keydown', goMove);
  12. function goMove(e) {
  13. var el = document.activeElement;
  14. if
  15. (
  16. (el &&
  17. (el.isContentEditable ||
  18. el.localName == 'input' && el.type.match(/^(text|color|date*|email|month|number|password|range|search|tel|time|url|week)$/) ||
  19. el.localName == 'textarea')
  20. )
  21. )
  22. return;
  23. {
  24. if(e.keyCode == 8 && e.shiftKey)
  25. {
  26. window.history.forward();
  27. return;
  28. }
  29. if(e.keyCode == 8)
  30. {
  31. window.history.back();
  32. return;
  33. }
  34. }
  35. }