miniBB ® 

miniBB

®
Support Forums
  
 | Start | Register | Search | Statistics | File Bank | Manual |
Custom Tutorials and Modifications miniBB Support Forums / Custom Tutorials and Modifications /  
 

Spoiler

 
 
Page  Page 1 of 2:  1  2  Next »

Author Anonymous
Guest
#1 | Posted: 2 Jul 2007 16:47 
alguna posibilidad de agregar "Spoiler" a el software de minibb ?

Author lime
Partaker
#2 | Posted: 7 Jul 2007 16:22 
Can you give more details of what you're looking for exactly?

Author Anonymous
Guest
#3 | Posted: 7 Jul 2007 16:27 
ok go to http://sc.gosugamers.net/replays/9029

and see the "Spoiler" button then click on it.

alguna posibilidad de agregar "Spoiler" a el software de minibb ?

Author lime
Partaker
#4 | Posted: 7 Jul 2007 18:29 
I use the javascript from http://www.webmonkey.com/webmonkey/reference/javascript_code_library/wm_chg_vis/?tw=reference&category=dhtml
to make one spoiler button that works but the tricky part is integrating it since it is working with only a static id so far.

Heres the sample (you'll have to save it as an html file):

<html>
<head>

<script>
function WM_checkIn(id) {

/*
WM_checkIn()
Takes the ID of a positioned HTML element and returns an object reference.

Source: Webmonkey Code Library
(http://www.hotwired.com/webmonkey/javascript/code_library/)

Author: Taylor
Author Email: taylor@wired.com
Author URL: http://www.taylor.org/

Usage: WM_checkIn('id')
*/

// This function checks for DOM strategy, then
// returns an object reference.
if (document.all) {
return document.all[id].style;
} else if(document.layers) {
return document.layers[id];
}
}




/*
WM_changeVisibility()
Changes whether a layer is visible or hidden.

Source: Webmonkey Code Library
(http://www.hotwired.com/webmonkey/javascript/code_library/)

Author: Nadav Savio
Author Email: nadav@wired.com

usage: WM_changeVisibility('targetLayer1',[visible|hidden|toggle],'targetLayer2',[visible|hidden|toggle],...,'targetLayerN',[vi sible|hidden|toggle])

*/

// set hidden/visible vars for Netscape 4 compatibility
if (document.layers) {
var hidden = "hide";
var visible = "show";
} else {
var hidden = "hidden";
var visible = "visible";
}
var toggle = "toggle";

function WM_changeVisibility() {
if (document.layers || document.all) {
var inc, endInc=arguments.length;
// run through the args (objects) and set the visibility of each
for (inc=0; inc<endInc; inc+=2) {
// get a good object reference
var daObj = WM_checkIn(arguments[inc]);
if (arguments[inc+1] == hidden) {
// hide the object
daObj.visibility = hidden;
} else if (arguments[inc+1] == visible) {
// show the object
daObj.visibility = visible;
} else if (arguments[inc+1] == toggle) {
// toggle the object's visibility
if (daObj.visibility == visible) {
daObj.visibility = hidden;
} else if (daObj.visibility == hidden) {
daObj.visibility = visible;
}
}
}
}
}

</script>
</head>
<body>

<input type="button" value="Spoiler" onClick="WM_changeVisibility('spoiler',toggle);" />
<div id="spoiler" style="visibility:hidden">Hidden text</div>

</body>
</html>

Author Anonymous
Guest
#5 | Posted: 7 Jul 2007 20:14 
well, how itegrate it to mini bb codes ?

Like: [ b ] [ i ] [ u ][ / u ] [ / i ] [ / b ]

Author lime
Partaker
#6 | Posted: 8 Jul 2007 16:13 
It was kind of tricky but I think I have a version that works. You have to modify quite a few files so please read carefully.

https://www.minibb.com/forums/storage/mods/spoilerbutton.zip

Author Anonymous
Guest
#7 | Posted: 8 Jul 2007 20:40 
O_O!!! oH My God!!! you are the best :) thx men, gracias amigo ;) !

Author lime
Partaker
#8 | Posted: 9 Jul 2007 09:28 
You're welcome =)

Author tom322
Active Member
#9 | Posted: 9 Jul 2007 11:29 
I still don't quite understand what "Spoiler" is for... :)

Author lime
Partaker
#10 | Posted: 9 Jul 2007 13:17 
It's to hide text. For example you could use the spoiler button to hide a discussion about a movie that you've seen so that someone who hasn't seen it won't have the story spoiled for him. But if they do want to read the hidden text, they just click on the button.

---

By the way Anonymous, there was an error in the decoding bb part, I forgot to escape the round brackets. I've uploaded the correction so you can download again. Or just make this fix in bb_codes.php in the deCodeBB() function:

/* Spoiler code */
$pattern[]="/<input type=\"button\" class=\"spoiler_button\" value=\"Spoiler\" onClick=\"WM_changeVisibility\('([0-9]+)',toggle\)\" \/><div id=\"([0-9]+)\" class=\"spoiler_text\" style=\"visibility:hidden\">(.+?)<\/div>/i";
$replacement[]="[spoiler]\\3[/spoiler]";
/* --Spoiler code */

Author Anonymous
Guest
#11 | Posted: 10 Jul 2007 08:18 
lime
eres lo mejor, gracias por ayudarme :)

Author adam
Guest
#12 | Posted: 11 Jul 2007 09:23 
this mod dont work for FireFox :( can do you fix it plz?

Author lime
Partaker
#13 | Posted: 11 Jul 2007 10:13 
I decided to use a new javascript function so you'll have to change the code in form.js and the encode and decode functions. It'll probably be easier to just download the whole thing.

It should now work in Firefox as well.

https://www.minibb.com/forums/storage/mods/spoilerbutton.zip

Author adam
Guest
#14 | Posted: 12 Jul 2007 21:00 
nice, now work in firefox :) tha again lime

Author Paul
Lead Developer 
#15 | Posted: 30 Jul 2007 10:57 
Strange, but this thing doesn't work for me... First of all I have magic_quotes_gpc turned off and it produces an error while saving the message after edit. Second, I dislike simple things implemented difficult way, so I have not went further and not investigated why it doesn't work. There are enough buggy JavaScript things in my life ;-)

Now, the suggestion... have you guys thought about such simple approach as to display Spoiler text in black color on black background? Or in white color on white backround... For bb_codes then you will just need to implement one simple <SPAN> with proper CSS class, and put this CSS class into CSS file...

So everybody who would like to see a spoiler, will then just need to SELECT the spoiler text, that way they will see it...

I think that would be much simplier than providing huge JS code, modifying core files, templates, working around the apostrophes etc...

Page  Page 1 of 2:  1  2  Next » 
Custom Tutorials and Modifications miniBB Support Forums / Custom Tutorials and Modifications /
 Spoiler
 Share Topic's Link

Your Reply Click this icon to move up to the quoted message


  ?
Post as a Guest, leaving the Password field blank. You could also enter a Guest name, if it's not taken by a member yet. Sign-in and post at once, or just sign-in, bypassing the message's text.


Before posting, make sure your message is compliant with forum rules; otherwise it could be locked or removed with no explanation.

 

 
 
miniBB Support Forums Powered by Forum Software miniBB ® Home  Features  Requirements  Demo  Download  Showcase  Gallery of Arts
Compiler  Premium Extensions  Premium Support  License  Contact Us
Proceed with the Captcha add-on: protect your miniBB-forums from the automated spam and flood.


  ⇑