// ==UserScript== // @name 文库下载器百度文库专版 // @version 2.0.1 // @namespace https://waahah.gitee.io // @description 百度文库解析下载功能 解除百度文库限制【保持原格式】界面简洁,脚本仅限学习。 // @author waahah // @antifeature membership 百度文库需要提交链接等待3-5分钟才能下载 // @require https://cdn.bootcss.com/jquery/3.5.1/jquery.min.js // @match *://wenku.baidu.com/view/* // @match *://wenku.baidu.com/tfview/* // @match *://wenku.baidu.com/link?url* // @match *://wenku.baidu.com/share/* // @license Apache-2.0 // @icon data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='%233498db' d='M21 5c-1.11-.35-2.33-.5-3.5-.5-1.95 0-4.05.4-5.5 1.5-1.45-1.1-3.55-1.5-5.5-1.5S2.45 4.9 1 6v14.65c0 .25.25.5.5.5.1 0 .15-.05.25-.05C3.1 20.45 5.05 20 6.5 20c1.95 0 4.05.4 5.5 1.5 1.35-.85 3.8-1.5 5.5-1.5 1.65 0 3.35.3 4.75 1.05.1.05.15.05.25.05.25 0 .5-.25.5-.5V6c-.6-.45-1.25-.75-2-1zm0 13.5c-1.1-.35-2.3-.5-3.5-.5-1.7 0-4.15.65-5.5 1.5V8c1.35-.85 3.8-1.5 5.5-1.5 1.2 0 2.4.15 3.5.5v11.5z'/%3E%3Cpath fill='%232980b9' d='M17.5 10.5c.88 0 1.73.09 2.5.26V9.24c-.79-.15-1.64-.24-2.5-.24-1.7 0-3.24.29-4.5.83v1.66c1.13-.64 2.7-.99 4.5-.99zM13 12.49v1.66c1.13-.64 2.7-.99 4.5-.99.88 0 1.73.09 2.5.26V11.9c-.79-.15-1.64-.24-2.5-.24-1.7 0-3.24.3-4.5.83zm4.5 1.84c-1.7 0-3.24.29-4.5.83v1.66c1.13-.64 2.7-.99 4.5-.99.88 0 1.73.09 2.5.26v-1.52c-.79-.16-1.64-.24-2.5-.24z'/%3E%3C/svg%3E // @grant unsafeWindow // @grant GM_openInTab // @grant GM.openInTab // ==/UserScript== (function () { 'use strict'; if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', init); } else { init(); } function init() { setTimeout(mainFunction, 1000); } function mainFunction() { let webUrl = window.location.href; let webUrl2; const path = window.location.pathname.split("/")[1]; const host = location.host; const tfpath = location.href.split("/"); const title = document.title.split(' - ')[0]; const after = obj => { return obj.replace('/view/', '/share/').replace('.html', '') + '?share_api=1&width=800'; } const css = css => { const myStyle = document.createElement('style'); myStyle.textContent = css; const doc = document.head || document.documentElement; doc.appendChild(myStyle); } css(` #zuihuitao { position: fixed; top: 120px; left: 20px; z-index: 2147483647; font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif; font-size: 14px; transition: all 0.3s ease; width: 280px; min-height: 200px; background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(10px); border-radius: 16px; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12); border: 1px solid rgba(255, 255, 255, 0.2); overflow: hidden; } #zuihuitao.compact { width: 50px; height: 50px; min-height: 50px; } .widget-header { background: linear-gradient(135deg, #3498db, #2980b9); color: white; padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; cursor: move; user-select: none; } .widget-title { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 8px; } .widget-controls { display: flex; gap: 6px; } .control-btn { width: 20px; height: 20px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: rgba(255, 255, 255, 0.2); cursor: pointer; transition: all 0.2s ease; font-size: 12px; font-weight: bold; } .control-btn:hover { background: rgba(255, 255, 255, 0.3); transform: scale(1.1); } .widget-body { padding: 16px; } #zuihuitao.compact .widget-body { display: none; } #zuihuitao.compact .widget-header { display: none; } .section { margin-bottom: 20px; } .section-title { font-size: 13px; color: #666; margin-bottom: 10px; font-weight: 500; padding-left: 4px; border-left: 3px solid #3498db; } .btn-group { display: flex; flex-direction: column; gap: 8px; } .action-btn { padding: 10px 12px; border: none; border-radius: 8px; font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.2s ease; display: flex; align-items: center; gap: 8px; background: #f8f9fa; color: #333; border: 1px solid #e9ecef; } .action-btn:hover { background: #3498db; color: white; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3); } .action-btn.primary { background: #3498db; color: white; } .action-btn.primary:hover { background: #2980b9; } .status-indicator { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #666; padding: 8px 12px; background: #f8f9fa; border-radius: 8px; margin-top: 12px; } .status-dot { width: 8px; height: 8px; border-radius: 50%; background: #2ecc71; animation: pulse 2s infinite; } @keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.5; } 100% { opacity: 1; } } .compact-mode { width: 50px; height: 50px; background: linear-gradient(135deg, #3498db, #2980b9); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: white; cursor: pointer; box-shadow: 0 4px 16px rgba(52, 152, 219, 0.4); transition: all 0.3s ease; font-size: 20px; display: none; } #zuihuitao.compact .compact-mode { display: flex; } .btn-success { position: fixed; font-weight: 400; color: #fff; background-color: #28a745; border-color: #28a745; text-align: center; vertical-align: middle; border: 1px solid transparent; padding: .375rem .75rem; font-size: 1rem; line-height: 1.5; border-radius: .25rem; z-index: 2147483647; cursor: pointer; box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3); } @media (max-width: 768px) { #zuihuitao { width: 260px; left: 10px; } } @media print { body { display: block !important; } #zuihuitao { display: none !important; } } * { -webkit-user-select: text; -moz-user-select: text; -ms-user-select: text; user-select: text; } .reader-container #zuihuitao, .reader-wrap #zuihuitao, .reader-holder #zuihuitao { z-index: 2147483647 !important; } `); const html = `