// ==UserScript==
// @name 图集岛VIP-FancyBox版
// @namespace https://scriptcat.org/script-show-page/443
// @version 2.0
// @description 破解图集岛VIP
// @author yyg, 253681319,LARASSR
// @include /https?:\/\/(\w+\.)?tujidao\w*\.\w+/
// @grant none
// @date 2022-01-14
// @require https://cdn.staticfile.org/jquery/3.6.0/jquery.min.js
// @require https://cdn.jsdelivr.net/gh/CYqiang-sc/hello@master/fancybox.js
// @require https://cdn.jsdelivr.net/gh/CYqiang-sc/hello@master/main.js
// @license MIT
// ==/UserScript==
(async function () {
"use strict";
var html1 =
'
img_title' +
"" +
'';
var html2 = "
";
var pic_base =
"{imgnum}
";
console.log("start");
var createnew = function (num, pic_id, tags) {
var pic_new = pic_base.replace("{pic_id}", pic_id);
var tagHtml = [];
var last = tags.pop();
for (let t of tags) {
tagHtml.push(t.outerHTML);
}
tagHtml.push(last.innerText);
tagHtml =
"" +
tagHtml.join(" / ") +
"
";
var imgs = [];
for (var i = 1; i <= num; i++) {
imgs.push(
pic_new.replace("{num}", i).replace("{imgnum}", ` [${i}/${num}]`)
);
}
let html = html1.replace("img_title", `${last.innerText} - ${num}P @ ${pic_id}`);
html += imgs.join("\n");
html += html2;
var w = window.open("https://www.tujidao.com/");
w.onload = () => {
w.document.write(tagHtml + html);
var head = w.document.getElementsByTagName('head')[0];
if (head) {
var statement = document.createElement('script');
statement.src = 'https://cdn.jsdelivr.net/gh/CYqiang-sc/hello@master/fancybox.js';
head.appendChild(statement);
statement = document.createElement('script');
statement.textContent = fancyboxDefaultJs;
head.appendChild(statement);
statement = document.createElement('style');
statement.setAttribute('type', 'text/css');
statement.textContent = fancyBoxCss;
head.appendChild(statement);
if (os.isPc) {
statement = document.createElement('style');
statement.setAttribute('type', 'text/css');
statement.textContent = fancyBoxCssAdditon;
head.appendChild(statement);
}
}
w.document.close();
};
};
// var lis = document.getElementsByClassName('shuliang');
//
//
// 27P
// 机构:网络美女
// 标签:大尺-度 福利
// 人物:Byoru
// [网红COSER写真] 日本性感萝莉Byoru - Kiara Summer
//
// 小图链接
/**
* 给已有的图片容器添加点击事件,移除原有跳转链接
*/
function addEvent(list) {
for (const li of list) {
//第一个a
li.querySelector('img').onclick = function () {
// 获取数量
var num = li
.querySelector("span.shuliang")
.innerText.split("P")[0];
num = parseInt(num);
// id
var aTag = li.querySelector("a");
aTag.removeAttribute("href"); // 删除链接,防止跳转
var id = li.querySelector(".biaoti a").getAttribute("href");
id = id.split("id=")[1];
//丢掉最后一个
var tags = li.querySelectorAll("p>a");
createnew(num, id, [...tags]);
};
}
}
/**
* 获取当前页面的图片列表
*/
function getLiList() {
return document.querySelectorAll("div.hezi>ul>li");
}
addEvent(getLiList());
var contentContainer = document.getElementById("search");
var config = {
childList: true,
subtree: true
};
// 当观察到突变时执行的回调函数
var callback = function (mutationsList) {
mutationsList.forEach(function (item, index) {
const {
addedNodes
} = item;
addEvent(addedNodes);
});
};
// 创建一个链接到回调函数的观察者实例
var observer = new MutationObserver(callback);
// 开始观察已配置突变的目标节点
contentContainer && observer.observe(contentContainer, config);
// 配置 自动无缝翻页 突变的目标节点
var AutoPagerCallbacks = function (mutationsList) {
mutationsList.forEach(function (item, index) {
// console.log(item);
const {
children
} = item.addedNodes[0].children[0];
addEvent(children);
});
};
var AutoPagerContainer = document.querySelector("body");
var AutoPagerObserver = new MutationObserver(AutoPagerCallbacks);
AutoPagerContainer && AutoPagerObserver.observe(AutoPagerContainer, config);
})();