// ==UserScript== // @name 动漫花园预览增强 // @namespace http://tampermonkey.net/ // @version 0.1 // @description 在动漫花园种子列表显示预览和磁力链接 // @author You // @match *://dmhy.org/* // @match *://share.dmhy.org/* // @grant GM_addStyle // @grant GM_setClipboard // @require https://code.jquery.com/jquery-3.6.0.min.js // @license MIT // @downloadURL https://update.greasyfork.icu/scripts/519551/%E5%8A%A8%E6%BC%AB%E8%8A%B1%E5%9B%AD%E9%A2%84%E8%A7%88%E5%A2%9E%E5%BC%BA.user.js // @updateURL https://update.greasyfork.icu/scripts/519551/%E5%8A%A8%E6%BC%AB%E8%8A%B1%E5%9B%AD%E9%A2%84%E8%A7%88%E5%A2%9E%E5%BC%BA.meta.js // ==/UserScript== (function() { 'use strict'; // 确保jQuery加载 if (typeof window.jQuery === 'undefined') { console.error('jQuery未能正确加载'); return; } let $ = window.jQuery.noConflict(true); // 添加样式 GM_addStyle(` .preview-box { padding: 10px; background: #f8f8f8; margin: 5px 0; border: 1px solid #ddd; border-radius: 4px; } .magnet-container { display: flex; align-items: center; gap: 10px; background: #fff; padding: 8px; margin: 5px 0; border-radius: 4px; border: 1px solid #e0e0e0; } .magnet-link { flex-grow: 1; word-break: break-all; font-family: monospace; font-size: 12px; padding: 5px; border-radius: 4px; background: #f5f5f5; cursor: pointer; } .magnet-link:hover { background-color: #e8e8e8; } .copy-btn { padding: 5px 10px; background: #4CAF50; color: white; border: none; border-radius: 4px; cursor: pointer; font-size: 12px; } .copy-btn:hover { background: #45a049; } .copy-tooltip { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background: rgba(0, 0, 0, 0.8); color: white; padding: 10px 20px; border-radius: 4px; z-index: 10000; pointer-events: none; } .file-info { margin-top: 5px; font-size: 12px; color: #666; } .preview-container { display: flex; gap: 15px; align-items: flex-start; } .preview-image { width: 200px; height: 150px; background: #f0f0f0; display: flex; align-items: center; justify-content: center; border-radius: 4px; overflow: hidden; } .preview-image img { max-width: 100%; max-height: 100%; object-fit: contain; } .preview-info { flex: 1; } .loading { color: #666; font-size: 14px; } .no-image { color: #999; font-size: 14px; } `); // 显示提示 function showTooltip(message) { const tooltip = $('
').text(message); $('body').append(tooltip); setTimeout(() => { tooltip.fadeOut(200, function() { tooltip.remove(); }); }, 1000); } // 处理种子列表 function processTable() { $('table.tablesorter tbody tr').each(function() { const row = $(this); if (row.hasClass('processed')) return; // 获取详情页链接 const detailLink = row.find('td.title a').attr('href'); if (!detailLink) return; // 获取磁力链接并提取哈��值 const fullMagnetLink = row.find('a[href^="magnet:?"]').attr('href'); if (!fullMagnetLink) return; const hashMatch = fullMagnetLink.match(/magnet:\?xt=urn:btih:([A-Za-z0-9]+)/i); if (!hashMatch) return; const shortMagnetLink = `magnet:?xt=urn:btih:${hashMatch[1]}`; const fileSize = row.find('td:nth-child(5)').text().trim(); // 创建预览框 const previewBox = $(`