Better PornHub.com

Make video player large by default and scroll to video but only if you're on top while loading the page - 6/21/2021, 10:43:58 AM

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

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

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

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

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

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name        Better PornHub.com
// @namespace   Violentmonkey Scripts
// @match       https://www.pornhub.com/view_video.php
// @grant       none
// @version     1.0
// @author      -
// @description Make video player large by default and scroll to video but only if you're on top while loading the page - 6/21/2021, 10:43:58 AM
// @require https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js
// ==/UserScript==

// PornHub has jQuery under $j, but it only shows up after a while.
this.$ = jQuery.noConflict(true)

$("div#player").ready(function () {
  player_div = $("div#player")
  
  if(! player_div.hasClass("wide")) {
    player_key = Object.keys(MGP.players)[0]
    
    // enlarge player to wide version
    MGP.players[player_key].settings().events.expandPlayer()
    
    // scroll to player, but only if we're at the top of the page when we load it
    if($("html").scrollTop() == 0) {
      $("html").animate({
        scrollTop: player_div.offset().top - 5
      }, 10);
    }
  }
})