wu :: forums (http://www.ocf.berkeley.edu/~wwu/cgi-bin/yabb/YaBB.cgi)
riddles >> suggestions, help, and FAQ >> the [hideb] tag
(Message started by: Grimbal on Jun 18th, 2005, 12:29pm)

Title: the [hideb] tag
Post by Grimbal on Jun 18th, 2005, 12:29pm
I got an idea.

The hide block says "Hidden:".  It would be nice if you could specify the label to appear, to make it "Hint:", "Spoiler:", "Solution:", "Explanations:" or whatever.
We could have:
[hideb label=Hint] yabada [/hideb]

That would appear as:

Hint:
####################
####################

Title: Re: the [hideb] tag
Post by rmsgrey on Jun 19th, 2005, 10:04am
Wouldthis be more appropriate to the Suggestions, Help and FAQ board?

That said, I agree it would be a nice piece of added functionality, but would prefer to see the math symbols back first - at present you can get the same functionality by saying "Hint: [hideb..."

And if you want to do it, I'd tend towards doing it as "[hideb={label}]..." as more consistent with other tags (possibly from other boards)

Title: Re: the [hideb] tag
Post by SWF on Jun 19th, 2005, 12:36pm
I don't know how other feel, but I find those hide tags to be more of an annoyance than useful. If somebody does not want to see the answer, he shouldn't read ahead- no need to hide anything. If somebody wants clues he can stop reading when he has seen enough.

It is especially frustrating, in the 'What Am I' and 'What Happened' forums when so many people hide wild guesses that aren't even close to the answer. I usually don't bother reading the hidden text, because so often it isn't worth the effort needed to click on it.  Doing a "Select All" works to display all the hidden text, but is not pleasant to read when the entire page is highlighted.

Rather than adding new kinds of hide tags, a more useful feature would be a way to disable all hide tags.

Title: Re: the [hideb] tag
Post by towr on Jun 19th, 2005, 12:44pm
I must admit I hardly ever let hidden text stop me from reading it immediately :P

But I like the suggestions so far.
-Changing the label for hide blocks
-First restoring math symbols
-Some way to disable all hiding at once.

I'll see if I can find.make a piece of javascript that could do the last. I've been plugging all sorts of javascript links on the bookmark-bar of my browser; fun stuff that.

Title: Re: the [hideb] tag
Post by towr on Jun 23rd, 2005, 5:17am
For unhiding the following works (for firefox and IE):


Code:
javascript: function qawsedrf(node) {  while (node)  {    if ( ( node.tagName=='SPAN') || (node.tagName=='TD' && node.attributes['bgColor'] && node.attributes['bgColor'].value == "#b8860b" )) node.style.background='none';  child = node.firstChild;    qawsedrf(child);    node = node.nextSibling;  ];qawsedrf(document);


You can put it as a bookmark on your browsers' linkbar
It removes the background color for all SPAN elements and for all TD elements with the given background color.
You could also change the textcolor if you want, but I left it as it is.

[edit]third update of code-snippet[/edit]

Title: Re: the [hideb] tag
Post by Sir Col on Jun 23rd, 2005, 2:17pm
[hide]That is very useful and impressive, towr; bravo![/hide]

And, of course, the following code will hide it again:


Code:
javascript: function qawsedrf(node) {  while (node)  {    if ( node.tagName=='SPAN' ) node.style.background='#b8860b';  child = node.firstChild;    qawsedrf(child);    node = node.nextSibling;  ];qawsedrf(document);



[e]Edited: the code above will only restore the hidden property to the standard hide tag, not the hide block. It will also "hide" (change the background colour of) the glow tag.[/e]

testing

[hideb]second test[/hideb]

Title: Re: the [hideb] tag
Post by towr on Jun 23rd, 2005, 3:14pm
Hmm.. I'm somewhat surprised it does also work for TDs, since your still checking for bgcolor, and it was just set to none with the unhide code.
I suppose changing the style doesn't change the bgcolor attribute.

Still, it would be a neater solution if every element had a class to identify what they're used for. Rather then use attributes like bgcolor :P

Title: Re: the [hideb] tag
Post by SWF on Jun 23rd, 2005, 10:07pm
Great job, towr! I had no idea you could do something like that with javascript.  That will really help reduce the frustration of all those unnecessary hide tags.

Title: Re: the [hideb] tag
Post by towr on Jun 24th, 2005, 12:27am

on 06/23/05 at 22:07:10, SWF wrote:
Great job, towr! I had no idea you could do something like that with javascript.
You can essentially chance the whole document content.
You could probably even do something like search&replace on specific words if you really wanted (or highlight them, or maybe add a dictionary-link for each word, or reverse each word).

Title: Re: the [hideb] tag
Post by Grimbal on Jun 24th, 2005, 1:26am
Can I hide all post that contain "GRY" or "3 doors"?   ;D

Title: Re: the [hideb] tag
Post by towr on Jun 24th, 2005, 1:43am

on 06/24/05 at 01:26:53, Grimbal wrote:
Can I hide all post that contain "GRY" or "3 doors"?   ;D
Sure :P
You'd still first have to click a link. But it's possible with some work. (Just examine for all elements with an innerHTML attribute whether it contains "gry" or "3 doors", and if so, set the innerHTML to empty)

Title: Re: the [hideb] tag
Post by SWF on Jun 25th, 2005, 6:56am
That works as advertised with Firefox, but on IE it has the side effect of stopping animated GIFs.  Why does that happen? As animated GIFs can be distracting, that may be considered a bonus. Can it be made to stop animated GIFs in Firefox?  I know IE has an setting to stop animiations, but I don't see such a setting in Firefox.

Sir Col, I won't be using your command to re-hide , but those who love the hiding feature so much may appreciatie a macro that will hide everything, not just previously hidden words.
8)

Title: Re: the [hideb] tag
Post by Sir Col on Jun 25th, 2005, 10:03am
It's perhaps a little severe, SWF, but the following code will hide all .gif images on the page:


Code:
javascript: function hide_img(node) { while (node) { if ( node.tagName=='IMG' && node.src.indexOf('.gif')>0 ) node.style.visibility='hidden';  child=node.firstChild; hide_img(child); node=node.nextSibling; ]; hide_img(document);


If you want to hide all images just remove "&& node.src.indexOf('.gif')>0".

The nice thing about this method is that it won't mess up the appearance of the page as the images are on the page, just not visible.


Thanks for the recursive routine/template, towr; this is so much fun!

Title: Re: the [hideb] tag
Post by towr on Jun 25th, 2005, 10:19am
Firefox has a nice extension that allows you to hide images, and other objects (although the latest firefox update broke the object hiding, I think).
I'm not sure what it's called (it's on my home computer), but shouldn't be too hard to find.



Powered by YaBB 1 Gold - SP 1.4!
Forum software copyright © 2000-2004 Yet another Bulletin Board