Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Extension: Hidden Text (old discussion)
Krak
New
Hidden Text, It allows you to hide text (or anything else) in a discussion or comment.
It could be used in a situation where movie spoilers would need to be hidden from view, or perhaps a bunch of images. The possibilities are endless really.
It uses JS to change the CSS of a div tag to and from "block" and "none". You can have as many comments as you want with hidden text as long as you only do it once per comment, anything after the first one will not unhide.
All you do is add the code [hide]your text here[/hide] and it does the rest. I made it so it also adds some text to show that there is something hidden. There is a link next to the edit/block links to enable/disable the hidden text. In the users account page forum preferences there is also an option. This will turn on/off the hiding of the tag. So each user can decide if they want to see the hidden text by default.
Thanks to the authors of Quote Text, BBInsertBar, Comments Permalinks (Remi's and Mark W's), and the Lussumo Docs!
post with hidden text, well, hidden - http://dev.hatethis.org/2007-01-21_211319.png
post with the hidden text visable - http://dev.hatethis.org/2007-01-21_211343.png
Download
http://lussumo.com/addons/index.php?PostBackAction=AddOn&AddOnID=250
PLEASE POST ALL COMMENTS IN THIS DISCUSSION:
http://lussumo.com/community/discussion/5640/hidden-text/#Item_11
It could be used in a situation where movie spoilers would need to be hidden from view, or perhaps a bunch of images. The possibilities are endless really.
It uses JS to change the CSS of a div tag to and from "block" and "none". You can have as many comments as you want with hidden text as long as you only do it once per comment, anything after the first one will not unhide.
All you do is add the code [hide]your text here[/hide] and it does the rest. I made it so it also adds some text to show that there is something hidden. There is a link next to the edit/block links to enable/disable the hidden text. In the users account page forum preferences there is also an option. This will turn on/off the hiding of the tag. So each user can decide if they want to see the hidden text by default.
Thanks to the authors of Quote Text, BBInsertBar, Comments Permalinks (Remi's and Mark W's), and the Lussumo Docs!
post with hidden text, well, hidden - http://dev.hatethis.org/2007-01-21_211319.png
post with the hidden text visable - http://dev.hatethis.org/2007-01-21_211343.png
Download
http://lussumo.com/addons/index.php?PostBackAction=AddOn&AddOnID=250
PLEASE POST ALL COMMENTS IN THIS DISCUSSION:
http://lussumo.com/community/discussion/5640/hidden-text/#Item_11
0
This discussion has been closed.
Comments
In order to hide multiple things per comment wouldn't wrapping selected text in a span with a specific class work? I understand that would initially mean all comments get hidden/unhidden at once, but it's a start eh? In fact, you could then just have the span unhide on mouse over I would think...
Here is some of my blah blah text [hide]then have hidden text[/hide] Then say some more yadda yadda yadda [hide]with more hidden content[/hide]
Creating:
<p>Here is some of my blah blah text <span class="hidden">then have hidden text</span></p> <p>Then say some more yadda yadda yadda<br /> <span class="hidden">with more hidden content</span>
Which displays by default like this: (obviously without the box which is just there for demonstration purposes)
Then say some more yadda yadda yadda
**Hidden Text - Click to display**
Which the magic of javascript makes display like this:
Then say some more yadda yadda yadda
**Hidden Text - Click to display**
Or this:
Then say some more yadda yadda yadda
with more hidden content
I shall go and see if there's a way to attach a display:inline/display:none toggle t a bunch of classes using JS as that would do the trick.
<div onclick="this.innerHTML = 'Add your hidden content here';">Click here to display hidden text</div>
It's nice and simple, and you don't have to keep track of all the IDs and stuff, each div keeps track of itself. If you want to make it so that several changes happen, you can make it a bit easier on yourself by adding a function like this:
<script type="text/javascript"> function show_hidden(obj, txt) { obj.className = 'some_other_class'; obj.innerHTML = txt; } </script> <div onclick="show_hidden(this, 'Your hidden text here');">Click here to display hidden text</div>
<style type="text/css"> .hidden_comment { color: #00f; text-decoration: underline; cursor: pointer; } .shown_comment { cursor: pointer; } </style> <script type="text/javascript"> function show_comment() { this.innerHTML = this.hidden_comment; this.className = 'shown_comment'; this.onclick = hide_comment; } function hide_comment() { this.innerHTML = 'Click here to show comment'; this.className = 'hidden_comment'; this.onclick = show_comment; } var hidden_comments = []; // Dynamically generated list of comments. Example: hidden_comments[0] = 'Some comment'; hidden_comments[1] = 'Some other comment'; if (window.onload) {prev_function = window.onload;} else {prev_function = false;} window.onload = function () { if (prev_function) {prev_function();} for (var i=0; i < hidden_comments.length; i++) { ele = document.getElementById('hidden_comment_'+ i); ele.onclick = show_comment; ele.hidden_comment = hidden_comments[i]; ele.className = 'hidden_comment'; ele.innerHTML = 'Click here to show comment'; } // If you are really concerned about memory usage... hidden_comments = null; }; </script> <!--(X)HTML junk --> <div id="hidden_comment_0"></div> <!--(X)HTML junk --> <div id="hidden_comment_1"></div> <!-- etc... ->
There you go - absolutely no JavaScript to muck up your HTML. Plus you don't frustrate the users who have JavaScript disabled by displaying something they can't use.
$i=0; foreach ($hidden_text_values as $hidden) { echo 'hidden_comments['.$i.'] = "'.$hidden.'";'; }
To do the increments with the hidden code, you can have a global value with a name like $random_prefix_hidden_comment_counter (something fairly long so that it won't interfere with other variables) or you could even set something in $context that is not used yet. It's been a while since I looked at that object, so I don't remember off the top of my head where the best place would be to do something like that. Anywho, I gotta get back to work. I finally have plenty to do, but I will check back later.
The "unhide" link always shows up, even if there is no hidden text in the post.
The "unhide" link always says "unhide", even when the text in the "hide" block is shown.
Otherwise, I like.
Posted: Friday, 13 July 2007 at 6:46AM