The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Disalow right click for quests

4 posters

Go down

Solved Disalow right click for quests

Post by DustyBones June 5th 2010, 3:42 pm

Is there any way to make it so only quests can't right click?
I searched and can't find anything on this


Last edited by DustyBones on April 18th 2011, 12:33 am; edited 1 time in total
DustyBones
DustyBones
Active Poster

Male Posts : 1234
Reputation : 528
Language : English
Location : Washington, USA

http://raps-graphics.forumotion.com/

Back to top Go down

Solved Re: Disalow right click for quests

Post by Clug June 5th 2010, 3:50 pm

It's only possible to make everyone not right click. <body oncontextmenu="return false"> is the code. In fact, if you made that in a Nav Button that was invisible and only guests are meant to see it, that could work.
Clug
Clug
Forumember

Male Posts : 425
Reputation : 8
Language : English
Location : Australia

http://lbtproductionz.forumsmusic.com/

Back to top Go down

Solved Re: Disalow right click for quests

Post by DustyBones June 5th 2010, 4:00 pm

Clug wrote:It's only possible to make everyone not right click. <body oncontextmenu="return false"> is the code. In fact, if you made that in a Nav Button that was invisible and only guests are meant to see it, that could work.

Tried it, didn't work. Sad


Last edited by DustyBones on June 5th 2010, 4:25 pm; edited 2 times in total
DustyBones
DustyBones
Active Poster

Male Posts : 1234
Reputation : 528
Language : English
Location : Washington, USA

http://raps-graphics.forumotion.com/

Back to top Go down

Solved Re: Disalow right click for quests

Post by exterminator June 5th 2010, 4:14 pm

Hello!

Try to paste this code in overall_header_new, right after the tag <head> :

Code:

<!-- BEGIN switch_user_logged_out -->
<script>
document.onselectstart=new Function("return false");
function ds(e){return false;}
function ra(){return true;}
document.onmousedown=ds;
document.onclick=ra;
document.oncontextmenu=function(){return false};
</script>

<!-- END switch_user_logged_out -->

This code will disable right click for guest only!

--------------

Edit : Oh! Sorry, i didn't see you use phpbb 3 version. Those code just use for phpbb2 and punbb only!
exterminator
exterminator
Forumember

Male Posts : 106
Reputation : 4
Language : English, Japanese, Vietnamese, HTML, Javascript, C, C++, C#, VB.Net
Location : Hochiminh City - Vietnam

Back to top Go down

Solved Re: Disalow right click for quests

Post by Clug June 5th 2010, 4:35 pm

As he uses phpBB3, your code is not possible Wink
Clug
Clug
Forumember

Male Posts : 425
Reputation : 8
Language : English
Location : Australia

http://lbtproductionz.forumsmusic.com/

Back to top Go down

Solved Re: Disalow right click for quests

Post by harvengure June 6th 2010, 2:12 am

I've not tested it but I think this should work, assuming your navigation bar has the class of navbar.
Code:
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">
$(document).ready(function() {
if ($('div.navbar:contains("Log in")').length > 0) {
    $(document).bind("contextmenu",function(e){
        return false;
    });
}
    });
</script>
avatar
harvengure
Forumember

Posts : 86
Reputation : 0
Language : English

Back to top Go down

Solved Re: Disalow right click for quests

Post by DustyBones June 6th 2010, 2:49 am

harvengure wrote:I've not tested it but I think this should work, assuming your navigation bar has the class of navbar.
Code:
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">
$(document).ready(function() {
if ($('div.navbar:contains("Log in")').length > 0) {
    $(document).bind("contextmenu",function(e){
        return false;
    });
}
    });
</script>

Wasn't sure where to put this. Tried CSS stylesheet but that of course didn't work.
So I put it in homepage message and that didn't work either Sad
I'm using phpBB3
DustyBones
DustyBones
Active Poster

Male Posts : 1234
Reputation : 528
Language : English
Location : Washington, USA

http://raps-graphics.forumotion.com/

Back to top Go down

Solved Re: Disalow right click for quests

Post by Clug June 6th 2010, 3:40 am

Probably want to place the code he said under a navbar thing, like I suggested Wink
Clug
Clug
Forumember

Male Posts : 425
Reputation : 8
Language : English
Location : Australia

http://lbtproductionz.forumsmusic.com/

Back to top Go down

Solved Re: Disalow right click for quests

Post by harvengure June 6th 2010, 3:57 am

I put it in an announcement so as to apply it across the whole site.
avatar
harvengure
Forumember

Posts : 86
Reputation : 0
Language : English

Back to top Go down

Solved Re: Disalow right click for quests

Post by DustyBones June 6th 2010, 4:07 am

Still doesn't work
DustyBones
DustyBones
Active Poster

Male Posts : 1234
Reputation : 528
Language : English
Location : Washington, USA

http://raps-graphics.forumotion.com/

Back to top Go down

Solved Re: Disalow right click for quests

Post by exterminator June 6th 2010, 4:29 am

DustyBones wrote:Still doesn't work

What do you mean "still doesn't work"? Which code doesn't work?


Last edited by exterminator on June 6th 2010, 4:34 am; edited 1 time in total
exterminator
exterminator
Forumember

Male Posts : 106
Reputation : 4
Language : English, Japanese, Vietnamese, HTML, Javascript, C, C++, C#, VB.Net
Location : Hochiminh City - Vietnam

Back to top Go down

Solved Re: Disalow right click for quests

Post by Clug June 6th 2010, 4:32 am

I can't think of much else... sorry.
Clug
Clug
Forumember

Male Posts : 425
Reputation : 8
Language : English
Location : Australia

http://lbtproductionz.forumsmusic.com/

Back to top Go down

Solved Re: Disalow right click for quests

Post by harvengure June 6th 2010, 4:39 am

My bad. I forgot about the jQuery restrictions...Try the code below...I've tested it on a phpBB3 forum and it works.
Code:
<script type="text/javascript">
jQuery(document).ready(function() {
if (jQuery('div.navbar:contains("Log in")').length > 0) {
    jQuery(document).bind("contextmenu",function(e){
        return false;
    });
}
    });
</script>
avatar
harvengure
Forumember

Posts : 86
Reputation : 0
Language : English

Back to top Go down

Solved Re: Disalow right click for quests

Post by exterminator June 6th 2010, 4:42 am

Wait! I think you should try this way :

Copy all these code below :

Code:
document.onselectstart=new Function("return false");
function ds(e){return false;}
function ra(){return true;}
document.onmousedown=ds;
document.onclick=ra;
document.oncontextmenu=function(){return false};

Paste it to notepad, save with the name "disablerightclick.js", file type "All file".

Then you upload it to make a direct link.
Ex :
Code:
http://your link.js

then go to ACP >>> Genaral >>> Forum >>> Configuration

paste this to "Site description" :

Code:
<script src="http://your link.js" type="text/javascript"></script>

Save and test!

P/s : replace "your link.js" with the link that you have upload the js.
exterminator
exterminator
Forumember

Male Posts : 106
Reputation : 4
Language : English, Japanese, Vietnamese, HTML, Javascript, C, C++, C#, VB.Net
Location : Hochiminh City - Vietnam

Back to top Go down

Solved Re: Disalow right click for quests

Post by exterminator June 6th 2010, 4:44 am

harvengure wrote:My bad. I forgot about the jQuery restrictions...Try the code below...I've tested it on a phpBB3 forum and it works.


Wow, you have tested on phpbb3 version??? How do you paste the code into template????
exterminator
exterminator
Forumember

Male Posts : 106
Reputation : 4
Language : English, Japanese, Vietnamese, HTML, Javascript, C, C++, C#, VB.Net
Location : Hochiminh City - Vietnam

Back to top Go down

Solved Re: Disalow right click for quests

Post by harvengure June 6th 2010, 5:34 am

What I've done with the site I mod for is I use the announcements to make the code apply all the pages. It's in the ACP under General>Messages and Emails>Announcements.

I like jQuery and have used it to hide the original announcements scroller area...just because we have no actual announcements to give at the moment. However should I get the creator of the forum to approve they will remain hidden all the time as I can use jQuery to create a new announcement area anywhere on the page and have it be multi-lined among other things. But anywho, thats how I tested the above code was by pasting it into the announcements. Though it might work from the site description as well...or even work better as done in the post prior to your reply to me.
avatar
harvengure
Forumember

Posts : 86
Reputation : 0
Language : English

Back to top Go down

Solved Re: Disalow right click for quests

Post by DustyBones June 6th 2010, 5:46 am

None worked.
harvengure: I tried the last one you gave me and put it in announcements and still didn't work

I give up. Thanks guys for trying
DustyBones
DustyBones
Active Poster

Male Posts : 1234
Reputation : 528
Language : English
Location : Washington, USA

http://raps-graphics.forumotion.com/

Back to top Go down

Solved Re: Disalow right click for quests

Post by harvengure June 6th 2010, 6:01 am

Hmmm. Works on my site....tell you what, link me and I'll see what I can do. In the very least I can view your site and use firebug to make sure that were the code I gave you inserted in the area it would be if I had admin rites, it would work.
avatar
harvengure
Forumember

Posts : 86
Reputation : 0
Language : English

Back to top Go down

Back to top

- Similar topics

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