Panopto Transcript

Adds a button to copy a full video transcript from Panopto

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         Panopto Transcript
// @namespace    http://tampermonkey.net/
// @version      2024-10-01
// @description  Adds a button to copy a full video transcript from Panopto
// @author       ioc
// @match        https://*.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=panopto.eu
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    const btn = document.createElement("button");
    btn.innerHTML = "Copy transcript";
    btn.onclick = function(event) {
        event.preventDefault();

        function getElementByXpath(path) {
            return document.evaluate(path, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
        }

        const textArr = [];
        const largeSet = document.getElementsByClassName("index-event");

        for (let i=0; i<largeSet.length; i++) {
            const e = largeSet[i];
            try {
                if (e.id.toLowerCase().includes("transcript")) {
                    textArr.push(e.children[1].children[1].children[0].innerText);
                }
            } catch (error) {}
        }

        let res = textArr.join(" ");
        res = res.replaceAll(". ", ".\n");

        const type = "text/plain";
        const blob = new Blob([res], { type });
        const data = [new ClipboardItem({ [type]: blob })];
        window.navigator.clipboard.write(data);
    }
    document.getElementById("eventTabControl").appendChild(btn);
})();