Çeşitli Siteler İçin URL'den Arama

URL'den arama yapmaya olanak sağlar (URL Örneği: https://subscene.com/subtitles/title?q=Dexter).

当前为 2023-05-06 提交的版本,查看 最新版本

此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.cn-greasyfork.org/scripts/427315/1186601/%C3%87e%C5%9Fitli%20Siteler%20%C4%B0%C3%A7in%20URL%27den%20Arama.js

  1. // ==UserScript==
  2. // @name Çeşitli Siteler İçin URL'den Arama
  3. // @version 1.5
  4. // @description URL'den arama yapmaya olanak sağlar (URL Örneği: https://subscene.com/subtitles/title?q=Dexter).
  5. // @author nht.ctn
  6. // @namespace https://github.com/nhtctn
  7.  
  8. // @match *://turktorrent.us/?p=torrents&pid=10&q=*
  9. // @match *://subscene.com/subtitles/title?q=*
  10. // @include *://*turkanime.co/?q=*
  11. // @grant none
  12. // @run-at document-start
  13. // @icon https://turktorrent.us/favicon.ico?lv=2.2
  14. // @require https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js
  15. // ==/UserScript==
  16. /* global $ */
  17. /*jshint esversion: 6 */
  18.  
  19. (function() {
  20. 'use strict';
  21.  
  22. const pageUrl = window.location.href;
  23. if (pageUrl.search(/https?:\/\/turktorrent\.us/) >= 0) {
  24. window.stop();
  25.  
  26. let urlParams = new URLSearchParams(window.location.search);
  27. let postKeyword = urlParams.get('q');
  28. let postUrl = 'https://turktorrent.us/?p=torrents&pid=10';
  29.  
  30. if (urlParams.get('q') && postKeyword !== '') {
  31. let postForm = document.createElement("form");
  32. postForm.setAttribute("method", "post");
  33. postForm.setAttribute("action", postUrl);
  34. let hiddenField = document.createElement("input");
  35. hiddenField.setAttribute("name", "keywords");
  36. hiddenField.setAttribute("value", postKeyword);
  37. hiddenField.setAttribute("type", "hidden");
  38. postForm.appendChild(hiddenField);
  39. let hiddenSelect = document.createElement("select");
  40. hiddenSelect.setAttribute("name", "search_type");
  41. let hiddenOpt = document.createElement("option");
  42. hiddenOpt.setAttribute("value", "name");
  43. hiddenSelect.appendChild(hiddenOpt);
  44. postForm.appendChild(hiddenSelect);
  45. console.log(postForm);
  46. document.getElementsByTagName('html')[0].appendChild(postForm);
  47. postForm.submit();
  48. }
  49. else {
  50. document.location = 'https://turktorrent.us/?p=torrents&pid=10';
  51. }
  52. }
  53. else if (pageUrl.search(/https?:\/\/subscene\.com/) >= 0) {
  54. window.stop();
  55. if ($("html").data("searchByTitle") != 1) {
  56. $("html").data("searchByTitle", 1);
  57. let urlParams = new URLSearchParams(window.location.search);
  58. let postKeyword = urlParams.get('q');
  59. let postUrl = '/subtitles/searchbytitle';
  60.  
  61. if (urlParams.get('q') && postKeyword !== '') {
  62. let postForm = document.createElement("form");
  63. postForm.setAttribute("method", "post");
  64. postForm.setAttribute("action", postUrl);
  65. let hiddenField = document.createElement("input");
  66. hiddenField.setAttribute("name", "query");
  67. hiddenField.setAttribute("value", postKeyword);
  68. hiddenField.setAttribute("type", "hidden");
  69. postForm.appendChild(hiddenField);
  70. document.getElementsByTagName('html')[0].appendChild(postForm);
  71. postForm.submit();
  72. }
  73. else {
  74. document.location = 'https://subscene.com/subtitles';
  75. }
  76. }
  77. }
  78. else if (pageUrl.search(/https?:\/\/.+turkanime\.co/) >= 0) {
  79. window.stop();
  80.  
  81. let urlParams = new URLSearchParams(window.location.search);
  82. let postKeyword = urlParams.get('q');
  83.  
  84. if (urlParams.get('q') && postKeyword !== '') {
  85. let postForm = document.createElement("form");
  86. postForm.setAttribute("method", "post");
  87. postForm.setAttribute("action", "arama");
  88. let hiddenField = document.createElement("input");
  89. hiddenField.setAttribute("name", "arama");
  90. hiddenField.setAttribute("value", postKeyword);
  91. hiddenField.setAttribute("type", "hidden");
  92. postForm.appendChild(hiddenField);
  93. document.getElementsByTagName('html')[0].appendChild(postForm);
  94. postForm.submit();
  95. }
  96. }
  97.  
  98. })();