DuckDuckGo - Add Google links with current query

当前为 2018-01-24 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name DuckDuckGo - Add Google links with current query
  3. // @namespace Violentmonkey Scripts
  4. // @description:en Adds Google links with current query used at DuckDuckGo (for faster and more comfortable way to check alternative search results)
  5. // @match https://duckduckgo.com/?*
  6. // @grant none
  7. // @version 0.9
  8. // ==/UserScript==
  9.  
  10. var query = '' + document.forms.x.q.value;
  11. var ds = document.getElementById('duckbar_static');
  12. var link = document.createElement('a');
  13.  
  14. link.innerHTML = 'Google';
  15. link.href = 'https://www.google.com/search?q=' + encodeURIComponent(query);
  16. link.style.verticalAlign = 'top';
  17. link.style.fontWeight = "bold";
  18. //wdt.parentNode.parentNode.insertBefore(link, wdt.parentNode);
  19. var link2 = link.cloneNode();
  20. link2.innerHTML = 'Google';
  21. link2.style.position = 'fixed';
  22. link2.style.right = "110px";
  23. link2.style.bottom = "20px";
  24. link2.style.zIndex = "11";
  25. link2.style.fontSize = "xx-large";
  26.  
  27. ds.parentNode.appendChild(link);
  28. document.body.appendChild(link2);