Version Testing

Could be any script that is still being tested.

目前为 2014-10-01 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name Version Testing
  3. // @version 0.8001
  4. // @description Could be any script that is still being tested.
  5. // @author Cristo
  6. // @include *
  7. // @grant GM_getValue
  8. // @grant GM_setValue
  9. // @copyright 2012+, You
  10. // @namespace https://greasyfork.org/users/1973
  11. // ==/UserScript==
  12.  
  13.  
  14. var FPK;
  15. if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1) {
  16. FPK = 61;
  17. } else {
  18. FPK = 187;
  19. }
  20.  
  21. document.addEventListener("keydown", function(i) {
  22. if (i.keyCode == 192) {//~ Launchs Search
  23. launchIt();
  24. }
  25. if (i.keyCode == FPK) {//+ Adds terms
  26. var wordBank = prompt("Please enter search term to add");
  27. GM_setValue("search term", wordBank);
  28. }}, false);
  29. function launchIt() {
  30. var lighted = window.getSelection().toString();
  31. var newWidth;
  32. var newLeft;
  33. if (window.screenX > (screen.width - (window.screenX + window.outerWidth))) {
  34. newWidth = window.screenX;
  35. newLeft = "0";
  36. } else {
  37. newWidth = screen.width - (window.screenX + window.outerWidth);
  38. newLeft = window.screenX + window.outerWidth;
  39. }
  40. if (newWidth < screen.width/3) {
  41. window.open("http://www.google.com/search?q="+ lighted + " " + GM_getValue("search term"));
  42. } else {
  43. var windowTo = 'width=' + newWidth;
  44. windowTo += ', height=' + screen.height;
  45. windowTo += ', top=' + "0";
  46. windowTo += ', left=' + newLeft;
  47. window.open("http://www.google.com/search?q="+ lighted + " " + GM_getValue("search term"), "name", windowTo);
  48. }
  49. }