您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Adds download buttons to addon pages on AnkiWeb.
- // ==UserScript==
- // @name AnkiWeb: Download buttons for addons
- // @namespace flan
- // @description Adds download buttons to addon pages on AnkiWeb.
- // @include https://ankiweb.net/shared/info/*
- // @version 1
- // @grant none
- // @license https://unlicense.org/
- // ==/UserScript==
- function basename(path) {
- let s = path.split("/");
- return s[s.length-1];
- }
- function add_dl_button(after, version) {
- let a = document.createElement("a");
- a.href = `/shared/download/${basename(window.location.pathname)}?v=${version}`;
- a.className = "btn btn-primary btn-lg";
- a.style.marginRight = "1em";
- a.innerText = `Download (${version}.x)`;
- after.parentElement.insertBefore(a, after.nextSibling);
- }
- let id_card = document.querySelector(".card-outline-primary");
- id_card.style.display = "inline-block";
- id_card.style.marginRight = "1em";
- if(document.querySelector("a[href='/shared/addons/2.1']"))
- add_dl_button(id_card, "2.1");
- if(document.querySelector("a[href='/shared/addons/2.0']"))
- add_dl_button(id_card, "2.0");