PageRenderTime 43ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/javascript/searchbuttons.js

https://github.com/rickdog/chewbone
JavaScript | 133 lines | 98 code | 24 blank | 11 comment | 8 complexity | 2044651589208fd6c1a2fe4b8d937c03 MD5 | raw file
  1. // ==UserScript==
  2. // @name RYM google current album
  3. // @description open a google search window for the current artist and album
  4. // @namespace https://greasyfork.org/en/scripts/5966-rym-google-current-album
  5. // @include http://rateyourmusic.com/release/*
  6. // @version 1.9
  7. // ==/UserScript==
  8. function getSelected()
  9. {
  10. var t = '';
  11. if (window.getSelection){
  12. t = window.getSelection();
  13. } else if (document.getSelection){
  14. t = document.getSelection();
  15. } else if (document.selection){
  16. t = document.selection.createRange().text;
  17. }
  18. return t;
  19. }
  20. function quote(s) {return '"' + s + '"';}
  21. function loaded()
  22. {
  23. var $ = jQuery;
  24. var whereAppend = $($("body"));
  25. console.log(whereAppend);
  26. var sel = getSelected();
  27. function addButton(sName, url)
  28. {
  29. var sButton = '<button class="rickdog">' + sName + '</button>';
  30. var btn = $(sButton).click(function () {
  31. window.open(url, '_blank');
  32. });
  33. whereAppend.append(btn);
  34. }
  35. whereAppend.append($("<B>" + sel + "</B><br>"));
  36. addButton('Google', 'https://google.com?q=' + quote(sel));
  37. addButton('Google Blog', 'https://google.com?q=' + quote(sel) + '&tbm=blg');
  38. addButton('Google Image', 'https://www.google.com/searchbyimage?image_url=' + quote(sel));
  39. addButton('tineye', 'http://tineye.com/search?url=' + quote(sel));
  40. addButton('DDGG', 'https://duckduckgo.com/?ia=audio&q=' + quote(sel));
  41. addButton('mail.ru', 'http://go.mail.ru/search?q=' + quote(sel));
  42. addButton('Inoreader', 'http://www.inoreader.com/search/' + quote(sel) + '/public');
  43. addButton('Feedly', 'http://feedly.com/i/search/' + sel + '/all/engagement.any/any/topic/global.popular');
  44. addButton('Spotify', 'https://play.spotify.com/search/' + sel);
  45. addButton('reviews', 'http://developer.echonest.com/api/v4/artist/reviews?format=json&api_key=FEQK8YEAC4WDXAWSP&results=100&name=' + sel);
  46. addButton('AllMusic', 'http://www.allmusic.com/search/all/' + sel);
  47. addButton('MBrainz', 'http://musicbrainz.org/search?type=release&query=' + sel);
  48. addButton('Discogs', 'http://www.discogs.com/search/?type=all&q=' + sel);
  49. addButton('Ranker', 'http://www.ranker.com/app/search.htm?q=' + sel);
  50. addButton('viewMe', 'http://www.viewme.com/search?q=' + sel);
  51. addButton('myzuka.org', 'http://go.mail.ru/search_site?p=1&aux=PLA099&q=' + sel);
  52. addButton('GenFile', 'http://www.generalfil.es/?qa=' + sel);
  53. addButton('GenSearch', 'http://www.general-search.net/download/' + sel);
  54. addButton('FBug', 'http://www.filesbug.com/search/' + sel);
  55. addButton('FDeck', 'http://filesdeck.com/search.php?q=' + sel);
  56. addButton('Ebookee', 'http://ebookee.org/search.php?q=' + sel);
  57. addButton('Avax', 'http://avaxsearch.org/search?q=' + sel);
  58. addButton('mp3releases', 'http://mp3releases.org/search/' + sel);
  59. addButton('Taringa', 'http://www.taringa.net/buscar/?q=' + sel);
  60. addButton('sharedir', 'http://sharedir.com/index.php?s=' + sel);
  61. addButton('downloadstube', 'http://www.downloadstube.net/' + sel + '/DDLs.html');
  62. addButton('RSE', 'http://rapid-search-engine.com/index-s=' + sel + ".html");
  63. addButton('ULOZ', 'http://www.ulozto.net/hledej?q=' + sel);
  64. addButton('fileKnow', 'http://fileknow.org/' + sel);
  65. addButton('fileTram', 'http://filetram.com/' + sel);
  66. addButton('byDuck', 'http://www.byduck.com/?s=' + sel);
  67. addButton('media-tube', 'http://media-tube.me/?do=search&subaction=search&story=' + sel);
  68. addButton('NoNaMe', 'http://nnm.me/search?in=news&q=' + sel);
  69. addButton('NNC', 'http://go.mail.ru/search_site?p=%5Bobject+Object%5D&aux=nK3H8d&q=' + sel);
  70. addButton('waretube', 'http://waretube.org/index.php?do=search&do=search&full_search=0&result_from=1&search_start=1&subaction=search&story=' + sel);
  71. addButton('FileSkull', 'http://www.filesal.com/search.php?q=' + sel);
  72. addButton('cdBaby', 'http://www.cdbaby.com/?q=' + sel);
  73. addButton('tehparadox', 'http://tehparadox.com/forum/search.php?do=process&quicksearch=1&childforums=1&showposts=0&exactname=1&s=&securitytoken=1425005892-87caad13ca34df98b139e467ff9f838b2cc242a2&query=' + sel);
  74. addButton('NeThing', 'http://nethingoez.com/index.php?app=core&module=search&do=search&fromMainBar=1&search_app=forums&search_term=' + sel);
  75. addButton('fileCatch', 'http://filecatch.com/?q=' + sel);
  76. addButton('MFT', 'http://mediafiretrend.com/?q=' + sel);
  77. addButton('tfile.me', 'http://tfile.me/forum/ssearch.php?q=' + sel);
  78. addButton('rutracker', 'http://rutracker.org/forum/tracker.php?nm=' + sel);
  79. addButton('bitsnoop', 'http://bitsnoop.com/search/all/' + sel);
  80. addButton('bestDL', 'https://www.bestdownload.eu/search?f=' + sel);
  81. addButton('ruhunt', 'http://ruhunt.org/search?q=' + sel);
  82. addButton('realmt', 'http://realmt.org/tracker.php?max=1&to=1&nm=' + sel);
  83. addButton('filespr', 'http://www.filespr.me/' + sel.toString().toLowerCase() [0] + '/' + sel);
  84. addButton('byFiles', 'http://byfiles.com/search/' + sel);
  85. var html = '<form method="post" action="http://www.filesloop.com/search/" target="_blank"><input type="text" id="search" value="XXX" name="search" style="display:none"></input><input type="submit" value="FilesLoop"></input></form>';
  86. html = html.replace('XXX', sel);
  87. whereAppend.append($(html));
  88. $(".rickdog")[0].scrollIntoView();
  89. }
  90. (function() {
  91. var script = document.createElement('script');
  92. script.src = '//code.jquery.com/jquery.min.js';
  93. if(script.addEventListener) {
  94. script.addEventListener("load", loaded, false);
  95. } else {
  96. script.onreadystatechange = function() {
  97. if (this.readyState=="complete"){
  98. loaded();
  99. script = null;
  100. }
  101. }
  102. }
  103. script.type="text/javascript";
  104. document.getElementsByTagName('head')[0].appendChild(script);
  105. })();
  106. /*
  107. Exception: missing ) after argument list
  108. @Scratchpad/4:43
  109. */