Is there anything that I can add to just that banner module to prevent right click. I realize there are work arounds but I would still want to add it
thanks
thanks
window.addEventListener('load', function() {
document.addEventListener('contextmenu', function(e) {
if ($(e.target).closest('#widget_[COLOR=#FF0000]XXXXX[/COLOR]').length > 0) {
alert('Sorry, right click is disabled in this module.');
e.preventDefault();
return false;
}
return true;
});
});
![]() ![]() |
My Amazon Affiliate Link Fast vBulletin VPS Host: This site is hosted by IONOS |
<script>
window.addEventListener('load', function() {
document.addEventListener('contextmenu', function(e) {
if ($(e.target).closest('#widget_336').length > 0) {
alert('Sorry, right click is disabled in this module.');
e.preventDefault();
return false;
}
return true;
});
});
</script>
![]() ![]() |
My Amazon Affiliate Link Fast vBulletin VPS Host: This site is hosted by IONOS |
![]() ![]() |
My Amazon Affiliate Link Fast vBulletin VPS Host: This site is hosted by IONOS |
<div class="h-align-center">
<!-- Insert default image and link here -->
<a id="rotateBannerLink" href="http://www.directemar.cl" target="_blank"><img id="rotateBannerImg" src="http://www.denunciasbuceo.cl/foro/banners/direct.jpg" alt="" /></a>
</div>
<script>
(function() {
// list down all possible images and links here
var bannerImages = [
{
link: 'http://www.dt.gob.cl',
src: 'http://www.denunciasbuceo.cl/foro/banners/dt.jpg'
},
{
link: 'http://mma.gob.cl',
src: 'http://www.denunciasbuceo.cl/foro/banners/mma.jpg'
},
{
link: 'http://www.sernapesca.cl',
src: 'http://www.denunciasbuceo.cl/foro/banners/sern.jpg'
},
{
link: 'http://www.ssffaa.cl',
src: 'http://www.denunciasbuceo.cl/foro/banners/subs ffaa.jpg'
},
/* no trailing comma here at the last item */
],
link = document.getElementById('rotateBannerLink'),
image = document.getElementById('rotateBannerImg');
// function to get a random banner from the list of banners
function rotateBanner() {
var index = Math.floor(Math.random() * bannerImages.length);
image.src = bannerImages[index].src;
link.href = bannerImages[index].link;
}
if (link && image) {
// rotate the banner every 3 seconds
window.setInterval(rotateBanner, 3000); //1000 (msec) = 1 sec (adjust as needed)
} else {
console.log('Error: Link and/or image does not exists. Make sure the <a> and <img> IDs are correct.');
}
})();
</script>
![]() ![]() |
My Amazon Affiliate Link Fast vBulletin VPS Host: This site is hosted by IONOS |

Comment