您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Replace <a> href with <li> data-href
// ==UserScript== // @name 車型維修資料網站直接打開pdf // @namespace http://tampermonkey.net/ // @version 1.1 // @description Replace <a> href with <li> data-href // @description:zh-tw 車型維修資料網站直接打開pdf // @match https://library.yasn.com/* // @grant none // @license MIT // ==/UserScript== (function() { 'use strict'; var listItems = document.querySelectorAll('#directory-listing li'); listItems.forEach(function(item) { var link = item.querySelector('a'); var dataHref = item.getAttribute('data-href'); if (link && dataHref) { // 检查 dataHref 是否包含 pdf viewer 的 URL if (dataHref.includes('pdf/web/viewer.html?file=')) { // 将 pdf viewer 的 URL 转换为直接的 pdf URL dataHref = dataHref.replace('pdf/web/viewer.html?file=', ''); } link.setAttribute('href', dataHref); link.removeAttribute('onclick'); // 移除 onclick 属性 } }); })();