Panopto Transcript

Adds a button to copy a full video transcript from Panopto

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

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