Combine waterfall layout and jump button for JavDB
// ==UserScript==
// @name JavDB & MissAv Jumper
// @namespace https://javdb.com/
// @version 3.1
// @description Combine waterfall layout and jump button for JavDB
// @license MIT
// @author YourName
// @match https://javdb.com/*
// @match https://missav.ws/*
// @match https://missav.ai/*
// @grant GM_addStyle
// @grant GM_getValue
// @grant GM_setValue
// @grant GM_deleteValue
// @grant GM_notification
// @grant GM_setClipboard
// @grant GM_getResourceURL
// @grant GM_registerMenuCommand
// @grant GM_info
// @grant GM_openInTab
// @grant GM_xmlhttpRequest
// @connect *
// @run-at document-idle
// ==/UserScript==
(function() {
'use strict';
// JavDB Jump Button Code
var jumpButton = document.createElement('button');
jumpButton.style.backgroundColor = 'green';
jumpButton.style.color = 'white';
jumpButton.style.position = 'fixed';
jumpButton.style.bottom = '10px';
jumpButton.style.left = '10px';
jumpButton.style.zIndex = '9999';
jumpButton.style.padding = '16px 24px';
jumpButton.style.borderRadius = '8px';
jumpButton.style.fontSize = '24px';
jumpButton.style.border = 'none';
jumpButton.style.cursor = 'pointer';
jumpButton.style.display = 'none';
jumpButton.addEventListener('click', function() {
let 番號 = '';
let url = '';
if (window.location.href.includes('javdb.com')) {
var link = document.querySelector('.panel-block.first-block a.button.is-white.copy-to-clipboard');
if (link) {
番號 = link.getAttribute('data-clipboard-text');
if (番號) {
url = "https://missav.ws/" + 番號.toLowerCase();
}
}
} else if (window.location.href.includes('missav.ws')) {
var element = document.querySelector('.text-secondary span.font-medium');
if (element) {
番號 = element.innerText;
番號 = 番號.replace(/-UNCENSORED-LEAK|-CHINESE-SUBTITLE/g, '');
url = "https://javdb.com/search?f=all&q=" + 番號;
}
}
if (番號 && url) {
var a = document.createElement('a');
a.href = url;
a.target = '_blank';
a.style.display = 'none';
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
}
});
let 番號 = '';
if (window.location.href.includes('javdb.com')) {
var link = document.querySelector('.panel-block.first-block a.button.is-white.copy-to-clipboard');
if (link) {
番號 = link.getAttribute('data-clipboard-text');
}
} else if (window.location.href.includes('missav.ws')) {
var element = document.querySelector('.text-secondary span.font-medium');
if (element) {
番號 = element.innerText;
番號 = 番號.replace(/-UNCENSORED-LEAK|-CHINESE-SUBTITLE/g, '');
}
}
if (番號) {
jumpButton.innerHTML = 番號;
jumpButton.style.display = 'block';
} else {
jumpButton.style.display = 'none';
}
document.body.appendChild(jumpButton);
// 修改磁力連接的下載按鈕
function updateDownloadButtons() {
if (window.location.href.includes('javdb.com')) {
// 找到所有磁力連接項目
const magnetItems = document.querySelectorAll('#magnets-content .item.columns');
magnetItems.forEach(item => {
// 找到該項目的複製按鈕和下載按鈕
const copyButton = item.querySelector('.copy-to-clipboard');
const downloadButton = item.querySelector('a.button.is-info.is-small[href^="https://keepshare.org"]');
if (copyButton && downloadButton) {
// 獲取磁力連接
const magnetLink = copyButton.getAttribute('data-clipboard-text');
if (magnetLink) {
// 將下載按鈕的 href 改為磁力連接
downloadButton.href = magnetLink;
// 移除 target="_blank" 讓磁力連接在當前頁面處理
downloadButton.removeAttribute('target');
}
}
});
}
}
// 頁面載入完成後執行
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', updateDownloadButtons);
} else {
updateDownloadButtons();
}
// 監聽動態載入的內容(如果有 AJAX 載入)
const observer = new MutationObserver(() => {
updateDownloadButtons();
});
const magnetsContent = document.querySelector('#magnets-content');
if (magnetsContent) {
observer.observe(magnetsContent, { childList: true, subtree: true });
}
})();