// ==UserScript==
// @name dlsite jump
// @namespace http://tampermonkey.net/
// @version 1.1.2
// @license MIT
// @description dlsite跳转放流资源
// @author crudBoy
// @match https://*.dlsite.com/*/product_id/*
// @icon https://www.dlsite.com/images/web/common/logo/pc/logo-dlsite.png
// @grant GM_xmlhttpRequest
// @connect asmr-200.com
// @connect erovoice.us
// @connect anime-sharing.com
// @connect asmrconnecting.xyz
// ==/UserScript==
((o) => {
if (typeof GM_addStyle == "function") {
GM_addStyle(o);
return;
}
const t = document.createElement("style");
(t.textContent = o), document.head.append(t);
})(
" .rdl-list{box-sizing:border-box;display:flex;flex-wrap:wrap;justify-content:flex-start;gap:10px;width:100%;height:100%;z-index:1;background-color:#fff;transition:right .2s ease-in-out;font-family:Roboto,Helvetica,Arial,sans-serif;color:#000}.rdl-button,.rdl-button_def{position:relative;display:flex;align-items:center;justify-content:center;box-sizing:border-box;padding:3px 10px;border-radius:4px;font-weight:500;font-size:14px;border:1px solid #dcdfe6;color:#606266;cursor:pointer}.rdl-button_def{margin:10px 0;width:100px}.rdl-button:visited{color:#606266}.rdl-button:hover{text-decoration:none;color:#409eff;border:1px solid #c6e2ff;background-color:#ecf5ff}.rdl-button_label{position:absolute;font-size:10px;padding:4px;border-radius:4px;top:-13px;right:-10px;line-height:.75;color:#67c23a;border:1px solid #e1f3d8;background:white}.rdl-button_green{color:#fff!important;background-color:#67c23a}.rdl-button_green:hover{color:#fff!important;background-color:#95d475}.rdl-button_red{color:#fff!important;background-color:#f56c6c}.rdl-button_red:hover{color:#fff!important;background-color:#f89898}.rdl-loading{display:inline-block;width:14px;height:14px;margin-right:10px;border:2px dashed #dcdfe6;border-top-color:transparent;border-radius:100%;animation:btnLoading infinite 1s linear}@keyframes btnLoading{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.rdl-tag{padding:3px 6px;color:#409eff!important;background:#ecf5ff;border:1px solid #d9ecff;border-radius:4px}.rdl-setting-list{display:flex;flex-wrap:wrap;background-color:#fff}.rdl-setting-title{margin:10px 0 5px}.rdl-setting-item{display:flex;height:20px;justify-content:center;align-items:center;margin-right:15px;-webkit-user-select:none;user-select:none;cursor:pointer}.db-panel .movie-panel-info div.panel-block{padding:5.5px 12px}.db-panel .rdl-app{padding:15px 12px}.lib-panel .rdl-app{padding:20px 30px;margin-top:10px}input[type=checkbox],input[type=radio]{margin:0 0 0 5px;cursor:pointer} ",
);
(function () {
'use strict';
initView()
unlockTitleCopy()
function initView() {
let workOutline = document.getElementById("work_outline");
let body = workOutline.children[0]
let isAsmr = body.innerHTML.includes("icon_SOU")||body.innerHTML.includes("icon_MUS")||body.innerHTML.includes("icon_AMT")||body.innerHTML.includes("icon_VCM")||body.innerHTML.includes("icon_MOV");
let tr = document.createElement('tr');
let th = document.createElement('th');
th.textContent = "跳转"
let td = document.createElement('td');
let rdlApp = document.createElement("div")
rdlApp.className = "rdl-app"
let rdlList = document.createElement("div")
rdlList.className = "rdl-list"
const siteItems = [
{"title": "asmrone", "onlyAsmr": true},
{"title": "eroVoice", "onlyAsmr": true},
{"title": "animeShare", "onlyAsmr": false},
{"title": "不妙屋", "onlyAsmr": true},
{"title": "南+", "onlyAsmr": false},
{"title": "hvdb", "onlyAsmr": true},
{"title": "ai2moe", "onlyAsmr": false},
{"title": "eHentai", "onlyAsmr": false},
];
for (let item of siteItems) {
if (isAsmr || (!item.onlyAsmr)) {
let element = document.createElement("a");
element.className = "rdl-button";
element.target = "_blank";
let span = document.createElement("span");
span.innerText = item.title;
element.appendChild(span);
rdlList.appendChild(element);
}
}
rdlApp.appendChild(rdlList)
td.appendChild(rdlApp)
tr.appendChild(th)
tr.appendChild(td)
body.appendChild(tr)
checkExits(isAsmr)
}
function findItem(t) {
let list = document.getElementsByClassName("rdl-list")[0]
for (let i = 0; i < list.children.length; i++) {
let item = list.children[i]
if (item.textContent === t) {
return item
}
}
return null
}
function checkExits(isAsmr) {
let rj = urlToRJNumber(document.URL)
if (isAsmr) {
asmrOneCheck(rj)
eroVoiceCheck(rj)
asmrConnectingCheck(rj)
let item = findItem("hvdb")
item.className = "rdl-button"
item.href = "https://hvdb.me/Dashboard/WorkDetails/" + rj
}
animeShareCheck(rj)
let item = findItem("南+")
item.className = "rdl-button"
item.href = "https://bbs.white-plus.net/search.php?step=2&keyword="+rj+"&method=OR&pwuser=&sch_area=0&f_fid=all&sch_time=all&orderway=postdate&asc=DESC"
let ai2moe = findItem("ai2moe")
ai2moe.className = "rdl-button"
ai2moe.href = "https://www.ai2moe.org/search/?&q="+rj+"&search_and_or=or&sortby=relevancy"
let eHentai = findItem("eHentai")
eHentai.className = "rdl-button"
eHentai.href = "https://e-hentai.org/?f_search="+document.getElementById("work_name").innerText
}
function asmrOneCheck(rj) {
let url =
"https://api.asmr-200.com/api/search/" + rj + "?order=create_date&sort=desc&page=1&subtitle=0&includeTranslationWorks=true"
let item = findItem("asmrone");
fetchData(url)
.then(response => {
let works = JSON.parse(response.responseText).works
if (works.length > 1) {
item.className = "rdl-button rdl-button_green"
item.href = "https://asmr-200.com/works?keyword=" + rj
} else if (works.length === 1) {
let asmroneItemId = works[0].id
if("RJ0"+(asmroneItemId+1)===rj||"RJ0"+(asmroneItemId-1)===rj||"RJ0"+asmroneItemId===rj
||"RJ"+(asmroneItemId+1)===rj||"RJ"+(asmroneItemId-1)===rj||"RJ"+asmroneItemId===rj){
item.className = "rdl-button rdl-button_green"
item.href = "https://asmr-200.com/work/" + rj
}else{
item.className = "rdl-button rdl-button_red"
}
} else {
item.className = "rdl-button rdl-button_red"
}
})
.catch(error => {
console.log(error);
item.className = "rdl-button rdl-button_red "
});
}
function eroVoiceCheck(rj) {
let url =
"http://e.erovoice.us/search/?q=" + rj
let item = findItem("eroVoice");
fetchData(url)
.then(response => {
let parser = new DOMParser();
let doc = parser.parseFromString(response.responseText, 'text/html');
let dateOuter = doc.getElementsByClassName("date-outer")
if (dateOuter.length > 1) {
item.className = "rdl-button rdl-button_green"
item.href = url
} else if (dateOuter.length === 1) {
item.className = "rdl-button rdl-button_green"
item.href = doc.getElementsByClassName("anes")[0].href
} else {
item.className = "rdl-button rdl-button_red"
}
})
.catch(error => {
console.log(error);
item.className = "rdl-button rdl-button_red "
});
}
function asmrConnectingCheck(rj) {
let url =
"https://asmrconnecting.xyz/api/fs/search"
let postData = "{\n" +
" \"parent\": \"/\",\n" +
" \"keywords\": \""+rj+"\",\n" +
" \"page\": 1,\n" +
" \"scope\": 0,\n" +
" \"per_page\": 100,\n" +
" \"password\": \"\"\n" +
"}"
let item = findItem("不妙屋");
fetchDataWithPost(url,postData)
.then(response => {
let data = JSON.parse(response.responseText).data
if (data.total > 1) {
item.className = "rdl-button rdl-button_green"
let content = data.content
let currentSize = Number.MAX_SAFE_INTEGER;
let ref = "";
for (let i = 0; i < content.length; i++) {
let contentKey = content[i];
if(contentKey.is_dir&&contentKey.size<currentSize){
currentSize = contentKey.size
let parent = contentKey.parent.replaceAll("/Guest","")
ref = "https://asmrconnecting.xyz"+parent+"/"+contentKey.name
}
}
item.href = ref
} else {
item.className = "rdl-button rdl-button_red"
}
})
.catch(error => {
console.log(error);
item.className = "rdl-button rdl-button_red "
});
}
function animeShareCheck(rj) {
let url =
"https://www.anime-sharing.com/search/3528560/?q=" + rj + "&o=relevance"
let item = findItem("animeShare");
fetchData(url)
.then(response => {
let parser = new DOMParser();
let doc = parser.parseFromString(response.responseText, 'text/html');
let voiceIconNode = doc.getElementsByClassName("label label--primary")
if (voiceIconNode.length > 0 && doc.getElementsByClassName("query-replacement").length < 1) {
item.className = "rdl-button rdl-button_green"
item.href = url
} else {
item.className = "rdl-button rdl-button_red"
}
})
.catch(error => {
console.log(error);
item.className = "rdl-button rdl-button_red "
});
}
function fetchData(url) {
return new Promise((resolve, reject) => {
GM_xmlhttpRequest({
method: "GET",
url: url,
onload: (response) => resolve(response),
onerror: (error) => reject(error),
});
});
}
function fetchDataWithPost(url,data) {
return new Promise((resolve, reject) => {
GM_xmlhttpRequest({
method: "POST",
url: url,
data:data,
headers: {
"Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8",
"Origin": "https://asmrconnecting.xyz",
"Referer": "https://asmrconnecting.xyz/",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36",
"Content-Type": "application/json;charset=UTF-8", // 设置请求头为JSON格式
},
onload: (response) => resolve(response),
onerror: (error) => reject(error),
});
});
}
function urlToRJNumber(url) {
let rjCode = ""
if (url.includes("?")) {
rjCode = url.substring(url.lastIndexOf("translation=") + 12)
} else {
rjCode = url.substring(url.lastIndexOf("/") + 1, url.lastIndexOf("."))
}
return rjCode
}
function unlockTitleCopy(){
document.querySelector("#top_wrapper > ul > li:last-child").style = "user-select:auto"
document.getElementById("work_name").style = "user-select:auto"
}
})();