Let's copy all this code and paste it into the theme.liquid of our template. To paste the code it has to be at the end of our template but before the <body> command ends
It has been proven that disabling the right mouse button on web pages only brings negative causes. This particular code acts only on the images and is to give a message (in addition to not allowing the image to be copied or saved in the first instance) unfortunately it will always be possible to save the element with the element inspector or other commands, but it is We can make it a little more difficult.
Paste this code between the two <head> of your theme.liquid
{{ «no-mouse-imagenes.js» | asset_url | script_tag }}
Then in the assets folder of the code editor create a new file and call it no-mouse-images and choose .js and paste this text that you added below.
If it is very difficult for you, you can find this Jony Tips in Products > accessories
function disableClick(e) {
var message = 'WOULD YOU STEAL A CAR?';
if (document.all) {
if (((event.button == 2) || (event.button == 3)) && ((event.srcElement.tagName == "IMG") || (event.srcElement.getAttribute("type").toUpperCase() == "IMAGE"))) {
if (event.srcElement.oncontextmenu) {
event.srcElement.oncontextmenu = function(event) {
if (event.preventDefault) {
event.preventDefault();
};
if (event.stopPropagation) {
event.stopPropagation();
};
if (event.returnValue) {
event.returnValue = false;
};
};
} else {
if (event.srcElement.addEventListener) {
event.srcElement.addEventListener("contextmenu", function(event) {
if (event.preventDefault) {
event.preventDefault();
};
if (event.stopPropagation) {
event.stopPropagation();
};
if (event.returnValue) {
event.returnValue = false;
};
}
);
} else if (event.srcElement.attachEvent) {
event.srcElement.attachEvent("contextmenu", function(event) {
if (event.preventDefault) {
event.preventDefault();
};
if (event.stopPropagation) {
event.stopPropagation();
};
if (event.returnValue) {
event.returnValue = false;
};
}
);
};
};
alert(message);
return false;
};
} else if (document.layers)
{
if ((e.which == 2) || (e.which == 3)) {
if (e.target.oncontextmenu) {
e.target.oncontextmenu = function(e) {
if (e.preventDefault) {
e.preventDefault();
};
if (e.stopPropagation) {
e.stopPropagation();
};
if (e.returnValue) {
e.returnValue = false;
};
};
} else {
if (e.target.addEventListener) {
e.target.addEventListener("contextmenu", function(e) {
if (e.preventDefault) {
e.preventDefault();
};
if (e.stopPropagation) {
e.stopPropagation();
};
if (e.returnValue) {
e.returnValue = false;
};
}
);
};
};
alert(message);
return false;
};
} else if (document.getElementById)
{
if (((e.which == 2) || (e.which == 3)) && ((e.target.tagName == "IMG") || (e.target.getAttribute("type") && e.target.getAttribute("type").toUpperCase() == "IMAGE"))) {
if (e.target.oncontextmenu) {
e.target.oncontextmenu = function(e) {
if (e.preventDefault) {
e.preventDefault();
};
if (e.stopPropagation) {
e.stopPropagation();
};
if (e.returnValue) {
e.returnValue = false;
};
};
} else {
if (e.target.addEventListener) {
e.target.addEventListener("contextmenu", function(e) {
if (e.preventDefault) {
e.preventDefault();
};
if (e.stopPropagation) {
e.stopPropagation();
};
if (e.returnValue) {
e.returnValue = false;
};
}
);
};
};
alert(message);
return false;
};
};
};
function associateImages() {
for (i = 0; i < document.images.length; i++) {
document.images[i].onmousedown = disableClick;
};
};
if (document.all) {
if (document.onmouseup) {
document.onmouseup = disableClick;
} else {
window.onmouseup = disableClick;
};
} else if (document.getElementById) {
if (document.onmousedown) {
document.onmousedown = disableClick;
} else {
window.onmousedown = disableClick;
};
} else if (document.layers) {
associateImages();
};
Excelente servicio, muy amable y rápido en realizar el trabajo, 100% recomendado
Jony es seco, siempre disponible para ayudar
Lo recomiendo plenamente puesto que a la opción contratada Jonytips la adaptó a las necesidades propias de mi ecommerce.
Muy profesional. Todo como corresponde!
100% recomendado!. Efectividad, seriedad y profesionalismo en las soluciones implementadas. 👌😊
Excelente servicio me encantó súper rápido y la página quedó increíble con sus cambios. Un 7 👌🏻
0 comments