The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

little help in that code disable the right click

View previous topic View next topic Go down

Solved little help in that code disable the right click

Post by Michael_vx on November 2nd 2014, 11:21 am

little help in that code disable the right click
i find that code that disable the right click like if your mouse click is broke or you dont have the right click Very Happy

Code:
<script async="async" type="text/javascript">
  <!--
  var message="مايكل سوفت للتطوير البرمجى";
  ///////////////////////////////////
  function clickIE() {if (document.all) {(message);return false;}}
  function clickNS(e) {if
  (document.layers||(document.getElementById&&!document.all)) {
  if (e.which==2||e.which==3) {(message);return false;}}}
  if (document.layers)
  {document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
  else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
  document.oncontextmenu=new Function("return false")
  // -->
</script>
now i wonder if i can add the Features of the code i have asked for before

http://help.forumotion.com/t131790-is-there-script-to-disable-right-klick-works-with-topics-and-vistiors-only

and to work with this system with out warning disable same as the code i asked for before but with the way of the code i find and as i guess this is HTML so will have less weak points Very Happy
Michael Soft Laughing


Last edited by Michael_vx on November 4th 2014, 10:31 am; edited 1 time in total (Reason for editing : Solved)

Michael_vx
Forumember

Male Posts : 656
Reputation : 29
Language : Arabic and some English
Location : Egypt

Back to top Go down

Solved Re: little help in that code disable the right click

Post by _Twisted_Mods_ on November 2nd 2014, 11:38 am

u want same code but without the warning msg?

Code:
<script async="async" type="text/javascript">
  <!--
  function clickIE() {if (document.all) {;return false;}}
  function clickNS(e) {if
  (document.layers||(document.getElementById&&!document.all)) {
  if (e.which==2||e.which==3) {;return false;}}}
  if (document.layers)
  {document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
  else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
  document.oncontextmenu=new Function("return false")
  // -->
</script>

_Twisted_Mods_
Helper
Helper

Male Posts : 2020
Reputation : 299
Language : English
Location : Ms

http://liquidcode.forumotion.com

Back to top Go down

Solved Re: little help in that code disable the right click

Post by Michael_vx on November 2nd 2014, 11:51 am

@_Twisted_Mods_ wrote:u want same code but without the warning msg?
the keys Ctrl + C still working in the code you provide Very Happy
so i think 1 of 2 things better do add
1 disable select or disable ctrl + C or may be both to avoid the weak spots Very Happy
am I right Smile
Edit
i forget to say it should be works with visitors only like the code Ange did provide before Smile

Michael_vx
Forumember

Male Posts : 656
Reputation : 29
Language : Arabic and some English
Location : Egypt

Back to top Go down

Solved Re: little help in that code disable the right click

Post by px4ever on November 2nd 2014, 12:23 pm

@Michael_vx wrote:
@_Twisted_Mods_ wrote:u want same code but without the warning msg?
the keys Ctrl + C still working in the code you provide Very Happy
so i think 1 of 2 things better do add
1 disable select or disable ctrl + C or may be both to avoid the weak spots Very Happy
am I right Smile
Edit
i forget to say it should be works with visitors only like the code Ange did provide before Smile
You just stop select It will be hard to copier to copy your content because he can't select.

But even if you stop CTRL+C with stopping select still there some people can copy your content with different
ways so it stop temporary not permanently.

px4ever
New Member

Male Posts : 2
Reputation : 1
Language : EN

http://mon3y-onlin3.7olm.org

Back to top Go down

Solved Re: little help in that code disable the right click

Post by Michael_vx on November 2nd 2014, 12:29 pm

i understand that nothing will work with 100% as we wish
and im trying to find that site i sow before i tried all ways i know to copy content but i failed
thanks for tips again Smile
Edit
i find that site
http://shahiya.com/ar/
you can not select with the mouse click but there a spot that you use Ctrl + A but that will get all the page
this what im looking for
disable the select by the mouse Very Happy

Michael_vx
Forumember

Male Posts : 656
Reputation : 29
Language : Arabic and some English
Location : Egypt

Back to top Go down

Solved Re: little help in that code disable the right click

Post by _Twisted_Mods_ on November 2nd 2014, 12:57 pm

i dont know java to well but im sure ange will help

i figured a way with css but it blocks it on all pages

Code:
body {-webkit-touch-callout: none; -khtml-user-select: none; -moz-user-select: -moz-none; -ms-user-select: none; user-select: none; text-align: justify;}

_Twisted_Mods_
Helper
Helper

Male Posts : 2020
Reputation : 299
Language : English
Location : Ms

http://liquidcode.forumotion.com

Back to top Go down

Solved Re: little help in that code disable the right click

Post by Michael_vx on November 2nd 2014, 2:03 pm

@_Twisted_Mods_ wrote:i dont know java to well but im sure ange will help

i figured a way with css but it blocks it on all pages
wow CSS code Shocked
i think its cool Idea
to say the truth i thought that was a JavaScript
thanks again
and i wish to see better tricks Very Happy
Happy Halloween and Trick or treat Smile

Michael_vx
Forumember

Male Posts : 656
Reputation : 29
Language : Arabic and some English
Location : Egypt

Back to top Go down

Solved Re: little help in that code disable the right click

Post by _Twisted_Mods_ on November 3rd 2014, 12:07 am

here some javascript

just goto modules>javascript management

create a new javascript
select to use in all pages

Code:
var domNode = $('body');
if (jQuery.browser.msie) {
  domNode.get(0).onselectstart = function () { return false; };
} else
{
    domNode.get(0).onmousedown = function(e){e.preventDefault()}
}
save

go back to javascript management and make sure you have it turned on

_Twisted_Mods_
Helper
Helper

Male Posts : 2020
Reputation : 299
Language : English
Location : Ms

http://liquidcode.forumotion.com

Back to top Go down

Solved Re: little help in that code disable the right click

Post by Michael_vx on November 3rd 2014, 5:53 am

@_Twisted_Mods_ wrote:here some javascript

just goto modules>javascript management

create a new javascript
select to use in all pages

Code:
var domNode = $('body');
if (jQuery.browser.msie) {
  domNode.get(0).onselectstart = function () { return false; };
} else
{
  domNode.get(0).onmousedown = function(e){e.preventDefault()}
}
save

go back to javascript management and make sure you have it turned on
is this code should be used alone or with something else
because it didnt work Very Happy
like its not here
im sure there is a way
just if warning message disabled this might do the trick and with the code that disable select will be almost 90%
:wouhou:

Michael_vx
Forumember

Male Posts : 656
Reputation : 29
Language : Arabic and some English
Location : Egypt

Back to top Go down

Solved Re: little help in that code disable the right click

Post by _Twisted_Mods_ on November 3rd 2014, 6:10 am

sorry forgot a lil of the code here it is

Code:
$(function() {
var domNode = $('body');
if (jQuery.browser.msie) {
  domNode.get(0).onselectstart = function () { return false; };
} else
{
    domNode.get(0).onmousedown = function(e){e.preventDefault()}
}
});

_Twisted_Mods_
Helper
Helper

Male Posts : 2020
Reputation : 299
Language : English
Location : Ms

http://liquidcode.forumotion.com

Back to top Go down

Solved Re: little help in that code disable the right click

Post by Michael_vx on November 3rd 2014, 7:18 am

i didnt see that was just a little lil was missing Very Happy
no problem 1st thing disable select is done now the only left is disable the right click with the short Keys same as this way works Very Happy
ill start also trying my own Idea if did it work ill share the code
Smile

Michael_vx
Forumember

Male Posts : 656
Reputation : 29
Language : Arabic and some English
Location : Egypt

Back to top Go down

Solved Re: little help in that code disable the right click

Post by Ange Tuteur on November 3rd 2014, 7:57 am

Hello Michael,

To disable the context menu(right click), go to Administration Panel > Modules > JavaScript codes management > create a new script

Title : your choice
placement : in all the pages
paste the code below and submit :
Code:
document.oncontextmenu = function(e) { e.preventDefault() };

Ange Tuteur
Forumaster

Male Posts : 13021
Reputation : 2684
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: little help in that code disable the right click

Post by _Twisted_Mods_ on November 3rd 2014, 8:00 am

disable right click, highlighting, cut and copy options


Code:
$(document).on({
    "contextmenu": function(e) {
        console.log("ctx menu button:", e.which);

        // Stop the context menu
        e.preventDefault();
    },
    "mousedown": function(e) {
        console.log("normal mouse down:", e.which);
    },
    "mouseup": function(e) {
        console.log("normal mouse up:", e.which);
    }
});


$(function() {
var domNode = $('body');
if (jQuery.browser.msie) {
  domNode.get(0).onselectstart = function () { return false; };
} else
{
    domNode.get(0).onmousedown = function(e){e.preventDefault()}
}
});

$(document).ready(function() {
$('body').bind('copy cut',function(e) {
e.preventDefault(); //disable cut,copy,paste
alert('cut & copy options are disabled !!');
});
});

_Twisted_Mods_
Helper
Helper

Male Posts : 2020
Reputation : 299
Language : English
Location : Ms

http://liquidcode.forumotion.com

Back to top Go down

Solved Re: little help in that code disable the right click

Post by Michael_vx on November 3rd 2014, 8:35 am

now that what i call it super cool
one last thing
i tried to add
Code:
if (location.pathname == '/contact') return;
if (!document.getElementById('logout'))
i think i cant make it right Very Happy
Edit
sorry was my mistake
i forget to test in Visitor mode its done
Hello

Michael_vx
Forumember

Male Posts : 656
Reputation : 29
Language : Arabic and some English
Location : Egypt

Back to top Go down

Solved Re: little help in that code disable the right click

Post by Michael_vx on November 4th 2014, 10:26 am

there is little problem i just find out
the toolbar of the forum is disabled by the code
Shocked
when Script active the forum toolbar disappear when not the toolbar appear again any tips ?
Edit
i dont know why i do rush so much these days
it was also my mistake in changing of the code
mark topic as solved
thanks a lot


Last edited by Michael_vx on November 4th 2014, 10:31 am; edited 1 time in total (Reason for editing : Solved)

Michael_vx
Forumember

Male Posts : 656
Reputation : 29
Language : Arabic and some English
Location : Egypt

Back to top Go down

Solved Re: little help in that code disable the right click

Post by Ange Tuteur on November 4th 2014, 9:56 pm

Topic archived

Ange Tuteur
Forumaster

Male Posts : 13021
Reputation : 2684
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum