URL Based Search for Some Websites

If you enter required parameter in URL, it trigger a search on website. (URL example: https://subscene.com/subtitles/title?q=Avatar).

لا ينبغي أن لا يتم تثبيت هذا السكريت مباشرة. هو مكتبة لسكبتات لتشمل مع التوجيه الفوقية // @require https://update.greasyfork.org/scripts/427315/1220388/URL%20Based%20Search%20for%20Some%20Websites.js

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

ستحتاج إلى تثبيت إضافة مثل Stylus لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتتمكن من تثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

(لدي بالفعل مثبت أنماط للمستخدم، دعني أقم بتثبيته!)

// ==UserScript==
// @name         Çeşitli Siteler İçin URL'den Arama
// @version      1.6
// @description  URL'den arama yapmaya olanak sağlar (URL Örneği: https://subscene.com/subtitles/title?q=Dexter).
// @author       nht.ctn
// @namespace    https://github.com/nhtctn

// @match      *://turktorrent.us/?p=torrents&pid=10&q=*
// @match      *://subscene.com/subtitles/title?q=*
// @include    *://*turkanime.co/?q=*
// @grant        none
// @run-at       document-start
// @icon         https://turktorrent.us/favicon.ico?lv=2.2
// @require	     https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js
// ==/UserScript==
/* global $ */
/*jshint esversion: 6 */

(function() {
	'use strict';

	const pageUrl = window.location.href;
if ($('meta#redirecting648').length < 1) {
	if (pageUrl.search(/https?:\/\/turktorrent\.us/) >= 0) {
		window.stop();
		$('head').append('<meta id="redirecting648">');

		let urlParams = new URLSearchParams(window.location.search);
		let postKeyword = urlParams.get('q');
		let postUrl = 'https://turktorrent.us/?p=torrents&pid=10';

		if (urlParams.get('q') && postKeyword !== '') {
			let postForm = document.createElement("form");
			postForm.setAttribute("method", "post");
			postForm.setAttribute("action", postUrl);
			let hiddenField = document.createElement("input");
			hiddenField.setAttribute("name", "keywords");
			hiddenField.setAttribute("value", postKeyword);
			hiddenField.setAttribute("type", "hidden");
			postForm.appendChild(hiddenField);
			let hiddenSelect = document.createElement("select");
			hiddenSelect.setAttribute("name", "search_type");
			let hiddenOpt = document.createElement("option");
			hiddenOpt.setAttribute("value", "name");
			hiddenSelect.appendChild(hiddenOpt);
			postForm.appendChild(hiddenSelect);
			console.log(postForm);
			document.getElementsByTagName('html')[0].appendChild(postForm);
			postForm.submit();
		}
		else {
			document.location = 'https://turktorrent.us/?p=torrents&pid=10';
		}
	}
	else if (pageUrl.search(/https?:\/\/subscene\.com/) >= 0) {
		window.stop();
		$('head').append('<meta id="redirecting648">');

		if ($("html").attr("searchByTitle") != 1) {
			$("html").attr("searchByTitle", 1);
			let urlParams = new URLSearchParams(window.location.search);
			let postKeyword = urlParams.get('q');
			let postUrl = '/subtitles/searchbytitle';

			if (urlParams.get('q') && postKeyword !== '') {
				let postForm = document.createElement("form");
				postForm.setAttribute("method", "post");
				postForm.setAttribute("action", postUrl);
				let hiddenField = document.createElement("input");
				hiddenField.setAttribute("name", "query");
				hiddenField.setAttribute("value", postKeyword);
				hiddenField.setAttribute("type", "hidden");
				postForm.appendChild(hiddenField);
				document.getElementsByTagName('html')[0].appendChild(postForm);
				postForm.submit();
			}
			else{
				document.location = 'https://subscene.com/subtitles';
			}
		}
	}
	else if (pageUrl.search(/https?:\/\/.+turkanime\.co/) >= 0) {
		window.stop();
		$('head').append('<meta id="redirecting648">');

		let urlParams = new URLSearchParams(window.location.search);
		let postKeyword = urlParams.get('q');

		if (urlParams.get('q') && postKeyword !== '') {
			let postForm = document.createElement("form");
			postForm.setAttribute("method", "post");
			postForm.setAttribute("action", "arama");
			let hiddenField = document.createElement("input");
			hiddenField.setAttribute("name", "arama");
			hiddenField.setAttribute("value", postKeyword);
			hiddenField.setAttribute("type", "hidden");
			postForm.appendChild(hiddenField);
			document.getElementsByTagName('html')[0].appendChild(postForm);
			postForm.submit();
		}
	}
}

})();