Sign Up! Login: Password: New User? Forgot? Support
Top Mods!
Wowhead Search
by sonofsamedi
Digital Clock
by Wolfar15
Admin Forums
Welcome to the GuildPortal Help Community! These forums are for admin-to-admin help.
Available Forums
Forums : Voodoo Tech and Scripter's Den of Scriptniquity > Adding code into a hidden free form text/HTML type widget
Mottie (MVP) 11/15/2009 5:21 PM EST : Adding code to a hide a free form text/HTML type widget
GuildPortal MVP
Mottie
Posts: 3884
Zomgawsh Poster

Adding code to hide a free form text/HTML type widget

This code should be included into a free form text/HTML type widget along with any other code you wish to add to your page. It targets the <div> with the class "hideThisWidget", finds the content box that contains it then hides the entire thing. The other alternative would be to use the custom box HTML from this post, then hide the box ID using CSS.

Code
<!--
********************************************
Add this to your code box
(in a free form text/HTML type content box).
It will hide itself
********************************************
-->
<div class="hideThisWidget"></div>
<script type="text/javascript">
$(document).ready(function(){
 $('.hideThisWidget').closest('.gpWidget').hide();
})
</script>
Customization

There isn't any way to customize this script, but if you have a second widget you wish to hide, add this code to contents.
<div class="hideThisWidget"></div>
Edit (11/19/2009): Updated the original code to work with content boxes that use tables. I also added a second code to work with other layouts.
Edit (11/21/2009): Updated code again to use the widget container, making a second code unnecessary.
TopBottom

Merenwench (MVP) 11/18/2009 6:49 PM EST : RE: Adding code to a hide a free form text/HTML type ...
GuildPortal MVP
Merenwench
Posts: 2772
Zomgawsh Poster

For some reason, I get this bit of code to work. I know that as usual it's some easy fix, but not seeing it.

TopBottom

Mottie (MVP) 11/18/2009 6:55 PM EST : RE: Adding code to a hide a free form text/HTML type ...
GuildPortal MVP
Mottie
Posts: 3884
Zomgawsh Poster

Hi Merenwench!

You can? or can't?... could you please share a link to your site so I can check it (sorry I lost all my links when my computer crashed).
TopBottom

Merenwench (MVP) 11/19/2009 9:14 AM EST : RE: Adding code to a hide a free form text/HTML type ...
GuildPortal MVP
Merenwench
Posts: 2772
Zomgawsh Poster

HA!! Yeah adding that would have made all the difference...the code isn't working for me atm...widgets aren't hidden. These two pages are where I need it to work. Widgets I would like to hide are currently titled Misc.

http://guildportal.com/Guild.aspx?GuildID=272377&TabID=2286485&PageName=Forums

http://guildportal.com/Guild.aspx?GuildID=272377&TabID=2286487&PageName=Calendar


TopBottom

Mottie (MVP) 11/19/2009 11:41 AM EST : RE: Adding code to a hide a free form text/HTML type ...
GuildPortal MVP
Mottie
Posts: 3884
Zomgawsh Poster

Hi Merenwench!

I updated the code, you'll need to use the second one to work with your site.
TopBottom

Merenwench (MVP) 11/19/2009 1:46 PM EST : RE: Adding code to a hide a free form text/HTML type ...
GuildPortal MVP
Merenwench
Posts: 2772
Zomgawsh Poster

Sweeet!! That did it and tyvm!! Your magic is amazing!

TopBottom

Mottie (MVP) 11/21/2009 6:45 AM EST : RE: Adding code to a hide a free form text/HTML type ...
GuildPortal MVP
Mottie
Posts: 3884
Zomgawsh Poster

Updated the code again to now find and hide the widget container.
TopBottom

Tewl EQ2 (New Admin) 8/15/2010 3:49 AM EST : RE: Adding code to a hide a free form text/HTML type ...
Tewl EQ2
Posts: 265
Fingers of Fury!

Hey Mottie I saw you last posted on this thread about hiding the widget container (that you had updated the code).  Can you post the code for hiding the widget container please?
All I see is a link to you help site and I couldn't find what I was looking for there.


P.S.  Whats a practical use of hiding the whole widget?  I tried it and sure enough my widget disappeared! 
TopBottom

Tewl EQ2 (New Admin) 8/15/2010 3:49 AM EST : RE: Adding code to a hide a free form text/HTML type ...
Tewl EQ2
Posts: 265
Fingers of Fury!

Hey Mottie I saw you last posted on this thread about hiding the widget container (that you had updated the code).  Can you post the code for hiding the widget container please?
All I see is a link to you help site and I couldn't find what I was looking for there.


P.S.  Whats a practical use of hiding the whole widget?  I tried it and sure enough my widget disappeared! 
TopBottom

Mottie (MVP) 8/15/2010 7:23 AM EST : RE: Adding code to a hide a free form text/HTML type ...
GuildPortal MVP
Mottie
Posts: 3884
Zomgawsh Poster

Hi Tewl EQ2!

I add an extra Free Form Text/HTML widget to every page on my site specifically to hold code that targets a widget on that page (e.g. a shout box). The code widget is empty and serves no visual purpose, so I hide it. I try to reserve the custom header and footer HTML areas for code that effects every page of the site.

I could pick another Free Form Text/HTML widget on the page, but then in the future when I want to modify or add more code, I'd have to either hunt for the code by clicking edit buttons or viewing the page source.

In another example, the code for a WoW Roster XSL can gather information from other roster widgets then hide them so you don't have roster widget overload on the page.
TopBottom

Admins Online
There are   members online.
So-and-so has logged on!
%title%
%message%