Register Members List Search Today's Posts Mark Forums Read

Reply
 
Article Options
Hide certain things from users that have javascript disabled
Lea Verou
Join Date: Jul 2005
Posts: 1,856

Greece
by Lea Verou Lea Verou is offline 14 Nov 2007
Rating: (2 votes - 4.50 average)

Hide certain things from users that have javascript disabled
I needed this for a project I'm working on, and thought I'd share it, as I liked my idea a lot.

Instructions
Open your headinclude template and add this code at the very bottom:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Then you can add the class ifjs to any element you want to be hidden from visitors that have disabled javascript. For example:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

You can even use it in non-vbulletin pages (as long as you put that code in the head) as it doesn't use any vB-specific code.
Feel free to go crazy with javascript now and not worry about those morons who disable it!
Views: 5159
Reply With Quote
Comments
  #2  
Old 14 Nov 2007, 12:38
yoyoyoyo's Avatar
yoyoyoyo yoyoyoyo is offline
 
Join Date: Dec 2004
great idea - I will have to try it out later. very simple javascript, but seems like it would be effective. It seems like this could easily be converted to BB code, also.
Reply With Quote
  #3  
Old 14 Nov 2007, 12:47
Lea Verou Lea Verou is offline
 
Join Date: Jul 2005
Real name: Lea Verou
Originally Posted by yoyoyoyo View Post
great idea - I will have to try it out later. very simple javascript, but seems like it would be effective. It seems like this could easily be converted to BB code, also.
In fact it doesn't use any javascript, it just uses the <noscript> tags to define a css class that will hide anything that has it. However the browser only "sees" that class if the javascript is disabled, since the <style> tags are inside <noscript> tags.

Why would someone want to convert this to a bbcode? I can't think of any use of such a bbcode...
Reply With Quote
  #4  
Old 15 Nov 2007, 15:38
Analogpoint's Avatar
Analogpoint Analogpoint is offline
 
Join Date: Feb 2007
Nice job Michelle!
__________________
My vBulletin Modifications.
Reply With Quote
  #5  
Old 15 Nov 2007, 15:43
ragtek's Avatar
ragtek ragtek is offline
 
Join Date: Mar 2006
Location: austria, croatia
jea cool
much nicer then my idee http://www.developer-network.org/showthread.php?t=40
__________________
my addons: http://ragtek.github.com
Reply With Quote
  #6  
Old 15 Nov 2007, 17:02
yoyoyoyo's Avatar
yoyoyoyo yoyoyoyo is offline
 
Join Date: Dec 2004
Originally Posted by Michelle View Post
Why would someone want to convert this to a bbcode? I can't think of any use of such a bbcode...
here is one example:
http://www.vbulletin.org/forum/showthread.php?t=141584
Reply With Quote
  #7  
Old 15 Nov 2007, 17:42
Analogpoint's Avatar
Analogpoint Analogpoint is offline
 
Join Date: Feb 2007
Originally Posted by Michelle View Post

Why would someone want to convert this to a bbcode? I can't think of any use of such a bbcode...
You could combine it with any BBCode that uses Javascript, such as a spoiler tag.
__________________
My vBulletin Modifications.
Reply With Quote
  #8  
Old 29 Aug 2008, 01:32
dartho dartho is offline
 
Join Date: Sep 2005
Thanks you - incredibly useful!
Reply With Quote
  #9  
Old 10 Jun 2009, 02:17
Tim Skellett Tim Skellett is offline
 
Join Date: Sep 2005
Really neat, very helpful! Many thanks!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Article Options

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


New To Site? Need Help?

All times are GMT. The time now is 08:25.

Layout Options | Width: Wide Color: