';
html += '
';
html += ''; // header
html += '
';
html += '';
html += '无弹幕(推荐) ';
html += '有弹幕 ';
html += '
'; // text
html += '
'
a.innerHTML = html;
let b = document.getElementsByClassName("layout-Main")[0];
b.insertBefore(a, b.childNodes[0]);
}
function initPkg_PopupPlayer_Func() {
document.getElementsByClassName("popup-player")[0].addEventListener("click", function () {
document.getElementById("popup-player__prompt").style.display = "block";
});
document.getElementById("popup-player__cancel").addEventListener("click", function() {
document.getElementById("popup-player__prompt").style.display = "none";
})
document.getElementById("popup-player__ok").addEventListener("click", function() {
let roomUrl = document.getElementById("popup-player__url").value;
if (roomUrl != "") {
let isIframe = document.getElementById("popup-player__noiframe").checked;
let isStream = false;
if (roomUrl.length > 150) {
let confirm = window.confirm("你输入的是直播流吗?");
if (confirm == true) {
isStream = true;
}
}
if (isStream) {
createNewVideo_Stream(videoPlayerArr.length, roomUrl);
} else {
if (isIframe == true) {
if (roomUrl.indexOf("douyu.com") != -1) {
getRealRid_Douyu(roomUrl, (rid) => {
createNewVideo(videoPlayerArr.length, rid, "Douyu");
});
} else if (roomUrl.indexOf("bilibili.com") != -1) {
getRealRid_Bilibili(roomUrl, (rid) => {
createNewVideo(videoPlayerArr.length, rid, "Bilibili");
});
} else if (roomUrl.indexOf("huya.com") != -1) {
createNewVideo(videoPlayerArr.length, roomUrl, "Huya");
} else {
createNewVideo_Stream(videoPlayerArr.length, roomUrl);
}
} else {
createNewVideo_iframe(videoPlayerArr.length, roomUrl);
}
}
} else {
showMessage("请输入地址", "error");
}
document.getElementById("popup-player__prompt").style.display = "none";
})
document.getElementById("popup-player__prompt").addEventListener("keydown", function(event) {
let theEvent = window.event || e;
let code = theEvent.keyCode || theEvent.which || theEvent.charCode;
if (code == 13) {
document.getElementById("popup-player__ok").click();
}
})
}
function createNewVideo(id, rid, platform) {
switch (platform) {
case "Douyu":
createNewVideo_Douyu(id, rid);
break;
case "Bilibili":
createNewVideo_Bilibili(id, rid);
break;
case "Huya":
let a = String(rid).split("/");
createNewVideo_Huya(id, a[a.length - 1], a[a.length - 1]);
break;
default:
createNewVideo_Douyu(id, rid);
break;
}
}
function setElementVideo(id, l) {
if (flvjs.isSupported()) {
var videoElement = document.getElementById("exVideoPlayer" + String(id));
var flvPlayer = flvjs.createPlayer({
type: 'flv',
url: l
},{fixAudioTimestampGap: false});
if (id > videoPlayerArr.length - 1) {
videoPlayerArr.push(flvPlayer);
} else {
videoPlayerArr[id] = flvPlayer;
}
flvPlayer.attachMediaElement(videoElement);
flvPlayer.load();
flvPlayer.play();
}
}
function setElementResize(id) {
let box = document.getElementById("exVideoDiv" + String(id));
let scale = document.getElementById("exVideoScale" + String(id));
scale.onmousedown = function (e) {
// 阻止冒泡,避免缩放时触发移动事件
e.stopPropagation();
e.preventDefault();
let pos = {
'w': box.offsetWidth,
'h': box.offsetHeight,
'x': e.clientX,
'y': e.clientY
};
let w;
let h;
document.onmousemove = function (ev) {
ev.stopPropagation();
ev.preventDefault();
w = Math.max(400, ev.clientX - pos.x + pos.w)
h = Math.max(0, ev.clientY - pos.y + pos.h)
w = w >= document.offsetWidth - box.offsetLeft ? document.offsetWidth - box.offsetLeft : w
h = h >= document.offsetHeight - box.offsetTop ? document.offsetHeight - box.offsetTop : h
box.style.width = w + 'px';
box.style.height = h + 'px';
}
document.onmouseup = function (e) {
e.stopPropagation();
e.preventDefault();
document.onmousemove = null;
document.onmouseup = null;
}
}
}
function setElementDrag(id) {
let box = document.getElementById("exVideoDiv" + String(id));
box.onmousedown = function (event) {
event.stopPropagation();
let xx = event.clientX - box.offsetLeft;
let yy = event.clientY - box.offsetTop;
let mouseX;
let mouseY;
document.onmousemove = function (event) {
event.stopPropagation();
mouseX = event.clientX - xx;
mouseY = event.clientY - yy;
box.style.left = mouseX + "px";
box.style.top = mouseY + "px";
}
document.onmouseup = function (event) {
event.stopPropagation();
document.onmousemove = null;
document.onmouseup = null;
}
}
}
// Douyu
function createNewVideo_Douyu(id, rid) {
getRealLive_Douyu(rid, true, false, "1", (lurl) => {
if (lurl != "" || lurl != null) {
if (lurl == "None") {
showMessage("房间未开播或其他错误", "error");
return;
}
let lurl_host_arr = String(lurl).split("/live");
let lurl_host = "";
if (lurl_host_arr.length > 0) {
lurl_host = lurl_host_arr[0];
}
let a = document.createElement("div");
let html = "";
a.id = "exVideoDiv" + String(id);
a.rid = rid;
a.className = "exVideoDiv";
html += "
" + "斗鱼 - " + rid + " ";
html += "
高清 超清 蓝光4M 蓝光8M 原画 ";
html += "
主线路 备用线路5 备用线路6 ";
html += "
无视频? ";
html += `
`;
html += `
`;
html += `
`;
html += "
X
";
html += "
";
html += "
";
a.innerHTML = html;
let b = document.getElementsByClassName("layout-Main")[0];
b.insertBefore(a, b.childNodes[0]);
setElementDrag(id);
setElementResize(id);
setElementFunc_Douyu(id, rid);
setElementVideo(id, lurl);
}
});
}
function setElementFunc_Douyu(id, rid) {
let box = document.getElementById("exVideoDiv" + String(id));
let exVideoPlayer = document.getElementById("exVideoPlayer" + String(id));
let info = document.getElementById("exVideoInfo" + String(id));
let scale = document.getElementById("exVideoScale" + String(id));
let exVideoEmbed = document.getElementById("exVideoEmbed" + String(id));
let exVideoUnEmbed = document.getElementById("exVideoUnEmbed" + String(id));
let originVideo = document.getElementById("__video2");
exVideoPlayer.onclick = function(e) {
e.stopPropagation();
e.preventDefault();
if (scale.style.display != "block") {
scale.style.display = "block";
info.style.display = "block";
} else {
scale.style.display = "none";
info.style.display = "none";
}
for (let i = 0; i < videoPlayerArr.length; i++) {
let box = document.getElementById("exVideoDiv" + String(i));
if (box != null) {
if (i == id) {
box.style.zIndex = 1016;
} else {
box.style.zIndex = 1015;
}
}
}
}
let exVideoQn = document.getElementById("exVideoQn" + String(id));
let exVideoCDN = document.getElementById("exVideoCDN" + String(id));
let exVideoClose = document.getElementById("exVideoClose" + String(id));
exVideoQn.onchange = function() {
getRealLive_Douyu(rid, true, false, exVideoQn.value, (lurl) => {
videoPlayerArr[id].destroy();
setElementVideo(id, lurl);
})
}
exVideoCDN.onchange = function() {
getRealLive_Douyu(rid, true, false, exVideoQn.value, (lurl) => {
videoPlayerArr[id].destroy();
setElementVideo(id, lurl);
})
}
exVideoClose.onclick = function() {
originVideo.style.display = "block";
videoPlayerArr[id].destroy();
exVideoPlayer.remove();
box.remove();
}
let exVideoCopy = document.getElementById("exVideoCopy" + String(id)) || document.getElementById("exVideoRID" + String(id));
if (exVideoCopy) {
exVideoCopy.onclick = function() {
getRealLive_Douyu(rid, !exVideoCopy.innerHTML.includes("斗鱼音频流"), false, exVideoQn.value, (lurl) => {
GM_setClipboard(String(lurl).replace("https", "http"));
showMessage("复制成功", "success");
})
}
}
if (exVideoEmbed) {
exVideoEmbed.onclick = function() {
originVideo.style.display = "none";
exVideoEmbed.style.display = "none";
exVideoUnEmbed.style.display = "inline";
box.style.height = "0px";
originVideo.parentElement.insertBefore(exVideoPlayer, originVideo);
}
}
if (exVideoUnEmbed) {
exVideoUnEmbed.onclick = function() {
originVideo.style.display = "block";
exVideoUnEmbed.style.display = "none";
exVideoEmbed.style.display = "inline";
box.style.height = "250px";
box.insertBefore(exVideoPlayer, box.childNodes[box.childNodes.length - 1]);
}
}
}
function createNewAudio_Douyu(id, rid) {
getRealLive_Douyu(rid, false, true, "1", (lurl) => {
if (lurl != "" || lurl != null) {
if (lurl == "None") {
showMessage("房间未开播或其他错误", "error");
return;
}
let lurl_host_arr = String(lurl).split("/live");
let lurl_host = "";
if (lurl_host_arr.length > 0) {
lurl_host = lurl_host_arr[0];
}
let a = document.createElement("div");
let html = "";
a.id = "exVideoDiv" + String(id);
a.rid = rid;
a.className = "exVideoDiv";
html += "
";
html += "
";
a.innerHTML = html;
let b = document.getElementsByClassName("layout-Main")[0];
b.insertBefore(a, b.childNodes[0]);
setElementDrag(id);
setElementResize(id);
setElementFunc_Douyu(id, rid);
setElementVideo(id, lurl);
}
});
}
// Bilibili
function createNewVideo_Bilibili(id, rid){
getRealLive_Bilibili(rid, "1", "1", (lurl) => {
if (lurl != "" || lurl != null) {
let a = document.createElement("div");
let html = "";
a.id = "exVideoDiv" + String(id);
a.rid = rid;
a.className = "exVideoDiv";
html += "
";
html += "
";
a.innerHTML = html;
let b = document.getElementsByClassName("layout-Main")[0];
b.insertBefore(a, b.childNodes[0]);
setElementDrag(id);
setElementResize(id);
setElementFunc_Bilibili(id, rid);
setElementVideo(id, lurl);
}
});
}
function setElementFunc_Bilibili(id, rid) {
let box = document.getElementById("exVideoDiv" + String(id));
let exVideoPlayer = document.getElementById("exVideoPlayer" + String(id));
let info = document.getElementById("exVideoInfo" + String(id));
let scale = document.getElementById("exVideoScale" + String(id));
exVideoPlayer.onclick = function(e) {
e.stopPropagation();
e.preventDefault();
if (scale.style.display != "block") {
scale.style.display = "block";
info.style.display = "block";
} else {
scale.style.display = "none";
info.style.display = "none";
}
for (let i = 0; i < videoPlayerArr.length; i++) {
let box = document.getElementById("exVideoDiv" + String(i));
if (box != null) {
if (i == id) {
box.style.zIndex = 1016;
} else {
box.style.zIndex = 1015;
}
}
}
}
let exVideoQn = document.getElementById("exVideoQn" + String(id));
let exVideoCDN = document.getElementById("exVideoCDN" + String(id));
let exVideoClose = document.getElementById("exVideoClose" + String(id));
let exVideoEmbed = document.getElementById("exVideoEmbed" + String(id));
let exVideoUnEmbed = document.getElementById("exVideoUnEmbed" + String(id));
let originVideo = document.getElementById("__video2");
exVideoQn.onchange = function() {
getRealLive_Bilibili(rid, exVideoQn.value, exVideoCDN.value, (lurl) => {
videoPlayerArr[id].destroy();
setElementVideo(id, lurl);
})
}
exVideoCDN.onchange = function() {
getRealLive_Bilibili(rid, exVideoQn.value, exVideoCDN.value, (lurl) => {
videoPlayerArr[id].destroy();
setElementVideo(id, lurl);
})
}
exVideoClose.onclick = function() {
originVideo.style.display = "block";
videoPlayerArr[id].destroy();
exVideoPlayer.remove();
box.remove();
}
exVideoEmbed.onclick = function() {
originVideo.style.display = "none";
exVideoEmbed.style.display = "none";
exVideoUnEmbed.style.display = "inline";
box.style.height = "0px";
originVideo.parentElement.insertBefore(exVideoPlayer, originVideo);
}
exVideoUnEmbed.onclick = function() {
originVideo.style.display = "block";
exVideoUnEmbed.style.display = "none";
exVideoEmbed.style.display = "inline";
box.style.height = "250px";
box.insertBefore(exVideoPlayer, box.childNodes[box.childNodes.length - 1]);
}
let exVideoCopy = document.getElementById("exVideoCopy" + String(id));
exVideoCopy.onclick = function() {
getRealLive_Bilibili(rid, exVideoQn.value, exVideoCDN.value, (lurl) => {
GM_setClipboard(lurl);
showMessage("复制成功", "success");
})
}
}
// Huya
function createNewVideo_Huya(id, rid, rname){
getRealLive_Huya(rid, "1", (lurl, msg) => {
if (lurl != "" || lurl != null) {
if (msg != "") {
showMessage(msg, "error");
return;
}
let a = document.createElement("div");
let html = "";
a.id = "exVideoDiv" + String(id);
a.rid = rid;
a.className = "exVideoDiv";
html += "
";
html += "
";
a.innerHTML = html;
let b = document.getElementsByClassName("layout-Main")[0];
b.insertBefore(a, b.childNodes[0]);
setElementDrag(id);
setElementResize(id);
setElementFunc_Huya(id, rid);
setElementVideo(id, lurl);
}
});
}
function setElementFunc_Huya(id, rid) {
let box = document.getElementById("exVideoDiv" + String(id));
let exVideoPlayer = document.getElementById("exVideoPlayer" + String(id));
let info = document.getElementById("exVideoInfo" + String(id));
let scale = document.getElementById("exVideoScale" + String(id));
let exVideoEmbed = document.getElementById("exVideoEmbed" + String(id));
let exVideoUnEmbed = document.getElementById("exVideoUnEmbed" + String(id));
exVideoPlayer.onclick = function(e) {
e.stopPropagation();
e.preventDefault();
if (scale.style.display != "block") {
scale.style.display = "block";
info.style.display = "block";
} else {
scale.style.display = "none";
info.style.display = "none";
}
for (let i = 0; i < videoPlayerArr.length; i++) {
let box = document.getElementById("exVideoDiv" + String(i));
if (box != null) {
if (i == id) {
box.style.zIndex = 1016;
} else {
box.style.zIndex = 1015;
}
}
}
}
let exVideoQn = document.getElementById("exVideoQn" + String(id));
// let exVideoCDN = document.getElementById("exVideoCDN" + String(id));
let exVideoClose = document.getElementById("exVideoClose" + String(id));
let originVideo = document.getElementById("__video2");
exVideoQn.onchange = function() {
getRealLive_Huya(rid, exVideoQn.value, (lurl, msg) => {
if (msg != "") {
showMessage(msg, "error");
return;
}
videoPlayerArr[id].destroy();
setElementVideo(id, lurl);
})
}
exVideoClose.onclick = function() {
originVideo.style.display = "block";
videoPlayerArr[id].destroy();
exVideoPlayer.remove();
box.remove();
}
let exVideoCopy = document.getElementById("exVideoCopy" + String(id));
exVideoCopy.onclick = function() {
getRealLive_Huya(rid, exVideoQn.value, (lurl, msg) => {
if (msg != "") {
showMessage(msg, "error");
return;
}
GM_setClipboard(lurl);
showMessage("复制成功", "success");
})
}
exVideoEmbed.onclick = function() {
originVideo.style.display = "none";
exVideoEmbed.style.display = "none";
exVideoUnEmbed.style.display = "inline";
box.style.height = "0px";
originVideo.parentElement.insertBefore(exVideoPlayer, originVideo);
}
exVideoUnEmbed.onclick = function() {
originVideo.style.display = "block";
exVideoUnEmbed.style.display = "none";
exVideoEmbed.style.display = "inline";
box.style.height = "250px";
box.insertBefore(exVideoPlayer, box.childNodes[box.childNodes.length - 1]);
}
}
// iframe
function createNewVideo_iframe(id, url) {
if (String(url).indexOf("douyu.com") == -1) {
showMessage("有弹幕模式仅支持斗鱼直播", "error");
return;
}
let rid_arr = String(url).split("/");
let rid = rid_arr[rid_arr.length - 1];
let a = document.createElement("div");
let html = "";
a.id = "exVideoDiv" + String(id);
a.rid = rid;
a.className = "exVideoDiv";
html += "
" + "斗鱼 - " + rid + " ";
html += "
X
"
html += "
";
html += "
"
html += "
";
a.innerHTML = html;
let b = document.getElementsByClassName("layout-Main")[0];
b.insertBefore(a, b.childNodes[0]);
setElementDrag(id);
setElementResize(id);
if (id > videoPlayerArr.length - 1) {
videoPlayerArr.push("iframe");
} else {
videoPlayerArr[id] = "iframe";
}
setElementFunc_iframe(id);
}
function setElementFunc_iframe(id) {
let box = document.getElementById("exVideoDiv" + String(id));
let exVideoClose = document.getElementById("exVideoClose" + String(id));
exVideoClose.onclick = function() {
videoPlayerArr[id].destroy();
box.remove();
}
box.onclick = function(e) {
e.stopPropagation();
e.preventDefault();
for (let i = 0; i < videoPlayerArr.length; i++) {
let box = document.getElementById("exVideoDiv" + String(i));
if (box != null) {
if (i == id) {
box.style.zIndex = 1016;
} else {
box.style.zIndex = 1015;
}
}
}
}
}
// 任意直播流
function createNewVideo_Stream(id, lurl) {
if (lurl == "" || lurl == null) return;
let a = document.createElement("div");
let html = "";
a.id = "exVideoDiv" + String(id);
a.rid = rid;
a.className = "exVideoDiv";
html += "
";
html += "
";
a.innerHTML = html;
let b = document.getElementsByClassName("layout-Main")[0];
b.insertBefore(a, b.childNodes[0]);
setElementDrag(id);
setElementResize(id);
setElementVideo(id, lurl);
setElementFunc_Stream(id);
}
function setElementFunc_Stream(id) {
let box = document.getElementById("exVideoDiv" + String(id));
let exVideoPlayer = document.getElementById("exVideoPlayer" + String(id));
let info = document.getElementById("exVideoInfo" + String(id));
let scale = document.getElementById("exVideoScale" + String(id));
let exVideoEmbed = document.getElementById("exVideoEmbed" + String(id));
let exVideoUnEmbed = document.getElementById("exVideoUnEmbed" + String(id));
exVideoPlayer.onclick = function(e) {
e.stopPropagation();
e.preventDefault();
if (scale.style.display != "block") {
scale.style.display = "block";
info.style.display = "block";
} else {
scale.style.display = "none";
info.style.display = "none";
}
for (let i = 0; i < videoPlayerArr.length; i++) {
let box = document.getElementById("exVideoDiv" + String(i));
if (box != null) {
if (i == id) {
box.style.zIndex = 1016;
} else {
box.style.zIndex = 1015;
}
}
}
}
let exVideoClose = document.getElementById("exVideoClose" + String(id));
let originVideo = document.getElementById("__video2");
exVideoClose.onclick = function() {
originVideo.style.display = "block";
videoPlayerArr[id].destroy();
exVideoPlayer.remove();
box.remove();
}
exVideoEmbed.onclick = function() {
originVideo.style.display = "none";
exVideoEmbed.style.display = "none";
exVideoUnEmbed.style.display = "inline";
box.style.height = "0px";
originVideo.parentElement.insertBefore(exVideoPlayer, originVideo);
}
exVideoUnEmbed.onclick = function() {
originVideo.style.display = "block";
exVideoUnEmbed.style.display = "none";
exVideoEmbed.style.display = "inline";
box.style.height = "250px";
box.insertBefore(exVideoPlayer, box.childNodes[box.childNodes.length - 1]);
}
}
let real_info = {
view: "",
showtime: 1015,
danmu_person_count: "",
gift_person_count: "",
paid_person_count: "",
isShow: 2,
money_yc: 0,
money_bag: 0,
money_total: 0,
}
let hasAvatarBottom = false;
function initPkg_RealAudience() {
initPkg_RealAudience_StyleHook();
initPkg_RealAudience_Dom();
initPkg_RealAudience_Func();
setAvatarVideo();
fetch("https://www.douyu.com/swf_api/h5room/" + rid, {
method: 'GET',
mode: 'no-cors',
credentials: 'include'
}).then(res => {
return res.json();
}).then(retData => {
real_info.showtime = retData.data.show_time;
real_info.isShow = retData.data.show_status;
setRealViewer();
setInterval(setRealViewer, 150000);
setInterval(switchRealAndTodayWatch, 5000);
}).catch(err => {
console.log("请求失败!", err);
})
}
function initPkg_RealAudience_StyleHook() {
StyleHook_set("Ex_Style_RealAudience", `
.VideoEntry{display:none !important;}
.layout-Player-rank{top:34px !important;}
`);
}
function initPkg_RealAudience_Dom() {
let real_viewIcon = '
';
let real_danmuIcon = '
';
// let real_giftIcon = '
'
let real_money_yc = '
';
document.getElementsByClassName("VideoEntry")[0].style.display = "none";
// document.querySelector(".AnchorAnnounce > h3").style.display = "none";
let html = "";
let a = document.createElement("div");
a.className = "real-audience";
html += "
";
html += "
" + real_viewIcon + '****
';
html += "
" + real_danmuIcon + '****
';
// html += "
" + real_giftIcon + '****
';
html += "
" + real_money_yc + '****
';
html += "
";
html += '
' + "已播:" + "****" + " ";
html += '
' + "已观看:" + "****" + " ";
a.innerHTML = html;
let b = document.getElementsByClassName("layout-Player-announce")[0];
b.insertBefore(a, b.childNodes[0]);
}
function initPkg_RealAudience_Func() {
document.getElementsByClassName("real-audience")[0].addEventListener("click", function() {
openPage(`https://www.doseeing.com/room/${rid}`, true);
})
}
async function setRealViewer() {
if(document.querySelector(".MatchSystemChatRoomEntry") != null){
document.querySelector(".MatchSystemChatRoomEntry").style.display = "none";
}
let retData = await getRealViewer(rid);
let todayWatchData = await getTodayWatch(rid);
let showedTime = 0;
if (real_info.isShow == 2) {
showedTime = 0;
} else {
if (real_info.showtime == 1015) {
showedTime = 0;
} else {
showedTime = Math.floor(Date.now()/1000) - Number(real_info.showtime);
}
}
real_info.view = retData.data["active.uv"] || 0;
real_info.danmu_person_count = retData.data["chat.uv"] || 0;
real_info.gift_person_count = retData.data["gift.all.uv"] || 0;
real_info.paid_person_count = retData.data["gift.paid.uv"] || 0;
real_info.money_yc = Number(retData.data["gift.paid.price"] / 100 || 0).toFixed(2);
real_info.money_total = Number(retData.data["gift.all.price"] / 100 || 0).toFixed(2);
document.getElementById("real-audience__total").innerText = real_info.view;
document.getElementById("real-audience__t").title = "活跃人数:" + real_info.view + " 弹幕人数:" + real_info.danmu_person_count + " 送礼人数:" + real_info.gift_person_count + " 付费人数:" + real_info.paid_person_count;
document.getElementById("real-audience__barrage").innerText = real_info.danmu_person_count;
// document.getElementById("real-audience__gift").innerText = real_info.gift_person_count;
document.getElementById("real-audience__money_yc").innerText = real_info.money_yc;
document.getElementById("real-audience__money").title = "总礼物价值:" + real_info.money_total + " 鱼翅礼物:" + real_info.money_yc;
document.getElementById("real-audience__time").innerText = "已播:" + formatSeconds(showedTime);
document.getElementById("real-audience__time").title = "开播时间:" + String(dateFormat("yyyy年MM月dd日hh时mm分ss秒 ",new Date(Number(real_info.showtime + "000")))) + "\n已观看:" + formatSeconds(todayWatchData.data.todayWatch);
if (todayWatchData.error == 0) {
document.getElementById("real-audience__watchtime").innerText = "已观看:" + formatSeconds(todayWatchData.data.todayWatch);
document.getElementById("real-audience__watchtime").title = "开播时间:" + String(dateFormat("yyyy年MM月dd日hh时mm分ss秒 ",new Date(Number(real_info.showtime + "000")))) + "\n已观看:" + formatSeconds(todayWatchData.data.todayWatch);
}
}
function setAvatarVideo() {
// 1. 插入对应的dom
// 2. 绑定相应的函数
// 3. 拉高黑框
// 4. 对头像框鼠标移入移出事件绑定
let homeDom = document.querySelectorAll(".VideoEntry-tabItem>a")[0];
if (homeDom == undefined) {
return;
}
let videoUrl = homeDom.href + "?type=video";
let videoReplayUrl = homeDom.href + "?type=liveReplay";
setAvatarVideo_Dom();
setAvatarVideo_Func(videoUrl, videoReplayUrl);
document.getElementsByClassName("Title-anchorPic-bottom")[0].style.display = "none";
document.getElementsByClassName("Title-anchorPic-bottom")[0].style.height = hasAvatarBottom ? "44px" : "22px";
document.getElementsByClassName("Title-anchorPicBack")[0].addEventListener("mouseenter", () => {
document.getElementsByClassName("Title-anchorPic-bottom")[0].style.display = "block";
});
document.getElementsByClassName("Title-anchorPicBack")[0].addEventListener("mouseleave", () => {
document.getElementsByClassName("Title-anchorPic-bottom")[0].style.display = "none";
});
}
function setAvatarVideo_Dom() {
let a = document.createElement("div");
hasAvatarBottom = !!document.getElementsByClassName("Title-anchorPic-bottom")[0];
a.className = hasAvatarBottom ? "" : "Title-anchorPic-bottom";
a.innerHTML = `
回看
投稿
`
let b = document.getElementsByClassName("Title-anchorPic-bottom")[0] || document.getElementsByClassName("Title-anchorPicBack")[0];
b.append(a);
}
function setAvatarVideo_Func(videoUrl, videoReplayUrl) {
document.getElementById("Ex_VideoSubmit").addEventListener("click", () => {
openPage(videoUrl, true);
})
document.getElementById("Ex_VideoReview").addEventListener("click", () => {
openPage(videoReplayUrl, true);
})
}
function getTodayWatch(rid) {
return new Promise((resolve, reject) => {
fetch('https://www.douyu.com/japi/interactnc/web/fsjk/getCardTaskInfo?rid=' + rid,{
method: 'GET',
mode: 'no-cors',
credentials: 'include'
}).then(res => {
return res.json();
}).then(ret => {
resolve(ret);
}).catch(err => {
reject(err);
})
})
}
function getRealViewer(rid) {
return new Promise((resolve, reject) => {
GM_xmlhttpRequest({
method: "POST",
url: `https://www.doseeing.com/xeee/room/aggr`,
headers: {
"Connection": "keep-alive",
"Content-Type": "application/json;charset=UTF-8",
"Origin": "https://www.doseeing.com",
"Referer": "https://www.doseeing.com/room/" + rid,
"User-Agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1 Edg/91.0.4472.114"
},
data: `{"m":"${window.btoa(`rid=${rid}&dt=0`).split("").reverse().join("")}"}`,
responseType: "json",
onload: (response) => {
resolve(response.response);
},
onerror: (err) => {
reject(err);
}
});
})
}
function switchRealAndTodayWatch() {
let realDom = document.getElementById("real-audience__time");
let watchDom = document.getElementById("real-audience__watchtime");
if (realDom.style.display == "none") {
realDom.style.display = "block";
watchDom.style.display = "none";
} else {
realDom.style.display = "none";
watchDom.style.display = "block";
}
}
function initPkg_Refresh() {
initPkg_Refresh_BarrageFrame();
initPkg_Refresh_Video();
initPkg_Refresh_Barrage();
}
function saveData_Refresh() {
// 此处为保存简洁模式的数据,请在每次操作后都调用这个函数以保存状态
// 数据结构
// {功能1:{子功能1:{}}}
// 每个子模块需要提供相应的返回数据函数
let data = {
barrageFrame: {
status: refresh_BarrageFrame_getStatus(),
},
video: {
status: refresh_Video_getStatus(),
},
barrage: {
status: refresh_Barrage_getStatus(),
}
}
localStorage.setItem("ExSave_Refresh", JSON.stringify(data)); // 存储弹幕列表
}
let current_barrage_status = 0; // 0没被简化 1被简化
function initPkg_Refresh_Barrage() {
initPkg_Refresh_Barrage_Dom();
initPkg_Refresh_Barrage_Func();
initPkg_Refresh_Barrage_Set();
}
function initPkg_Refresh_Barrage_Dom() {
Refresh_Barrage_insertIcon();
}
function Refresh_Barrage_insertIcon() {
let a = document.createElement("a");
a.className = "refresh-barrage";
a.id = "refresh-barrage";
a.innerHTML = '
前缀 ';
let b = document.getElementsByClassName("Barrage-toolbar")[0];
b.insertBefore(a, b.childNodes[0]);
}
function initPkg_Refresh_Barrage_Func() {
document.getElementById("refresh-barrage").addEventListener("click", function() {
if (current_barrage_status == 0) {
// 简化
setRefreshBarrage();
} else {
cancelRefreshBarrage();
}
saveData_Refresh();
});
}
function refresh_Barrage_getStatus() {
if (current_barrage_status == 1) {
// 被简化
return true;
} else {
// 没被简化
return false;
}
}
function initPkg_Refresh_Barrage_Set() {
let ret = localStorage.getItem("ExSave_Refresh");
if (ret != null) {
let retJson = JSON.parse(ret);
if ("barrage" in retJson == false) {
retJson.barrage = {status: false};
}
if (retJson.barrage.status == true) {
setRefreshBarrage();
}
}
}
function setRefreshBarrage() {
let cssText = `
.UserCsgoGameDataMedal,.Barrage-honor,.Barrage-listItem .Barrage-icon,.Barrage-listItem .FansMedal.is-made,.Barrage-listItem .RoomLevel,.Barrage-listItem .Motor,.Barrage-listItem .ChatAchievement,.Barrage-listItem .Barrage-hiIcon,.Barrage-listItem .Medal,.Barrage-listItem .MatchSystemTeamMedal{display:none !important;}
/*.Barrage-listItem .UserLevel{display:none !important;}*/
.Barrage-listItem .Baby{display:none !important;}
.FansMedalWrap{display:none !important;}
`;
StyleHook_set("Ex_Style_RefreshBarrage", cssText);
current_barrage_status = 1;
document.getElementById("refresh-barrage").style.backgroundColor = "rgb(18,150,219)";
document.getElementById("refresh-barrage__text").style.color = "#fff";
}
function cancelRefreshBarrage() {
StyleHook_remove("Ex_Style_RefreshBarrage");
current_barrage_status = 0;
document.getElementById("refresh-barrage").style.backgroundColor = "#fff";
document.getElementById("refresh-barrage__text").style.color = "";
}
function initPkg_Refresh_BarrageFrame() {
initPkg_Refresh_BarrageFrame_Dom();
initPkg_Refresh_BarrageFrame_Func();
initPkg_Refresh_BarrageFrame_Set();
}
function initPkg_Refresh_BarrageFrame_Dom() {
Refresh_BarrageFrame_insertIcon();
}
function Refresh_BarrageFrame_insertIcon() {
let a = document.createElement("a");
a.className = "Barrage-toolbarLock";
a.id = "refresh-barrage-frame";
a.innerHTML = '
拉高 ';
let b = document.getElementsByClassName("Barrage-toolbar")[0];
b.insertBefore(a, b.childNodes[0]);
}
function initPkg_Refresh_BarrageFrame_Func() {
document.getElementById("refresh-barrage-frame").addEventListener("click", function() {
let dom_rank = document.getElementsByClassName("layout-Player-rank")[0];
let dom_barrage = document.getElementById("js-player-barrage");
let dom_activity = document.getElementById("js-room-activity");
let dom_topBarrage = document.getElementsByClassName("Barrage")[0];
if (dom_rank.style.display == "none") {
// 被拉高
dom_rank.style.display = "block";
dom_barrage.style = "";
dom_activity.style.display = "block";
dom_topBarrage.className = "Barrage";
document.getElementById("refresh-barrage-frame__text").innerText = "拉高";
} else {
// 没拉高
let topHeight = document.getElementsByClassName("layout-Player-announce")[0].offsetHeight;
dom_rank.style.display = "none";
dom_activity.style.display = "none";
dom_barrage.style = "top:" + topHeight + "px";
dom_topBarrage.className = "Barrage top-0-important";
document.getElementById("refresh-barrage-frame__text").innerText = "恢复";
}
saveData_Refresh();
});
}
function refresh_BarrageFrame_getStatus() {
let dom_rank = document.getElementsByClassName("layout-Player-rank")[0];
if (dom_rank.style.display == "none") {
// 被拉高
return true;
} else {
// 没拉高
return false;
}
}
function initPkg_Refresh_BarrageFrame_Set() {
let ret = localStorage.getItem("ExSave_Refresh");
if (ret != null) {
let retJson = JSON.parse(ret);
if ("barrageFrame" in retJson == false) {
retJson.barrageFrame = {status: false};
}
if (retJson.barrageFrame.status == true) {
let dom_rank = document.getElementsByClassName("layout-Player-rank")[0];
let dom_barrage = document.getElementById("js-player-barrage");
let dom_activity = document.getElementById("js-room-activity");
let topHeight = document.getElementsByClassName("layout-Player-announce")[0].offsetHeight;
dom_rank.style.display = "none";
dom_activity.style.display = "none";
dom_barrage.style = "top:" + topHeight + "px";
document.getElementById("refresh-barrage-frame__text").innerText = "恢复";
}
}
}
let video_num = 0;
function initPkg_Refresh_Video() {
let timer = setInterval(() => {
if (document.getElementsByClassName("right-e7ea5d").length > 0) {
clearInterval(timer);
initPkg_Refresh_Video_Dom();
initPkg_Refresh_Video_Func();
initPkg_Refresh_Video_Set();
}
video_num++;
if (video_num >= 100) {
clearInterval(timer);
}
}, 1500);
}
function initPkg_Refresh_Video_Dom() {
Refresh_Video_insertIcon();
}
function Refresh_Video_insertIcon() {
let a = document.createElement("li");
a.id = "refresh-video";
a.innerText = "简洁模式";
let b = document.getElementsByClassName("menu-da2a9e")[0];
b.insertBefore(a, b.childNodes[b.childNodes.length -1]);
a = document.createElement("div");
a.id = "refresh-video2";
a.title = "视频区简洁模式";
a.innerHTML = '
';
b = document.getElementsByClassName("PlayerToolbar")[0];
b.insertBefore(a, b.childNodes[0]);
}
function initPkg_Refresh_Video_Func() {
new DomHook('.right-e7ea5d', true, () => {
const video_fullPage = document.querySelector('.wfs-2a8e83.removed-9d4c42') ? true : false;
const dom_player_toolbar = document.getElementById("js-player-toolbar");
dom_player_toolbar.style = video_fullPage ? "z-index:20" : "z-index:30";
});
document.getElementById("refresh-video").addEventListener("click", (e) => {
let dom_toolbar = document.getElementsByClassName("PlayerToolbar-ContentRow")[0];
let dom_video = document.getElementsByClassName("layout-Player-video")[0];
let dom_refresh = document.getElementById("refresh-video");
let dom_refresh2 = document.getElementById("refresh-video2");
if (dom_toolbar.style.visibility == "hidden") {
dom_toolbar.style.visibility = "visible";
dom_video.style = "";
dom_refresh2.style.display = "none";
dom_refresh.innerText = "简洁模式";
refresh_Video_removeStyle();
} else {
dom_toolbar.style.visibility = "hidden";
dom_video.style = "bottom:0;z-index:25";
dom_refresh2.style.display = "block";
dom_refresh.innerText = "√ 简洁模式";
refresh_Video_setStyle();
}
saveData_Refresh();
resizeWindow();
});
document.getElementById("refresh-video2").addEventListener("click", () => {
let dom_toolbar = document.getElementsByClassName("PlayerToolbar-ContentRow")[0];
let dom_video = document.getElementsByClassName("layout-Player-video")[0];
let dom_refresh = document.getElementById("refresh-video");
let dom_refresh2 = document.getElementById("refresh-video2");
if (dom_toolbar.style.visibility == "hidden") {
dom_toolbar.style.visibility = "visible";
dom_video.style = "";
dom_refresh2.style.display = "none";
dom_refresh.innerText = "简洁模式";
refresh_Video_removeStyle();
} else {
dom_toolbar.style.visibility = "hidden";
dom_video.style = "bottom:0;z-index:25";
dom_refresh2.style.display = "block";
dom_refresh.innerText = "√ 简洁模式";
refresh_Video_setStyle();
}
saveData_Refresh();
resizeWindow();
});
}
function refresh_Video_getStatus() {
let dom_toolbar = document.getElementsByClassName("PlayerToolbar-ContentRow")[0];
if (dom_toolbar.style.visibility == "hidden") {
return true;
} else {
return false;
}
}
// FullPageFollowGuide
function initPkg_Refresh_Video_Set() {
let ret = localStorage.getItem("ExSave_Refresh");
if (ret != null) {
let retJson = JSON.parse(ret);
if ("video" in retJson == false) {
retJson.video = {status: false};
}
if (retJson.video.status == true) {
let dom_toolbar = document.getElementsByClassName("PlayerToolbar-ContentRow")[0];
let dom_video = document.getElementsByClassName("layout-Player-video")[0];
let dom_refresh2 = document.getElementById("refresh-video2");
let dom_refresh = document.getElementById("refresh-video");
let dom_player_toolbar = document.getElementById("js-player-toolbar");
dom_toolbar.style.visibility = "hidden";
dom_video.style = "bottom:0;z-index:25";
dom_player_toolbar.style = "z-index:30";
let ret = localStorage.getItem("ExSave_FullScreen");
if (ret != null) {
let retJson = JSON.parse(ret);
if (retJson.isFullScreen) {
dom_player_toolbar.style = "z-index:20";
}
}
dom_refresh2.style.display = "block";
dom_refresh.innerText = "√ 简洁模式";
refresh_Video_setStyle();
resizeWindow();
}
}
}
function refresh_Video_setStyle() {
StyleHook_set("Ex_Style_VideoRefresh", `
.PELact,.pushTower-wrapper-gf1HG,.PkView-9f6a2c,.MorePk,.RandomPKBar,.LiveRoomLoopVideo,.LiveRoomDianzan,.maiMaitView-68e80c,.PkView{display:none !important;}
`)
}
function refresh_Video_removeStyle() {
StyleHook_remove("Ex_Style_VideoRefresh");
}
function initPkg_RemoveAD() {
let t = setInterval(() => {
let a = document.getElementsByClassName("PlayerToolbar-wealthNum")[0];
if (a != undefined) {
clearInterval(t);
optimizePageStyle();
removeChatLimit();
initPkg_RemoveMsgNotice();
}
}, 1000);
}
// .dy-ModalRadius-mask,dy-ModalRadius-wrap{display:none !important;}
function removeAD() {
StyleHook_set("Ex_Style_RemoveAD", `
.ScreenBannerAd,.XinghaiAd,.CustomGroupGuide,.FudaiGiftToolBarTips,.UserInfo-tryEnterHiddenLead,.BargainingKit,.AnchorPocketTips,.FishShopTip,.FollowGuide,#js-bottom-right-cloudGame,.CloudGameLink,.RoomText-icon-horn,.RoomText-list,.Search-ad,.RedEnvelopAd,.noHandlerAd-0566b9,.PcDiversion,.DropMenuList-ad,.DropPane-ad,.WXTipsBox,.igl_bg-b0724a,.closure-ab91fb,.VideoAboveVivoAd,.css-widgetWrapper-EdVVC,.watermark-442a18,.FollowGuide-FadeOut,.MatchSystemChatRoomEntry-roomTabs,.FansMedalDialog-normal,.GameLauncher,.recommendAD-54569e,.recommendApp-0e23eb,.Title-ad,.Bottom-ad,.SignBarrage,.corner-ad-495ade,.SignBaseComponent-sign-ad,.SuperFansBubble,.is-noLogin,.PlayerToolbar-signCont,#js-widget,.Frawdroom,.HeaderGif-right,.HeaderGif-left,.liveos-workspace{display:none !important;}
.Barrage-topFloater{z-index:999}
.danmuAuthor-3d7b4a, .danmuContent-25f266{overflow: initial}
.BattleShipTips{display:none !important;}
.LastLiveTime,.recommendView-3e8b62{display:none !important;}
.TurntableLottery-actTips{display:none !important;}
.feedback-e27241{display:none !important;}
.FansMedalEnter-maxFlag{display:none !important;}
.Header-follow-listBox{max-height:640px !important;}
.GuessGameMiniPanelB-wrapper{display:none !important;}
.ZoomTip{display:none !important;}
/*福利券*/
.PlayerToolbar-couponInfo{display:none !important;}
/*太空探险tips*/
.AroundStarsActTips-actTips,.AroundStarsMoonBoxTips,.AroundStarsPlanetTips{display:none !important;}
/*优化页面*/
#js-barrage-list-parent{scrollbar-width: none;-ms-overflow-style: none;width:98%;height:100%}
#js-barrage-list-parent::-webkit-scrollbar{display: none;}
/*陪玩*/
.InteractPlayWithEnter-enterTips1{display:none !important;}
/*恢复emoji彩色 chrome加粗情况下emoji会变灰,需要找一个fontweight起始值在500的字体库才可以兼容*/
/*右侧分享*/
.SharePanel,.CommonShareToolkit{
display: none!important;
}
/*去除还在电脑面前的mask*/
.mask1-63237a,.mask2-a8df6e,.panel1-1484c9,.panel2-5ece0e{
display: none!important;
}
/*左侧悬浮二维码广告*/
.IconCardAdCard{
display: none!important;
}
/*视频右侧的游戏手柄按钮AD*/
.IconCardAd {
display: none!important;
}
/*视频区视频广告*/
.CloseVideoPlayerAd,.IconCardAdBoundsBox{
display: none!important;
}
/*直播间顶部广告*/
.room-top-banner-box {
display: none!important;
}
/*弹幕框底部进场弹幕信息*/
#js-barrage-extend-container {
display: none!important;
display: var(--enter-display, none) !important;
}
/*直播间右侧广告*/
.LadderNav {
display: none!important;
}
#js-bottom-right-recommendAd {
display: none!important;
}
/*弹幕框顶部广告*/
.aside-top-uspension-box {
display: none!important;
}
#js-player-asideMain {
top: 0!important;
}
`);
// body{transform: translateZ(0)!important;}
// .RomanticDatePanelModal-middle--small{height:220px !important;}
// .MainDialog-main--content{height:450px !important;}
// .RomanticDatePanelModal-middle--rowItemBottom--rowItemBottomBtn{margin-left:0px !important;margin-top:0px !important;width:170px !important;height:40px !important;background:orange !important;}
// }
}
function removeChatLimit() {
let a;
a = document.getElementsByClassName("ChatSend-button")[0];
if (a != undefined) {
a.className = "ChatSend-button";
}
a = document.getElementsByClassName("ChatSend-txt")[0];
if (a != undefined) {
a.maxLength = a.maxLength + 20; // 原来为50字符,修改成70字符
}
}
function optimizePageStyle() {
// 弹幕框滚动条隐藏
let dom_barrage = document.getElementById("js-barrage-list").parentNode;
dom_barrage.id = "js-barrage-list-parent";
}
let isRemoveMsgNotice = 0;
function initPkg_RemoveMsgNotice() {
initPkg_RemoveMsgNotice_Dom();
initPkg_RemoveMsgNotice_Func();
initPkg_RemoveMsgNotice_Set();
}
function initPkg_RemoveMsgNotice_Dom() {
let a = document.createElement("div");
a.style = "position: absolute;right: 5px;top: 40px;cursor: pointer;"
a.id = "ex-removeMsgNotice";
a.innerHTML = `
关闭角标提醒`;
a.title = "关闭角标提醒";
let b = document.getElementsByClassName("PrivateLetter-frame")[0];
if (b) {
b.appendChild(a);
}
}
function initPkg_RemoveMsgNotice_Func() {
let dom = document.getElementById("msg-removeNotice");
if (!dom) return;
let checkbox = dom.querySelector("input");
dom.addEventListener("click", () => {
let ischecked = checkbox.checked;
if (ischecked == true) {
isRemoveMsgNotice = 1;
removeMsgNotice();
} else{
isRemoveMsgNotice = 0;
removeMsgNoticeCanel();
}
saveData_removeMsgNotice();
})
}
function initPkg_RemoveMsgNotice_Set() {
let ret = localStorage.getItem("ExSave_isRemoveMsgNotice");
if (ret && ret == "1") {
isRemoveMsgNotice = 1;
removeMsgNotice();
let dom = document.getElementById("msg-removeNotice");
if (dom) {
dom.querySelector("input").checked = true;
}
}
}
function removeMsgNotice() {
StyleHook_set("Ex_Style_RemoveMsgNotice", `.UserInfo .Badge,.ChatLetter-PopUnread{display:none!important;}`);
}
function removeMsgNoticeCanel() {
StyleHook_remove("Ex_Style_RemoveMsgNotice");
}
function saveData_removeMsgNotice() {
localStorage.setItem("ExSave_isRemoveMsgNotice", isRemoveMsgNotice);
}
const roomVipExpireDayLimit = 3;
function initPkg_RoomVip() {
setRoomVipExpireDays();
}
function initPkg_RoomVip_Dom() {
let a = document.createElement("span");
a.className = "room-vip";
a.innerHTML = `
距VIP到期
** 天
`;
let b = document.getElementsByClassName("PlayerToolbar-Wealth")[0];
b.insertBefore(a, b.childNodes[0]);
}
function setRoomVipExpireDays() {
fetch("https://www.douyu.com/member/platform_task/effect_list", {
method: "GET",
mode: "no-cors",
cache: "default",
credentials: "include"
})
.then((res) => {
return res.text();
})
.then(async (doc) => {
doc = new DOMParser().parseFromString(doc, "text/html");
const enterEffectDom = doc.getElementsByClassName("enter-wraper is-effect");
if (!enterEffectDom) return;
if (enterEffectDom.length == 0) return;
const showEffectMoreDom = enterEffectDom[0].getElementsByClassName("show-effect-more");
if (!showEffectMoreDom) return;
if (showEffectMoreDom.length == 0) return;
for (let i = 0; i < showEffectMoreDom.length; i++) {
const detail = JSON.parse(showEffectMoreDom[i].getAttribute("data-detail"));
if (String(detail.property_id) !== "1646") continue; // 1646是VIP的ID
if (String(detail.show_id_list) !== String(rid)) continue;
const expireTime = detail.expire_time * 1000;
const days = Math.floor((expireTime - Date.now()) / (1000 * 60 * 60 * 24));
if (days <= roomVipExpireDayLimit) {
initPkg_RoomVip_Dom();
document.getElementById("room-vip-expire-days").innerText = days;
}
}
})
.catch((err) => {
console.log("请求失败!", err);
});
}
let isRemoveDanmakuBackground = getLocalIsRemoveDanmakuBackground();
function initPkg_Shield_RemoveDanmakuBackground() {
const shieldTool = document.getElementsByClassName("ShieldTool-list")[0];
shieldTool.insertAdjacentHTML(
"beforeend",
`
屏蔽弹幕背景
`
);
if (isRemoveDanmakuBackground) removeDanmakuBackground();
const dom = document.getElementById("ex-removeDanmakuBackground");
dom.addEventListener("click", () => {
isRemoveDanmakuBackground = !isRemoveDanmakuBackground;
if (isRemoveDanmakuBackground) {
removeDanmakuBackground();
dom.className = dom.className.replace("is-noChecked", "is-checked");
} else {
StyleHook_remove("Ex_Style_RemoveDanmakuBackground");
dom.className = dom.className.replace("is-checked", "is-noChecked");
}
saveRemoveDanmakuBackground();
});
}
function getLocalIsRemoveDanmakuBackground() {
const ret = localStorage.getItem("ExSave_isRemoveDanmakuBackground");
return ret ? Number(ret) === 1 : false;
}
function saveRemoveDanmakuBackground() {
localStorage.setItem("ExSave_isRemoveDanmakuBackground", isRemoveDanmakuBackground ? 1 : 0);
}
function removeDanmakuBackground() {
StyleHook_set(
"Ex_Style_RemoveDanmakuBackground",
`
.danmuItem-31f924 {
background: none !important;
}
.danmuItem-31f924 div{
background: none;
}
.danmuItem-31f924 > img {
display: none;
}
.danmuItem-31f924 div > img {
display: none;
}
.super-text-0281ca {
background: none !important;
}
.danmuItem-31f924 .noble-bf13ad {
background: none !important;
}
.customBarrage {
background: none !important;
text-shadow: none !important;
}
.customBarrage > div {
background: none !important;
}
`
);
}
let isRemoveDanmakuImage = getLocalIsRemoveDanmakuImage();
function initPkg_Shield_RemoveDanmakuImage() {
const shieldTool = document.getElementsByClassName("ShieldTool-list")[0];
shieldTool.insertAdjacentHTML(
"beforeend",
`
屏蔽DouyuEx图片
`
);
if (isRemoveDanmakuImage) removeDanmakuImage();
const dom = document.getElementById("ex-RemoveDanmakuImage");
dom.addEventListener("click", () => {
isRemoveDanmakuImage = !isRemoveDanmakuImage;
if (isRemoveDanmakuImage) {
removeDanmakuImage();
dom.className = dom.className.replace("is-noChecked", "is-checked");
} else {
StyleHook_remove("Ex_Style_RemoveDanmakuImage");
dom.className = dom.className.replace("is-checked", "is-noChecked");
}
saveRemoveDanmakuImage();
});
}
function getLocalIsRemoveDanmakuImage() {
const ret = localStorage.getItem("ExSave_isRemoveDanmakuImage");
return ret ? Number(ret) === 1 : false;
}
function saveRemoveDanmakuImage() {
localStorage.setItem("ExSave_isRemoveDanmakuImage", isRemoveDanmakuImage ? 1 : 0);
}
function removeDanmakuImage() {
StyleHook_set(
"Ex_Style_RemoveDanmakuImage",
`
.danmuItem-31f924 a {
display: none !important;
}
`
);
}
function initPkg_Shield_RemoveEnter() {
let shieldTool = document.getElementsByClassName("ShieldTool-list")[0];
let isRemoveEnterBarrage = localStorage.getItem("ExSave_isRemoveEnterBarrage"); // '1'移除check
let isChecked = (isRemoveEnterBarrage == null || isRemoveEnterBarrage == '1') ? true : false;
let isSupported = window.CSS && window.CSS.supports && window.CSS.supports('--enter-display', 'none'); //CSS变量兼容性检测
let barrageExtendContainer = document.getElementById("js-barrage-extend-container");
barrageExtendContainer && barrageExtendContainer.style.setProperty("--enter-display", isChecked ? "none" : "block", "important");
if (shieldTool == undefined || !isSupported)
return;
if (isRemoveEnterBarrage == null)
isRemoveEnterBarrage = '1';
shieldTool.insertAdjacentHTML("beforeend", `
屏蔽进场弹幕
`);
document.getElementById("ex-enter-shield").addEventListener("click", (e) => {
let classList = e.currentTarget.classList;
let noChecked = classList.toggle("is-noChecked");
let chceked = classList.toggle("is-checked");
let enterDisplay = (noChecked && !chceked) ? "block": "none";
barrageExtendContainer && barrageExtendContainer.style.setProperty("--enter-display", enterDisplay, "important");
localStorage.setItem("ExSave_isRemoveEnterBarrage", (noChecked && !chceked) ? "0" : "1"); // '1'移除check
});
}
function initPkg_Shield() {
let t = setInterval(() => {
if (typeof document.getElementsByClassName("ShieldTool-list")[0] !== "undefined") {
clearInterval(t);
initPkg_Shield_RemoveEnter();
initPkg_Shield_RemoveDanmakuBackground();
}
}, 1000);
}
function initPkg_ShowDanmaku() {
responseHook((url, text) => {
if (url.indexOf("/betard") !== -1) {
return text.replace('player_barrage\":0', 'player_barrage\":1');
}
return text;
});
}
function initPkg_ShowDanmakuOriginAction() {
scriptHook({
url: "/firstqueue",
callback: (content) => {
let newContent = content;
// 加一按钮
newContent = newContent.replace(`if(s&&s.isOpenFireFBComment)`, `if(true)`);
// 回复按钮
newContent = newContent.replace(`if(B&&!this.isFireOpenRank(a))if(parseInt(B,10)&&M&&S>=R&&(!L||L&&I))`, `if(true)if(true) `);
// 点赞按钮
newContent = newContent.replace(`else if(1==+Object(m.A)("barrage_praise"))`, `if(true) `);
return newContent;
}
});
}
function initPkg_Sign() {
initPkg_Sign_Dom();
initPkg_Sign_Func();
}
function initPkg_Sign_Func() {
let dom = new CClick(document.getElementsByClassName("ex-sign")[0]);
dom.click(() => {
initPkg_Sign_Main(false); // 只签到开播的
});
dom.longClick(() => {
initPkg_Sign_Main(true); // 全部签到
});
}
function initPkg_Sign_Dom() {
Sign_insertIcon();
}
function Sign_insertIcon() {
let a = document.createElement("div");
a.className = "ex-sign"; // 以免有同名冲突,加了ex-
a.innerHTML = '
';
let b = document.getElementsByClassName("ex-panel__wrap")[0];
b.insertBefore(a, b.childNodes[0]);
}
function initPkg_Sign_Main(isAll) {
// 这里挂载每个子模块的函数入口
// 入口即为调用
initPkg_Sign_Yuba(); // 鱼吧签到
initPkg_Sign_Client();
// initPkg_Sign_Motorcade();
initPkg_Sign_Room(isAll);
// initPkg_Sign_Ad_666(); // 此处移动到鱼塘鱼丸领取中去以免观看冲突
// initPkg_Sign_Ad_Sign(); // 2022年9月1日23:41:59 失效
// initPkg_Sign_Aoligei();
// initPkg_Sign_Ad_Yuba();
// initPkg_Sign_Bycc();
// saobai后每秒签到一个
// initPkg_Sign_Saobai();
// initPkg_Sign_Changzheng();
// initPkg_Sign_Chengxiao();
// initPkg_Sign_WuXuanyi();
// initPkg_Sign_1000();
// initPkg_Sign_Zhuli();
// initPkg_Sign_TV(); // 2022年9月1日23:41:59 失效
// initPkg_Sign_Yuba_Like(); // 2022年9月1日23:41:59 失效
// initPkg_Sign_Renlei();
initPkg_Sign_Act();
initPkg_Sign_ActqzsUserTask();
// initPkg_Sign_Bowuyuan();
// initPkg_Sign_ZBXSL2();
// initPkg_Sign_COD();
// initPkg_Sign_Wangzhe();
initPkg_Sign_ReadPosts();
initPkg_Sign_Follow();
initPkg_Sign_FansTree();
initPkg_Sign_SuperFans();
}
// function takeActPrize(name) {
// // 关注20200911LMJX_T2
// // 分享20200911LMJX_T5
// return new Promise(resolve => {
// fetch('https://www.douyu.com/japi/carnival/nc/actTask/takePrize',{
// method: 'POST',
// mode: 'no-cors',
// credentials: 'include',
// headers: {'Content-Type': 'application/x-www-form-urlencoded'},
// body: `token=${ dyToken }&aid=android&taskAlias=${ name }`
// }).then(res => {
// return res.json();
// }).then(ret => {
// resolve(ret);
// }).catch(err => {
// console.log("请求失败!", err);
// })
// })
// }
// function addFollowRoom(rid) {
// return new Promise(resolve => {
// fetch('https://www.douyu.com/wgapi/livenc/liveweb/follow/add',{
// method: 'POST',
// mode: 'no-cors',
// credentials: 'include',
// headers: {'Content-Type': 'application/x-www-form-urlencoded'},
// body: `rid=${ rid }&ctn=${ getCCN() }`
// }).then(res => {
// return res.json();
// }).then(ret => {
// resolve(ret);
// }).catch(err => {
// console.log("请求失败!", err);
// })
// })
// }
// function removeFollowRoom(rid) {
// return new Promise(resolve => {
// fetch('https://www.douyu.com/wgapi/livenc/liveweb/follow/rm',{
// method: 'POST',
// mode: 'no-cors',
// credentials: 'include',
// headers: {'Content-Type': 'application/x-www-form-urlencoded'},
// body: `rid=${ rid }&ctn=${ getCCN() }`
// }).then(res => {
// return res.json();
// }).then(ret => {
// resolve(ret);
// }).catch(err => {
// console.log("请求失败!", err);
// })
// })
// }
// function shareAct(name) {
// // 20200911LMJX
// return new Promise(resolve => {
// fetch('https://www.douyu.com/japi/carnival/common/share',{
// method: 'POST',
// mode: 'no-cors',
// credentials: 'include',
// headers: {'Content-Type': 'application/x-www-form-urlencoded'},
// body: `actAlias=${ name }&token=${ dyToken }`
// }).then(res => {
// return res.json();
// }).then(ret => {
// resolve(ret);
// }).catch(err => {
// console.log("请求失败!", err);
// })
// })
// }
// function getJackpot(id) {
// return new Promise(resolve => {
// fetch("https://www.douyu.com/japi/carnival/nc/lottery/jackpot", {
// method: 'POST',
// headers: {'Content-Type': 'application/json;charset=UTF-8'},
// body: `{"activityId":"${ id }","token":"${ dyToken }"}`
// }).then(res => {
// return res.json();
// }).then(ret => {
// resolve(ret);
// })
// })
// }
// function getActRemaining(id) {
// return new Promise(resolve => {
// fetch("https://www.douyu.com/japi/carnival/nc/lottery/remaining?activityId=" + id, {
// method: 'GET',
// mode: 'no-cors',
// credentials: 'include',
// headers: {'Content-Type': 'application/json;charset=UTF-8'},
// }).then(res => {
// return res.json();
// }).then(ret => {
// resolve(ret);
// })
// })
// }
// 本地化的活动地址
// {
// "version": "2021.01.29.01",
// "data": [{
// "name": "斗鱼党宣",
// "script": [{
// "name": "signAct",
// "value": "XSDXZC"
// }, {
// "name": "getActRemaining",
// "value": "610"
// }]
// },
// {
// "name": "春节签到",
// "script": [{
// "name": "doSign",
// "value": "20210210lhqd"
// }]
// },
// ]
// }
let actList = {};
function initPkg_Sign_Act() {
getAct();
}
async function getAct() {
// actList = JSON.parse(decodeURIComponent(escape(window.atob(actList))) || "{}");
if ("data" in actList == false) {
return;
}
for (let i = 0; i < actList.data.length; i++) {
let eachAct = actList.data[i];
let name = eachAct.name;
for (let j = 0; j < eachAct.script.length; j++) {
let script = eachAct.script[j];
let value = script.value;
let ret;
let ret2;
switch (script.name) {
case "signAct":
ret = await signAct(value);
if (ret.error == "0") {
showMessage(`【${name}】签到完毕`, "success");
} else {
showMessage(`【${name}】${ret.msg}`, "error");
}
break;
case "userStatus":
ret = await userStatus(value);
if (ret.error == 0) {
for (let key in ret.data) {
let item = ret.data[key];
let cnt = item.curCompleteNum - item.curDeliverNum;
let name2 = name + "-" + item.taskName;
for (let i = 0; i < cnt; i++) {
let ret2 = await takeActPrize(key);
if (ret2.error == "0") {
showMessage(`【${name2}】获得` + ret2.data.sendRes.items[0].prizeName + "*" + ret2.data.sendRes.items[0].prizeNum, "success");
} else {
showMessage(`【${name2}】${ret2.msg}`, "error");
}
}
}
}
break;
case "addFollowRoom":
await addFollowRoom(value);
break;
case "removeFollowRoom":
await removeFollowRoom(value);
break;
case "shareAct":
await shareAct(value);
break;
case "doSign":
await doSign(value);
break;
case "getActRemaining":
ret = await getActRemaining(value);
if (ret.error == "0") {
for (let i = 0; i < ret.data.freeCount; i++) {
ret2 = await getJackpot(value);
if (ret2.error == "0") {
showMessage(`【${name}】礼盒开启:${ret2.data.giftName}`, "success");
}
}
}
default:
break;
}
}
}
}
async function initPkg_Sign_ActqzsUserTask() {
const rids = ["5189167", "290935", "6979222", "5132174", "4042402"];
let activityId = await getActivityId(dateFormat("yyyyMM", new Date()));
if (!activityId) {
const currentDate = new Date();
const nextMonth = currentDate.getMonth() + 1;
const prevMonth = currentDate.getMonth() - 1;
const prevMonthDate = new Date(currentDate.getFullYear(), prevMonth, 1);
const nextMonthDate = new Date(currentDate.getFullYear(), nextMonth, 1);
activityId = await getActivityId(dateFormat("yyyyMM", prevMonthDate));
if (!activityId) {
activityId = await getActivityId(dateFormat("yyyyMM", nextMonthDate));
}
}
let cardArenaId = await getCardArenaId(dateFormat("yyyyMM", new Date()));
if (!cardArenaId) {
const currentDate = new Date();
const nextMonth = currentDate.getMonth() + 1;
const prevMonth = currentDate.getMonth() - 1;
const prevMonthDate = new Date(currentDate.getFullYear(), prevMonth, 1);
const nextMonthDate = new Date(currentDate.getFullYear(), nextMonth, 1);
cardArenaId = await getCardArenaId(dateFormat("yyyyMM", prevMonthDate));
if (!cardArenaId) {
cardArenaId = await getCardArenaId(dateFormat("yyyyMM", nextMonthDate));
}
}
const actIds = [activityId, cardArenaId];
for (const actId of actIds) {
for (const rid of rids) {
const signinActRet = await signinAct(actId, rid);
if (signinActRet.error == 0) {
let gift = signinActRet.data.awards.map(item => `${item.name}x${item.num}`).join("、");
showMessage("【一键签到】右侧活动直播间已签到,获得" + gift, "success");
}
const signinCardArenaRet = await signinCardArena(actId, rid);
if (signinCardArenaRet.error == 0) {
let gift = signinCardArenaRet.data.awards.map(item => `${item.name}x${item.num}`).join("、");
showMessage("【一键签到】右侧活动直播间已签到,获得" + gift, "success");
}
}
}
}
function getActivityId(dateStr) {
return new Promise((resolve) => {
fetch(`https://webconf.douyucdn.cn/resource/common/activity/actqzs${dateStr}_w.json`)
.then((res) => {
return res.text();
})
.then((ret) => {
let json = ret.substring(
String("DYConfigCallback(").length,
ret.length
);
json = json.substring(0, json.lastIndexOf(")"));
try {
json = JSON.parse(json);
resolve(json.data.activity_setting.activity_id);
} catch (err) {
resolve(null);
}
})
.catch((err) => {
resolve(null);
});
});
}
function getCardArenaId(dateStr) {
return new Promise((resolve) => {
fetch(`https://webconf.douyucdn.cn/resource/common/activity/cardArena${dateStr}_w.json`)
.then((res) => {
return res.text();
})
.then((ret) => {
let json = ret.substring(
String("DYConfigCallback(").length,
ret.length
);
json = json.substring(0, json.lastIndexOf(")"));
try {
json = JSON.parse(json);
resolve(json.data.activity_setting.activity_id);
} catch (err) {
resolve(null);
}
})
.catch((err) => {
resolve(null);
});
});
}
function signinCardArena(activityId, rid) {
return new Promise((resolve, reject) => {
fetch("https://www.douyu.com/japi/revenuenc/web/cardArena/userTask/signIn", {
method: 'POST',
mode: 'no-cors',
credentials: 'include',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: `ctn=${getCCN()}&activity_id=${activityId}&rid=${rid}`
}).then(res => {
return res.json();
}).then(ret => {
resolve(ret);
}).catch(err => {
console.log("请求失败!", err);
reject(err);
})
})
}
function signinAct(activityId, rid) {
return new Promise((resolve, reject) => {
fetch("https://www.douyu.com/japi/revenuenc/web/actqzs/userTask/signIn", {
method: 'POST',
mode: 'no-cors',
credentials: 'include',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: `ctn=${getCCN()}&activity_id=${activityId}&rid=${rid}`
}).then(res => {
return res.json();
}).then(ret => {
resolve(ret);
}).catch(err => {
console.log("请求失败!", err);
reject(err);
})
})
}
function initPkg_Sign_Ad_Sign() {
getFishBall_Ad_Sign();
}
function getFishBall_Ad_Sign() {
let fishBallNum = "0";
let posid_ad_sign = "1064246";
GM_xmlhttpRequest({
method: "GET",
url: "https://apiv2.douyucdn.cn/japi/inspire/api/ad/inspire/getFishBallNum?posId=" + posid_ad_sign + "&ct=1&token=" + dyToken,
responseType: "json",
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
onload: function(response) {
let ret = response.response;
if (ret.error == "0") {
fishBallNum = ret.data.num;
GM_xmlhttpRequest({
method: "GET",
url: "https://apiv2.douyucdn.cn/japi/inspire/api/ad/inspire/sendFishBall?uid=" + getUID() + "&posCode=" + posid_ad_sign + "&ct=1&token=" + dyToken,
responseType: "json",
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
onload: function(response) {
let ret = response.response;
if (ret.error == "0") {
showMessage("【签到鱼丸】成功领取" + fishBallNum + "个鱼丸", "success");
} else {
if (ret.msg == "null") {
showMessage("【签到鱼丸】未绑定手机" , "warning");
} else {
showMessage("【签到鱼丸】" + ret.msg, "warning");
}
}
}
});
}
}
});
}
function initPkg_Sign_Client() {
signClient();
}
function signClient() {
GM_xmlhttpRequest({
method: "POST",
url: "https://apiv2.douyucdn.cn/h5nc/sign/sendSign",
data: 'token=' + dyToken,
responseType: "json",
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
onload: function(response) {
let ret = response.response;
if (ret.data.length == 0) {
showMessage("【客户端】今日已签到", "warning");
// console.log("【客户端】今日已签到");
} else {
if (ret.data.sign_pl.length != 0) {
let recv = "";
for (let i = 0; i < ret.data.sign_pl.length; i++) {
recv = recv + ret.data.sign_pl[i].cnt + "个" + ret.data.sign_pl[i].name + ",";
}
showMessage("【客户端】签到成功! 获得物品:" + recv, "success");
// console.log("【客户端】签到成功! 获得物品:" + recv);
} else {
showMessage("【客户端】签到成功! 可惜没有获得东西", "success");
// console.log("【客户端】签到成功! 可惜没获得东西");
}
}
}
});
}
async function initPkg_Sign_FansTree() {
for (let i = 0; i < myFansBadgeList.length; i++) {
const roomId = myFansBadgeList[i];
let ret = await signRoomTree(roomId);
if (ret.error !== 0) {
showMessage(`【粉丝家园】${roomId}${ret.msg}`, "error");
} else {
showMessage(`【粉丝家园】${roomId}签到成功!`, "success");
}
}
}
function signRoomTree(rid) {
return new Promise((resolve, reject) => {
fetch("https://www.douyu.com/japi/interactnc/web/fanshome/sign", {
method: 'POST',
mode: 'no-cors',
credentials: 'include',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: `ctn=${getCCN()}&rid=${rid}`
}).then(res => {
return res.json();
}).then(ret => {
resolve(ret);
}).catch(err => {
console.log("请求失败!", err);
reject(err);
})
})
}
async function initPkg_Sign_Follow() {
// 此处为了完成斗鱼等级任务
const room_id = "3186571";
await followRoom(room_id);
await unfollowRoom(room_id);
}
function unfollowRoom(rid) {
return new Promise((resolve, reject) => {
fetch("https://www.douyu.com/wgapi/livenc/liveweb/follow/rm", {
method: 'POST',
mode: 'no-cors',
credentials: 'include',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: `ctn=${getCCN()}&rid=${rid}`
}).then(res => {
return res.json();
}).then(ret => {
resolve(ret);
}).catch(err => {
console.log("请求失败!", err);
reject(err);
})
})
}
function followRoom(rid) {
return new Promise((resolve, reject) => {
fetch("https://www.douyu.com/wgapi/livenc/liveweb/follow/add", {
method: 'POST',
mode: 'no-cors',
credentials: 'include',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: `ctn=${getCCN()}&rid=${rid}`
}).then(res => {
return res.json();
}).then(ret => {
resolve(ret);
}).catch(err => {
console.log("请求失败!", err);
reject(err);
})
})
}
function initPkg_Sign_Motorcade() {
signMotorcade();
}
function signMotorcade() {
openPage("https://msg.douyu.com/motorcade/#/motorcade/list/recommend?exid=chun", false);
}
function getCookie(cookieName) {
let csrfToken = "";
let strCookie = document.cookie;
let arrCookie = strCookie.split("; ");
for(let i = 0; i < arrCookie.length; i++) {
let arr = arrCookie[i].split("=");
if(cookieName == arr[0]){
csrfToken = arr[1];
}
}
if(csrfToken == ""){
csrfToken = Math.random().toString(36).substr(2);
document.cookie = "post-csrfToken="+ escape(csrfToken)+";path=/";
}
return csrfToken;
}
async function signMotorcade_Sign() {
let retConnect = await motorcadeConnect();
let retConnect2 = await motorcadeConnect2(retConnect.data.uid, retConnect.data.sig);
let mid = await getMotorcadeID(retConnect2.TinyId, retConnect2.A2Key, retConnect.data.uid);
if (!mid || mid == "") {
closePage();
return;
}
console.log("mid是:", mid);
mid = encodeURIComponent(mid);
GM_xmlhttpRequest({
method: "GET",
url: 'https://msg.douyu.com/v3/motorcade/signs/weekly?mid=' + mid + '×tamp=' + Math.random().toFixed(17),
responseType: "json",
headers: {
'dy-device-id':'-',
"dy-client": "web",
"dy-csrf-token":getCookie("post-csrfToken"),
'Content-Type': 'application/x-www-form-urlencoded'
},
onload: function(response) {
let ret = response.response;
console.log("weekly:", ret);
if (ret.data.is_sign == "1") {
closePage();
} else {
GM_xmlhttpRequest({
method: "POST",
url: 'https://msg.douyu.com/v3/msign/add?timestamp=' + Math.random().toFixed(17),
data: "to_mid="+ mid +"&expression=" + String(Number(ret.data.total) + 1),
responseType: "json",
headers: {
'dy-device-id':'-',
"dy-client": "web",
"dy-csrf-token":getCookie("post-csrfToken"),
'Content-Type': 'application/x-www-form-urlencoded'
},
onload: function(response) {
if (Math.floor(response.response.status_code / 100) == 2){
console.log("【车队】签到成功")
} else {
console.log(response.response.message);
}
closePage();
}
});
}
}
});
}
function motorcadeConnect() {
return new Promise(resolve => {
GM_xmlhttpRequest({
method: "GET",
url: 'https://msg.douyu.com/v3/login/getusersig?t=' + String(new Date().getTime()) + '×tamp=' + Math.random().toFixed(17),
data: '{"State":"Online"}',
responseType: "json",
headers: {
'dy-device-id':'-',
"dy-client": "web",
"dy-csrf-token":getCookie("post-csrfToken"),
'Content-Type': 'application/x-www-form-urlencoded'
},
onload: function(response) {
resolve(response.response);
}
});
})
}
function motorcadeConnect2(identifier, sig) {
let url = "https://webim.tim.qq.com/v4/openim/login?identifier=" + identifier + "&usersig=" + sig +"&contenttype=json&sdkappid=1400029396";
return new Promise(resolve => {
GM_xmlhttpRequest({
method: "POST",
url: url,
data: '{"State":"Online"}',
responseType: "json",
headers: {
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
},
onload: function(response) {
resolve(response.response);
}
});
})
}
function getMotorcadeID(tinyid, a2, identifier) {
return new Promise(resolve => {
GM_xmlhttpRequest({
method: "POST",
url: "https://webim.tim.qq.com/v4/group_open_http_svc/get_joined_group_list?tinyid=" + tinyid + "&a2=" + a2 + "&contenttype=json&sdkappid=1400029396",
data: '{"Member_Account":"' + identifier + '"}',
responseType: "json",
headers: {
"Content-Type": "application/x-www-form-urlencoded"
},
onload: function(response) {
if (response.response.GroupIdList && response.response.GroupIdList.length > 0) {
resolve(response.response.GroupIdList[0].GroupId);
} else {
resolve("");
}
}
});
})
}
async function initPkg_Sign_ReadPosts() {
const counts = 5;
for (let i = 0; i < counts; i++) {
await readPosts();
await sleep(2000);
}
}
function readPosts() {
GM_xmlhttpRequest({
method: "GET",
url: "https://yuba.douyu.com/wbapi/web/post/detail/555691541586843641?cid=×tamp=" + new Date().getTime(),
responseType: "json",
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
"dy-token": dyToken,
"dy-client": "pc"
},
onload: function(response) {
}
});
}
function initPkg_Sign_Room(isAll) {
signAllRoom(isAll);
}
function signAllRoom(isAll) {
// 1. get page counts(1015)
// 2. for in all pages
// 3. sign each room
let pageCount = 0;
let signedCount = 0;
let count = 0;
fetch('https://www.douyu.com/wgapi/livenc/liveweb/follow/list?page=1015',{
method: 'GET',
mode: 'no-cors',
cache: 'default',
credentials: 'include',
}).then(res => {
return res.json();
}).then(ret => {
pageCount = Number(ret.data.pageCount);
for (let nowPage = 1; nowPage <= pageCount; nowPage++) {
fetch('https://www.douyu.com/wgapi/livenc/liveweb/follow/list?page=' + String(nowPage),{
method: 'GET',
mode: 'no-cors',
cache: 'default',
credentials: 'include',
}).then(res => {
return res.json();
}).then(ret1 => {
let roomCount = Number(ret1.data.list.length);
for (let i = 0; i < roomCount; i++) {
if (isAll == false) {
if (ret1.data.list[i].show_status == "1") {
signRoom(ret1.data.list[i].room_id);
signedCount++;
}
} else {
signRoom(ret1.data.list[i].room_id);
signedCount++;
}
count++;
if (count == ret1.data.total && i == roomCount - 1) {
let rest = Number(ret1.data.total) - signedCount;
showMessage("【房间签到】" + String(signedCount) + "个房间签到已完成," + String(rest) + "个房间未签到", "success");
}
}
}).catch(err => {
console.log("请求失败!", err);
})
}
showMessage("【房间签到】" + ret.data.total + "个房间正在签到中...", "info");
}).catch(err => {
console.log("请求失败!", err);
})
}
function signRoom(r) {
GM_xmlhttpRequest({
method: "POST",
url: "https://apiv2.douyucdn.cn/japi/roomuserlevel/apinc/checkIn?client_sys=android",
data: 'rid=' + r,
responseType: "json",
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'token': dyToken,
'aid': 'android1'
},
onload: function(response) {
}
});
}
async function initPkg_Sign_SuperFans() {
for (let i = 0; i < myFansBadgeList.length; i++) {
const roomId = myFansBadgeList[i];
let ret = await signSuperFans(roomId);
if (ret.error !== 0) {
// showMessage(`【钻粉联赛签到】${roomId}${ret.msg}`, "error");
} else {
showMessage(`【钻粉联赛签到】${roomId}签到成功!`, "success");
}
}
}
function signSuperFans(rid) {
return new Promise((resolve, reject) => {
fetch("https://www.douyu.com/japi/interactnc/web/dfansact/userSign", {
method: 'POST',
mode: 'no-cors',
credentials: 'include',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: `ctn=${getCCN()}&rid=${rid}`
}).then(res => {
return res.json();
}).then(ret => {
resolve(ret);
}).catch(err => {
console.log("请求失败!", err);
reject(err);
})
})
}
function initPkg_Sign_TV() {
signTV();
}
function signTV() {
let did = window.btoa(getDyDid());
GM_xmlhttpRequest({
method: "GET",
url: "https://apitv.douyucdn.cn/user/sign/index?token=" + dyToken + "&client_sys=android",
responseType: "json",
headers: {
'User-Device': did
},
onload: function(response) {
let ret = response.response;
if (ret.error == "0") {
showMessage("【电视端】签到成功!获得100鱼丸", "success");
} else {
showMessage("【电视端】" + ret.data.msg, "warning");
}
}
});
}
let signedYuba = 0;
let totalYuba = 0;
let doneYuba = 0;
let signCountMap = {};
function initPkg_Sign_Yuba() {
signYubaList();
}
function signYubaFast() {
GM_xmlhttpRequest({
method: "POST",
url: "https://mapi-yuba.douyu.com/wb/v3/fastSign",
responseType: "json",
headers: {
"Content-Type": "application/x-www-form-urlencoded",
"client": "android",
"token": dyToken,
},
onload: function (response) {
if (response.response.message == "" && response.response.data != 0) {
// showMessage("【鱼吧】一键签到成功! 获得经验" + response.response.data, "success");
// console.log("【极速鱼吧】" + group_id + "签到成功! 连续" + response.response.data.count + "天 获得经验" + response.response.data.exp);
} else if (response.response.data == 0) {
// showMessage("【鱼吧】没有7级以上的鱼吧或极速签到已完成", "warning");
// console.log("【极速鱼吧】" + group_id + response.response.message);
} else {
// showMessage("【鱼吧】" + response.response.message, "warning");
// console.log("【极速鱼吧】" + response.response.message);
}
}
});
}
async function signYuba(group_id, t) {
GM_xmlhttpRequest({
method: "POST",
url: "https://yuba.douyu.com/ybapi/topic/sign",
data: 'group_id=' + group_id,
responseType: "json",
headers: {
"Content-Type": "application/x-www-form-urlencoded",
"dy-client": "pc",
"dy-token": t,
'Referer': 'https://yuba.douyu.com/group/' + group_id
},
onload: async function (response) {
if (signCountMap[group_id] >= 10) {
return;
}
if (response.response.message == "签到失败") {
await sleep(2000);
signYuba(group_id, t);
return;
}
if (signCountMap[group_id]) {
signCountMap[group_id]++;
} else {
signCountMap[group_id] = 1;
}
doneYuba++;
if (response.response.message == "") {
signedYuba++;
// showMessage("【鱼吧】" + group_id + "签到成功! 连续" + response.response.data.count + "天 获得经验" + response.response.data.exp, "success");
// console.log("【鱼吧】" + group_id + "签到成功! 连续" + response.response.data.count + "天 获得经验" + response.response.data.exp);
} else {
// showMessage("【鱼吧】" + group_id + response.response.message, "warning");
// console.log("【鱼吧】" + group_id + response.response.message);
}
signYubaSupplementary(group_id);
if (doneYuba == totalYuba) {
// 完成全部签到
if (signedYuba > 0) {
if (totalYuba - signedYuba == 0) {
showMessage("【鱼吧】" + String(signedYuba) + "个鱼吧签到完成", "success")
} else {
showMessage("【鱼吧】" + String(signedYuba) + "个鱼吧签到完成," + String(totalYuba - signedYuba) + "个鱼吧已签到", "success");
}
} else {
showMessage("【鱼吧】"+ String(totalYuba) + "个鱼吧已签到", "warning");
}
signedYuba = null;
totalYuba = null;
doneYuba = null;
}
}
});
}
async function signYubaSupplementary(group_id) {
let result = await signSupplementary(group_id);
for (let i = 0; i < result.data.supplementary_cards; i++) {
await signSupplementary(group_id);
}
}
async function signYubaList() {
let yubaList = [];
let ret = await getYubaPage(1);
yubaList = yubaList.concat(ret.list);
let pageNum = Number(ret.count_page) - 1;
if (pageNum >= 1) {
for (let i = 0; i < pageNum; i++) {
let curPage = 2 + i;
ret = await getYubaPage(curPage);
yubaList = yubaList.concat(ret.list);
}
}
totalYuba = yubaList.length;
signYubaFast();
for (let i = 0; i < yubaList.length; i++) {
signYuba(yubaList[i].group_id, dyToken);
}
}
function getYubaPage(page) {
return new Promise(resolve => {
GM_xmlhttpRequest({
method: "GET",
url: "https://yuba.douyu.com/wbapi/web/group/myFollow?page=" + String(page) + "&limit=30",
responseType: "json",
headers: {
"Content-Type": "application/x-www-form-urlencoded",
"dy-client": "pc",
"dy-token": dyToken
},
onload: function(response) {
resolve(response.response.data)
}
});
})
}
function getSupplementaryNums(group_id) {
return new Promise(resolve => {
GM_xmlhttpRequest({
method: "GET",
url: "https://yuba.douyu.com/wbapi/web/signDetail?group_id=" + group_id,
responseType: "json",
headers: {
"Content-Type": "application/x-www-form-urlencoded",
"dy-client": "pc",
"dy-token": dyToken
},
onload: function(response) {
resolve(response.response);
}
});
})
}
function signSupplementary(group_id) {
return new Promise(resolve => {
GM_xmlhttpRequest({
method: "POST",
url: "https://mapi-yuba.douyu.com/wb/v3/supplement",
responseType: "json",
headers: {
"Content-Type": "application/x-www-form-urlencoded",
"client": "android",
"token": dyToken,
},
data: "group_id=" + group_id,
onload: function(response) {
resolve(response.response);
}
});
})
}
function initPkg_Sign_Yuba_Like() {
likeYuba();
}
function likeYuba() {
let pid = "555691541586843641";
// likeYubaPostComment(pid, "1483548421625277411", "-1").then(() => {likeYubaPostComment(pid, "1483548421625277411", "1")});
// likeYubaPostComment(pid, "1483548421625277411", "-1").then(() => {likeYubaPostComment(pid, "1483548421625277411", "1")});
// likeYubaPostComment(pid, "1482171839375552044", "-1").then(() => {likeYubaPostComment(pid, "1482171839375552044", "1")});
// likeYubaPostComment(pid, "1481389816302095706", "-1").then(() => {likeYubaPostComment(pid, "1481389816302095706", "1")});
// likeYubaPostComment(pid, "1470603012833589758", "-1").then(() => {likeYubaPostComment(pid, "1470603012833589758", "1")});
likeYubaPost(pid, "-1").then(() => {likeYubaPost(pid, "1")});
showMessage("【鱼吧点赞】已完成", "success");
}
function likeYubaPostComment(post_id, commnet_id, type) {
let data = `pid=${ post_id }&comment_id=${ commnet_id }&type=${ type }`;
return new Promise(resolve => {
GM_xmlhttpRequest({
method: "POST",
url: "https://yuba.douyu.com/ybapi/follow/like",
data: data,
responseType: "json",
headers: {
"dy-token": dyToken,
"dy-client": "pc",
"Content-Type": "application/x-www-form-urlencoded",
"Referer": "https://yuba.douyu.com/p/555691541586843641"
},
onload: function(response) {
let ret = response.response;
resolve(ret);
}
});
})
}
function likeYubaPost(post_id, type) {
let data = `pid=${ post_id }&type=${ type }`;
return new Promise(resolve => {
GM_xmlhttpRequest({
method: "POST",
url: "https://yuba.douyu.com/ybapi/follow/like",
data: data,
responseType: "json",
headers: {
"dy-token": dyToken,
"dy-client": "pc",
"Content-Type": "application/x-www-form-urlencoded",
"Referer": "https://yuba.douyu.com/p/" + post_id
},
onload: function(response) {
let ret = response.response;
resolve(ret);
}
});
})
}
var _hmt = _hmt || [];
function initPkg_Statistics() {
let hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?4dc4fb0549a56fe03ba53c022b1ff455";
let s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
}
function initPkg_SyncJoy() {
initPkg_SyncJoy_Dom();
initPkg_SyncJoy_Func();
}
function initPkg_SyncJoy_Dom() {
SyncJoy_insertIcon();
}
function SyncJoy_insertIcon() {
let a = document.createElement("div");
a.className = "ex-syncjoy";
a.innerHTML = '
';
let b = document.getElementsByClassName("ex-panel__wrap")[0];
b.insertBefore(a, b.childNodes[0]);
}
function initPkg_SyncJoy_Func() {
document.getElementsByClassName("ex-syncjoy")[0].addEventListener("click", function() {
openPage("https://sb.douyuex.com/");
});
}
// 版本号
// 格式 yyyy.MM.dd.**
var curVersion = "2025.04.09.01"
var isNeedUpdate = false
var lastestVersion = ""
function initPkg_Update() {
initPkg_Update_Dom();
initPkg_Update_Func();
// Update_checkVersion(); // 首次检查更新
if (isNeedUpdate) {
Update_showTip(true);
}
}
function initPkg_Update_Dom() {
Update_insertIcon();
}
function Update_insertIcon() {
let a = document.createElement("div");
a.className = "ex-update";
a.innerHTML = '
';
let b = document.getElementsByClassName("ex-panel__wrap")[0];
b.insertBefore(a, b.childNodes[0]);
}
function initPkg_Update_Func() {
document.getElementsByClassName("ex-update")[0].addEventListener("click", Update_openUpdatePage);
}
function checkUpdate_Src() {
return new Promise((resolve, reject) => {
GM_xmlhttpRequest({
method: "GET",
url: `https://src.douyuex.com/src/douyuex_version.txt?t=${new Date().getTime()}`,
responseType: "text",
onload: function(response) {
const txt = response.response;
if(txt != undefined){
if (txt != curVersion) {
resolve([true, txt]);
}
}
resolve(false);
},
onerror: function(err) {
console.error('请求失败', err);
reject();
}
});
})
}
function checkUpdate_GreasyFork() {
return new Promise((resolve, reject) => {
fetch('https://greasyfork.org/zh-CN/scripts/394497',{
method: 'GET',
mode: 'cors',
cache: 'no-store',
credentials: 'omit',
}).then(res => {
return res.text();
}).then(txt => {
txt = (new DOMParser()).parseFromString(txt, 'text/html');
let v = txt.getElementsByClassName("script-show-version")[1];
if(v != undefined){
if (v.innerText != curVersion) {
resolve([true, v.innerText]);
}
}
resolve(false);
}).catch(err => {
console.error('请求失败', err);
reject();
})
})
}
async function Update_checkVersion(isShowNotUpdate = false) {
// 用解构赋值会导致函数undefined,暂不知原因
let tmp = [];
tmp = await checkUpdate_Src().catch(err => {
tmp = [false, curVersion];
isNeedUpdate = tmp[0];
lastestVersion = tmp[1];
if (isNeedUpdate) {
Update_showMessage();
if (isNeedUpdate) {
Update_showTip(true);
}
} else {
if (isShowNotUpdate) {
showMessage(`【版本更新】当前版本${curVersion}已为最新,
点击查看更新内容 `, "success")
}
}
})
isNeedUpdate = tmp[0];
lastestVersion = tmp[1];
if (isNeedUpdate) {
Update_showMessage();
if (isNeedUpdate) {
Update_showTip(true);
}
} else {
if (isShowNotUpdate) {
showMessage(`【版本更新】当前版本${curVersion}已为最新,
点击查看更新内容 `, "success")
}
}
}
function Update_openUpdatePage() {
openPage("https://html.douyuex.com/install/web.html", true);
}
function Update_showTip(a) {
let d = document.getElementById("ex-update__tip");
if (d) {
if (a) {
if (d.style.display != "block") {
d.style.display = "block";
}
} else {
d.style.display = "none";
}
}
}
function Update_showMessage() {
let msg = `【版本更新】最新版本:${lastestVersion},点击
官方源 或者
GreasyFork源 更新,
点击查看更新内容 `
showMessage(msg, "error", {
timeout: 50,
});
}
let videoStartTime = 0;
let videoTime_domhook_videoChange = null;
let videoTime_domhook_showtime = null;
let videoTime_timeout = 0;
function initPkg_VideoTime() {
let timer = setInterval(() => {
VideoTime_setData();
let videoDom = document.getElementsByTagName("demand-video")[0].shadowRoot.getElementById("__video");
let showtimeDom = document.getElementsByTagName("demand-video")[0].shadowRoot.getElementById("demandcontroller-bar").shadowRoot.querySelector("demand-video-controller-progress").shadowRoot.querySelector("demand-video-controller-preview");
if (videoDom !== undefined && videoDom !== null) {
clearInterval(timer);
videoTime_domhook_videoChange = new MutationObserver(function(mutations) {
VideoTime_setData();
});
videoTime_domhook_videoChange.observe(videoDom, { attributes: true, childList: true, subtree: false });
videoTime_domhook_showtime = new MutationObserver(function(mutations) {
for (let i = 0; i < mutations.length; i++) {
let item = mutations[i];
if (item.attributeName == "showtime") {
// 此时修改时间
let showtime = Number(VideoTime_getShowTime());
VideoTime_setShowTime(String(dateFormat("yyyy-MM-dd hh:mm:ss", new Date(Number(videoStartTime + showtime * 1000)))) + "
" + formatSeconds2(showtime));
break;
} else if (item.attributeName == "isshow") {
clearTimeout(videoTime_timeout);
let showtime = Number(VideoTime_getShowTime());
// 宏任务 模拟nextTick
videoTime_timeout = setTimeout(() => {
VideoTime_setShowTime(String(dateFormat("yyyy-MM-dd hh:mm:ss", new Date(Number(videoStartTime + showtime * 1000)))) + "
" + formatSeconds2(showtime));
}, 0);
break;
}
}
});
videoTime_domhook_showtime.observe(showtimeDom, { attributes: true, childList: true, subtree: false });
}
}, 1000)
}
function VideoTime_setData() {
let pathnameArr = String(window.location.pathname).split("/");
let videoId = pathnameArr[pathnameArr.length - 1];
fetch("https://v.douyu.com/video/video/getVideoUrl?vid=" + videoId, {
method: 'GET',
mode: 'no-cors',
credentials: 'include',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
}).then(res => {
return res.json();
}).then(ret => {
let imgUrl = ret.data.viewthumb[0].url;
let timeStr = getStrMiddle(imgUrl, "--", "/");
videoStartTime = new Date(timeStr.replace(/^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$/, "$1-$2-$3 $4:$5:$6")).getTime();
}).catch(err => {
console.log("请求失败!", err);
})
}
function VideoTime_getShowTime() {
let t = document.getElementsByTagName("demand-video")[0].shadowRoot.getElementById("demandcontroller-bar").shadowRoot.querySelector("demand-video-controller-progress").shadowRoot.querySelector("demand-video-controller-preview").getAttribute("showtime");
return Number(t).toFixed(0);
}
function VideoTime_setShowTime(timeStr) {
let dom = document.getElementsByTagName("demand-video")[0].shadowRoot.getElementById("demandcontroller-bar").shadowRoot.querySelector("demand-video-controller-progress").shadowRoot.querySelector("demand-video-controller-preview").shadowRoot.querySelector(".Preview-Time");
if (dom) {
dom.style.position = "relative";
dom.style.bottom = "60px"
dom.style.backgroundColor = "rgba(0,0,0,0.4)";
dom.innerHTML = timeStr;
}
}
var gifworkerStr = `(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o
=ByteArray.pageSize)this.newPage();this.pages[this.page][this.cursor++]=val};ByteArray.prototype.writeUTFBytes=function(string){for(var l=string.length,i=0;i=0)this.dispose=disposalCode};GIFEncoder.prototype.setRepeat=function(repeat){this.repeat=repeat};GIFEncoder.prototype.setTransparent=function(color){this.transparent=color};GIFEncoder.prototype.addFrame=function(imageData){this.image=imageData;this.colorTab=this.globalPavarte&&this.globalPavarte.slice?this.globalPavarte:null;this.getImagePixels();this.analyzePixels();if(this.globalPavarte===true)this.globalPavarte=this.colorTab;if(this.firstFrame){this.writeLSD();this.writePavarte();if(this.repeat>=0){this.writeNetscapeExt()}}this.writeGraphicCtrlExt();this.writeImageDesc();if(!this.firstFrame&&!this.globalPavarte)this.writePavarte();this.writePixels();this.firstFrame=false};GIFEncoder.prototype.finish=function(){this.out.writeByte(59)};GIFEncoder.prototype.setQuality=function(quality){if(quality<1)quality=1;this.sample=quality};GIFEncoder.prototype.setDither=function(dither){if(dither===true)dither="FloydSteinberg";this.dither=dither};GIFEncoder.prototype.setGlobalPavarte=function(pavarte){this.globalPavarte=pavarte};GIFEncoder.prototype.getGlobalPavarte=function(){return this.globalPavarte&&this.globalPavarte.slice&&this.globalPavarte.slice(0)||this.globalPavarte};GIFEncoder.prototype.writeHeader=function(){this.out.writeUTFBytes("GIF89a")};GIFEncoder.prototype.analyzePixels=function(){if(!this.colorTab){this.neuQuant=new NeuQuant(this.pixels,this.sample);this.neuQuant.buildColormap();this.colorTab=this.neuQuant.getColormap()}if(this.dither){this.ditherPixels(this.dither.replace("-serpentine",""),this.dither.match(/-serpentine/)!==null)}else{this.indexPixels()}this.pixels=null;this.colorDepth=8;this.palSize=7;if(this.transparent!==null){this.transIndex=this.findClosest(this.transparent,true)}};GIFEncoder.prototype.indexPixels=function(imgq){var nPix=this.pixels.length/3;this.indexedPixels=new Uint8Array(nPix);var k=0;for(var j=0;j=0&&x1+x=0&&y1+y>16,(c&65280)>>8,c&255,used)};GIFEncoder.prototype.findClosestRGB=function(r,g,b,used){if(this.colorTab===null)return-1;if(this.neuQuant&&!used){return this.neuQuant.lookupRGB(r,g,b)}var c=b|g<<8|r<<16;var minpos=0;var dmin=256*256*256;var len=this.colorTab.length;for(var i=0,index=0;i=0){disp=dispose&7}disp<<=2;this.out.writeByte(0|disp|0|transp);this.writeShort(this.delay);this.out.writeByte(this.transIndex);this.out.writeByte(0)};GIFEncoder.prototype.writeImageDesc=function(){this.out.writeByte(44);this.writeShort(0);this.writeShort(0);this.writeShort(this.width);this.writeShort(this.height);if(this.firstFrame||this.globalPavarte){this.out.writeByte(0)}else{this.out.writeByte(128|0|0|0|this.palSize)}};GIFEncoder.prototype.writeLSD=function(){this.writeShort(this.width);this.writeShort(this.height);this.out.writeByte(128|112|0|this.palSize);this.out.writeByte(0);this.out.writeByte(0)};GIFEncoder.prototype.writeNetscapeExt=function(){this.out.writeByte(33);this.out.writeByte(255);this.out.writeByte(11);this.out.writeUTFBytes("NETSCAPE2.0");this.out.writeByte(3);this.out.writeByte(1);this.writeShort(this.repeat);this.out.writeByte(0)};GIFEncoder.prototype.writePavarte=function(){this.out.writeBytes(this.colorTab);var n=3*256-this.colorTab.length;for(var i=0;i>8&255)};GIFEncoder.prototype.writePixels=function(){var enc=new LZWEncoder(this.width,this.height,this.indexedPixels,this.colorDepth);enc.encode(this.out)};GIFEncoder.prototype.stream=function(){return this.out};module.exports=GIFEncoder},{"./LZWEncoder.js":2,"./TypedNeuQuant.js":3}],2:[function(require,module,exports){var EOF=-1;var BITS=12;var HSIZE=5003;var masks=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535];function LZWEncoder(width,height,pixels,colorDepth){var initCodeSize=Math.max(2,colorDepth);var accum=new Uint8Array(256);var htab=new Int32Array(HSIZE);var codetab=new Int32Array(HSIZE);var cur_accum,cur_bits=0;var a_count;var free_ent=0;var maxcode;var clear_flg=false;var g_init_bits,ClearCode,EOFCode;function char_out(c,outs){accum[a_count++]=c;if(a_count>=254)flush_char(outs)}function cl_block(outs){cl_hash(HSIZE);free_ent=ClearCode+2;clear_flg=true;output(ClearCode,outs)}function cl_hash(hsize){for(var i=0;i=0){disp=hsize_reg-i;if(i===0)disp=1;do{if((i-=disp)<0)i+=hsize_reg;if(htab[i]===fcode){ent=codetab[i];continue outer_loop}}while(htab[i]>=0)}output(ent,outs);ent=c;if(free_ent<1<0){outs.writeByte(a_count);outs.writeBytes(accum,0,a_count);a_count=0}}function MAXCODE(n_bits){return(1<0)cur_accum|=code<=8){char_out(cur_accum&255,outs);cur_accum>>=8;cur_bits-=8}if(free_ent>maxcode||clear_flg){if(clear_flg){maxcode=MAXCODE(n_bits=g_init_bits);clear_flg=false}else{++n_bits;if(n_bits==BITS)maxcode=1<0){char_out(cur_accum&255,outs);cur_accum>>=8;cur_bits-=8}flush_char(outs)}}this.encode=encode}module.exports=LZWEncoder},{}],3:[function(require,module,exports){var ncycles=100;var netsize=256;var maxnetpos=netsize-1;var netbiasshift=4;var intbiasshift=16;var intbias=1<>betashift;var betagamma=intbias<>3;var radiusbiasshift=6;var radiusbias=1<>3);var i,v;for(i=0;i>=netbiasshift;network[i][1]>>=netbiasshift;network[i][2]>>=netbiasshift;network[i][3]=i}}function altersingle(alpha,i,b,g,r){network[i][0]-=alpha*(network[i][0]-b)/initalpha;network[i][1]-=alpha*(network[i][1]-g)/initalpha;network[i][2]-=alpha*(network[i][2]-r)/initalpha}function alterneigh(radius,i,b,g,r){var lo=Math.abs(i-radius);var hi=Math.min(i+radius,netsize);var j=i+1;var k=i-1;var m=1;var p,a;while(jlo){a=radpower[m++];if(jlo){p=network[k--];p[0]-=a*(p[0]-b)/alpharadbias;p[1]-=a*(p[1]-g)/alpharadbias;p[2]-=a*(p[2]-r)/alpharadbias}}}function contest(b,g,r){var bestd=~(1<<31);var bestbiasd=bestd;var bestpos=-1;var bestbiaspos=bestpos;var i,n,dist,biasdist,betafreq;for(i=0;i>intbiasshift-netbiasshift);if(biasdist>betashift;freq[i]-=betafreq;bias[i]+=betafreq<>1;for(j=previouscol+1;j>1;for(j=previouscol+1;j<256;j++)netindex[j]=maxnetpos}function inxsearch(b,g,r){var a,p,dist;var bestd=1e3;var best=-1;var i=netindex[g];var j=i-1;while(i=0){if(i=bestd)i=netsize;else{i++;if(dist<0)dist=-dist;a=p[0]-b;if(a<0)a=-a;dist+=a;if(dist=0){p=network[j];dist=g-p[1];if(dist>=bestd)j=-1;else{j--;if(dist<0)dist=-dist;a=p[0]-b;if(a<0)a=-a;dist+=a;if(dist>radiusbiasshift;if(rad<=1)rad=0;for(i=0;i=lengthcount)pix-=lengthcount;i++;if(delta===0)delta=1;if(i%delta===0){alpha-=alpha/alphadec;radius-=radius/radiusdec;rad=radius>>radiusbiasshift;if(rad<=1)rad=0;for(j=0;j
`;
let b = document.getElementById("js-player-dialog");
b.insertBefore(a, b.childNodes[0]);
}
function initPkg_VideoTools_Camera_Func() {
let dom = document.getElementsByClassName("layout-Player-video")[0];
let dom_video = document.getElementsByClassName("room-Player-Box")[0];
let camera = document.getElementById("ex-camera");
let gif = null;
let timer = 0;
let downTime = 0;
let imgBase64;
let timer_timeout = 0;
dom.addEventListener("mouseenter", () => {
camera.style.display = "flex";
timer_timeout = setTimeout(() => {
camera.style.display = "none";
}, 2000);
})
dom_video.addEventListener("mousemove", () => {
camera.style.display = "flex";
clearTimeout(timer_timeout);
timer_timeout = setTimeout(() => {
camera.style.display = "none";
}, 2000);
})
camera.addEventListener("mouseenter", () => {
camera.style.display = "flex";
clearTimeout(timer_timeout);
})
dom.addEventListener("mouseleave", () => {
camera.style.display = "none";
})
camera.addEventListener("mousedown", (e) => {
downTime = new Date().getTime();
camera_canvas_img.getContext('2d').drawImage(liveVideoNode, 0, 0, camera_canvas_img.width, camera_canvas_img.height);
imgBase64 = camera_canvas_img.toDataURL("image/png");
gif = new GIF({
workers: 5,
quality: 3,
width: camera_width,
height: camera_height,
workerScript: gifworkerBlob
});;
cameraAddFrame(liveVideoNode, camera_canvas, gif, camera_fps);
timer = setInterval(() => {cameraAddFrame(liveVideoNode, camera_canvas, gif, camera_fps)}, camera_fps);
})
camera.addEventListener("mouseup", (e) => {
let upTime = new Date().getTime();
clearInterval(timer);
if (upTime - downTime >= 800) {
showMessage("【录制】正在生成gif...", "info");
gif.on('finished', blob => {
let el = document.createElement('a');
el.href = URL.createObjectURL(blob);
el.download = `【${camera_anchorName}】${dateFormat("yyyy-MM-dd hh-mm-ss",new Date())}`;
document.body.appendChild(el);
let evt = document.createEvent("MouseEvents");
evt.initEvent("click", false, false);
el.dispatchEvent(evt);
document.body.removeChild(el);
});
gif.render();
} else {
let el = document.createElement("a");
el.download = `【${camera_anchorName}】${dateFormat("yyyy-MM-dd hh-mm-ss",new Date())}`;
el.href = imgBase64;
document.body.appendChild(el);
let evt = document.createEvent("MouseEvents");
evt.initEvent("click", false, false);
el.dispatchEvent(evt);
document.body.removeChild(el);
}
})
}
function initPkg_VideoTools_Camera_Video() {
let timer = setInterval(() => {
liveVideoNode = document.getElementsByTagName("demand-video")[0].shadowRoot.getElementById("__video");
if (liveVideoNode !== undefined && liveVideoNode !== null && liveVideoNode.videoWidth) {
clearInterval(timer);
camera_anchorName = document.getElementsByTagName("demand-video-anchor")[0].shadowRoot.querySelector(".anchor-name").innerText;
camera_width = liveVideoNode.videoWidth * 0.25;
camera_height = liveVideoNode.videoHeight * 0.25;
camera_canvas = document.createElement("canvas");
camera_canvas.width = camera_width;
camera_canvas.height = camera_height;
camera_canvas_img = document.createElement("canvas");
camera_canvas_img.width = liveVideoNode.videoWidth;
camera_canvas_img.height = liveVideoNode.videoHeight;
initPkg_VideoTools_Camera_Video_Dom();
initPkg_VideoTools_Camera_Video_Func();
}
}, 1000)
}
function initPkg_VideoTools_Camera_Video_Dom() {
Camera_Video_insertIcon();
}
function Camera_Video_insertIcon() {
let a = document.createElement("div");
a.id = "ex-camera";
a.title = "单击截图 长按录制gif"
a.innerHTML = `
`;
let b = document.getElementsByClassName("Video")[0];
b.insertBefore(a, b.childNodes[0]);
}
function initPkg_VideoTools_Camera_Video_Func() {
let dom = document.getElementsByTagName("demand-video")[0];
let camera = document.getElementById("ex-camera");
let gif = null;
let timer = 0;
let downTime = 0;
let imgBase64;
let timer_timeout = 0;
dom.addEventListener("mouseenter", () => {
camera.style.display = "flex";
timer_timeout = setTimeout(() => {
camera.style.display = "none";
}, 2000);
})
dom.addEventListener("mousemove", () => {
camera.style.display = "flex";
clearTimeout(timer_timeout);
timer_timeout = setTimeout(() => {
camera.style.display = "none";
}, 2000);
})
camera.addEventListener("mouseenter", () => {
camera.style.display = "flex";
clearTimeout(timer_timeout);
})
dom.addEventListener("mouseleave", () => {
camera.style.display = "none";
})
camera.addEventListener("mousedown", (e) => {
downTime = new Date().getTime();
camera_canvas_img.getContext('2d').drawImage(liveVideoNode, 0, 0, camera_canvas_img.width, camera_canvas_img.height);
imgBase64 = camera_canvas_img.toDataURL("image/png");
gif = new GIF({
workers: 5,
quality: 3,
width: camera_width,
height: camera_height,
workerScript: gifworkerBlob
});;
cameraAddFrame(liveVideoNode, camera_canvas, gif, camera_fps);
timer = setInterval(() => {
cameraAddFrame(liveVideoNode, camera_canvas, gif, camera_fps)
}, camera_fps);
})
camera.addEventListener("mouseup", (e) => {
let upTime = new Date().getTime();
clearInterval(timer);
if (upTime - downTime >= 800) {
showMessage("【录制】正在生成gif...", "info");
gif.on('finished', blob => {
let el = document.createElement('a');
el.href = URL.createObjectURL(blob);
el.download = `【${camera_anchorName}】${dateFormat("yyyy-MM-dd hh-mm-ss",new Date())}`;
document.body.appendChild(el);
let evt = document.createEvent("MouseEvents");
evt.initEvent("click", false, false);
el.dispatchEvent(evt);
document.body.removeChild(el);
});
gif.render();
} else {
let el = document.createElement("a");
el.download = `【${camera_anchorName}】${dateFormat("yyyy-MM-dd hh-mm-ss",new Date())}`;
el.href = imgBase64;
document.body.appendChild(el);
let evt = document.createEvent("MouseEvents");
evt.initEvent("click", false, false);
el.dispatchEvent(evt);
document.body.removeChild(el);
}
})
}
function initPkg_VideoTools_Cinema() {
initPkg_VideoTools_Cinema_Dom();
initPkg_VideoTools_Cinema_Func();
}
function initPkg_VideoTools_Cinema_Dom() {
Cinema_insertIcon();
}
function Cinema_insertIcon() {
// let a = document.createElement("div");
// a.id = "ex-cinema";
// a.innerHTML = `
//
//
// `;
// let b = document.getElementsByClassName("right-e7ea5d")[0];
// b.insertBefore(a, b.childNodes[0]);
let a = document.createElement("li");
a.id = "ex-cinema";
a.innerHTML = `
影院比例
`;
let b = document.getElementsByClassName("menu-da2a9e")[0];
b.insertBefore(a, b.childNodes[1]);
}
function initPkg_VideoTools_Cinema_Func() {
document.getElementById("cinema__default").addEventListener("click", () => {
StyleHook_remove("Ex_Style_Cinema");
});
document.getElementById("cinema__cover").addEventListener("click", () => {
setVideoCinemaMode("cover");
});
document.getElementById("cinema__fill").addEventListener("click", () => {
setVideoCinemaMode("fill");
});
}
function setVideoCinemaMode(fit) {
let newHeigth = String(parseInt(liveVideoNode.style.width) / 2.39) + "px";
StyleHook_remove("Ex_Style_Cinema");
let style = `
.layout-Player-videoEntity video{object-fit:${ fit } !important;height:${ newHeigth } !important;}
`;
StyleHook_set("Ex_Style_Cinema", style);
}
let icon_joysound_on = ` `;
let icon_joysound_off = ` `;
function initPkg_VideoTools_Joysound() {
initPkg_VideoTools_Joysound_Dom();
initPkg_VideoTools_Joysound_Func();
}
function initPkg_VideoTools_Joysound_Dom() {
Joysound_insertIcon();
}
function Joysound_insertIcon() {
let a = document.createElement("div");
a.id = "ex-joysound";
a.title = "Joysound音效增强"
if (unsafeWindow.hasInstalledJoysound && localStorage.getItem("Ex_isJoysound") == 1) {
a.innerHTML = icon_joysound_on;
} else {
a.innerHTML = icon_joysound_off;
}
let b = document.getElementsByClassName("right-e7ea5d")[0];
b.insertBefore(a, b.childNodes[0]);
}
function initPkg_VideoTools_Joysound_Func() {
let dom = document.getElementById("ex-joysound");
document.getElementById("ex-joysound").addEventListener("click", () => {
if (unsafeWindow.hasInstalledJoysound) {
if (localStorage.getItem("Ex_isJoysound") == 1) {
unsafeWindow.disableJoysound();
dom.innerHTML = icon_joysound_off;
} else {
unsafeWindow.enableJoysound();
dom.innerHTML = icon_joysound_on;
}
} else {
openPage("https://greasyfork.org/zh-CN/scripts/439845");
}
})
}
let videoMetaData = null;
function initPkg_VideoTools_MetaData() {
MetaData_init();
}
function initPkg_VideoTools_MetaData_Dom() {
if (!videoMetaData) return;
if (!videoMetaData.dy_cpu_model && !videoMetaData.dy_gpu_model && !videoMetaData.dy_device_model && !videoMetaData.dy_os_version && !videoMetaData.z_canvas_code) return;
let a = document.createElement("li");
a.id = "ex-metadata";
a.innerHTML = `
主播配置信息
`;
let b = document.getElementsByClassName("menu-da2a9e")[0];
b.insertBefore(a, b.childNodes[1]);
}
function MetaData_init() {
getRealLive_Douyu(rid, true, false, "1", (lurl) => {
if (lurl != "" || lurl != null) {
if (lurl == "None") {
showMessage("房间未开播或其他错误", "error");
return;
}
let lurl_host_arr = String(lurl).split("/live");
let lurl_host = "";
if (lurl_host_arr.length > 0) {
lurl_host = lurl_host_arr[0];
}
let id = "Fake"
let a = document.createElement("div");
let html = "";
a.id = "exVideoDiv" + id;
a.className = "exVideoDiv";
html += "
";
a.innerHTML = html;
let b = document.getElementsByClassName("layout-Main")[0];
b.insertBefore(a, b.childNodes[0]);
if (flvjs.isSupported()) {
let videoElement = document.getElementById("exVideoPlayer" + id);
let flvPlayer = flvjs.createPlayer(
{
type: "flv",
url: lurl
},
{ fixAudioTimestampGap: false }
);
flvPlayer.on("media_info", (e) => {
if (e && e.metadata) {
videoMetaData = e.metadata;
let box = document.getElementById("exVideoDiv" + String(id));
let exVideoPlayer = document.getElementById("exVideoPlayer" + String(id));
flvPlayer.destroy();
exVideoPlayer.remove();
box.remove();
initPkg_VideoTools_MetaData_Dom();
}
});
flvPlayer.attachMediaElement(videoElement);
flvPlayer.load();
}
}
});
}
let currentBrightness = "";
let currentContrast = "";
let currentSaturate = "";
let liveVideoParentClassName = "";
let isMirror = false;
let rotateAngle = 0;
let transformCss = {
rotateY: "",
rotate: "",
scale: "",
}
let panorama = null;
function initPkg_VideoTools_Filter() {
liveVideoParentClassName = liveVideoNode.parentNode.className;
initPkg_VideoTools_Filter_Dom();
initPkg_VideoTools_Filter_Func();
}
function initPkg_VideoTools_Filter_Dom() {
Filter_insertIcon();
}
function Filter_insertIcon() {
let a = document.createElement("div");
a.id = "ex-filter";
a.innerHTML = `
滤镜
无
1977
Aden
Amaro
Brannan
Brooklyn
Claredon
Earlybird
Gingham
Hudson
Inkwell
Lofi
Maven
Perpetua
Reyes
Stinson
Toaster
Walden
Valencia
Xpro2
`;
let b = document.getElementsByClassName("right-e7ea5d")[0];
b.insertBefore(a, b.childNodes[0]);
b = document.getElementsByClassName("menu-da2a9e")[0];
let domPanorama = document.createElement("li");
domPanorama.id = "filter__panorama";
domPanorama.innerText = "全景";
b.insertBefore(domPanorama, b.childNodes[1]);
let domMirror = document.createElement("li");
domMirror.id = "filter__mirror";
domMirror.innerText = "镜像画面";
b.insertBefore(domMirror, b.childNodes[1]);
let domRotate = document.createElement("li");
domRotate.id = "filter__rotate";
domRotate.innerText = "旋转画面";
b.insertBefore(domRotate, b.childNodes[1]);
let domReset = document.createElement("li");
domReset.id = "filter__reset";
domReset.innerText = "重置";
b.insertBefore(domReset, b.childNodes[1]);
let domDivider = document.createElement("div");
domDivider.className = "divider-f9d33d";
b.insertBefore(domDivider, b.childNodes[1]);
}
function initPkg_VideoTools_Filter_Func() {
document.onmouseup = function () {
document.onmousemove = null; //弹起鼠标不做任何操作
}
setScrollFunc(document.getElementById("scroll__bright"), document.getElementById("bar__bright"), document.getElementById("mask__bright"), (data) => {
currentBrightness = `brightness(${ data }%)`;
liveVideoNode.style.filter = `${ currentBrightness } ${ currentContrast } ${ currentSaturate }`;
});
setScrollFunc(document.getElementById("scroll__contrast"), document.getElementById("bar__contrast"), document.getElementById("mask__contrast"), (data) => {
currentContrast = `contrast(${ data }%)`;
liveVideoNode.style.filter = `${ currentBrightness } ${ currentContrast } ${ currentSaturate }`;
});
setScrollFunc(document.getElementById("scroll__saturate"), document.getElementById("bar__saturate"), document.getElementById("mask__saturate"), (data) => {
currentSaturate = `saturate(${ data }%)`;
liveVideoNode.style.filter = `${ currentBrightness } ${ currentContrast } ${ currentSaturate }`;
});
const filterButton = document.getElementById("ex-filter");
const filterPanel = document.getElementsByClassName("filter__wrap")[0];
let overPanel = false;
let timeout = null;
filterButton.addEventListener("mouseover", function () {
if (timeout) clearTimeout(timeout);
filterPanel.style.display = "block";
timeout = setTimeout(() => {
if(!overPanel) {
filterPanel.style.display = "none";
}
}, 1500);
});
filterPanel.addEventListener("mouseover", function() {
overPanel = true;
})
filterPanel.addEventListener("mouseleave", function () {
setTimeout(() => {
filterPanel.style.display = "none"
overPanel = false;
}, 500);
});
document.getElementById("filter__reset").addEventListener("click", () => {
resetVideoFilter();
});
document.getElementById("filter__reset2").addEventListener("click", () => {
resetVideoFilter();
});
document.getElementById("filter__mirror").addEventListener("click", () => {
if (!isMirror) {
isMirror = true;
transformCss.rotateY = "rotateY(180deg)";
} else {
isMirror = false;
transformCss.rotateY = "rotateY(0deg)";
}
liveVideoNode.parentNode.style.transition = "all .5s";
liveVideoNode.parentNode.style.transform = transformCss.rotateY + " " + transformCss.rotate + " " + transformCss.scale;
});
document.getElementById("filter__rotate").addEventListener("click", () => {
rotateAngle += 90;
transformCss.rotate = `rotate(${String(rotateAngle)}deg)`;
liveVideoNode.parentNode.style.transition = "all .5s";
if ((rotateAngle/90) % 2 !== 0) {
if (window.innerWidth > window.innerHeight) {
transformCss.scale = "scale(" + String(liveVideoNode.videoHeight / liveVideoNode.videoWidth) + ")";
} else {
transformCss.scale = "scale(" + String(liveVideoNode.videoWidth / liveVideoNode.videoHeight) + ")";
}
} else {
transformCss.scale = "";
}
liveVideoNode.parentNode.style.transform = transformCss.rotateY + " " + transformCss.rotate + " " + transformCss.scale;
});
document.getElementById("filter__select").onchange = function() {
let option = this.options[this.selectedIndex].text;
switch (option) {
case "default":
StyleHook_remove("Ex_Style_Filter")
break;
case "1977":
setVideoFilter(`.${ liveVideoParentClassName }{position:relative;-webkit-filter:contrast(110%)brightness(110%)saturate(130%);filter:contrast(110%)brightness(110%)saturate(130%)}.${ liveVideoParentClassName }::before{content:"";display:block;height:100%;width:100%;top:0;left:0;position:absolute;pointer-events:none;mix-blend-mode:screen;background:rgba(243,106,188,0.3);z-index:10}`)
break;
case "Aden":
setVideoFilter(`.${ liveVideoParentClassName }{position:relative;-webkit-filter:contrast(90%)brightness(120%)saturate(85%)hue-rotate(20deg);filter:contrast(90%)brightness(120%)saturate(85%)hue-rotate(20deg)}.${ liveVideoParentClassName }::before{content:"";display:block;height:100%;width:100%;top:0;left:0;position:absolute;pointer-events:none;mix-blend-mode:darken;background:-webkit-linear-gradient(to right,rgba(66,10,14,0.2)1,rgba(66,10,14,0));background:linear-gradient(to right,rgba(66,10,14,0.2)1,rgba(66,10,14,0));z-index:10}`)
break;
case "Amaro":
setVideoFilter(`.${ liveVideoParentClassName }{position:relative;-webkit-filter:contrast(90%)brightness(110%)saturate(150%)hue-rotate(-10deg);filter:contrast(90%)brightness(110%)saturate(150%)hue-rotate(-10deg)}`)
break;
case "Brannan":
setVideoFilter(`.${ liveVideoParentClassName }{position:relative;-webkit-filter:contrast(140%)sepia(50%);filter:contrast(140%)sepia(50%)}.${ liveVideoParentClassName }::before{content:"";display:block;height:100%;width:100%;top:0;left:0;position:absolute;pointer-events:none;mix-blend-mode:lighten;background:rgba(161,44,199,0.31);z-index:10}`)
break;
case "Brooklyn":
setVideoFilter(`.${ liveVideoParentClassName }{position:relative;-webkit-filter:contrast(90%)brightness(110%);filter:contrast(90%)brightness(110%)}.${ liveVideoParentClassName }::before{content:"";display:block;height:100%;width:100%;top:0;left:0;position:absolute;pointer-events:none;mix-blend-mode:overlay;background:-webkit-radial-gradient(50%50%,circle closest-corner,rgba(168,223,193,0.4)1,rgba(183,196,200,0.2));background:radial-gradient(50%50%,circle closest-corner,rgba(168,223,193,0.4)1,rgba(183,196,200,0.2));z-index:10}`)
break;
case "Claredon":
setVideoFilter(`.${ liveVideoParentClassName }{position:relative;-webkit-filter:contrast(120%)saturate(125%);filter:contrast(120%)saturate(125%)}.${ liveVideoParentClassName }::before{content:"";display:block;height:100%;width:100%;top:0;left:0;position:absolute;pointer-events:none;mix-blend-mode:overlay;background:rgba(127,187,227,0.2);z-index:10}`)
break;
case "Earlybird":
setVideoFilter(`.${ liveVideoParentClassName }{position:relative;-webkit-filter:contrast(90%)sepia(20%);filter:contrast(90%)sepia(20%)}.${ liveVideoParentClassName }::before{content:"";display:block;height:100%;width:100%;top:0;left:0;position:absolute;pointer-events:none;mix-blend-mode:overlay;background:-webkit-radial-gradient(50%50%,circle closest-corner,rgba(208,186,142,1)20,rgba(29,2,16,0.2));background:radial-gradient(50%50%,circle closest-corner,rgba(208,186,142,1)20,rgba(29,2,16,0.2));z-index:10}`)
break;
case "Gingham":
setVideoFilter(`.${ liveVideoParentClassName }{position:relative;-webkit-filter:brightness(105%)hue-rotate(350deg);filter:brightness(105%)hue-rotate(350deg)}.${ liveVideoParentClassName }::before{content:"";display:block;height:100%;width:100%;top:0;left:0;position:absolute;pointer-events:none;mix-blend-mode:darken;background:-webkit-linear-gradient(to right,rgba(66,10,14,0.2)1,rgba(0,0,0,0));background:linear-gradient(to right,rgba(66,10,14,0.2)1,rgba(0,0,0,0));z-index:10}`)
break;
case "Hudson":
setVideoFilter(`.${ liveVideoParentClassName }{position:relative;-webkit-filter:contrast(90%)brightness(120%)saturate(110%);filter:contrast(90%)brightness(120%)saturate(110%)}.${ liveVideoParentClassName }::before{content:"";display:block;height:100%;width:100%;top:0;left:0;position:absolute;pointer-events:none;mix-blend-mode:multiply;opacity:0.5;background:-webkit-radial-gradient(50%50%,circle closest-corner,rgba(255,177,166,1)50,rgba(52,33,52,1));background:radial-gradient(50%50%,circle closest-corner,rgba(255,177,166,1)50,rgba(52,33,52,1));z-index:10}`)
break;
case "Inkwell":
setVideoFilter(`.${ liveVideoParentClassName }{position:relative;-webkit-filter:contrast(110%)brightness(110%)sepia(30%)grayscale(100%);filter:contrast(110%)brightness(110%)sepia(30%)grayscale(100%)}.${ liveVideoParentClassName }::before{content:"";display:block;height:100%;width:100%;top:0;left:0;position:absolute;pointer-events:none;background:rgba(0,0,0,0);z-index:10}`)
break;
case "Lofi":
setVideoFilter(`.${ liveVideoParentClassName }{position:relative;-webkit-filter:contrast(150%)saturate(110%);filter:contrast(150%)saturate(110%)}.${ liveVideoParentClassName }::before{content:"";display:block;height:100%;width:100%;top:0;left:0;position:absolute;pointer-events:none;mix-blend-mode:multiply;background:-webkit-radial-gradient(50%50%,circle closest-corner,rgba(0,0,0,0)70,rgba(34,34,34,1));background:radial-gradient(50%50%,circle closest-corner,rgba(0,0,0,0)70,rgba(34,34,34,1));z-index:10}`);
break;
case "Maven":
setVideoFilter(`.${ liveVideoParentClassName }{position:relative;-webkit-filter:contrast(95%)brightness(95%)saturate(150%)sepia(25%);filter:contrast(95%)brightness(95%)saturate(150%)sepia(25%)}.${ liveVideoParentClassName }::before{content:"";display:block;height:100%;width:100%;top:0;left:0;position:absolute;pointer-events:none;mix-blend-mode:hue;background:rgba(3,230,26,0.2);z-index:10}`)
break;
case "Perpetua":
setVideoFilter(`.${ liveVideoParentClassName }{position:relative}.${ liveVideoParentClassName }::before{content:"";display:block;height:100%;width:100%;top:0;left:0;position:absolute;pointer-events:none;mix-blend-mode:soft-light;opacity:0.5;background:-webkit-linear-gradient(to bottom,rgba(0,91,154,1)1,rgba(61,193,230,0));background:linear-gradient(to bottom,rgba(0,91,154,1)1,rgba(61,193,230,0));z-index:10}`)
break;
case "Reyes":
setVideoFilter(`.${ liveVideoParentClassName }{position:relative;-webkit-filter:contrast(85%)brightness(110%)saturate(75%)sepia(22%);filter:contrast(85%)brightness(110%)saturate(75%)sepia(22%)}.${ liveVideoParentClassName }::before{content:"";display:block;height:100%;width:100%;top:0;left:0;position:absolute;pointer-events:none;mix-blend-mode:soft-light;opacity:0.5;background:rgba(173,205,239,1);z-index:10}`)
break;
case "Stinson":
setVideoFilter(`.${ liveVideoParentClassName }{position:relative;-webkit-filter:contrast(75%)brightness(115%)saturate(85%);filter:contrast(75%)brightness(115%)saturate(85%)}.${ liveVideoParentClassName }::before{content:"";display:block;height:100%;width:100%;top:0;left:0;position:absolute;pointer-events:none;mix-blend-mode:soft-light;background:rgba(240,149,128,0.2);z-index:10}`)
break;
case "Toaster":
setVideoFilter(`.${ liveVideoParentClassName }{position:relative;-webkit-filter:contrast(150%)brightness(90%);filter:contrast(150%)brightness(90%)}.${ liveVideoParentClassName }::before{content:"";display:block;height:100%;width:100%;top:0;left:0;position:absolute;pointer-events:none;mix-blend-mode:screen;opacity:0.5;background:-webkit-radial-gradient(50%50%,circle closest-corner,rgba(15,78,128,1)1,rgba(59,0,59,1));background:radial-gradient(50%50%,circle closest-corner,rgba(15,78,128,1)1,rgba(59,0,59,1));z-index:10}`)
break;
case "Walden":
setVideoFilter(`.${ liveVideoParentClassName }{position:relative;-webkit-filter:brightness(110%)saturate(160%)sepia(30%)hue-rotate(350deg);filter:brightness(110%)saturate(160%)sepia(30%)hue-rotate(350deg)}.${ liveVideoParentClassName }::before{content:"";display:block;height:100%;width:100%;top:0;left:0;position:absolute;pointer-events:none;mix-blend-mode:screen;opacity:0.3;background:rgba(204,68,0,1);z-index:10}`)
break;
case "Valencia":
setVideoFilter(`.${ liveVideoParentClassName }{position:relative;-webkit-filter:contrast(108%)brightness(108%)sepia(8%);filter:contrast(108%)brightness(108%)sepia(8%)}.${ liveVideoParentClassName }::before{content:"";display:block;height:100%;width:100%;top:0;left:0;position:absolute;pointer-events:none;mix-blend-mode:exclusion;opacity:0.5;background:rgba(58,3,57,1);z-index:10}`)
break;
case "Xpro2":
setVideoFilter(`.${ liveVideoParentClassName }{position:relative;-webkit-filter:sepia(30%);filter:sepia(30%)}.${ liveVideoParentClassName }::before{content:"";display:block;height:100%;width:100%;top:0;left:0;position:absolute;pointer-events:none;mix-blend-mode:color-burn;background:-webkit-radial-gradient(50%50%,circle closest-corner,rgba(224,231,230,1)40,rgba(43,42,161,0.6));background:radial-gradient(50%50%,circle closest-corner,rgba(224,231,230,1)40,rgba(43,42,161,0.6));z-index:10}`)
break;
default:
StyleHook_remove("Ex_Style_Filter")
break;
}
}
document.getElementById("filter__panorama").addEventListener("click", () => {
let tmp = document.getElementById("ex-panorama");
if (tmp) {
tmp.remove();
panorama = null;
} else {
let node = document.getElementById("__h5player");
let dom = document.createElement("div");
dom.id = "ex-panorama";
dom.style = "width:100%;height:100%;z-index:1;background:black;"
node.insertBefore(dom, node.childNodes[0]);
panorama = new PanoramaVideo(dom, liveVideoNode);
panoramaAnimation(panorama);
}
})
}
function resetVideoFilter() {
StyleHook_remove("Ex_Style_Filter");
document.getElementById("filter__select").selectedIndex = 0;
liveVideoNode.style.filter = "";
rotateAngle = 0;
transformCss = {
rotateY: "",
rotate: "",
scale: "",
}
liveVideoNode.parentNode.style.transform = "";
document.getElementById("bar__bright").style.left = "100px";
document.getElementById("bar__contrast").style.left = "100px";
document.getElementById("bar__saturate").style.left = "100px";
document.getElementById("mask__bright").style.width = "100px";
document.getElementById("mask__contrast").style.width = "100px";
document.getElementById("mask__saturate").style.width = "100px";
// 重置全景
let domPanorama = document.getElementById("ex-panorama");
if (domPanorama) {
domPanorama.remove();
panorama = null;
}
// 重置缩放
let domVideoWrap = document.getElementsByClassName("layout-Player-videoEntity")[0];
domVideoWrap.style.transform = "";
domVideoWrap.style.transformOrigin = "";
videoScale = 1;
// 重置影院模式
StyleHook_remove("Ex_Style_Cinema");
// 重置视频倍速
liveVideoNode.playbackRate = 1;
}
function panoramaAnimation(panorama) {
requestAnimationFrame(() => {
panoramaAnimation(panorama)
})
panorama.update();
}
function setVideoFilter(style) {
// liveVideoNode.style.filter = text;
// liveVideoNode.style.webkitFilter = text;
StyleHook_remove("Ex_Style_Filter");
StyleHook_set("Ex_Style_Filter", style);
document.getElementsByClassName("filter__wrap")[0].style.display = "none";
}
function setScrollFunc(scrollDom, barDom, maskDom, callback) {
let scroll = scrollDom;
let bar = barDom;
let mask = maskDom;
let barleft = 0;
bar.onmousedown = function (e) {
let event = e || window.event;
let leftVal = event.clientX - this.offsetLeft;
let that = this;
// 拖动一定写到 down 里面才可以
document.onmousemove = function (e) {
let event = e || window.event;
barleft = event.clientX - leftVal;
if (barleft < 0)
barleft = 0;
else if (barleft > scroll.offsetWidth - bar.offsetWidth)
barleft = scroll.offsetWidth - bar.offsetWidth;
mask.style.width = barleft + 'px';
that.style.left = barleft + "px";
callback(parseInt(barleft / (scroll.offsetWidth - bar.offsetWidth) * 255));
//防止选择内容--当拖动鼠标过快时候,弹起鼠标,bar也会移动,修复bug
window.getSelection ? window.getSelection().removeAllRanges() : document.selection.empty();
}
}
}
function initPkg_VideoTools_VideoRecall() {
initPkg_VideoTools_VideoRecall_Func();
}
function initPkg_VideoTools_VideoRecall_Func() {
document.getElementsByClassName("layout-Player-video")[0].addEventListener("keydown", (e) => {
if (isInput == true) {
return;
}
if (e.keyCode == 37) {
liveVideoNode.currentTime += -3;
} else if (e.keyCode == 39) {
liveVideoNode.currentTime += 3;
}
});
}
function initPkg_VideoTools_VideoSpeed() {
initPkg_VideoTools_VideoSpeed_Dom();
initPkg_VideoTools_VideoSpeed_Func();
}
function initPkg_VideoTools_VideoSpeed_Dom() {
VideoSpeed_insertIcon();
}
function VideoSpeed_insertIcon() {
let a = document.createElement("li");
a.id = "ex-videospeed";
a.innerHTML = `
倍速播放
2.0x
1.5x
1.25x
1.0x
0.75x
0.5x
`;
let b = document.getElementsByClassName("menu-da2a9e")[0];
b.insertBefore(a, b.childNodes[1]);
}
function initPkg_VideoTools_VideoSpeed_Func() {
document.getElementById("videospeed__2.0").addEventListener("click", () => {
liveVideoNode.playbackRate = 2;
});
document.getElementById("videospeed__1.5").addEventListener("click", () => {
liveVideoNode.playbackRate = 1.5;
});
document.getElementById("videospeed__1.25").addEventListener("click", () => {
liveVideoNode.playbackRate = 1.25;
});
document.getElementById("videospeed__1.0").addEventListener("click", () => {
liveVideoNode.playbackRate = 1;
});
document.getElementById("videospeed__0.75").addEventListener("click", () => {
liveVideoNode.playbackRate = 0.75;
});
document.getElementById("videospeed__0.5").addEventListener("click", () => {
liveVideoNode.playbackRate = 0.5;
});
}
function initPkg_VideoTools_VideoSync() {
initPkg_VideoTools_VideoSync_Dom();
initPkg_VideoTools_VideoSync_Func();
}
function initPkg_VideoTools_VideoSync_Dom() {
VideoSync_insertIcon();
}
function VideoSync_insertIcon() {
let a = document.createElement("div");
a.id = "ex-videosync";
a.title = "同步时间";
a.innerHTML = `
`;
let b = document.getElementsByClassName("left-d3671e")[0];
b.insertBefore(a, b.childNodes[3]);
}
function initPkg_VideoTools_VideoSync_Func() {
document.getElementById("ex-videosync").addEventListener("click", () => {
setVideoSync();
})
}
function setVideoSync() {
let buffered = liveVideoNode.buffered;
if (buffered.length == 0) {
// 暂停中
return;
}
liveVideoNode.currentTime = buffered.end(0);
}
var liveVideoNode; // 直播video标签节点
var isInput = false;
let videotools_num = 0;
function initPkg_VideoTools() {
let timer = setInterval(() => {
if (document.getElementsByClassName("right-e7ea5d").length > 0) {
clearInterval(timer);
liveVideoNode = document.querySelector(".layout-Player-videoEntity video");
document.getElementsByClassName("disable-23f484")[0].innerHTML = `DouyuEx_${curVersion}`;
initPkg_VideoTools_Module();
initPkg_VideoTools_Func();
}
videotools_num++;
if (videotools_num >= 100) {
clearInterval(timer);
}
}, 1500);
}
function initPkg_VideoTools_Module() {
// 添加模块
initPkg_VideoTools_Joysound();
initPkg_VideoTools_VideoSpeed();
initPkg_VideoTools_Cinema();
initPkg_VideoTools_VideoSync();
initPkg_VideoTools_VideoRecall();
initPkg_VideoTools_Filter();
initPkg_VideoTools_Camera();
initPkg_VideoTools_VideoZoom();
initPkg_VideoTools_MetaData();
}
function initPkg_VideoTools_Func() {
document.getElementById("js-player-toolbar").addEventListener("mouseover", () => {
document.getElementsByClassName("filter__wrap")[0].style.display = "none";
});
document.getElementById("js-player-asideMain").addEventListener("mouseover", () => {
document.getElementsByClassName("filter__wrap")[0].style.display = "none";
});
document.getElementsByClassName("inputView-2a65aa")[0].addEventListener("focus", () => {
isInput = true;
});
document.getElementsByClassName("inputView-2a65aa")[0].addEventListener("blur", () => {
isInput = false;
});
let m = new DomHook(".app-f0f9c7", false, (m) => {
if (m.length > 0) {
if (m[0].addedNodes.length > 0) {
isInput = true;
} else if (m[0].removedNodes.length > 0) {
isInput = false;
}
}
});
}
let videoScale = 1;
function initPkg_VideoTools_VideoZoom() {
let domWrap = document.getElementsByClassName("layout-Player-video")[0];
let domVideoWrap = document.getElementsByClassName("layout-Player-videoEntity")[0];
let x = 0;
let y = 0;
let mousedownX = 0;
let mousedownY = 0;
let mouseupX = 0;
let mouseupY = 0;
domVideoWrap.style.transition = "all 0.1s";
domWrap.addEventListener("mousewheel", e => {
if (!e.ctrlKey) {
return;
}
e.preventDefault();
e.stopPropagation();
let delta = e.wheelDelta || -e.detail;
x = e.screenX - domWrap.getBoundingClientRect().left;
y = e.screenY - domWrap.getBoundingClientRect().top;
if (delta >= 0) {
videoScale += 0.1;
} else {
videoScale -= 0.1;
}
domVideoWrap.style.transform = `scale(${videoScale})`;
domVideoWrap.style.transformOrigin = `${x}px ${y}px`;
});
domWrap.addEventListener("mousedown", e => {
if (!e.ctrlKey) {
return;
}
if (e.button === 0) {
mousedownX = e.clientX - domWrap.getBoundingClientRect().left;
mousedownY = e.clientY - domWrap.getBoundingClientRect().top;
}
});
domWrap.addEventListener("mouseup", e => {
if (!e.ctrlKey) {
return;
}
if (e.button === 0) {
mouseupX = e.clientX - domWrap.getBoundingClientRect().left;
mouseupY = e.clientY - domWrap.getBoundingClientRect().top;
let delX = mouseupX - mousedownX;
let delY = mouseupY - mousedownY;
x -= delX;
y -= delY;
if (domVideoWrap.style.transform !== "") {
domVideoWrap.style.transformOrigin = `${x}px ${y}px`;
}
}
});
}
function initPkg_WeeklyPanel() {
if (isShowWeeklyPanel()) {
initPkg_WeeklyPanel_Dom();
initPkg_WeeklyPanel_Func();
}
}
function initPkg_WeeklyPanel_Dom() {
let a = document.createElement("div");
a.className = "weeklypanel__panel-wrap";
a.innerHTML = `
×
😳项目维护不易,如果觉得DouyuEx有帮助到你的话
请点击下方链接,在右上角点个免费的⭐吧!
以鼓励我长期维护下去,感谢使用😇
`;
let b = document.getElementById("root");
b.insertBefore(a, b.childNodes[0]);
}
function initPkg_WeeklyPanel_Func() {
let weeklyPanel = document.getElementsByClassName("weeklypanel__panel-wrap")[0];
document.getElementsByClassName("weeklypanel__close")[0].addEventListener("click", () => {
weeklyPanel.style.display = "none";
});
}
function isShowWeeklyPanel() {
const LOCAL_NAME = "Ex_WeeklyPanel_NextTime";
let tt = new Date().getTime();
let nt = tt + 604800000;
let nextTime = Number(localStorage.getItem(LOCAL_NAME));
if (nextTime) {
if (tt >= nextTime) {
localStorage.setItem(LOCAL_NAME, nt);
return true;
}
} else {
localStorage.setItem(LOCAL_NAME, nt);
return true;
}
return false;
}
function doSign(alias) {
return new Promise(resolve => {
fetch('https://www.douyu.com/japi/carnival/nc/hostSnowSign/doSign',{
method: 'POST',
mode: 'no-cors',
credentials: 'include',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: `actAlias=${alias}&token=${dyToken}&ctn=${getCCN()}`
}).then(res => {
return res.json();
}).then(ret => {
resolve(ret);
}).catch(err => {
console.log("请求失败!", err);
})
})
}
function signAct(alias) {
return new Promise(resolve => {
fetch("https://www.douyu.com/japi/carnival/nc/signAct/signIn", {
method: 'POST',
mode: 'no-cors',
credentials: 'include',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: 'token=' + dyToken + "&signAlias=" + alias
}).then(res => {
return res.json();
}).then(ret => {
resolve(ret);
})
})
}
function userStatus(tasks) {
return new Promise(resolve => {
fetch("https://www.douyu.com/japi/carnival/nc/actTask/userStatus", {
method: 'POST',
mode: 'no-cors',
credentials: 'include',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: `tasks=${tasks}&token=${dyToken}`
}).then(res => {
return res.json();
}).then(ret => {
resolve(ret);
}).catch(err => {
console.log("请求失败!", err);
})
})
}
function takeActPrize(name) {
// 该接口会在userStatus后自动执行
// 关注20200911LMJX_T2
// 分享20200911LMJX_T5
return new Promise(resolve => {
fetch('https://www.douyu.com/japi/carnival/nc/actTask/takePrize',{
method: 'POST',
mode: 'no-cors',
credentials: 'include',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: `token=${ dyToken }&aid=android&taskAlias=${ name }`
}).then(res => {
return res.json();
}).then(ret => {
resolve(ret);
}).catch(err => {
console.log("请求失败!", err);
})
})
}
function addFollowRoom(rid) {
return new Promise(resolve => {
fetch('https://www.douyu.com/wgapi/livenc/liveweb/follow/add',{
method: 'POST',
mode: 'no-cors',
credentials: 'include',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: `rid=${ rid }&ctn=${ getCCN() }`
}).then(res => {
return res.json();
}).then(ret => {
resolve(ret);
}).catch(err => {
console.log("请求失败!", err);
})
})
}
function removeFollowRoom(rid) {
return new Promise(resolve => {
fetch('https://www.douyu.com/wgapi/livenc/liveweb/follow/rm',{
method: 'POST',
mode: 'no-cors',
credentials: 'include',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: `rid=${ rid }&ctn=${ getCCN() }`
}).then(res => {
return res.json();
}).then(ret => {
resolve(ret);
}).catch(err => {
console.log("请求失败!", err);
})
})
}
function shareAct(name) {
// 20200911LMJX
return new Promise(resolve => {
fetch('https://www.douyu.com/japi/carnival/common/share',{
method: 'POST',
mode: 'no-cors',
credentials: 'include',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: `actAlias=${ name }&token=${ dyToken }`
}).then(res => {
return res.json();
}).then(ret => {
resolve(ret);
}).catch(err => {
console.log("请求失败!", err);
})
})
}
function getJackpot(id) {
return new Promise(resolve => {
fetch("https://www.douyu.com/japi/carnival/nc/lottery/jackpot", {
method: 'POST',
headers: {'Content-Type': 'application/json;charset=UTF-8'},
body: `{"activityId":"${ id }","token":"${ dyToken }"}`
}).then(res => {
return res.json();
}).then(ret => {
resolve(ret);
})
})
}
function getActRemaining(id) {
return new Promise(resolve => {
fetch("https://www.douyu.com/japi/carnival/nc/lottery/remaining?activityId=" + id, {
method: 'GET',
mode: 'no-cors',
credentials: 'include',
headers: {'Content-Type': 'application/json;charset=UTF-8'},
}).then(res => {
return res.json();
}).then(ret => {
resolve(ret);
})
})
}
function getActList() {
// return new Promise(resolve => {
// fetch('http://src.douyuex.com/src/actList.txt',{
// method: 'GET',
// mode: 'cors',
// cache: 'no-store',
// credentials: 'omit',
// }).then(res => {
// return res.text();
// }).then(txt => {
// resolve(txt);
// }).catch(err => {
// console.error('请求失败', err);
// })
// })
}
// function douyuVideo_createUp(cookie, vid, ctn) {
// // 斗鱼视频点赞
// return exHttpRequest("https://v.douyu.com/api/video/createUp", "POST", {
// cookie: cookie
// }, "vid=" + vid + "&ccn=" + ctn);
// }
// function douyuVideo_destroyUp(cookie, vid, ctn) {
// // 斗鱼视频取消点赞
// return exHttpRequest("https://v.douyu.com/api/video/destroyUp", "POST", {
// cookie: cookie
// }, "vid=" + vid + "&ccn=" + ctn);
// }
// function douyuVideo_createCollect(cookie, vid, ctn) {
// // 斗鱼视频收藏
// return exHttpRequest("https://v.douyu.com/api/video/createCollect", "POST", {
// cookie: cookie
// }, "vid=" + vid + "&ccn=" + ctn);
// }
// function douyuVideo_destroyCollect(cookie, vid, ctn) {
// // 斗鱼视频取消收藏
// return exHttpRequest("https://v.douyu.com/api/video/destroyCollect", "POST", {
// cookie: cookie
// }, "vid=" + vid + "&ccn=" + ctn);
// }
// function douyuVideo_createSub(cookie, uid, ctn) {
// // 斗鱼关注UP主
// return exHttpRequest("https://v.douyu.com/api/video/createSub", "POST", {
// cookie: cookie
// }, "uid=" + uid + "&ccn=" + ctn);
// }
// function douyuVideo_destroySub(cookie, uid, ctn) {
// // 斗鱼取消关注UP主
// return exHttpRequest("https://v.douyu.com/api/video/destroySub", "POST", {
// cookie: cookie
// }, "uid=" + uid + "&ccn=" + ctn);
// }
// function douyuVideo_shareVideo(token, vid) {
// // 斗鱼分享视频
// return exHttpRequest("https://apiv2.douyucdn.cn/mgapi/vodnc/share/success?token=" + token + "&client_sys=android", "POST", {}, "hash_id=" + vid + "&share_type=weixin");
// }
// https://blog.csdn.net/hongszh/article/details/104354252
/**
* options:
* - width: 视频宽度
* - height: 视频高度
* - fontSize: 字体大小
* - color: 字体颜色
* - alpha: 字体透明度 0~256
* - stayTime: 弹幕停留时间
*/
class ASS {
constructor(options) {
let defaultOptions = {
width: 1920,
height: 1080,
fontSize: 36,
alpha: this._prefixInteger(Number(0).toString(16), 2), // 0~255 0不透明 255全透明
stayTime: 10,
title: "Default"
};
this.options = {
...defaultOptions,
...options,
...options ? options.alpha ? this._prefixInteger(this.options.alpha.toString(16), 2) : {} : {},
};
this.lines = 20; // 弹幕行数
this.lineBase = this.options.height / this.lines; // 每行高度
this.currentLine = 0; // 当前行数
this.diffTime = 1500; // 如果上下两条在n秒内连续发送,就换行
}
generate(list) {
/**
* list:
* - time: 时间,单位毫秒
* - txt: 文本
* - color: 颜色
*/
let sortList = list.sort((a, b) => {
return a.time - b.time;
})
let result = this._getScriptInfo() + this._getV4Styles() + this._getEvents();
for (let i = 0; i < sortList.length; i++) {
if (i > 0 && sortList[i].time - sortList[i-1].time <= this.diffTime) {
this.currentLine++;
} else {
this.currentLine = 0;
}
if (this.currentLine >= this.lines) {
this.currentLine = 0;
}
let item = sortList[i];
let endTime = Number(item.time) + Number(this.options.stayTime) * 1000;
let heightOffset = this.lineBase * this.currentLine + this.options.fontSize;
let fontWidth = this.options.fontSize * item.txt.length;
result += `Dialogue: 0,${formatSeconds2(Number(item.time)/1000)}.00,${formatSeconds2(endTime/1000)}.00,Color${item.color},,0,0,0,,{\\move(${this.options.width + fontWidth},${heightOffset},${-fontWidth},${heightOffset})}${item.txt}\n`;
}
return result;
}
_prefixInteger(num, length) {
num = '' + num;
return Array(length + 1 - num.length).join('0') + num;
}
_getScriptInfo() {
return `[Script Info]
; DouyuEx -By qianjiachun
; https://github.com/qianjiachun/douyuEx
ScriptType: v4.00+
Title: ${this.options.title}
PlayResX: ${this.options.width}
PlayResY: ${this.options.height}
`
}
_getV4Styles() {
return `
[V4+ Styles]
Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
Style: Color0,黑体,${this.options.fontSize},&H${this.options.alpha}FFFFFF,&H80000000,&H80000000,&H80000000,0,0,0,0,100,100,0,0,0,0,0,0,0,0,0,134
Style: Color7,黑体,${this.options.fontSize},&H${this.options.alpha}5456FF,&H80000000,&H80000000,&H80000000,0,0,0,0,100,100,0,0,0,0,0,0,0,0,0,134
Style: Color8,黑体,${this.options.fontSize},&H${this.options.alpha}2375FF,&H80000000,&H80000000,&H80000000,0,0,0,0,100,100,0,0,0,0,0,0,0,0,0,134
Style: Color9,黑体,${this.options.fontSize},&H${this.options.alpha}B369FE,&H80000000,&H80000000,&H80000000,0,0,0,0,100,100,0,0,0,0,0,0,0,0,0,134
Style: Color10,黑体,${this.options.fontSize},&H${this.options.alpha}00BCFF,&H80000000,&H80000000,&H80000000,0,0,0,0,100,100,0,0,0,0,0,0,0,0,0,134
Style: Color11,黑体,${this.options.fontSize},&H${this.options.alpha}46C978,&H80000000,&H80000000,&H80000000,0,0,0,0,100,100,0,0,0,0,0,0,0,0,0,134
Style: Color12,黑体,${this.options.fontSize},&H${this.options.alpha}FF7F9E,&H80000000,&H80000000,&H80000000,0,0,0,0,100,100,0,0,0,0,0,0,0,0,0,134
Style: Color13,黑体,${this.options.fontSize},&H${this.options.alpha}FF9B3D,&H80000000,&H80000000,&H80000000,0,0,0,0,100,100,0,0,0,0,0,0,0,0,0,134
`
}
_getEvents() {
return `
[Events]
Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
`
}
}
/*
CClick
单双击/长按不冲突的解决方案
By: 小淳
调用方法:
let a = new CClick(document.getElementById(""));
a.click((e) => {// TODO});
a.dbClick((e) => {// TODO});
a.longClick((e) => {// TODO});
*/
class CClick {
constructor(element) {
const CONST_LONG_TIME = 700; // 长按多少ms执行
const CONST_DOUBLE_TIME = 0; // 双击的间隔
this.func_click = null;
this.func_dbClick = null;
this.func_longClick = null;
let isLong = false;
let timer_long;
let clickTimes = 0;
let timer_db;
element.onmousedown = (event) => {
if (event.button !== 0) {
return;
}
isLong = false;
timer_long = setTimeout(() => {
isLong = true;
if (this.func_longClick !== null) {
this.func_longClick(event);
}
}, CONST_LONG_TIME);
};
element.onmouseup = (event) => {
if (event.button !== 0) {
return;
}
if (isLong == false) {
clearTimeout(timer_long);
clickTimes++;
if (clickTimes >= 2) {
clearTimeout(timer_db);
clickTimes = 0;
if (this.func_dbClick !== null) {
this.func_dbClick(event);
}
return;
}
timer_db = setTimeout(() => {
clickTimes = 0;
if (this.func_click !== null) {
this.func_click(event);
}
}, CONST_DOUBLE_TIME);
}
};
}
click(callback) {
this.func_click = callback;
}
dbClick(callback) {
this.func_dbClick = callback;
}
longClick(callback) {
this.func_longClick = callback;
}
}
class DomHook {
constructor(selector, isSubtree, callback) {
this.selector = selector;
this.isSubtree = isSubtree;
let targetNode = document.querySelector(this.selector);
if (targetNode == null) {
return;
}
let observer = new MutationObserver(function(mutations) {
callback(mutations);
});
this.observer = observer;
this.observer.observe(targetNode, { attributes: true, childList: true, subtree: this.isSubtree });
}
closeHook() {
if (this.observer) {
this.observer.disconnect();
}
}
}
// 获取斗鱼视频站post body sign
// -By 小淳
// 用法: let dyVideoSign = new DyVideoSign("视频point_id"); let sign = dyVideoSign.getSign();
// 注意: 使用完记得将实例null,point_id为window.$DATA.ROOM.point_id
class DyVideoSign {
constructor(pointId) {
this.pointId = pointId;
this.decoder = new TextDecoder();
}
getSign() {
let did = "10000000000000000000000000001501"; // DEFAULT_DID$1
let tt = parseInt((new Date).getTime() / 1e3, 10);
return unsafeWindow[this.d539fa2cf7732d2a(256042, "9f4f419501570ad13334")](this.pointId, did, tt);
}
d539fa2cf7732d2a(e, t) {
for (var n = CryptoJS.MM(e.toString()).toString(), r = n[0].charCodeAt(0), a = n[16].charCodeAt(0), i = [], o = 0; o < 4; o++) i[o] = r << 24 | r << 16 | r << 8 | r, i[o + 4] = a << 24 | a << 16 | a << 8 | a;
var s = Math.floor(t.length / 16) % 4,
l = [],
d = t.length % 8,
c = Math.floor(t.length / 8);
for (o = 0; o < c; o++) l[o] = 255 & parseInt(t.substr(8 * o, 2), 16) | parseInt(t.substr(8 * o + 2, 2), 16) << 8 & 65280 | parseInt(t.substr(8 * o + 4, 2), 16) << 24 >>> 8 | parseInt(t.substr(8 * o + 6, 2), 16) << 24;
var p = [];
p = 0 == s ? e86500e2(l, i) : 1 == s ? this.c30070a4(l, i) : d831eb20(l, i);
var h = [];
for (o = 0; o < p.length; o++) {
var f = 255 & p[o],
u = p[o] >>> 8 & 255,
m = p[o] >>> 16 & 255,
g = p[o] >>> 24 & 255;
f && h.push(f), u && h.push(u), m && h.push(m), g && h.push(g)
}
var b = Math.floor(d / 2);
for (o = 0; o < b; o++) h.push(255 & parseInt(t.substr(8 * c + 2 * o, 2), 16));
return this.decoder.decode(new Uint8Array(h))
}
c30070a4(e, t) {
for (var n = Math.floor(e.length / 2), r = e.slice(0), a = 0; a < n; a++) {
var i = this.f5a40d76(e.slice(2 * a, 2 * a + 2), 32, t.slice(4 * a % 8, 4 * a % 8 + 4));
r[2 * a + 0] = i[0], r[2 * a + 1] = i[1]
}
return r
}
f5a40d76(e, t, n) {
for (var r = 0; r < e.length; r += 2) {
var a, i = e[r],
o = e[r + 1],
s = 2654435769 * t;
for (a = 0; a < t; a++) i -= ((o -= (i << 4 ^ i >>> 5) + i ^ s + n[s >>> 11 & 3]) << 4 ^ o >>> 5) + o ^ (s -= 2654435769) + n[3 & s];
e[r] = i, e[r + 1] = o
}
return e
}
}
class DyWacthAd {
constructor(posid, token, rid) {
this.posid = posid;
this.token = token;
this.rid = rid;
this._uid = String(token).split("_")[0];
this._mid = 0;
this._infoBack = "";
}
async start() {
let info = await this.getInfo(this.posid, this.token, this.rid);
if (info == false) {
return false;
}
this._mid = info.mid;
this._infoBack = info.infoBack;
let isStart = await this.getStart(this.posid, this.token, this._uid, this._mid, this._infoBack);
return isStart;
}
async finish() {
let isFinish = await this.getFinish(this.posid, this.token, this._uid, this._mid, this._infoBack);
return isFinish;
}
getInfo(posid, token, rid) {
return new Promise(resolve => {
GM_xmlhttpRequest({
method: "POST",
url: "https://rtbapi.douyucdn.cn/japi/sign/app/getinfo?token=" + token + "&mdid=phone" + "&client_sys=android",
data: "posid=" + posid + "&roomid=" + rid + "&cate1=1&cate2=1&chanid=30" + '&device={"nt":"1"}',
responseType: "json",
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
onload: function(response) {
let ret = response.response;
if (ret.error == "0") {
if (ret.data.length == 0) {
resolve(false);
return;
}
let mid = ret.data[0].mid;
let infoBack = encodeURIComponent(JSON.stringify(ret.data));
resolve({mid: mid, infoBack: infoBack});
}
}
});
})
}
getStart(posid, token, uid, mid, infoBack) {
return new Promise(resolve => {
GM_xmlhttpRequest({
method: "POST",
url: "https://apiv2.douyucdn.cn/japi/inspire/api/ad/fishpond/mobile/start?client_sys=android",
data: "&uid=" + uid + "&roomId=" + rid + "&posCode=" + posid + "&token=" + token + "&clientType=1&creativeId=" + mid + "&infoBack=" + infoBack,
responseType: "json",
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
onload: function(response) {
let ret = response.response;
if (ret.error == "0") {
resolve(true);
}
}
});
})
}
getFinish(posid, token, uid, mid, infoBack) {
return new Promise(resolve => {
GM_xmlhttpRequest({
method: "POST",
url: "https://apiv2.douyucdn.cn/japi/inspire/api/ad/fishpond/mobile/finish?client_sys=android",
data: "uid=" + uid + "&clientType=1&posCode=" + posid + "&creativeId=" + mid + "&roomId=" + rid + "&token=" + token + "&infoBack=" + infoBack,
responseType: "json",
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
onload: function(response) {
let ret = response.response;
if (ret.error == "0") {
if (ret.data == "1") {
resolve(true);
} else {
resolve(false);
}
} else {
resolve(false);
}
}
});
})
}
}
function M3U8() {
var _this = this; // access root scope
this.ie = navigator.appVersion.toString().indexOf(".NET") > 0;
this.ios = navigator.platform && /iPad|iPhone|iPod/.test(navigator.platform);
this.start = function(m3u8, options) {
if (!options)
options = {};
var callbacks = {
progress: null,
finished: null,
error: null,
aborted: null
}
var recur; // the recursive download instance to later be initialized. Scoped here so callbakcs can access and manage it.
function handleCb(key, payload) {
if (key && callbacks[key])
callbacks[key](payload);
}
if (_this.ios)
return handleCb("error", "Downloading on IOS is not supported.");
var startObj = {
on: function(str, cb) {
switch (str) {
case "progress": {
callbacks.progress = cb;
break;
}
case "finished": {
callbacks.finished = cb;
break;
}
case "error": {
callbacks.error = cb;
break;
}
case "aborted": {
callbacks.aborted = cb;
break;
}
}
return startObj;
},
abort: function() {
;
recur && (recur.aborted = function() {
handleCb("aborted");
});
}
}
var download = new Promise(function(resolve, reject) {
var url = new URL(m3u8);
var req = fetch(m3u8)
.then(function(d) {
return d.text();
})
.then(function(d) {
var filtered = filter(d.split(/(\r\n|\r|\n)/gi), function(item) {
return item.indexOf(".ts") > -1; // select only ts files
});
var mapped = map(filtered, function(v, i) {
if (v.indexOf("http") === 0 || v.indexOf("ftp") === 0) { // absolute url
return v;
}
return url.protocol + "//" + url.host + url.pathname + "/./../" + v; // map ts files into url
});
if (!mapped.length) {
reject("Invalid m3u8 playlist");
return handleCb("error", "Invalid m3u8 playlist");
}
recur = new RecurseDownload(mapped, function(data) {
var blob = new Blob(data, {
type: "octet/stream"
});
handleCb("progress", {
status: "Processing..."
});
if (!options.returnBlob) {
if (_this.ios) {
// handle ios?
} else if (_this.ie) {
handleCb("progress", {
status: "Sending video to Internet Explorer... this may take a while depending on your device's performance."
});
window.navigator.msSaveBlob(blob, (options && options.filename) || "video.mp4");
} else {
handleCb("progress", {
status: "Sending video to browser..."
});
var a = document.createElementNS("http://www.w3.org/1999/xhtml", "a");
a.href = URL.createObjectURL(blob);
a.download = (options && options.filename) || "video.mp4";
a.style.display = "none";
document.body.appendChild(a); // Firefox fix
a.click();
handleCb("finished", {
status: "Successfully downloaded video",
data: blob
});
resolve(blob);
}
} else {
handleCb("finished", {
status: "Successfully downloaded video",
data: blob
});
resolve(blob)
}
}, 0, []);
recur.onprogress = function(obj) {
handleCb("progress", obj);
}
})
.catch(function(err) {
handleCb("error", "Something went wrong when downloading m3u8 playlist: " + err);
});
});
return startObj;
}
function RecurseDownload(arr, cb, i, data) { // recursively download asynchronously 2 at the time
var _this = this;
this.aborted = false;
this.threadNum = 10;
this.step = 0;
recurseDownload(arr, cb, i, data);
function recurseDownload(arr, cb, i, data) {
let taskList = [];
for (let j = 0; j < _this.threadNum; j++) {
if (arr[i+j]) {
taskList.push(fetch(arr[i+j]).catch(err => {
fetch(arr[i+j]).catch(err => {
fetch(arr[i+j]);
})
}));
} else {
taskList.push(Promise.resolve());
break;
}
}
_this.step = taskList.length;
var req = Promise.all(taskList) // HTTP protocol dictates only TWO requests can be simultaneously performed
.then(function(d) {
return map(filter(d, function(v) {
return v && v.blob;
}), function(v) {
return v.blob();
});
})
.then(function(d) {
return Promise.all(d);
})
.then(function(d) {
var blobs = map(d, function(v, j) {
return new Promise(function(resolve, reject) {
var reader = new FileReader();
var read = reader.readAsArrayBuffer(new Blob([v], {
type: "octet/stream"
})); // IE can't read Blob.arrayBuffer :(
reader.addEventListener("loadend", function(event) {
resolve(reader.result);;
(_this.onprogress && _this.onprogress({
segment: i + j + 1,
total: arr.length,
percentage: ((i + j + 1) / arr.length * 100).toFixed(3),
downloaded: formatNumber(+reduce(map(data, function(v) {
return v.byteLength;
}), function(t, c) {
return t + c;
}, 0)),
status: "Downloading..."
}));
});
});
});
Promise.all(blobs).then(function(d) {
for (var n = 0; n < d.length; n++) { // polymorphism
data.push(d[n]);
}
let step = _this.step;
var increment = arr[i + 2] ? 2 : 1;
if (_this.aborted) {
data = null;
_this.aborted();
return; // exit promise
} else if (arr[i + step]) {
if (_this.ie) {
setTimeout(function() {
recurseDownload(arr, cb, i + step, data);
}, 500);
} else {
recurseDownload(arr, cb, i + step, data);
}
} else {
cb(data);
}
});
})
.catch(function(err) {
;
_this.onerror && _this.onerror("Something went wrong when downloading ts file, nr. " + i + ": " + err);
});
}
}
function filter(arr, condition) {
var result = [];
for (var i = 0; i < arr.length; i++) {
if (condition(arr[i], i)) {
result.push(arr[i]);
}
}
return result;
}
function map(arr, condition) {
var result = arr.slice(0);
for (var i = 0; i < arr.length; i++) {
result[i] = condition(arr[i], i);
}
return result;
}
function reduce(arr, condition, start) {
var result = start;
arr.forEach(function(v, i) {
var res = +condition(result, v, i);
result = res;
});
return result;
}
function formatNumber(n) {
var ranges = [{
divider: 1e18,
suffix: "EB"
},
{
divider: 1e15,
suffix: "PB"
},
{
divider: 1e12,
suffix: "TB"
},
{
divider: 1e9,
suffix: "GB"
},
{
divider: 1e6,
suffix: "MB"
},
{
divider: 1e3,
suffix: "kB"
}
]
for (var i = 0; i < ranges.length; i++) {
if (n >= ranges[i].divider) {
var res = (n / ranges[i].divider).toString()
return res.toString().split(".")[0] + ranges[i].suffix;
}
}
return n.toString();
}
}
/*
md5.js
*/
var hexcase=0;var b64pad="";var chrsz=8;function hex_md5(s){return binl2hex(core_md5(str2binl(s),s.length*chrsz))}function b64_md5(s){return binl2b64(core_md5(str2binl(s),s.length*chrsz))}function str_md5(s){return binl2str(core_md5(str2binl(s),s.length*chrsz))}function hex_hmac_md5(key,data){return binl2hex(core_hmac_md5(key,data))}function b64_hmac_md5(key,data){return binl2b64(core_hmac_md5(key,data))}function str_hmac_md5(key,data){return binl2str(core_hmac_md5(key,data))}function md5_vm_test(){return hex_md5("abc")=="900150983cd24fb0d6963f7d28e17f72"}function core_md5(x,len){x[len>>5]|=0x80<<((len)%32);x[(((len+64)>>>9)<<4)+14]=len;var a=1732584193;var b=-271733879;var c=-1732584194;var d=271733878;for(var i=0;i16)bkey=core_md5(bkey,key.length*chrsz);var ipad=Array(16),opad=Array(16);for(var i=0;i<16;i++){ipad[i]=bkey[i]^0x36363636;opad[i]=bkey[i]^0x5C5C5C5C}var hash=core_md5(ipad.concat(str2binl(data)),512+data.length*chrsz);return core_md5(opad.concat(hash),512+128)}function safe_add(x,y){var lsw=(x&0xFFFF)+(y&0xFFFF);var msw=(x>>16)+(y>>16)+(lsw>>16);return(msw<<16)|(lsw&0xFFFF)}function bit_rol(num,cnt){return(num<>>(32-cnt))}function str2binl(str){var bin=Array();var mask=(1<>5]|=(str.charCodeAt(i/chrsz)&mask)<<(i%32);return bin}function binl2str(bin){var str="";var mask=(1<>5]>>>(i%32))&mask);return str}function binl2hex(binarray){var hex_tab=hexcase?"0123456789ABCDEF":"0123456789abcdef";var str="";for(var i=0;i>2]>>((i%4)*8+4))&0xF)+hex_tab.charAt((binarray[i>>2]>>((i%4)*8))&0xF)}return str}function binl2b64(binarray){var tab="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";var str="";for(var i=0;i>2]>>8*(i%4))&0xFF)<<16)|(((binarray[i+1>>2]>>8*((i+1)%4))&0xFF)<<8)|((binarray[i+2>>2]>>8*((i+2)%4))&0xFF);for(var j=0;j<4;j++){if(i*8+j*6>binarray.length*32)str+=b64pad;else str+=tab.charAt((triplet>>6*(3-j))&0x3F)}}return str}
/*
Notice.js
*/
(function webpackUniversalModuleDefinition(root,factory){if(typeof exports==='object'&&typeof module==='object')module.exports=factory();else if(typeof define==='function'&&define.amd)define("NoticeJs",[],factory);else if(typeof exports==='object')exports["NoticeJs"]=factory();else root["NoticeJs"]=factory()})(typeof self!=='undefined'?self:this,function(){return(function(modules){var installedModules={};function __webpack_require__(moduleId){if(installedModules[moduleId]){return installedModules[moduleId].exports}var module=installedModules[moduleId]={i:moduleId,l:false,exports:{}};modules[moduleId].call(module.exports,module,module.exports,__webpack_require__);module.l=true;return module.exports}__webpack_require__.m=modules;__webpack_require__.c=installedModules;__webpack_require__.d=function(exports,name,getter){if(!__webpack_require__.o(exports,name)){Object.defineProperty(exports,name,{configurable:false,enumerable:true,get:getter})}};__webpack_require__.n=function(module){var getter=module&&module.__esModule?function getDefault(){return module['default']}:function getModuleExports(){return module};__webpack_require__.d(getter,'a',getter);return getter};__webpack_require__.o=function(object,property){return Object.prototype.hasOwnProperty.call(object,property)};__webpack_require__.p="dist/";return __webpack_require__(__webpack_require__.s=2)})([(function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var noticeJsModalClassName=exports.noticeJsModalClassName='noticejs-modal';var closeAnimation=exports.closeAnimation='noticejs-fadeOut';var Defaults=exports.Defaults={title:'',text:'',type:'success',position:'topRight',timeout:30,progressBar:true,closeWith:['button'],animation:null,modal:false,scroll:{maxHeight:300,showOnHover:true},rtl:false,callbacks:{beforeShow:[],onShow:[],afterShow:[],onClose:[],afterClose:[],onClick:[],onHover:[],onTemplate:[]}}}),(function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.appendNoticeJs=exports.addListener=exports.CloseItem=exports.AddModal=undefined;exports.getCallback=getCallback;var _api=__webpack_require__(0);var API=_interopRequireWildcard(_api);function _interopRequireWildcard(obj){if(obj&&obj.__esModule){return obj}else{var newObj={};if(obj!=null){for(var key in obj){if(Object.prototype.hasOwnProperty.call(obj,key))newObj[key]=obj[key]}}newObj.default=obj;return newObj}}var options=API.Defaults;function getCallback(ref,eventName){if(ref.callbacks.hasOwnProperty(eventName)){ref.callbacks[eventName].forEach(function(cb){if(typeof cb==='function'){cb.apply(ref)}})}}var AddModal=exports.AddModal=function AddModal(){if(document.getElementsByClassName(API.noticeJsModalClassName).length<=0){var element=document.createElement('div');element.classList.add(API.noticeJsModalClassName);element.classList.add('noticejs-modal-open');document.body.appendChild(element);setTimeout(function(){element.className=API.noticeJsModalClassName},200)}};var CloseItem=exports.CloseItem=function CloseItem(item){getCallback(options,'onClose');if(options.animation!==null&&options.animation.close!==null){item.className+=' '+options.animation.close}setTimeout(function(){item.remove()},200);if(options.modal===true&&document.querySelectorAll("[noticejs-modal='true']").length>=1){document.querySelector('.noticejs-modal').className+=' noticejs-modal-close';setTimeout(function(){document.querySelector('.noticejs-modal').remove()},500)}var position='.'+item.closest('.noticejs').className.replace('noticejs','').trim();setTimeout(function(){if(document.querySelectorAll(position+' .item').length<=0){let p=document.querySelector(position);if(p!=null){p.remove()}}},500)};var addListener=exports.addListener=function addListener(item){if(options.closeWith.includes('button')){item.querySelector('.close').addEventListener('click',function(){CloseItem(item)})}if(options.closeWith.includes('click')){item.style.cursor='pointer';item.addEventListener('click',function(e){if(e.target.className!=='close'){getCallback(options,'onClick');CloseItem(item)}})}else{item.addEventListener('click',function(e){if(e.target.className!=='close'){getCallback(options,'onClick')}})}item.addEventListener('mouseover',function(){getCallback(options,'onHover')})};var appendNoticeJs=exports.appendNoticeJs=function appendNoticeJs(noticeJsHeader,noticeJsBody,noticeJsProgressBar){var target_class='.noticejs-'+options.position;var noticeJsItem=document.createElement('div');noticeJsItem.classList.add('item');noticeJsItem.classList.add(options.type);if(options.rtl===true){noticeJsItem.classList.add('noticejs-rtl')}if(noticeJsHeader&¬iceJsHeader!==''){noticeJsItem.appendChild(noticeJsHeader)}noticeJsItem.appendChild(noticeJsBody);if(noticeJsProgressBar&¬iceJsProgressBar!==''){noticeJsItem.appendChild(noticeJsProgressBar)}if(['top','bottom'].includes(options.position)){document.querySelector(target_class).innerHTML=''}if(options.animation!==null&&options.animation.open!==null){noticeJsItem.className+=' '+options.animation.open}if(options.modal===true){noticeJsItem.setAttribute('noticejs-modal','true');AddModal()}addListener(noticeJsItem,options.closeWith);getCallback(options,'beforeShow');getCallback(options,'onShow');document.querySelector(target_class).appendChild(noticeJsItem);getCallback(options,'afterShow');return noticeJsItem}}),(function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var _createClass=function(){function defineProperties(target,props){for(var i=0;i0&&arguments[0]!==undefined?arguments[0]:{};_classCallCheck(this,NoticeJs);this.options=Object.assign(API.Defaults,options);this.component=new _components.Components();this.on('beforeShow',this.options.callbacks.beforeShow);this.on('onShow',this.options.callbacks.onShow);this.on('afterShow',this.options.callbacks.afterShow);this.on('onClose',this.options.callbacks.onClose);this.on('afterClose',this.options.callbacks.afterClose);this.on('onClick',this.options.callbacks.onClick);this.on('onHover',this.options.callbacks.onHover);return this}_createClass(NoticeJs,[{key:'show',value:function show(){var container=this.component.createContainer();if(document.querySelector('.noticejs-'+this.options.position)===null){document.body.appendChild(container)}var noticeJsHeader=void 0;var noticeJsBody=void 0;var noticeJsProgressBar=void 0;noticeJsHeader=this.component.createHeader(this.options.title,this.options.closeWith);noticeJsBody=this.component.createBody(this.options.text);if(this.options.progressBar===true){noticeJsProgressBar=this.component.createProgressBar()}var noticeJs=helper.appendNoticeJs(noticeJsHeader,noticeJsBody,noticeJsProgressBar);return noticeJs}},{key:'on',value:function on(eventName){var cb=arguments.length>1&&arguments[1]!==undefined?arguments[1]:function(){};if(typeof cb==='function'&&this.options.callbacks.hasOwnProperty(eventName)){this.options.callbacks[eventName].push(cb)}return this}}]);return NoticeJs}();exports.default=NoticeJs;module.exports=exports['default']}),(function(module,exports){}),(function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.Components=undefined;var _createClass=function(){function defineProperties(target,props){for(var i=0;i'+'"+''+''+this.textTemplate.content+" "+"
"+'"+" "+"";return temp},getConfirmTemplate:function(){return'