Hi, @davidkingham
If I understand well the script you have written, the second one prevents opening the context menu, when you right click on an image that was open in the lightbox.
The first one should do the same when you right click over any image, the thumbnail in the post, for example.
But it does not work, I can still open the secondary menu and open the full image in another window.
I have tried to put this en the CSS:
img {
pointer-events: none;
}
It prevents opening the context menu, but it prevents being able to click in the image to open the lightbox too.
What is wrong?
It woud be great to hide the download links under the lightbox.
I had previously this entry in the CSS:
.image-source-link
{
display: none;
}
But now it does not seem to work either, as the download and original image links are shown anyway under the lightbox image.
UPDATE:
I have modified the second script to include .lightbox-wrapper too, and now it seem to work and the context menu is not shown when you right click over an image in a post, and it correctly opens the lightbox when you click in the image.
<script type="text/discourse-plugin" version="0.8">
api.onPageChange((url, title) => {
$("body").on("contextmenu", ".cooked img, .mfp-img, .lightbox-wrapper", function(e) {
e.preventDefault();
});
});
</script>
Should I delete the first script that tries to make the same over a generic img object?
If I substitute the CSS of .img-source-link by .mfp-title it works, and now the download links are not visible, but the title is hidden too. I don’t understand why hiding only the links does not work and it works when you hide the entire title bar.
.mfp-title
{
display: none;
}