mirror of
https://github.com/the1812/Bilibili-Evolved.git
synced 2025-11-04 21:22:45 +08:00
Add touch combo like
This commit is contained in:
parent
6add1df842
commit
ff9c80d92f
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name Bilibili Evolved (Preview)
|
// @name Bilibili Evolved (Preview)
|
||||||
// @version 1.6.26
|
// @version 1.6.27
|
||||||
// @description 增强哔哩哔哩Web端体验(预览版分支): 修复界面瑕疵, 删除广告, 使用夜间模式浏览; 下载视频,封面,弹幕, 以及增加对触屏设备的支持等.
|
// @description 增强哔哩哔哩Web端体验(预览版分支): 修复界面瑕疵, 删除广告, 使用夜间模式浏览; 下载视频,封面,弹幕, 以及增加对触屏设备的支持等.
|
||||||
// @author Grant Howard, Coulomb-G
|
// @author Grant Howard, Coulomb-G
|
||||||
// @copyright 2018, Grant Howrad (https://github.com/the1812)
|
// @copyright 2018, Grant Howrad (https://github.com/the1812)
|
||||||
@ -69,6 +69,7 @@
|
|||||||
},
|
},
|
||||||
defaultPlayerLayout: "新版",
|
defaultPlayerLayout: "新版",
|
||||||
skipChargeList: false,
|
skipChargeList: false,
|
||||||
|
comboLike: false,
|
||||||
autoLightOff: false,
|
autoLightOff: false,
|
||||||
useCache: true,
|
useCache: true,
|
||||||
autoContinue: false,
|
autoContinue: false,
|
||||||
@ -77,18 +78,14 @@
|
|||||||
};
|
};
|
||||||
const fixedSettings = {
|
const fixedSettings = {
|
||||||
guiSettings: true,
|
guiSettings: true,
|
||||||
comboLike: false,
|
|
||||||
doubleCoins: false,
|
|
||||||
viewCover: true,
|
viewCover: true,
|
||||||
notifyNewVersion: true,
|
notifyNewVersion: true,
|
||||||
clearCache: true,
|
clearCache: true,
|
||||||
fixFullscreen: false,
|
|
||||||
downloadVideo: true,
|
downloadVideo: true,
|
||||||
downloadDanmaku: true,
|
downloadDanmaku: true,
|
||||||
useDefaultPlayerMode: true,
|
useDefaultPlayerMode: true,
|
||||||
useDefaultPlayerLayout: true,
|
useDefaultPlayerLayout: true,
|
||||||
about: false,
|
about: false,
|
||||||
blurSettingsPanel: false,
|
|
||||||
latestVersionLink: "https://github.com/the1812/Bilibili-Evolved/raw/preview/bilibili-evolved.preview.user.js",
|
latestVersionLink: "https://github.com/the1812/Bilibili-Evolved/raw/preview/bilibili-evolved.preview.user.js",
|
||||||
currentVersion: GM_info.script.version,
|
currentVersion: GM_info.script.version,
|
||||||
};
|
};
|
||||||
@ -540,17 +537,10 @@
|
|||||||
items: ["1080P60", "1080P+", "1080P", "720P60", "720P", "480P", "360P", "自动"],
|
items: ["1080P60", "1080P+", "1080P", "720P60", "720P", "480P", "360P", "自动"],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
comboLikeStyle: {
|
|
||||||
path: "min/combo-like.min.css",
|
|
||||||
},
|
|
||||||
comboLike: {
|
comboLike: {
|
||||||
path: "min/combo-like.min.js",
|
path: "min/combo-like.min.js",
|
||||||
styles: [
|
|
||||||
"comboLikeStyle",
|
|
||||||
],
|
|
||||||
displayNames: {
|
displayNames: {
|
||||||
comboLike: "启用素质三连",
|
comboLike: "素质三连触摸支持",
|
||||||
doubleCoins: "为原创视频投2个币"
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
autoContinue: {
|
autoContinue: {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name Bilibili Evolved
|
// @name Bilibili Evolved
|
||||||
// @version 1.6.26
|
// @version 1.6.27
|
||||||
// @description 增强哔哩哔哩Web端体验: 修复界面瑕疵, 删除广告, 使用夜间模式浏览; 下载视频,封面,弹幕, 以及增加对触屏设备的支持等.
|
// @description 增强哔哩哔哩Web端体验: 修复界面瑕疵, 删除广告, 使用夜间模式浏览; 下载视频,封面,弹幕, 以及增加对触屏设备的支持等.
|
||||||
// @author Grant Howard, Coulomb-G
|
// @author Grant Howard, Coulomb-G
|
||||||
// @copyright 2018, Grant Howrad (https://github.com/the1812)
|
// @copyright 2018, Grant Howrad (https://github.com/the1812)
|
||||||
@ -69,6 +69,7 @@
|
|||||||
},
|
},
|
||||||
defaultPlayerLayout: "新版",
|
defaultPlayerLayout: "新版",
|
||||||
skipChargeList: false,
|
skipChargeList: false,
|
||||||
|
comboLike: false,
|
||||||
autoLightOff: false,
|
autoLightOff: false,
|
||||||
useCache: true,
|
useCache: true,
|
||||||
autoContinue: false,
|
autoContinue: false,
|
||||||
@ -77,18 +78,14 @@
|
|||||||
};
|
};
|
||||||
const fixedSettings = {
|
const fixedSettings = {
|
||||||
guiSettings: true,
|
guiSettings: true,
|
||||||
comboLike: false,
|
|
||||||
doubleCoins: false,
|
|
||||||
viewCover: true,
|
viewCover: true,
|
||||||
notifyNewVersion: true,
|
notifyNewVersion: true,
|
||||||
clearCache: true,
|
clearCache: true,
|
||||||
fixFullscreen: false,
|
|
||||||
downloadVideo: true,
|
downloadVideo: true,
|
||||||
downloadDanmaku: true,
|
downloadDanmaku: true,
|
||||||
useDefaultPlayerMode: true,
|
useDefaultPlayerMode: true,
|
||||||
useDefaultPlayerLayout: true,
|
useDefaultPlayerLayout: true,
|
||||||
about: false,
|
about: false,
|
||||||
blurSettingsPanel: false,
|
|
||||||
latestVersionLink: "https://github.com/the1812/Bilibili-Evolved/raw/master/bilibili-evolved.user.js",
|
latestVersionLink: "https://github.com/the1812/Bilibili-Evolved/raw/master/bilibili-evolved.user.js",
|
||||||
currentVersion: GM_info.script.version,
|
currentVersion: GM_info.script.version,
|
||||||
};
|
};
|
||||||
@ -540,17 +537,10 @@
|
|||||||
items: ["1080P60", "1080P+", "1080P", "720P60", "720P", "480P", "360P", "自动"],
|
items: ["1080P60", "1080P+", "1080P", "720P60", "720P", "480P", "360P", "自动"],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
comboLikeStyle: {
|
|
||||||
path: "min/combo-like.min.css",
|
|
||||||
},
|
|
||||||
comboLike: {
|
comboLike: {
|
||||||
path: "min/combo-like.min.js",
|
path: "min/combo-like.min.js",
|
||||||
styles: [
|
|
||||||
"comboLikeStyle",
|
|
||||||
],
|
|
||||||
displayNames: {
|
displayNames: {
|
||||||
comboLike: "启用素质三连",
|
comboLike: "素质三连触摸支持",
|
||||||
doubleCoins: "为原创视频投2个币"
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
autoContinue: {
|
autoContinue: {
|
||||||
|
|||||||
2
min/combo-like.min.js
vendored
2
min/combo-like.min.js
vendored
@ -1 +1 @@
|
|||||||
(()=>{return(n,e)=>{let t=false;const i=Symbol("executed");const o=Symbol("skipped");const c=Symbol("failed");async function s(){const[n]=await SpinQuery.any(()=>document.querySelectorAll("div.ops>span.like"));if(!n.classList.contains("on")){t=true;n.click();await SpinQuery.condition(()=>n,()=>n.classList.contains("on"));return i}return o}async function l(){const[e]=await SpinQuery.any(()=>document.querySelectorAll("div.ops>span.coin"));if(!e.classList.contains("on")){e.click();const t=await SpinQuery.any(()=>$(".mc-box"));const o=await SpinQuery.any(()=>$(".coin-operated-m"));const s=o.children().filter((n,e)=>e.innerText.indexOf("2硬币")).length!==0;const l=(()=>{if(n.doubleCoins&&s){return 2}else{return 1}})();const a=t.filter((n,e)=>e.innerText.indexOf(l)!==-1)[0];a.click();const r=$(".bi-btn").filter((n,e)=>e.innerText==="确定")[0];r.click();await SpinQuery.condition(()=>$(".bili-dialog-m"),n=>n.length===0&&e.classList.contains("on")||$(".bili-msg").text().indexOf("硬币不足")!==-1);const u=document.querySelector(".bili-dialog-m i.icon.close");if(u){u.click();await SpinQuery.condition(()=>$(".bili-dialog-m"),n=>n.length===0);return[c,0]}return[i,l]}return[o,0]}async function a(){const[n]=await SpinQuery.any(()=>document.querySelectorAll("div.ops>span.collect"));if(!n.classList.contains("on")){n.click();const e=await SpinQuery.any(()=>$(".group-list label:has(input)"));const t=e.filter((n,e)=>e.innerText.indexOf("默认收藏夹")!==-1).find("input")[0];if(!t.checked){t.checked=true;raiseEvent(t,"change");const n=$(".btn.submit-move")[0];n.disabled=false;n.click()}else{const n=$("i.close")[0];n.click()}await SpinQuery.condition(()=>$(".bili-dialog-m"),e=>e.length===0&&n.classList.contains("on"));return i}return o}async function r(){e.applyImportantStyleFromText(`<style id="combo-like-temp-style">\n .bili-dialog-m\n {\n display: none !important;\n }\n </style>`);const n=document.querySelector(".video-toolbar .ops");n.classList.add("combo-liking");try{const e=await s();const[t]=await l();const r=await a();const u=(()=>{if([e,t,r].every(n=>n===i||n===o)){return null}if(t===c){return"已跳过投币阶段: 硬币不足."}})();if(u!==null){Toast.info(u,"素质三连",1e4);console.log(u)}}finally{n.classList.remove("combo-liking");$("#combo-like-temp-style").remove()}}(async()=>{const[n]=await SpinQuery.any(()=>document.querySelectorAll("div.ops>span.like"));n.style.userSelect="none";const e=1e3;n.addEventListener("pointerdown",n=>{t=true;if(n.type==="touch"){n.preventDefault()}setTimeout(()=>{if(t===true){t=false;r()}},e)});n.addEventListener("click",n=>{if(t===false){n.preventDefault();n.stopImmediatePropagation()}else{t=false}});n.addEventListener("touchend",n=>{if(t===false&&n.cancelable){n.preventDefault()}})})();return{widget:{content:`\n <button\n class="gui-settings-flat-button"\n id="combo-like">\n <i class="icon-like"></i>\n <span>素质三连</span>\n </button>`,condition:async()=>{const n=await SpinQuery.any(()=>document.querySelectorAll("div.ops>span.like"));return n!==undefined},success:()=>{$("#combo-like").on("click",()=>{r();$(".gui-settings-mask").click()})}}}}})();
|
(()=>{return(e,t)=>{(async()=>{const e=await SpinQuery.select(()=>document.querySelector(".ops span.like"));e.style.userSelect="none";function t(t,n){const s=new CustomEvent(t,n);e.dispatchEvent(s)}const n=200;let s=true;e.addEventListener("touchstart",e=>{e.preventDefault();s=true;setTimeout(()=>s=false,n);t("mousedown",e)});e.addEventListener("touchend",e=>{e.preventDefault();t("mouseup",e);if(s===true){t("click",e)}})})()}})();
|
||||||
@ -1 +1 @@
|
|||||||
<div class="gui-settings-mask"></div><div class="gui-settings-widgets-box icons-enabled"><div class="gui-settings-header"><i class="icon-widgets"></i><span class="gui-settings-title">附加功能</span></div><div class="widgets-container"></div></div><div class="gui-settings-box icons-enabled"><div class="gui-settings-header"><i class="icon-settings"></i><span class="gui-settings-title">设置</span><div style="flex: 1 0 auto"></div><i class="icon-search" style="transform: scale(0.9); margin-right: 0"></i><input class="gui-settings-search" placeholder="搜索设置项" type="text"></div><div class="gui-settings-content"><ul><category icon="video">视频</category><dropdown indent="0" key="defaultPlayerMode" dependencies=""></dropdown><dropdown indent="0" key="defaultPlayerLayout" dependencies=""></dropdown><checkbox indent="0" key="useDefaultVideoQuality" dependencies=""></checkbox><dropdown indent="1" key="defaultVideoQuality" dependencies="useDefaultVideoQuality"></dropdown><checkbox indent="0" key="useDefaultDanmakuSettings" dependencies=""></checkbox><checkbox indent="1" key="enableDanmaku" dependencies="useDefaultDanmakuSettings"></checkbox><checkbox indent="1" key="rememberDanmakuBlock" dependencies="useDefaultDanmakuSettings enableDanmaku"></checkbox><checkbox indent="0" key="autoLightOff" dependencies=""></checkbox><checkbox indent="0" key="expandDanmakuList" dependencies=""></checkbox><checkbox indent="0" key="expandDescription" dependencies=""></checkbox><checkbox indent="0" key="autoContinue" dependencies=""></checkbox><checkbox indent="0" key="skipChargeList" dependencies=""></checkbox><category icon="style">样式</category><li class="indent-0"><label class="gui-settings-textbox-container"><span>主题颜色</span><div class="custom-color-preview"><div class="predefined-colors popup"><div class="predefined-colors-grid"></div></div></div><input key="customStyleColor" dependencies="" spellcheck="false" type="text"/></label></li><checkbox indent="0" key="useNewStyle" dependencies=""></checkbox><textbox indent="1" key="blurBackgroundOpacity" dependencies="useNewStyle"></textbox><checkbox indent="0" key="useDarkStyle" dependencies=""></checkbox><checkbox indent="0" key="darkSchedule" dependencies=""></checkbox><textbox indent="1" key="darkScheduleStart" dependencies="darkSchedule"></textbox><textbox indent="1" key="darkScheduleEnd" dependencies="darkSchedule"></textbox><checkbox indent="0" key="overrideNavBar" dependencies=""></checkbox><checkbox indent="1" key="showBanner" dependencies="overrideNavBar"></checkbox><checkbox indent="1" key="preserveRank" dependencies="overrideNavBar"></checkbox><checkbox indent="0" key="blurVideoControl" dependencies=""></checkbox><checkbox indent="0" key="customControlBackground" dependencies=""></checkbox><textbox indent="1" key="customControlBackgroundOpacity" dependencies="customControlBackground"></textbox><checkbox indent="0" key="harunaScale" dependencies=""></checkbox><checkbox indent="0" key="removeLiveWatermark" dependencies=""></checkbox><checkbox indent="0" key="removeVideoTopMask" dependencies=""></checkbox><checkbox indent="0" key="forceWide" dependencies=""></checkbox><category icon="tool">工具</category><checkbox indent="0" key="removeAds" dependencies=""></checkbox><checkbox indent="0" key="watchLaterRedirect" dependencies=""></checkbox><checkbox indent="0" key="hideTopSearch" dependencies=""></checkbox><checkbox indent="0" key="fullTweetsTitle" dependencies=""></checkbox><category icon="touch">触摸</category><checkbox indent="0" key="touchNavBar" dependencies=""></checkbox><checkbox indent="0" key="touchVideoPlayer" dependencies=""></checkbox><checkbox indent="1" key="touchVideoPlayerAnimation" dependencies="touchVideoPlayer"></checkbox><checkbox indent="1" key="touchVideoPlayerDoubleTapControl" dependencies="touchVideoPlayer"></checkbox><category icon="other">其他</category><checkbox indent="0" key="toast" dependencies=""></checkbox><checkbox indent="1" key="toastInternalError" dependencies="toast"></checkbox><checkbox indent="0" key="useCache" dependencies=""></checkbox></ul></div><div class="gui-settings-tooltip"></div></div>
|
<div class="gui-settings-mask"></div><div class="gui-settings-widgets-box icons-enabled"><div class="gui-settings-header"><i class="icon-widgets"></i><span class="gui-settings-title">附加功能</span></div><div class="widgets-container"></div></div><div class="gui-settings-box icons-enabled"><div class="gui-settings-header"><i class="icon-settings"></i><span class="gui-settings-title">设置</span><div style="flex: 1 0 auto"></div><i class="icon-search" style="transform: scale(0.9); margin-right: 0"></i><input class="gui-settings-search" placeholder="搜索设置项" type="text"></div><div class="gui-settings-content"><ul><category icon="video">视频</category><dropdown indent="0" key="defaultPlayerMode" dependencies=""></dropdown><dropdown indent="0" key="defaultPlayerLayout" dependencies=""></dropdown><checkbox indent="0" key="useDefaultVideoQuality" dependencies=""></checkbox><dropdown indent="1" key="defaultVideoQuality" dependencies="useDefaultVideoQuality"></dropdown><checkbox indent="0" key="useDefaultDanmakuSettings" dependencies=""></checkbox><checkbox indent="1" key="enableDanmaku" dependencies="useDefaultDanmakuSettings"></checkbox><checkbox indent="1" key="rememberDanmakuBlock" dependencies="useDefaultDanmakuSettings enableDanmaku"></checkbox><checkbox indent="0" key="autoLightOff" dependencies=""></checkbox><checkbox indent="0" key="expandDanmakuList" dependencies=""></checkbox><checkbox indent="0" key="expandDescription" dependencies=""></checkbox><checkbox indent="0" key="autoContinue" dependencies=""></checkbox><checkbox indent="0" key="skipChargeList" dependencies=""></checkbox><category icon="style">样式</category><li class="indent-0"><label class="gui-settings-textbox-container"><span>主题颜色</span><div class="custom-color-preview"><div class="predefined-colors popup"><div class="predefined-colors-grid"></div></div></div><input key="customStyleColor" dependencies="" spellcheck="false" type="text"/></label></li><checkbox indent="0" key="useNewStyle" dependencies=""></checkbox><textbox indent="1" key="blurBackgroundOpacity" dependencies="useNewStyle"></textbox><checkbox indent="0" key="useDarkStyle" dependencies=""></checkbox><checkbox indent="0" key="darkSchedule" dependencies=""></checkbox><textbox indent="1" key="darkScheduleStart" dependencies="darkSchedule"></textbox><textbox indent="1" key="darkScheduleEnd" dependencies="darkSchedule"></textbox><checkbox indent="0" key="overrideNavBar" dependencies=""></checkbox><checkbox indent="1" key="showBanner" dependencies="overrideNavBar"></checkbox><checkbox indent="1" key="preserveRank" dependencies="overrideNavBar"></checkbox><checkbox indent="0" key="blurVideoControl" dependencies=""></checkbox><checkbox indent="0" key="customControlBackground" dependencies=""></checkbox><textbox indent="1" key="customControlBackgroundOpacity" dependencies="customControlBackground"></textbox><checkbox indent="0" key="harunaScale" dependencies=""></checkbox><checkbox indent="0" key="removeLiveWatermark" dependencies=""></checkbox><checkbox indent="0" key="removeVideoTopMask" dependencies=""></checkbox><checkbox indent="0" key="forceWide" dependencies=""></checkbox><category icon="tool">工具</category><checkbox indent="0" key="removeAds" dependencies=""></checkbox><checkbox indent="0" key="watchLaterRedirect" dependencies=""></checkbox><checkbox indent="0" key="hideTopSearch" dependencies=""></checkbox><checkbox indent="0" key="fullTweetsTitle" dependencies=""></checkbox><category icon="touch">触摸</category><checkbox indent="0" key="touchNavBar" dependencies=""></checkbox><checkbox indent="0" key="comboLike" dependencies=""></checkbox><checkbox indent="0" key="touchVideoPlayer" dependencies=""></checkbox><checkbox indent="1" key="touchVideoPlayerAnimation" dependencies="touchVideoPlayer"></checkbox><checkbox indent="1" key="touchVideoPlayerDoubleTapControl" dependencies="touchVideoPlayer"></checkbox><category icon="other">其他</category><checkbox indent="0" key="toast" dependencies=""></checkbox><checkbox indent="1" key="toastInternalError" dependencies="toast"></checkbox><checkbox indent="0" key="useCache" dependencies=""></checkbox></ul></div><div class="gui-settings-tooltip"></div></div>
|
||||||
35
touch/combo-like.js
Normal file
35
touch/combo-like.js
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
(() =>
|
||||||
|
{
|
||||||
|
return (settings, resources) =>
|
||||||
|
{
|
||||||
|
(async () =>
|
||||||
|
{
|
||||||
|
const likeButton = await SpinQuery.select(() => document.querySelector(".ops span.like"));
|
||||||
|
likeButton.style.userSelect = "none";
|
||||||
|
function mountEvent(name, args)
|
||||||
|
{
|
||||||
|
const event = new CustomEvent(name, args);
|
||||||
|
likeButton.dispatchEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
const clickInterval = 200;
|
||||||
|
let click = true;
|
||||||
|
likeButton.addEventListener("touchstart", e =>
|
||||||
|
{
|
||||||
|
e.preventDefault();
|
||||||
|
click = true;
|
||||||
|
setTimeout(() => click = false, clickInterval);
|
||||||
|
mountEvent("mousedown", e);
|
||||||
|
});
|
||||||
|
likeButton.addEventListener("touchend", e =>
|
||||||
|
{
|
||||||
|
e.preventDefault();
|
||||||
|
mountEvent("mouseup", e);
|
||||||
|
if (click === true)
|
||||||
|
{
|
||||||
|
mountEvent("click", e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})();
|
||||||
|
};
|
||||||
|
})();
|
||||||
@ -1,24 +0,0 @@
|
|||||||
.video-toolbar .ops
|
|
||||||
{
|
|
||||||
position: relative !important;
|
|
||||||
}
|
|
||||||
.video-toolbar .ops::after
|
|
||||||
{
|
|
||||||
content: "素质三连中";
|
|
||||||
position: absolute;
|
|
||||||
top: -8px;
|
|
||||||
left: -16px;
|
|
||||||
width: 200px;
|
|
||||||
background: #000a;
|
|
||||||
height: calc(100% + 12px);
|
|
||||||
padding-left: 120px;
|
|
||||||
padding-top: 8px;
|
|
||||||
transition: all .2s ease-out;
|
|
||||||
opacity: 0;
|
|
||||||
pointer-events: none;
|
|
||||||
}
|
|
||||||
.video-toolbar .ops.combo-liking::after
|
|
||||||
{
|
|
||||||
opacity: 1;
|
|
||||||
pointer-events: initial;
|
|
||||||
}
|
|
||||||
@ -1,198 +0,0 @@
|
|||||||
(() =>
|
|
||||||
{
|
|
||||||
return (settings, resources) =>
|
|
||||||
{
|
|
||||||
let trigger = false;
|
|
||||||
const executed = Symbol("executed");
|
|
||||||
const skipped = Symbol("skipped");
|
|
||||||
const failed = Symbol("failed");
|
|
||||||
async function like()
|
|
||||||
{
|
|
||||||
const [likeButton] = await SpinQuery.any(() => document.querySelectorAll("div.ops>span.like"));
|
|
||||||
if (!likeButton.classList.contains("on"))
|
|
||||||
{
|
|
||||||
trigger = true;
|
|
||||||
likeButton.click();
|
|
||||||
await SpinQuery.condition(() => likeButton, () => likeButton.classList.contains("on"));
|
|
||||||
return executed;
|
|
||||||
}
|
|
||||||
return skipped;
|
|
||||||
}
|
|
||||||
async function coin()
|
|
||||||
{
|
|
||||||
const [coinButton] = await SpinQuery.any(() => document.querySelectorAll("div.ops>span.coin"));
|
|
||||||
if (!coinButton.classList.contains("on"))
|
|
||||||
{
|
|
||||||
coinButton.click();
|
|
||||||
const dialog = await SpinQuery.any(() => $(".mc-box"));
|
|
||||||
const coinsSpan = await SpinQuery.any(() => $(".coin-operated-m"));
|
|
||||||
const supportDoubleCoins = coinsSpan.children().filter((_, it) => it.innerText.indexOf("2硬币")).length !== 0;
|
|
||||||
const coins = (() =>
|
|
||||||
{
|
|
||||||
if (settings.doubleCoins && supportDoubleCoins)
|
|
||||||
{
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
const coinSpan = dialog.filter((_, it) => it.innerText.indexOf(coins) !== -1)[0];
|
|
||||||
coinSpan.click();
|
|
||||||
const okButton = $(".bi-btn").filter((_, it) => it.innerText === "确定")[0];
|
|
||||||
okButton.click();
|
|
||||||
await SpinQuery.condition(
|
|
||||||
() => $(".bili-dialog-m"),
|
|
||||||
it => it.length === 0 && coinButton.classList.contains("on")
|
|
||||||
|| $(".bili-msg").text().indexOf("硬币不足") !== -1,
|
|
||||||
);
|
|
||||||
const closeButton = document.querySelector(".bili-dialog-m i.icon.close");
|
|
||||||
if (closeButton)
|
|
||||||
{
|
|
||||||
closeButton.click();
|
|
||||||
await SpinQuery.condition(
|
|
||||||
() => $(".bili-dialog-m"),
|
|
||||||
it => it.length === 0,
|
|
||||||
);
|
|
||||||
return [failed, 0];
|
|
||||||
}
|
|
||||||
return [executed, coins];
|
|
||||||
}
|
|
||||||
return [skipped, 0];
|
|
||||||
}
|
|
||||||
async function favorite()
|
|
||||||
{
|
|
||||||
const [favoriteButton] = await SpinQuery.any(() => document.querySelectorAll("div.ops>span.collect"));
|
|
||||||
if (!favoriteButton.classList.contains("on"))
|
|
||||||
{
|
|
||||||
favoriteButton.click();
|
|
||||||
const dialog = await SpinQuery.any(() => $(".group-list label:has(input)"));
|
|
||||||
const defaultInput = dialog.filter((_, it) => it.innerText.indexOf("默认收藏夹") !== -1).find("input")[0];
|
|
||||||
if (!defaultInput.checked)
|
|
||||||
{
|
|
||||||
defaultInput.checked = true;
|
|
||||||
raiseEvent(defaultInput, "change");
|
|
||||||
const okButton = $(".btn.submit-move")[0];
|
|
||||||
okButton.disabled = false;
|
|
||||||
okButton.click();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
const okButton = $("i.close")[0];
|
|
||||||
okButton.click();
|
|
||||||
}
|
|
||||||
await SpinQuery.condition(
|
|
||||||
() => $(".bili-dialog-m"),
|
|
||||||
it => it.length === 0 && favoriteButton.classList.contains("on"),
|
|
||||||
);
|
|
||||||
return executed;
|
|
||||||
}
|
|
||||||
return skipped;
|
|
||||||
}
|
|
||||||
async function comboLike()
|
|
||||||
{
|
|
||||||
resources.applyImportantStyleFromText(`<style id="combo-like-temp-style">
|
|
||||||
.bili-dialog-m
|
|
||||||
{
|
|
||||||
display: none !important;
|
|
||||||
}
|
|
||||||
</style>`);
|
|
||||||
const operationArea = document.querySelector(".video-toolbar .ops");
|
|
||||||
operationArea.classList.add("combo-liking");
|
|
||||||
try
|
|
||||||
{
|
|
||||||
const likeResult = await like();
|
|
||||||
const [coinResult] = await coin();
|
|
||||||
const favoriteResult = await favorite();
|
|
||||||
const message = (() =>
|
|
||||||
{
|
|
||||||
if ([likeResult, coinResult, favoriteResult].every(it => it === executed || it === skipped))
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (coinResult === failed)
|
|
||||||
{
|
|
||||||
return "已跳过投币阶段: 硬币不足.";
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
if (message !== null)
|
|
||||||
{
|
|
||||||
Toast.info(message, "素质三连", 10000);
|
|
||||||
console.log(message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
operationArea.classList.remove("combo-liking");
|
|
||||||
$("#combo-like-temp-style").remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
(async () =>
|
|
||||||
{
|
|
||||||
const [likeButton] = await SpinQuery.any(() => document.querySelectorAll("div.ops>span.like"));
|
|
||||||
likeButton.style.userSelect = "none";
|
|
||||||
const triggerTime = 1000;
|
|
||||||
likeButton.addEventListener("pointerdown", e =>
|
|
||||||
{
|
|
||||||
trigger = true;
|
|
||||||
if (e.type === "touch")
|
|
||||||
{
|
|
||||||
e.preventDefault();
|
|
||||||
}
|
|
||||||
setTimeout(() =>
|
|
||||||
{
|
|
||||||
if (trigger === true)
|
|
||||||
{
|
|
||||||
trigger = false;
|
|
||||||
comboLike();
|
|
||||||
}
|
|
||||||
}, triggerTime);
|
|
||||||
});
|
|
||||||
likeButton.addEventListener("click", e =>
|
|
||||||
{
|
|
||||||
if (trigger === false)
|
|
||||||
{
|
|
||||||
e.preventDefault();
|
|
||||||
e.stopImmediatePropagation();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
trigger = false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
likeButton.addEventListener("touchend", e =>
|
|
||||||
{
|
|
||||||
if (trigger === false && e.cancelable)
|
|
||||||
{
|
|
||||||
e.preventDefault();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
})();
|
|
||||||
return {
|
|
||||||
widget:
|
|
||||||
{
|
|
||||||
content: `
|
|
||||||
<button
|
|
||||||
class="gui-settings-flat-button"
|
|
||||||
id="combo-like">
|
|
||||||
<i class="icon-like"></i>
|
|
||||||
<span>素质三连</span>
|
|
||||||
</button>`,
|
|
||||||
condition: async () =>
|
|
||||||
{
|
|
||||||
const likeButton = await SpinQuery.any(() => document.querySelectorAll("div.ops>span.like"));
|
|
||||||
return likeButton !== undefined;
|
|
||||||
},
|
|
||||||
success: () =>
|
|
||||||
{
|
|
||||||
$("#combo-like").on("click", () =>
|
|
||||||
{
|
|
||||||
comboLike();
|
|
||||||
$(".gui-settings-mask").click();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
};
|
|
||||||
})();
|
|
||||||
@ -62,10 +62,9 @@
|
|||||||
<checkbox indent="0" key="watchLaterRedirect" dependencies=""></checkbox>
|
<checkbox indent="0" key="watchLaterRedirect" dependencies=""></checkbox>
|
||||||
<checkbox indent="0" key="hideTopSearch" dependencies=""></checkbox>
|
<checkbox indent="0" key="hideTopSearch" dependencies=""></checkbox>
|
||||||
<checkbox indent="0" key="fullTweetsTitle" dependencies=""></checkbox>
|
<checkbox indent="0" key="fullTweetsTitle" dependencies=""></checkbox>
|
||||||
<!-- <checkbox indent="0" key="comboLike" dependencies=""></checkbox>
|
|
||||||
<checkbox indent="1" key="doubleCoins" dependencies="comboLike"></checkbox> -->
|
|
||||||
<category icon="touch">触摸</category>
|
<category icon="touch">触摸</category>
|
||||||
<checkbox indent="0" key="touchNavBar" dependencies=""></checkbox>
|
<checkbox indent="0" key="touchNavBar" dependencies=""></checkbox>
|
||||||
|
<checkbox indent="0" key="comboLike" dependencies=""></checkbox>
|
||||||
<checkbox indent="0" key="touchVideoPlayer" dependencies=""></checkbox>
|
<checkbox indent="0" key="touchVideoPlayer" dependencies=""></checkbox>
|
||||||
<checkbox indent="1" key="touchVideoPlayerAnimation" dependencies="touchVideoPlayer"></checkbox>
|
<checkbox indent="1" key="touchVideoPlayerAnimation" dependencies="touchVideoPlayer"></checkbox>
|
||||||
<checkbox indent="1" key="touchVideoPlayerDoubleTapControl" dependencies="touchVideoPlayer"></checkbox>
|
<checkbox indent="1" key="touchVideoPlayerDoubleTapControl" dependencies="touchVideoPlayer"></checkbox>
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
1.6.26
|
1.6.27
|
||||||
Loading…
Reference in New Issue
Block a user