Broken Trailer Search - YIFY Movies

Clicking on the Youtube Trailer embedded video will search for the movie title and year on Google if the video is broken.

Εγκατάσταση αυτού του κώδικαΒοήθεια
Κώδικας προτεινόμενος από τον δημιιουργό

Μπορεί, επίσης, να σας αρέσει ο κώδικας RARGB Search - YIFY Movies.

Εγκατάσταση αυτού του κώδικα
// ==UserScript==
// @name         Broken Trailer Search - YIFY Movies
// @namespace    https://greasyfork.org/en/users/670188-hacker09?sort=daily_installs
// @version      2
// @description  Clicking on the Youtube Trailer embedded video will search for the movie title and year on Google if the video is broken.
// @author       hacker09
// @include      https://yts.mx/movies/*
// @icon         https://yts.mx/assets/images/website/apple-touch-icon-180x180.png
// @run-at       document-end
// @grant        none
// ==/UserScript==

(function() {
  'use strict';
  if (document.querySelector('.youtube.cboxElement').href === "https://www.youtube.com/embed/?rel=0&wmode=transparent&border=0&autoplay=1&iv_load_policy=3") //If the YT video is broken
  { //Starts the if condition
    document.querySelector('.youtube.cboxElement').addEventListener('click', function() { //When the YT video is clicked
      location.href = `https://www.google.com/search?q=${document.querySelector('.hidden-xs > h1').innerText + ' ' + document.querySelector('.hidden-xs > h2').innerText}&tbm=vid`; //Search on Google
    }); //Finishes the onclick event listener
  } //Finishes the if condition
})();