Skip to content

Commit

Permalink
Merge pull request #668 from SashaXser/main
Browse files Browse the repository at this point in the history
Перенос обработчика mousemove и mouseup  на this.container
  • Loading branch information
ilyhalight authored Jun 18, 2024
2 parents 7edc95c + 27c8aad commit b5142c8
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion dist/vot-cloudflare-min.user.js

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions dist/vot-cloudflare.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -4334,7 +4334,7 @@ const sites = () => {
host: "yandexdisk",
url: "https://yadi.sk/i/",
match: /^disk.yandex.ru$/,
selector: "yaplayertag > div:nth-of-type(1)",
selector: ".video-player__player > div:nth-child(1)",
},
{
host: "coursehunter",
Expand Down Expand Up @@ -5486,19 +5486,19 @@ class VideoHandler {
this.dragging = true;
});

document.addEventListener("mouseup", () => {
this.container.addEventListener("mouseup", () => {
this.dragging = false;
});

document.addEventListener("mousemove", async (e) => {
this.container.addEventListener("mousemove", async (e) => {
if (this.dragging) {
e.preventDefault();

const percentX = (e.clientX / this.video.clientWidth) * 100;
const percentX = (e.clientX / this.container.clientWidth) * 100;
// const percentY = (e.clientY / this.video.clientHeight) * 100;

this.data.buttonPos =
this.video.clientWidth && this.video.clientWidth > 550
this.container.clientWidth && this.container.clientWidth > 550
? percentX <= 33
? "left"
: percentX >= 66
Expand All @@ -5509,7 +5509,7 @@ class VideoHandler {
this.data.buttonPos === "default" ? "row" : "column";
this.votButton.container.dataset.position = this.data.buttonPos;
this.votMenu.container.dataset.position = this.data.buttonPos;
if (this.video.clientWidth && this.video.clientWidth > 550) {
if (this.container.clientWidth && this.container.clientWidth > 550) {
await storage/* votStorage */.d.set("buttonPos", this.data.buttonPos);
}
}
Expand Down
2 changes: 1 addition & 1 deletion dist/vot-min.user.js

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions dist/vot.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -4233,7 +4233,7 @@ const sites = () => {
host: "yandexdisk",
url: "https://yadi.sk/i/",
match: /^disk.yandex.ru$/,
selector: "yaplayertag > div:nth-of-type(1)",
selector: ".video-player__player > div:nth-child(1)",
},
{
host: "coursehunter",
Expand Down Expand Up @@ -5376,19 +5376,19 @@ class VideoHandler {
this.dragging = true;
});

document.addEventListener("mouseup", () => {
this.container.addEventListener("mouseup", () => {
this.dragging = false;
});

document.addEventListener("mousemove", async (e) => {
this.container.addEventListener("mousemove", async (e) => {
if (this.dragging) {
e.preventDefault();

const percentX = (e.clientX / this.video.clientWidth) * 100;
const percentX = (e.clientX / this.container.clientWidth) * 100;
// const percentY = (e.clientY / this.video.clientHeight) * 100;

this.data.buttonPos =
this.video.clientWidth && this.video.clientWidth > 550
this.container.clientWidth && this.container.clientWidth > 550
? percentX <= 33
? "left"
: percentX >= 66
Expand All @@ -5399,7 +5399,7 @@ class VideoHandler {
this.data.buttonPos === "default" ? "row" : "column";
this.votButton.container.dataset.position = this.data.buttonPos;
this.votMenu.container.dataset.position = this.data.buttonPos;
if (this.video.clientWidth && this.video.clientWidth > 550) {
if (this.container.clientWidth && this.container.clientWidth > 550) {
await votStorage.set("buttonPos", this.data.buttonPos);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/config/sites.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ const sites = () => {
host: "yandexdisk",
url: "https://yadi.sk/i/",
match: /^disk.yandex.ru$/,
selector: "yaplayertag > div:nth-of-type(1)",
selector: ".video-player__player > div:nth-child(1)",
},
{
host: "coursehunter",
Expand Down
10 changes: 5 additions & 5 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -904,19 +904,19 @@ class VideoHandler {
this.dragging = true;
});

document.addEventListener("mouseup", () => {
this.container.addEventListener("mouseup", () => {
this.dragging = false;
});

document.addEventListener("mousemove", async (e) => {
this.container.addEventListener("mousemove", async (e) => {
if (this.dragging) {
e.preventDefault();

const percentX = (e.clientX / this.video.clientWidth) * 100;
const percentX = (e.clientX / this.container.clientWidth) * 100;
// const percentY = (e.clientY / this.video.clientHeight) * 100;

this.data.buttonPos =
this.video.clientWidth && this.video.clientWidth > 550
this.container.clientWidth && this.container.clientWidth > 550
? percentX <= 33
? "left"
: percentX >= 66
Expand All @@ -927,7 +927,7 @@ class VideoHandler {
this.data.buttonPos === "default" ? "row" : "column";
this.votButton.container.dataset.position = this.data.buttonPos;
this.votMenu.container.dataset.position = this.data.buttonPos;
if (this.video.clientWidth && this.video.clientWidth > 550) {
if (this.container.clientWidth && this.container.clientWidth > 550) {
await votStorage.set("buttonPos", this.data.buttonPos);
}
}
Expand Down

0 comments on commit b5142c8

Please sign in to comment.