Scribd Show Full Document Button

Adds a button to show full Scribd document content in a new window By chatgpt :)

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Scribd Show Full Document Button
// @namespace    http://tampermonkey.net/
// @version      1.2
// @license      MIT
// @description  Adds a button to show full Scribd document content in a new window By chatgpt :)
// @match        *://www.scribd.com/document/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Retrieve the document ID from the URL
    const docIdMatch = window.location.href.match(/document\/(\d+)/);
    if (!docIdMatch) return;

    const docId = docIdMatch[1];

    // Find the Report button to insert the custom button nearby
    const referenceButton = document.querySelector("button.ButtonCore-module_wrapper_MkTb9s[data-e2e='report-content-button-sticky_metadata_column']");

    if (referenceButton) {
        // Create the custom button
        const showFullButton = document.createElement("button");
        showFullButton.innerText = "Full Doc.";
        showFullButton.style.padding = "10px 15px";
        showFullButton.style.marginLeft = "10px"; // Add some space between buttons
        showFullButton.style.backgroundColor = "#4CAF50";
        showFullButton.style.color = "white";
        showFullButton.style.border = "none";
        showFullButton.style.borderRadius = "5px";
        showFullButton.style.cursor = "pointer";

        // Add click event to open Scribd links in new windows
        showFullButton.onclick = function() {
            // Open the main Scribd document link
            window.open(`https://www.scribd.com/document/${docId}/All-My-Roblox-Ids`, '_blank');

            // Open the embed content link
            window.open(`https://www.scribd.com/embeds/${docId}/content`, '_blank');
        };

        // Insert the custom button after the Report button
        referenceButton.parentNode.insertBefore(showFullButton, referenceButton.nextSibling);
    }
})();