StudyGo 30 second preview bypass

Opens StudyGo videos with controls enabled in a new tab

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

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

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği indirebilmeniz için ayrıca Tampermonkey gibi bir eklenti kurmanız gerekmektedir.

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

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.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name         StudyGo 30 second preview bypass
// @name:nl      StudyGo 30 seconden-preview bypasser
// @license      MIT
// @namespace    https://greasyfork.org/nl/users/1552919-dandandev
// @version      1.0.1
// @description  Opens StudyGo videos with controls enabled in a new tab
// @description:nl Opent StudyGo videos met controls aan in een nieuw tabblad
// @match        https://studygo.com/*
// @match        https://www.studygo.com/*
// @grant        none
// @run-at       document-idle
// ==/UserScript==

(() => {
  'use strict';

  const VIMEO_HOST = "player.vimeo.com";

  function handleVimeoIframe(iframe) {
    if (!iframe.src || !iframe.src.includes(VIMEO_HOST)) return;
    window.open(iframe.src.replace("controls=0", "controls=1"), "_blank");
    document.querySelector(".media-modal-close-btn")?.click();
  }

  const observer = new MutationObserver(mutations => {
    for (const mutation of mutations) {
      for (const node of mutation.addedNodes) {
        if (node.nodeType !== Node.ELEMENT_NODE) continue;
        if (node.tagName === "IFRAME") handleVimeoIframe(node);
        node.querySelectorAll?.("iframe").forEach(handleVimeoIframe);
      }
    }
  });

  observer.observe(document.body, {
    childList: true,
    subtree: true
  });
})();