I have tried to edit this Tampermokey script that user arieljannai posted here to work with history.com: Disable Facebook "UP NEXT" popup and next video play

However, when I did, it shows that I'm watching my shows' pages. However, it will not stop the pop-up and stop the next video from auto-playing. As far as I can see, it should work. Here is a test video page on history.com's site to look at. The in-video popup shows up around 45 secs left in the video that's playing. Maybe I'm overlooking something here. Here is the modded version of that script, please don't get on me because I did not change anything that I didn't need to. Because I'm not going to post it anywhere on the net, so I'm not going to try to act as if it's mine.

Here is the code:

    // ==UserScript==
// @name         Remove Facebook UP NEXT Popup
// @description  Removes the annoying UP NEXT popup from Facebook videos and cancels the next video play automatically.
// @version
// @author       Ariel Jannai
// @namespace    https://github.com/arieljannai/tampermonkey-scripts
// @supportURL   https://github.com/arieljannai/tampermonkey-scripts/issues
// @match        https://www.history.com/*
// @require      https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js
// @grant        none
// @license      MIT
// ==/UserScript==

'use strict';

var videoPageIntervalID = 0;
var waitingForPopup = false;
var currLocation = '';

(function() {
    videoPageIntervalID = window.setInterval(onVideoPage, 1000);

function waitForUpNextToDisaply() {
    var selector = ("div:contains('UP NEXT')").eq(-8)
    if(selector.length === 1) {
        // remove the popup and cancel the play next
        console.log('popup removed!');
        waitingForPopup = false;
    else {
        setTimeout(function() {
            // console.log('waiting..');
            waitingForPopup = true;
            if (location.href.indexOf("/shows/") != -1) {
            } else {
                waitingForPopup = false;
        }, 500);

function onVideoPage() {
    if (location.href.indexOf("/shows/") != -1 && !waitingForPopup && location.href != currLocation ) {
        console.log('arrived to video page: ', location.href);
        currLocation = location.href;

I hope someone can figure out what I'm not seeing or need to add or change. Thanks for all of your time. I'm running the script on Google Chrome.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.