您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
generate a button for borrowed Internet Archive books.
- // ==UserScript==
- // @name Internet Archive Pdf Download Link
- // @namespace http://tampermonkey.net/
- // @version 0.1
- // @description generate a button for borrowed Internet Archive books.
- // @author BA
- // @match https://archive.org/details/*
- // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
- // @grant none
- // @license MIT
- // ==/UserScript==
- (function() {
- 'use strict';
- window.addEventListener('load', () => {
- addButton('Download PDF', downloadAcsmFn)
- })
- function addButton(text, onclick, cssObj) {
- const button = document.createElement('button')
- const titleEl = document.getElementById("IABookReaderMessageWrapper");
- titleEl.appendChild(button)
- button.innerHTML = text;
- button.onclick = onclick;
- return button
- }
- function downloadAcsmFn() {
- const currentUrl = document.URL
- const urlPartRaw = [...currentUrl.match(/org\/details\/(.*)/)]
- if (urlPartRaw.length > 0) {
- const identifier = urlPartRaw[1].split("/")[0];
- const acsmUrl = "https://archive.org/services/loans/loan/?action=media_url&identifier=" + identifier + "&format=pdf&redirect=1";
- window.open(acsmUrl, '_blank');
- }
- }
- })();