Betty

A user script that assists in finding open directories with Google.

目前为 2017-02-25 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name Betty
  3. // @namespace autostart.ini@gmail.com
  4. // @author Ali Abdulkadir (sgeto)
  5. // @version 0.6.5
  6. // @license GPL version 3 or any later version; http://www.gnu.org/licenses/gpl-3.0.txt
  7. // @description A user script that assists in finding open directories with Google.
  8. // @copyright Ali Abdulkadir (sgeto), Jorge Frisancho (teocci), jO9GEc
  9. // @icon https://raw.githubusercontent.com/sgeto/Betty/master/betty-space%20invader%20emoji.png
  10. // @homepage Pax Adiutor
  11. // @homepageURL https://goo.gl/DrRSGH
  12. // @contributionURL https://github.com/sgeto/Betty
  13. // @include https://*.google.*
  14. // @exclude https://*.images.google.*
  15. // @exclude https://*.video.google.*
  16. // @run-at document-end
  17. // @require http://cdnjs.cloudflare.com/ajax/libs/jquery/1.8.3/jquery.min.js
  18. // @grant GM_xmlhttpRequest
  19. // ==/UserScript==
  20.  
  21. //this will allow normal web queries
  22. var oldSubmit = document.getElementById('tsf').onsubmit;
  23. document.getElementById('tsf').onsubmit = function() {
  24. oldSubmit();
  25. };
  26. function newradio(nametext, dorkvalue) {
  27. var search = document.getElementsByName('f') [0];
  28. var sometext = document.createTextNode(nametext);
  29. var someradio = document.createElement('input');
  30. someradio.setAttribute('type', 'radio');
  31. someradio.setAttribute('name', 'q');
  32. someradio.setAttribute('value', dorkvalue);
  33. if (nametext === 'Web') {
  34. someradio.setAttribute('checked', 'checked');
  35. }
  36. search.appendChild(someradio);
  37. search.appendChild(sometext);
  38. }
  39. // I have no idea what this is doing.
  40. function newselect(nametext, dork) {
  41. var newoption = document.createElement('option');
  42. newoption.setAttribute('value', dork);
  43. newoption.innerHTML = nametext;
  44. s.appendChild(newoption);
  45. }
  46. //If I add more options, I'll eventually need to find a way to add a column break. There's also a max character limit for google searches that need to be taken care of for longer queries
  47. if ((document.title === 'Google')) {
  48. document.getElementsByName('q') [0].focus();
  49. newradio('Web', '');
  50. newradio('Music', '+(mp3|wav|ac3|ogg|flac|wma|m4a) -inurl:(jsp|pl|php|html|aspx|htm|cf|shtml) intitle:index.of "last modified" -inurl:(listen77|mp3raid|mp3toss|mp3drug|index_of|wallywashis)');
  51. newradio('Movie/TV', '+(mkv|mp4|avi|mov|mpg|wmv) -inurl:(jsp|pl|php|html|aspx|htm|cf|shtml) intitle:index.of "last modified" -inurl:(listen77|mp3raid|mp3toss|mp3drug|index_of|wallywashis)');
  52. newradio('Undefined', 'intitle:"index of" -inurl:(jsp|pl|php|html|aspx|htm|cf|shtml) -inurl:(listen77|mp3raid|mp3toss|mp3drug|index_of|wallywashis)');
  53. newradio('Archive', '+(rar|zip|tar|tgz|7zip|iso|cso|gz|7z|bz2|gzip) intitle:"index of" -inurl:(jsp|pl|php|html|aspx|htm|cf|shtml) -inurl:(listen77|mp3raid|mp3toss|mp3drug|index_of|wallywashis)');
  54. newradio('Software/Game', '+(exe|iso|tar|msi|rar|deb|zip|apk) -inurl:(jsp|pl|php|html|aspx|htm|cf|shtml) intitle:index.of "last modified" -inurl:(listen77|mp3raid|mp3toss|mp3drug|index_of|wallywashis)');
  55. newradio('Torrent', '+(.torrent) -inurl:(listen77|mp3raid|mp3toss|mp3drug|index_of|wallywashis|trailer)');
  56. newradio('Book', '+(mobi|cbz|cbr|cbc|chm|epub|fb2|lit|lrf|odt|pdf|prc|pdb|pml|rb|rtf|tcr|doc|docx) -inurl:(jsp|pl|php|html|aspx|htm|cf|shtml) intitle:index.of "last modified" -inurl:(listen77|mp3raid|mp3toss|mp3drug|index_of|wallywashis)');
  57. // uncomment the following line to use the experimental Google Drive search
  58. //newradio('Google Drive (experimental)', 'site:drive.google.com -"Whoops!"');
  59. }
  60.  
  61. // add cached links next to results. Huge thanks to jO9GEc's "Direct Google"
  62. var href = location.href;
  63.  
  64. function modifyGoogle() {
  65. //expose cached links
  66. $('div[role="menu"] ol li').find('a[href^="http://webcache.googleusercontent."]' +
  67. ', a[href^="https://webcache.googleusercontent."]').each(
  68. function() {
  69. this.style.display = 'inline';
  70. $(this).closest('div.action-menu.ab_ctl, div._nBb')
  71. .after(' <a href="' + this.href.replace(/^http\:/, 'https:') +
  72. '">(https)</a> ')
  73. .after($(this));
  74. }
  75. );
  76. }
  77.  
  78. MutationObserver = window.MutationObserver || window.WebKitMutationObserver;
  79. if(MutationObserver) {
  80. var observer = new MutationObserver(function(mutations) {
  81. modifyGoogle();
  82. });
  83. //tiny delay needed for firefox
  84. setTimeout(function() {
  85. observer.observe(document.body, {
  86. childList: true,
  87. subtree: true
  88. });
  89. modifyGoogle();
  90. }, 100);
  91. }
  92. //for chrome v18-, firefox v14-, internet explorer v11-, opera v15- and safari v6-
  93. else {
  94. setInterval(function() {
  95. modifyGoogle();
  96. }, 500);
  97. }

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址