Greasy Fork

Copy Plex token

Script that will copy the plex access token to your clipboard

目前为 2024-05-11 提交的版本。查看 最新版本

// ==UserScript==
// @name         Copy Plex token
// @namespace    http://tampermonkey.net/
// @version      2024-05-11
// @description  Script that will copy the plex access token to your clipboard
// @license MIT
// @author       Bastian Ganze
// @match        https://app.plex.tv/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=plex.tv
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    (function() {
        alert("Click here to copy the plex token.");
        setTimeout(() => {
            const copyText = localStorage.getItem("myPlexAccessToken");
            if (!copyText) {
                console.error("Could not find any token, wtf!?");
            }
            navigator.clipboard.writeText(copyText).then(() => {
                console.log(`${copyText} copied to clipboard`);
            },(err) => {
                console.error('Failed to copy Plex ID to clipboard copy');
                console.error(err);
            });
        }, 200);
    })();
})();