Spoiler plugin?
-
Just curious – is anyone working on such a thing? I had a terrific plugin for my WP comments section, but now that I’ve migrated everyone to bbPress and shut comments down, we’re in a bit of a bind. I’d gladly have them just color tag their text, but I’m not sure…
Could I create a custom tag that worked like ‘blockquote’ with its own CSS info?
-
Not sure what you are trying to do here. Explain to me like I am 5 years old what you are trying to get done because I act that way….
Trent
Okay, pretty simple – see here:
http://mikecarey.net/?p=187#comments
Scroll down a dozen comments from the top to the one dated March 18th, 2007 12:36 pm and see the ‘Show’ drop-downs. That’s a spoiler plugin that essentially takes any text with <spoiler> tags around it and inserts the drop-down function.
I’m either looking for something like that, or alternately jury-rigging a custom tag (if that’s even possible) to let my users post, say, black text on a black background (in a blockquote box) that you have to highlight to see.
Make a little more sense?
Matt
I see what you mean….way to put text in a javascript function that is shown if you click on it. I would imagine adding something like this would be possible, but I don’t have a clue how to do it myself. It would require calling javascript in your header.php. What is the URL of the plugin for WP?
Trent
The link to the plugin – I think it’s called ‘Enhanced SS’ – is here:
If you scroll down just a bit, you’ll see the English version/description.
If you can just put the tags in if you don’t have the ‘visual editor’ turned on for WP and it calls a javascript in the header, it must just parse the page for those tags. Why not test this theory and include the javascript in your theme’s header.php and make a post with the tags you have! It might also need including the other files as well, but I know the anarchy media script works that way. The script called in header.php parses the page for files that end with .mp3, .mov, etc and then creates the flash file around them! Worth a try!
Trent
If Trent’s theory is correct (and it sounds good) I think the best thing for you to do is to plonk that javascript reference in a plugin (that’s certainly the neatest thing). This is probably the code you need.
<?php
/*
Plugin Name: Javascript Spoilers
Plugin URI: [Enhanced SS page]
Description: Makes little javascript buttons to show and hide text in spoiler tags. A port of a WP plugin.
Author: [Author of Enhanced SS]
Version: 0.1
Author URI: [Author of Enhanced SS homepage]
*/
function ess_addjs()
{
$plugin_uri = bb_get_option('uri') . str_replace(BBPATH, '', BBPLUGINDIR);
$js_uri = $plugin_uri . 'enhancedss.js';
echo '<script type="text/javascript" src="' . $js_uri . '" />' . "n";
}
add_action('bb_head', ''ess_addjs);
?>You will have to modify the javascript filename from enhancedss.js to whatever it’s actually called.
Copy and paste all that into a plain-text file, call it something.php and upload it to your plugins folder. Also upload the enhancedss.js file to that folder.
Almost all that code was totally ripped off from Sam Bauer’s Page links plugin.
Ok, I’m giving this a try but it doesn’t seem to be working.
I created a plugin directory that I call “bb-spoiler.” Inside is “spoiler.js” (my renamed enhancedss.js file) and the plugin itself, which I named spoiler.php.
Here’s my spoiler.js file:
<script type='text/javascript' language='Javascript'>
function s_toggleDisplay(his, me, show, hide) {
if (his.style.display != 'none') {
his.style.display = 'none';
me.innerHTML = show;
} else {
his.style.display = 'block';
me.innerHTML = hide;
}
}
</script>Am I doing something wrong here?
No, as I can see out of the plugin code the Javascript files has to be called “enhancedss.js”. If it is not called like this, the plugin is not able to find it. Am I right?
That’s what I assume, Fantatier. I tried it both ways. Neither worked.
I’m either looking for something like that, or alternately jury-rigging a custom tag (if that’s even possible) to let my users post, say, black text on a black background (in a blockquote box) that you have to highlight to see.
Okay I can’t sort out the javascript stuff, but I can make a spoiler bar: Spoiler Tags Plugin
It’s working as intended on my forums right now.
- You must be logged in to reply to this topic.