mirror of
https://github.com/the1812/Bilibili-Evolved.git
synced 2025-11-04 21:22:45 +08:00
39 lines
1.1 KiB
JavaScript
39 lines
1.1 KiB
JavaScript
(() =>
|
|
{
|
|
return (settings, resources) =>
|
|
{
|
|
(async () =>
|
|
{
|
|
const likeButton = await SpinQuery.select(() => document.querySelector(".ops span.like"));
|
|
if (!likeButton)
|
|
{
|
|
return;
|
|
}
|
|
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);
|
|
}
|
|
});
|
|
})();
|
|
};
|
|
})(); |