shotcuts_set.js 734 B

123456789101112131415161718192021222324252627282930313233
  1. all_list = [
  2. ['F', '/'],
  3. ['C', '/recent_changes'],
  4. ['D', '/recent_discuss'],
  5. ['A', '/random']
  6. ];
  7. all_list.forEach(function(element) {
  8. shortcut.add(element[0], function() {
  9. window.location.href = element[1];
  10. }, {
  11. 'disable_in_input' : true
  12. });
  13. });
  14. all_list_2 = [
  15. ['W', '/w'],
  16. ['H', '/history'],
  17. ['E', '/edit'],
  18. ];
  19. window.onload = function () {
  20. all_list_2.forEach(function(element) {
  21. shortcut.add(element[0], function() {
  22. href_d = window.location.href.split("/");
  23. if(href_d[4]) {
  24. window.location.href = element[1] + '/' + href_d[4];
  25. }
  26. }, {
  27. 'disable_in_input' : true
  28. });
  29. });
  30. }