Disable media context menus in IV.

This commit is contained in:
John Preston 2024-03-14 12:49:51 +04:00
parent fe4b853393
commit d92418dc6d
2 changed files with 4 additions and 0 deletions

View file

@ -330,6 +330,7 @@ var IV = {
+ '" type="video/mp4" />' + '" type="video/mp4" />'
+ '</video>'; + '</video>';
var media = element.firstChild; var media = element.firstChild;
media.oncontextmenu = function () { return false; };
media.oncanplay = IV.checkVideos; media.oncanplay = IV.checkVideos;
media.onloadeddata = IV.checkVideos; media.onloadeddata = IV.checkVideos;
} }

View file

@ -516,6 +516,7 @@ QByteArray Parser::block(
const auto id = Number(photo.id); const auto id = Number(photo.id);
result = tag("a", { result = tag("a", {
{ "href", href }, { "href", href },
{ "oncontextmenu", data.vurl() ? QByteArray() : "return false;" },
{ "data-context", data.vurl() ? QByteArray() : "viewer-photo" + id }, { "data-context", data.vurl() ? QByteArray() : "viewer-photo" + id },
}, result) + caption(data.vcaption()); }, result) + caption(data.vcaption());
return result; return result;
@ -576,6 +577,7 @@ QByteArray Parser::block(
const auto href = resource("video" + id); const auto href = resource("video" + id);
result = tag("a", { result = tag("a", {
{ "href", href }, { "href", href },
{ "oncontextmenu", "return false;" },
{ "data-context", "viewer-video" + id }, { "data-context", "viewer-video" + id },
}, result); }, result);
} }
@ -745,6 +747,7 @@ QByteArray Parser::block(const MTPDpageBlockAudio &data) {
const auto src = documentFullUrl(audio); const auto src = documentFullUrl(audio);
return tag("figure", tag("audio", { return tag("figure", tag("audio", {
{ "src", src }, { "src", src },
{ "oncontextmenu", "return false;" },
{ "controls", std::nullopt }, { "controls", std::nullopt },
}) + caption(data.vcaption())); }) + caption(data.vcaption()));
} }