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

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 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.

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.

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

// ==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);
    }
  }
})