Created
June 23, 2019 03:58
-
-
Save noopkat/16befc1ee4f6840a2a4ebb51c370feb8 to your computer and use it in GitHub Desktop.
Tampermonkey script for pausing autoplaying videos on pinterest only
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Pinterest Autoplay Remover | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description pauses autoplaying / looping videos | |
// @author @noopkat | |
// @match https://www.pinterest.com | |
// @grant none | |
// ==/UserScript== | |
// beware: this is quick and dirty because it gets the job done and that's all I care about. | |
(function() { | |
'use strict'; | |
const observer = new MutationObserver((mutations) => document.querySelectorAll('video').forEach(video => video.pause())); | |
const observerConfig = { | |
childList: true, | |
subtree: true | |
}; | |
const targetNode = document.body; | |
observer.observe(targetNode, observerConfig); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment