altsearch links

Adds search on other sites for google, bing, and yahoo

当前为 2015-11-02 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name altsearch links
  3. // @description Adds search on other sites for google, bing, and yahoo
  4. // @version 0.1.4
  5. // @include http://www.google.com*
  6. // @include https://*.google.com*
  7. // @include http://www.google.com*
  8. // @include https://www.google.com*
  9. // @include https://duckduckgo.com*
  10. // @include http://duckduckgo.com*
  11. // @include http://www.wolframalpha.com*
  12. // @include http://www3.wolframalpha.com*
  13. // @include http://yandex.ru*
  14. // @include http://nigma.ru*
  15. // @include http://www.bing.com*
  16. // @include https://www.bing.com*
  17. // @include http://ru.wikipedia.org/w/*
  18. // @include http://nova.rambler.ru/*
  19. // @include http://rambler.ru/*
  20. // @include http://scholar.google.com*
  21. // @include http://search.yahoo.com*
  22. // @include https://search.yahoo.com*
  23. // @include http://academic.research.microsoft.com/*
  24. // @grant none
  25. // @namespace https://greasyfork.org/users/9631
  26. // ==/UserScript==
  27.  
  28. //document.addEventListener("DOMContentLoaded", function () {
  29. //had to comment this out to get it to work no idea why...
  30. var SEARCH_ON = 'Search on:';
  31. var POSITION = 'left';
  32.  
  33.  
  34.  
  35. var PLACEHOLDER_SELECTORS = '#resultStats, .sb_count, .b-wordstat__text, .searchresults b, #ext_link, #sidebar, .b-global-wrapper, #gs_ab, #left, #zero_click_wrapper, bing-summary, .bing-summary, #bing-summary';
  36. //var PLACEHOLDER_SELECTORS = '#resultStats, .sb_count, .b-wordstat__text, .searchresults b, #ext_link, #sidebar, .b-global-wrapper';
  37.  
  38. var results = document.querySelector(PLACEHOLDER_SELECTORS);
  39.  
  40. other = document.createElement('div');
  41. other.setAttribute("style", "width: 1000px; font-size: small; margin: 10px 10px 5px 159px;");
  42. if (window.location.href.indexOf("?query=") > -1) {
  43. query = window.location.href.match(/\?query=[^&]*/gi)[0].substr(7);
  44. } else if (window.location.href.indexOf("?q=") > -1) {
  45. query = window.location.href.match(/\?q=[^&]*/gi)[0].substr(3);
  46. } else {
  47. query = window.location.href.match(/\?p=[^&]*/gi)[0].substr(3);}
  48. query = query.replace(/\+filterui%3[^&^+]*/gi,"");
  49. links = "Try this search on " +
  50. "<a href =\"https://www.google.com/search?q=" + query + "\">Google</a>, " +
  51. "<a href =\"http://www.bing.com/search?q=" + query + "\">Bing</a>, " +
  52. "<a href =\"http://search.yahoo.com/search?p=" + query + "\">Yahoo</a>, " +
  53. //"<a href =\"http://web.ask.com/web?q=" + query + "\">Ask</a>, " +
  54. "<a href =\"https://duckduckgo.com/?q=" + query + "\">DuckDuckGo</a>, " +
  55. "<a href =\"http://www.wolframalpha.com/input/?i=" + query + "\">WolframAlpha</a>, " +
  56. "<a href =\"http://twitter.com/search?q=" + query + "\">Twitter</a>, " +
  57. "<a href =\"http://scholar.google.com/scholar?q=" + query + "\">Google Scholar</a>, " +
  58. "<a href =\"http://academic.research.microsoft.com/Search?query=" + query + "\">MS Academic</a>";
  59. other.innerHTML = links;
  60. results.parentNode.insertBefore(other, results);
  61. //}, false);