Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
[7.x] UBB Spoiler Tags #313140
02/12/2007 6:33 PM
02/12/2007 6:33 PM
Joined: Jan 2000
Posts: 5,936
Portland, OR, USA
Gizmo Offline OP

UBB.Dev / UBB.Wiki Owner
Time Lord
Gizmo  Offline OP

UBB.Dev / UBB.Wiki Owner
Time Lord
Joined: Jan 2000
Posts: 5,936
Portland, OR, USA
NOTE: Spoiler Tags are included in UBB.Threads 7.2.

Author: Gizmo (James of VNC Web Design)

Requirements:
  • Valid UBB.Threads 7.0 install and license


About:
This UBBCode will allow you to hide text in posts from users unless they choose to view it; thus allowing users to post movie, news, etc, spoilers and not have to ruin everyones fun!

Demo:
Please see the attached images:
2361-spoiler-closed.jpg - What people see before the spoiler is revealed.
2362-spoiler-open.jpg - What people see after the spoiler is revealed.

You can also see it in action here.

Install Instructions:
Open libs/ubbthreads.inc.php
Find:
Code
			array( "#\[email=([+_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4}))\](.+?)\[/email]#i", '<a href="mailto:\1">\5</a>' ),


Add Under:
Code
			array( "#\[spoiler\](.+?)\[/spoiler\]#i", "<div class=\"ubbcode-block\"><div class=\"ubbcode-header\">Warning, Spoiler: <input type=\"button\" class=\"form-button\" value=\"Show\" onclick=\"if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = '';this.innerText = ''; this.value = 'Hide'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = 'Show'; }\" /></div><div class=\"ubbcode-body\"><div style=\"display: none;\">\\1</div></div></div>" ),


IF you want to add this to the markup panel on the "Full Reply"/"Topic Creation" pages:
Code
Step 1:
Open templates/default/standardtext_editor.tpl
Find:
<a href="javascript: x()" onclick="DoPrompt('image');" title="{$lang.IMAGE_ALT}" alt="{$lang.IMAGE_ALT}"><img id="image" onmouseover="raiseButton(this.id);" onmouseout="normalButton(this.id);" onmousedown="lowerButton(this.id);" class="markup_panel_normal_button" src="{$config.BASE_URL}/images/{$style_array.markup_panel}/image.gif" /></a>

Add Under:
<a href="javascript: x()" onclick="DoPrompt('spoiler');" title="Spoiler" alt="Spoiler"><img id="spoiler" onmouseover="raiseButton(this.id);" onmouseout="normalButton(this.id);" onmousedown="lowerButton(this.id);" class="markup_panel_normal_button" src="{$config.BASE_URL}/images/{$style_array.markup_panel}/spoiler.gif" /></a>

Step 2:
Open ubb_js/standard_text_editor.js
Find:
	if (action == "image") {
		var thisImage = prompt(enterImage, "http://");
		if (thisImage == null){return;}

		insertAtCaret(document.replier.Body, ' ' + "[img]" + thisImage + "[/img]" + ' ' );
		document.replier.texteditor.focus();
		return;
	}

Add Under:
	if (action == "spoiler") {
		var thisSpoiler = prompt("Enter Spoiler", "");
		if (thisSpoiler == null){return;}

		insertAtCaret(document.replier.Body, ' ' + "[spoiler]" + thisSpoiler + "[/spoiler]" + ' ' );
		document.replier.texteditor.focus();
		return;
	}

Step 3:
You'll need to insert a spoiler.gif into your markup panel directory, I am appending one supplied by Cuervo.


To filter spoilers out of the ActiveTopics system, simply:
Open scripts/activetopics.inc.php
Find:
Code
		$topics[$i]['forum_id'] = $forum_id;


Add Above:
Code
		$post_body = preg_replace('/\[spoiler\](.*?)\[\/spoiler\]/si', '', $post_body);
		$post_body = preg_replace('/<div class="ubbcode-block"><div class="ubbcode-header">(.*?)<\/div><div class="ubbcode-body"><div style="display: none;">(.*?)<\/div><\/div><\/div>/si', '', $post_body);


To allow users to specify their own warning:
In libs/ubbthreads.inc.php, add after the [spoiler] tag set:
Code
			array( "#\[spoiler=(.+?)\](.+?)\[/spoiler\]#i", "<div class=\"ubbcode-block\"><div class=\"ubbcode-header\">\\1 <input type=\"button\" class=\"form-button\" value=\"{$ubbt_lang['SPOILER_SHOW']}\" onclick=\"if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = '';this.innerText = ''; this.value = '{$ubbt_lang['SPOILER_HIDE']}'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = '{$ubbt_lang['SPOILER_SHOW']}'; }\" /></div><div class=\"ubbcode-body\"><div style=\"display: none;\">\\2</div></div></div>" ),


Usage Instructions:
Code
[spoiler]This text will be hidden[/spoiler]
[spoiler=This will be the warning]This text will be hidden[/spoiler]


NOTE:
Every time a user visits the page, the spoiler text will be hidden again. Also, multi-level spoilers are not a possibility yet; I'll make that the next project wink. Additionally, the classes used are the standard ubb-code ones.

Attached Files
2361-spoiler-closed.jpg (149 downloads)
2362-spoiler-open.jpg (149 downloads)
2369-spoiler.gif (41 downloads)
2376-spoiler.gif (39 downloads)

UBB.Dev - Putting Dev into UBB.threads
Company: VNC Web Services - UBB.threads Scripts and Scripting, Install and Upgrade Services, Site and Server Maintenance.
Forums: A Gardeners Forum, Scouters World, and UGN Security
UBB.Threads: My UBB Themes, UBB.Sitemaps
Sponsored Links
Re: [7.x] UBB Spoiler Tags [Re: Gizmo] #313142
02/12/2007 6:42 PM
02/12/2007 6:42 PM
Joined: Mar 2006
Posts: 32
G
gliderdad Offline
Beta Tester
gliderdad  Offline
Beta Tester
G
Joined: Mar 2006
Posts: 32
Cool Thanks Giz :wave:

Re: [7.x] UBB Spoiler Tags [Re: gliderdad] #313147
02/12/2007 7:52 PM
02/12/2007 7:52 PM
Joined: Jan 2000
Posts: 5,936
Portland, OR, USA
Gizmo Offline OP

UBB.Dev / UBB.Wiki Owner
Time Lord
Gizmo  Offline OP

UBB.Dev / UBB.Wiki Owner
Time Lord
Joined: Jan 2000
Posts: 5,936
Portland, OR, USA
If you've already applied this, please update the spoiler ubbcode; there was a bug which would not allow you to quote users when they had a spoiler lol...

And yes, it was some lingering test code wink...

Last edited by Gizmo; 02/12/2007 8:08 PM.

UBB.Dev - Putting Dev into UBB.threads
Company: VNC Web Services - UBB.threads Scripts and Scripting, Install and Upgrade Services, Site and Server Maintenance.
Forums: A Gardeners Forum, Scouters World, and UGN Security
UBB.Threads: My UBB Themes, UBB.Sitemaps
Re: [7.x] UBB Spoiler Tags [Re: Gizmo] #313148
02/12/2007 7:55 PM
02/12/2007 7:55 PM
Joined: Jan 2000
Posts: 5,936
Portland, OR, USA
Gizmo Offline OP

UBB.Dev / UBB.Wiki Owner
Time Lord
Gizmo  Offline OP

UBB.Dev / UBB.Wiki Owner
Time Lord
Joined: Jan 2000
Posts: 5,936
Portland, OR, USA
by the way, this also fixed multi-level spoilers lol...

By multi level I mean:
Code
[spoiler][spoiler][spoiler][spoiler]we hide![/spoiler][/spoiler][/spoiler][/spoiler]


UBB.Dev - Putting Dev into UBB.threads
Company: VNC Web Services - UBB.threads Scripts and Scripting, Install and Upgrade Services, Site and Server Maintenance.
Forums: A Gardeners Forum, Scouters World, and UGN Security
UBB.Threads: My UBB Themes, UBB.Sitemaps
Re: [7.x] UBB Spoiler Tags [Re: Gizmo] #313152
02/12/2007 9:51 PM
02/12/2007 9:51 PM
Joined: May 2001
Posts: 11
F
Firstone Offline
Junior Member
Firstone  Offline
Junior Member
F
Joined: May 2001
Posts: 11
Just awesome! Thanks a lot Gizmo smile

(I hope Rick find it usefull too ... laugh )

Sponsored Links
Re: [7.x] UBB Spoiler Tags [Re: Firstone] #313155
02/12/2007 9:58 PM
02/12/2007 9:58 PM
Joined: Jan 2000
Posts: 5,936
Portland, OR, USA
Gizmo Offline OP

UBB.Dev / UBB.Wiki Owner
Time Lord
Gizmo  Offline OP

UBB.Dev / UBB.Wiki Owner
Time Lord
Joined: Jan 2000
Posts: 5,936
Portland, OR, USA
Not a problem... I'm hoping we can get it sneeked into a release as official-ness :crosses fingers:


UBB.Dev - Putting Dev into UBB.threads
Company: VNC Web Services - UBB.threads Scripts and Scripting, Install and Upgrade Services, Site and Server Maintenance.
Forums: A Gardeners Forum, Scouters World, and UGN Security
UBB.Threads: My UBB Themes, UBB.Sitemaps
Re: [7.x] UBB Spoiler Tags [Re: Gizmo] #313316
03/02/2007 7:19 AM
03/02/2007 7:19 AM
Joined: Nov 2001
Posts: 29
127.0.0.1
C
Cuervo Offline
User
Cuervo  Offline
User
C
Joined: Nov 2001
Posts: 29
127.0.0.1
Any chance of making this a markup panel button with a pop up?


-Cuervo
zOMG and oNOES
Re: [7.x] UBB Spoiler Tags [Re: Cuervo] #313331
03/02/2007 6:15 PM
03/02/2007 6:15 PM
Joined: Jan 2000
Posts: 5,936
Portland, OR, USA
Gizmo Offline OP

UBB.Dev / UBB.Wiki Owner
Time Lord
Gizmo  Offline OP

UBB.Dev / UBB.Wiki Owner
Time Lord
Joined: Jan 2000
Posts: 5,936
Portland, OR, USA
I'll look it up later; in all honesty i had no plans of it being in the markup panel so i never bothered; though if it's wanted i'll poke hehe


UBB.Dev - Putting Dev into UBB.threads
Company: VNC Web Services - UBB.threads Scripts and Scripting, Install and Upgrade Services, Site and Server Maintenance.
Forums: A Gardeners Forum, Scouters World, and UGN Security
UBB.Threads: My UBB Themes, UBB.Sitemaps
Re: [7.x] UBB Spoiler Tags [Re: Gizmo] #313337
03/03/2007 2:23 AM
03/03/2007 2:23 AM
Joined: Nov 2001
Posts: 29
127.0.0.1
C
Cuervo Offline
User
Cuervo  Offline
User
C
Joined: Nov 2001
Posts: 29
127.0.0.1
Most of my users are very bright when it comes to hand typing uBBcode and it is a nice mod!


-Cuervo
zOMG and oNOES
Re: [7.x] UBB Spoiler Tags [Re: Cuervo] #313338
03/03/2007 2:32 AM
03/03/2007 2:32 AM
Joined: Jan 2000
Posts: 5,936
Portland, OR, USA
Gizmo Offline OP

UBB.Dev / UBB.Wiki Owner
Time Lord
Gizmo  Offline OP

UBB.Dev / UBB.Wiki Owner
Time Lord
Joined: Jan 2000
Posts: 5,936
Portland, OR, USA
Completely untested, and taken from the youtube bbcode addon:
Code
[STEP 1:]
/templates/default/standard_text_editor.tpl

>>FIND
<a href="javascript: x()" onclick="DoPrompt('image');" title="{$lang.IMAGE_ALT}" alt="{$lang.IMAGE_ALT}"><img id="image" onmouseover="raiseButton(this.id);" onmouseout="normalButton(this.id);" onmousedown="lowerButton(this.id);" class="markup_panel_normal_button" src="{$config.BASE_URL}/images/{$style_array.markup_panel}/image.gif" /></a>

>>ADD BELOW
<a href="javascript: x()" onclick="DoPrompt('spoiler');" title="spoiler" alt="spoiler"><img id="spoiler" onmouseover="raiseButton(this.id);" onmouseout="normalButton(this.id);" onmousedown="lowerButton(this.id);" class="markup_panel_normal_button" src="{$config.BASE_URL}/images/{$style_array.markup_panel}/spoiler.gif" /></a>



[STEP 2:]
/ubb_js/standard_text_editor.js

>>FIND
if (action == "image") {
		var thisImage = prompt(enterImage, "http://");
		if (thisImage == null){return;}

		insertAtCaret(document.replier.Body, ' ' + "[img]" + thisImage + "[/img]" + ' ' );
		document.replier.texteditor.focus();
		return;
	}

>>ADD BELOW
if (action == "spoiler") {
		var thisSpoiler = prompt("Enter Spoiler Data", "Spoiler Text");
		if (thisVideo == null){return;}

		insertAtCaret(document.replier.Body, ' ' + "[spoiler]" + thisSpoiler + "[/spoiler]" + ' ' );
		document.replier.texteditor.focus();
		return;
	}

[STEP 3:]
Upload gif to markup panel directory


UBB.Dev - Putting Dev into UBB.threads
Company: VNC Web Services - UBB.threads Scripts and Scripting, Install and Upgrade Services, Site and Server Maintenance.
Forums: A Gardeners Forum, Scouters World, and UGN Security
UBB.Threads: My UBB Themes, UBB.Sitemaps
Sponsored Links
Re: [7.x] UBB Spoiler Tags [Re: Gizmo] #313362
03/04/2007 6:45 AM
03/04/2007 6:45 AM
Joined: Nov 2001
Posts: 29
127.0.0.1
C
Cuervo Offline
User
Cuervo  Offline
User
C
Joined: Nov 2001
Posts: 29
127.0.0.1
Gizmo,

Should I remove the other spoiler mod stuff before adding this in?

And I guess a Monkey Speak No Evil would make a good spoiler gif.


-Cuervo
zOMG and oNOES
Re: [7.x] UBB Spoiler Tags [Re: Cuervo] #313368
03/04/2007 3:31 PM
03/04/2007 3:31 PM
Joined: Jan 2000
Posts: 5,936
Portland, OR, USA
Gizmo Offline OP

UBB.Dev / UBB.Wiki Owner
Time Lord
Gizmo  Offline OP

UBB.Dev / UBB.Wiki Owner
Time Lord
Joined: Jan 2000
Posts: 5,936
Portland, OR, USA
The "other spoiler stuff" is the code tags in the lib files; those are completely seperate; the stuff i posted above for the editor is just the javascript that creates the editor entries. Youll slso need to put some sort of spoiler image, wasn't sure what to include...


UBB.Dev - Putting Dev into UBB.threads
Company: VNC Web Services - UBB.threads Scripts and Scripting, Install and Upgrade Services, Site and Server Maintenance.
Forums: A Gardeners Forum, Scouters World, and UGN Security
UBB.Threads: My UBB Themes, UBB.Sitemaps
Re: [7.x] UBB Spoiler Tags [Re: Gizmo] #313376
03/05/2007 7:10 AM
03/05/2007 7:10 AM
Joined: Nov 2001
Posts: 29
127.0.0.1
C
Cuervo Offline
User
Cuervo  Offline
User
C
Joined: Nov 2001
Posts: 29
127.0.0.1
So, are you saying that both of your spoiler mods must be in the code to get the markup part of it to work? Or, you can use either one by itself?


-Cuervo
zOMG and oNOES
Re: [7.x] UBB Spoiler Tags [Re: Cuervo] #313378
03/05/2007 12:35 PM
03/05/2007 12:35 PM
Joined: May 2001
Posts: 709
Pennsylvania
A
ADWOFF Offline
Content Queen
ADWOFF  Offline
Content Queen
A
Joined: May 2001
Posts: 709
Pennsylvania
Giz, my man, this is way cool! smile

I especially love how you can put a spoiler within a spoiler within a spoiler ...

The only real problem I'm seeing is with Active Topics & the preview. The "spoiler" is revealed ...

~Sue
adwoff.com

Re: [7.x] UBB Spoiler Tags [Re: Cuervo] #313382
03/05/2007 4:01 PM
03/05/2007 4:01 PM
Joined: Jan 2000
Posts: 5,936
Portland, OR, USA
Gizmo Offline OP

UBB.Dev / UBB.Wiki Owner
Time Lord
Gizmo  Offline OP

UBB.Dev / UBB.Wiki Owner
Time Lord
Joined: Jan 2000
Posts: 5,936
Portland, OR, USA
Originally Posted by Cuervo
So, are you saying that both of your spoiler mods must be in the code to get the markup part of it to work? Or, you can use either one by itself?
I'm saying, they're both seperate...

The first, lib file addition, HAS TO BE applied for ANYTHING to work; the second, the markup panel crap, can be added IF YOU WANT it...

Sue: sub spoilers rule lol...

As for search engine, Not sure how to suppress it there... I do however believe that if spoilers are critical to your community, they should be posted wiht a description above them, as to filter them out of any search results.


UBB.Dev - Putting Dev into UBB.threads
Company: VNC Web Services - UBB.threads Scripts and Scripting, Install and Upgrade Services, Site and Server Maintenance.
Forums: A Gardeners Forum, Scouters World, and UGN Security
UBB.Threads: My UBB Themes, UBB.Sitemaps
Re: [7.x] UBB Spoiler Tags [Re: Gizmo] #313384
03/05/2007 4:05 PM
03/05/2007 4:05 PM
Joined: Nov 2001
Posts: 29
127.0.0.1
C
Cuervo Offline
User
Cuervo  Offline
User
C
Joined: Nov 2001
Posts: 29
127.0.0.1
Originally Posted by Gizmo
Originally Posted by Cuervo
So, are you saying that both of your spoiler mods must be in the code to get the markup part of it to work? Or, you can use either one by itself?
I'm saying, they're both seperate...

The first, lib file addition, HAS TO BE applied for ANYTHING to work; the second, the markup panel crap, can be added IF YOU WANT it...



Thanks, I understand now.


-Cuervo
zOMG and oNOES
Re: [7.x] UBB Spoiler Tags [Re: Cuervo] #313386
03/05/2007 4:07 PM
03/05/2007 4:07 PM
Joined: Jan 2000
Posts: 5,936
Portland, OR, USA
Gizmo Offline OP

UBB.Dev / UBB.Wiki Owner
Time Lord
Gizmo  Offline OP

UBB.Dev / UBB.Wiki Owner
Time Lord
Joined: Jan 2000
Posts: 5,936
Portland, OR, USA
A lot of people don't care if it's in the markup panel or not, myself included; I only supplied that as a request, and quite frankly, I have no idea if it even works as I never tested it.

The other, the spoiler tags in the lib, has been heavily tested.


UBB.Dev - Putting Dev into UBB.threads
Company: VNC Web Services - UBB.threads Scripts and Scripting, Install and Upgrade Services, Site and Server Maintenance.
Forums: A Gardeners Forum, Scouters World, and UGN Security
UBB.Threads: My UBB Themes, UBB.Sitemaps
Re: [7.x] UBB Spoiler Tags [Re: Gizmo] #313388
03/05/2007 6:04 PM
03/05/2007 6:04 PM
Joined: Nov 2001
Posts: 29
127.0.0.1
C
Cuervo Offline
User
Cuervo  Offline
User
C
Joined: Nov 2001
Posts: 29
127.0.0.1
I did find something while I was trying to install this. I think the part of find:

Code
<a href="javascript: x()" onclick="DoPrompt('image');" title="{$lang.IMAGE_ALT}" alt="{$lang.IMAGE_ALT}"><img id="image" onmouseover="raiseButton(this.id);" onmouseout="normalButton(this.id);" onmousedown="lowerButton(this.id);" class="markup_panel_normal_button" src="{$config.BASE_URL}/images/{$style_array.markup_panel}/image.gif" /></a>


should read

Code
<a href="javascript: void(0)" onclick="DoPrompt('image');" title="{$lang.IMAGE_ALT}" alt="{$lang.IMAGE_ALT}"><img id="image" onmouseover="raiseButton(this.id);" onmouseout="normalButton(this.id);" onmousedown="lowerButton(this.id);" class="markup_panel_normal_button" src="{$config.BASE_URL}/images/{$style_array.markup_panel}/image.gif" /></a>


The "javascript: x() is javascript void(0)

I'm not sure on this, but it's what I found in my file.

Something of importance; when you click the markup button it brings up the add spoiler box and lets you add the text, but when you click the ok button it doesn't add the text to the post.

Any ideas on that one, Gizmo?

Last edited by Cuervo; 03/05/2007 7:06 PM.

-Cuervo
zOMG and oNOES
Re: [7.x] UBB Spoiler Tags [Re: Cuervo] #313391
03/05/2007 6:49 PM
03/05/2007 6:49 PM
Joined: Jan 2000
Posts: 5,936
Portland, OR, USA
Gizmo Offline OP

UBB.Dev / UBB.Wiki Owner
Time Lord
Gizmo  Offline OP

UBB.Dev / UBB.Wiki Owner
Time Lord
Joined: Jan 2000
Posts: 5,936
Portland, OR, USA
Yeh, I think some of the javascripts got updated in 7.1; the code I took the "add" line from was for 7.0.2, so it'd make sense wink... good find.

Does the markup option work? (I ask as I haven't applied it as I don't even like using the advanced editor, I mainly only use the quick reply).


UBB.Dev - Putting Dev into UBB.threads
Company: VNC Web Services - UBB.threads Scripts and Scripting, Install and Upgrade Services, Site and Server Maintenance.
Forums: A Gardeners Forum, Scouters World, and UGN Security
UBB.Threads: My UBB Themes, UBB.Sitemaps
Re: [7.x] UBB Spoiler Tags [Re: Gizmo] #313395
03/05/2007 7:08 PM
03/05/2007 7:08 PM
Joined: Nov 2001
Posts: 29
127.0.0.1
C
Cuervo Offline
User
Cuervo  Offline
User
C
Joined: Nov 2001
Posts: 29
127.0.0.1
I was testing it out just now.

It seems that once you add the text to the popup and click ok it doesn't add the text back to the post.

I'm not sure what needs to change to get the text back in there.

Last edited by Cuervo; 03/05/2007 7:27 PM. Reason: trying to clear up my post lol

-Cuervo
zOMG and oNOES
Re: [7.x] UBB Spoiler Tags [Re: Cuervo] #313397
03/05/2007 7:50 PM
03/05/2007 7:50 PM
Joined: Nov 2001
Posts: 29
127.0.0.1
C
Cuervo Offline
User
Cuervo  Offline
User
C
Joined: Nov 2001
Posts: 29
127.0.0.1
I think I found one more issue

Code
if (action == "spoiler") {
		var thisSpoiler = prompt("Enter Spoiler Data", "Spoiler Text");
		if (thisVideo == null){return;}

		insertAtCaret(document.replier.Body, ' ' + "[spoiler]" + thisSpoiler + "[/spoiler]" + ' ' );
		document.replier.texteditor.focus();
		return;
	}


should read

Code
if (action == "spoiler") {
		var thisSpoiler = prompt("Enter Spoiler Data", "Spoiler Text");
		if (thisSpoiler == null){return;}

		insertAtCaret(document.replier.Body, ' ' + "[spoiler]" + thisSpoiler + "[/spoiler]" + ' ' );
		document.replier.texteditor.focus();
		return;
	}


There is an instance where thisVideo should read thisSpoiler but I'm not sure if that's why it is not placing the new text in the post. /edit after further testing it appears that this is why the text was not getting posted into the message when you would click ok on the box.

Last edited by Cuervo; 03/05/2007 8:00 PM. Reason: more testing

-Cuervo
zOMG and oNOES
Re: [7.x] UBB Spoiler Tags [Re: Cuervo] #313399
03/05/2007 7:55 PM
03/05/2007 7:55 PM
Joined: Nov 2001
Posts: 29
127.0.0.1
C
Cuervo Offline
User
Cuervo  Offline
User
C
Joined: Nov 2001
Posts: 29
127.0.0.1
Well after some more testing is seems the thisSpoiler was the issue.

I have everything working now.

Thanks Gizmo for doing this code bit!!

I attach the spoiler.gif file I'm using.


Attached Files
2366-spoiler.gif (6 downloads)
Last edited by Cuervo; 03/05/2007 7:58 PM.

-Cuervo
zOMG and oNOES
Re: [7.x] UBB Spoiler Tags [Re: Gizmo] #313405
03/05/2007 9:39 PM
03/05/2007 9:39 PM
Joined: Jan 2000
Posts: 5,936
Portland, OR, USA
Gizmo Offline OP

UBB.Dev / UBB.Wiki Owner
Time Lord
Gizmo  Offline OP

UBB.Dev / UBB.Wiki Owner
Time Lord
Joined: Jan 2000
Posts: 5,936
Portland, OR, USA
I'm not sure, I'll give some hacking a go later...


UBB.Dev - Putting Dev into UBB.threads
Company: VNC Web Services - UBB.threads Scripts and Scripting, Install and Upgrade Services, Site and Server Maintenance.
Forums: A Gardeners Forum, Scouters World, and UGN Security
UBB.Threads: My UBB Themes, UBB.Sitemaps
Re: [7.x] UBB Spoiler Tags [Re: Cuervo] #313407
03/05/2007 10:37 PM
03/05/2007 10:37 PM
Joined: Jan 2000
Posts: 5,936
Portland, OR, USA
Gizmo Offline OP

UBB.Dev / UBB.Wiki Owner
Time Lord
Gizmo  Offline OP

UBB.Dev / UBB.Wiki Owner
Time Lord
Joined: Jan 2000
Posts: 5,936
Portland, OR, USA
I have this working:
Code
in templates/default/standardtext_editor.tpl:
<a href="javascript: x()" onclick="DoPrompt('image');" title="{$lang.IMAGE_ALT}" alt="{$lang.IMAGE_ALT}"><img id="image" onmouseover="raiseButton(this.id);" onmouseout="normalButton(this.id);" onmousedown="lowerButton(this.id);" class="markup_panel_normal_button" src="{$config.BASE_URL}/images/{$style_array.markup_panel}/image.gif" /></a>

Add Under:
<a href="javascript: x()" onclick="DoPrompt('spoiler');" title="Spoiler" alt="Spoiler"><img id="spoiler" onmouseover="raiseButton(this.id);" onmouseout="normalButton(this.id);" onmousedown="lowerButton(this.id);" class="markup_panel_normal_button" src="{$config.BASE_URL}/images/{$style_array.markup_panel}/spoiler.gif" /></a>


In ubb_js/standard_text_editor.js:
Find:
	if (action == "image") {
		var thisImage = prompt(enterImage, "http://");
		if (thisImage == null){return;}

		insertAtCaret(document.replier.Body, ' ' + "[img]" + thisImage + "[/img]" + ' ' );
		document.replier.texteditor.focus();
		return;
	}

Add Under:
	if (action == "spoiler") {
		var thisSpoiler = prompt("Enter Spoiler", "");
		if (thisSpoiler == null){return;}

		insertAtCaret(document.replier.Body, ' ' + "[spoiler]" + thisSpoiler + "[/spoiler]" + ' ' );
		document.replier.texteditor.focus();
		return;
	}


You'll need to insert a spoiler.gif into your markup panel directory, I just copied the one for strikethrough


UBB.Dev - Putting Dev into UBB.threads
Company: VNC Web Services - UBB.threads Scripts and Scripting, Install and Upgrade Services, Site and Server Maintenance.
Forums: A Gardeners Forum, Scouters World, and UGN Security
UBB.Threads: My UBB Themes, UBB.Sitemaps
Re: [7.x] UBB Spoiler Tags [Re: Gizmo] #313408
03/05/2007 10:42 PM
03/05/2007 10:42 PM
Joined: Jan 2000
Posts: 5,936
Portland, OR, USA
Gizmo Offline OP

UBB.Dev / UBB.Wiki Owner
Time Lord
Gizmo  Offline OP

UBB.Dev / UBB.Wiki Owner
Time Lord
Joined: Jan 2000
Posts: 5,936
Portland, OR, USA
Original post updated with markup panel instructions.


UBB.Dev - Putting Dev into UBB.threads
Company: VNC Web Services - UBB.threads Scripts and Scripting, Install and Upgrade Services, Site and Server Maintenance.
Forums: A Gardeners Forum, Scouters World, and UGN Security
UBB.Threads: My UBB Themes, UBB.Sitemaps
Re: [7.x] UBB Spoiler Tags [Re: Gizmo] #313409
03/05/2007 10:43 PM
03/05/2007 10:43 PM
Joined: Jan 2000
Posts: 5,936
Portland, OR, USA
Gizmo Offline OP

UBB.Dev / UBB.Wiki Owner
Time Lord
Gizmo  Offline OP

UBB.Dev / UBB.Wiki Owner
Time Lord
Joined: Jan 2000
Posts: 5,936
Portland, OR, USA
BTW, totally missed your second post lol


UBB.Dev - Putting Dev into UBB.threads
Company: VNC Web Services - UBB.threads Scripts and Scripting, Install and Upgrade Services, Site and Server Maintenance.
Forums: A Gardeners Forum, Scouters World, and UGN Security
UBB.Threads: My UBB Themes, UBB.Sitemaps
Re: [7.x] UBB Spoiler Tags [Re: Cuervo] #313410
03/05/2007 10:53 PM
03/05/2007 10:53 PM
Joined: Jan 2000
Posts: 5,936
Portland, OR, USA
Gizmo Offline OP

UBB.Dev / UBB.Wiki Owner
Time Lord
Gizmo  Offline OP

UBB.Dev / UBB.Wiki Owner
Time Lord
Joined: Jan 2000
Posts: 5,936
Portland, OR, USA
I cleaned up the spoiler graphic a bit, at least it looks good with a colored background, versus having a load of white shoved into it wink


UBB.Dev - Putting Dev into UBB.threads
Company: VNC Web Services - UBB.threads Scripts and Scripting, Install and Upgrade Services, Site and Server Maintenance.
Forums: A Gardeners Forum, Scouters World, and UGN Security
UBB.Threads: My UBB Themes, UBB.Sitemaps
Re: [7.x] UBB Spoiler Tags [Re: Cuervo] #313430
03/07/2007 11:24 PM
03/07/2007 11:24 PM
Joined: Jan 2000
Posts: 5,936
Portland, OR, USA
Gizmo Offline OP

UBB.Dev / UBB.Wiki Owner
Time Lord
Gizmo  Offline OP

UBB.Dev / UBB.Wiki Owner
Time Lord
Joined: Jan 2000
Posts: 5,936
Portland, OR, USA
I added another spoiler graphic; additionally, a thought to some on this... You could adapt it as a "not safe for work" tag... I've seen some communities whine about such things wink...


UBB.Dev - Putting Dev into UBB.threads
Company: VNC Web Services - UBB.threads Scripts and Scripting, Install and Upgrade Services, Site and Server Maintenance.
Forums: A Gardeners Forum, Scouters World, and UGN Security
UBB.Threads: My UBB Themes, UBB.Sitemaps
Re: [7.x] UBB Spoiler Tags [Re: Cuervo] #313436
03/08/2007 2:03 AM
03/08/2007 2:03 AM
Joined: Jan 2000
Posts: 5,936
Portland, OR, USA
Gizmo Offline OP

UBB.Dev / UBB.Wiki Owner
Time Lord
Gizmo  Offline OP

UBB.Dev / UBB.Wiki Owner
Time Lord
Joined: Jan 2000
Posts: 5,936
Portland, OR, USA
Added a regex filter to my initial post to filter spoiler content out of Active Topics.


UBB.Dev - Putting Dev into UBB.threads
Company: VNC Web Services - UBB.threads Scripts and Scripting, Install and Upgrade Services, Site and Server Maintenance.
Forums: A Gardeners Forum, Scouters World, and UGN Security
UBB.Threads: My UBB Themes, UBB.Sitemaps
Re: [7.x] UBB Spoiler Tags [Re: Gizmo] #313437
03/08/2007 2:12 AM
03/08/2007 2:12 AM
Joined: Nov 2001
Posts: 29
127.0.0.1
C
Cuervo Offline
User
Cuervo  Offline
User
C
Joined: Nov 2001
Posts: 29
127.0.0.1
Originally Posted by Gizmo
I added another spoiler graphic; additionally, a thought to some on this... You could adapt it as a "not safe for work" tag... I've seen some communities whine about such things wink...


Another outstanding use for this mod!


-Cuervo
zOMG and oNOES
Re: [7.x] UBB Spoiler Tags [Re: Gizmo] #313438
03/08/2007 2:18 AM
03/08/2007 2:18 AM
Joined: May 2001
Posts: 709
Pennsylvania
A
ADWOFF Offline
Content Queen
ADWOFF  Offline
Content Queen
A
Joined: May 2001
Posts: 709
Pennsylvania
Originally Posted by Gizmo
IF you wish to filter "spoiler content" from Active Topics:
open scripts/activetopics.inc.php
Find:
Code
		$topics[$i]['forum_id'] = $forum_id;


Add Above:
Code
		$post_body = preg_replace('/\[spoiler\](.*?)\[\/spoiler\]/si', '', $post_body);


Heya Giz~

I gave this a shot, and it did not take. frown

The spoiler part works, but it doesn't hide the text in Active Topics.



Sue
adwoff.com
Re: [7.x] UBB Spoiler Tags [Re: ADWOFF] #313439
03/08/2007 2:23 AM
03/08/2007 2:23 AM
Joined: Jan 2000
Posts: 5,936
Portland, OR, USA
Gizmo Offline OP

UBB.Dev / UBB.Wiki Owner
Time Lord
Gizmo  Offline OP

UBB.Dev / UBB.Wiki Owner
Time Lord
Joined: Jan 2000
Posts: 5,936
Portland, OR, USA
Cuervo: lol i noticed somethign last night when poking around a gardening sites forum, I laughed for like 20 minutes thinking of the "inappropriate lawn gnomes" I stumbled on, and the person who was at work who opened it...

Sue: Very odd, it works on my 7.1 demo site... I'll poke in and take a gander in a bit.


UBB.Dev - Putting Dev into UBB.threads
Company: VNC Web Services - UBB.threads Scripts and Scripting, Install and Upgrade Services, Site and Server Maintenance.
Forums: A Gardeners Forum, Scouters World, and UGN Security
UBB.Threads: My UBB Themes, UBB.Sitemaps
Re: [7.x] UBB Spoiler Tags [Re: Gizmo] #313440
03/08/2007 2:28 AM
03/08/2007 2:28 AM
Joined: Jan 2000
Posts: 5,936
Portland, OR, USA
Gizmo Offline OP

UBB.Dev / UBB.Wiki Owner
Time Lord
Gizmo  Offline OP

UBB.Dev / UBB.Wiki Owner
Time Lord
Joined: Jan 2000
Posts: 5,936
Portland, OR, USA
Hmmm, seems that the active topics doesn't show the tags themselves when they're parsed (duah on my part, I can't believe I didn't think about that)...

I'll need to think, because I believe the data in the active topics doesn't take tags used into account...


UBB.Dev - Putting Dev into UBB.threads
Company: VNC Web Services - UBB.threads Scripts and Scripting, Install and Upgrade Services, Site and Server Maintenance.
Forums: A Gardeners Forum, Scouters World, and UGN Security
UBB.Threads: My UBB Themes, UBB.Sitemaps
Re: [7.x] UBB Spoiler Tags [Re: Gizmo] #313441
03/08/2007 2:48 AM
03/08/2007 2:48 AM
Joined: Jan 2000
Posts: 5,936
Portland, OR, USA
Gizmo Offline OP

UBB.Dev / UBB.Wiki Owner
Time Lord
Gizmo  Offline OP

UBB.Dev / UBB.Wiki Owner
Time Lord
Joined: Jan 2000
Posts: 5,936
Portland, OR, USA
I'm still working on the regex, I'm not sure what's wrong with it yet... It seems like something isn't parsing on it, but so far what I have is:
Code
		$post_body = preg_replace('/<div class="ubbcode-block"><div class="ubbcode-header">Warning, Spoiler: <input type="button" value="Show" (.*?) \/><\/div><div class="ubbcode-body"><div style="display: none;">(.*?)<\/div><\/div><\/div>/si', '', $post_body);


It'll at least retard the viewing of the spoiler, well, the post in general... I'll try to get it working as soon as i can figure out what i'm b0gging lol


UBB.Dev - Putting Dev into UBB.threads
Company: VNC Web Services - UBB.threads Scripts and Scripting, Install and Upgrade Services, Site and Server Maintenance.
Forums: A Gardeners Forum, Scouters World, and UGN Security
UBB.Threads: My UBB Themes, UBB.Sitemaps
Re: [7.x] UBB Spoiler Tags [Re: Gizmo] #313442
03/08/2007 3:02 AM
03/08/2007 3:02 AM
Joined: Jan 2000
Posts: 5,936
Portland, OR, USA
Gizmo Offline OP

UBB.Dev / UBB.Wiki Owner
Time Lord
Gizmo  Offline OP

UBB.Dev / UBB.Wiki Owner
Time Lord
Joined: Jan 2000
Posts: 5,936
Portland, OR, USA
Well, seems that works just fine and Ive been working on n issue which wasn't there lol... I made a couple spoiler posts to test the regex on, and turns out that the one i was working with, didn't have any other content in the post; so when it filtered the spoiler, i was going nutty lol...


UBB.Dev - Putting Dev into UBB.threads
Company: VNC Web Services - UBB.threads Scripts and Scripting, Install and Upgrade Services, Site and Server Maintenance.
Forums: A Gardeners Forum, Scouters World, and UGN Security
UBB.Threads: My UBB Themes, UBB.Sitemaps
Re: [7.x] UBB Spoiler Tags [Re: Cuervo] #313443
03/08/2007 3:13 AM
03/08/2007 3:13 AM
Joined: Jan 2000
Posts: 5,936
Portland, OR, USA
Gizmo Offline OP

UBB.Dev / UBB.Wiki Owner
Time Lord
Gizmo  Offline OP

UBB.Dev / UBB.Wiki Owner
Time Lord
Joined: Jan 2000
Posts: 5,936
Portland, OR, USA
updated initial posting:
1. New spoiler graphic.
2. Updated spoiler code, now uses the style for forum buttons.
3. Added regex entries for scripts/activetopics.inc.php to filter out all spoiler entries from the activetopics.

Also, if you want to display [spoiler] instead of no spoiler text, in the new entries in the activetopics.inc.php simply put in:
Code
		$post_body = preg_replace('/\[spoiler\](.*?)\[\/spoiler\]/si', '[spoiler]', $post_body);
		$post_body = preg_replace('/<div class="ubbcode-block"><div class="ubbcode-header">(.*?)<\/div><div class="ubbcode-body"><div style="display: none;">(.*?)<\/div><\/div><\/div>/si', '[spoiler]', $post_body);


instead of
Code
		$post_body = preg_replace('/\[spoiler\](.*?)\[\/spoiler\]/si', '', $post_body);
		$post_body = preg_replace('/<div class="ubbcode-block"><div class="ubbcode-header">(.*?)<\/div><div class="ubbcode-body"><div style="display: none;">(.*?)<\/div><\/div><\/div>/si', '', $post_body);


UBB.Dev - Putting Dev into UBB.threads
Company: VNC Web Services - UBB.threads Scripts and Scripting, Install and Upgrade Services, Site and Server Maintenance.
Forums: A Gardeners Forum, Scouters World, and UGN Security
UBB.Threads: My UBB Themes, UBB.Sitemaps
Re: [7.x] UBB Spoiler Tags [Re: Gizmo] #313470
03/10/2007 5:03 AM
03/10/2007 5:03 AM
Joined: Nov 2001
Posts: 29
127.0.0.1
C
Cuervo Offline
User
Cuervo  Offline
User
C
Joined: Nov 2001
Posts: 29
127.0.0.1
Originally Posted by Gizmo
Cuervo: lol i noticed somethign last night when poking around a gardening sites forum, I laughed for like 20 minutes thinking of the "inappropriate lawn gnomes" I stumbled on, and the person who was at work who opened it...

Sue: Very odd, it works on my 7.1 demo site... I'll poke in and take a gander in a bit.


I could so see someone telling their boss to come look at this site, it has a great post about growing tomatoes and woops!


-Cuervo
zOMG and oNOES
Re: [7.x] UBB Spoiler Tags [Re: Cuervo] #313474
03/10/2007 2:12 PM
03/10/2007 2:12 PM
Joined: Jan 2000
Posts: 5,936
Portland, OR, USA
Gizmo Offline OP

UBB.Dev / UBB.Wiki Owner
Time Lord
Gizmo  Offline OP

UBB.Dev / UBB.Wiki Owner
Time Lord
Joined: Jan 2000
Posts: 5,936
Portland, OR, USA
Lol it was on topic... IT was talking about lawn gnomes haha...


UBB.Dev - Putting Dev into UBB.threads
Company: VNC Web Services - UBB.threads Scripts and Scripting, Install and Upgrade Services, Site and Server Maintenance.
Forums: A Gardeners Forum, Scouters World, and UGN Security
UBB.Threads: My UBB Themes, UBB.Sitemaps
Re: [7.x] UBB Spoiler Tags [Re: Cuervo] #313592
03/17/2007 6:07 PM
03/17/2007 6:07 PM
Joined: Apr 2001
Posts: 97
NJ
jgeoff Offline
Power User
jgeoff  Offline
Power User
Joined: Apr 2001
Posts: 97
NJ

Giz, I'm getting this error in 7.1 (I didn't apply any of the markup panel stuff)

Parse error: syntax error, unexpected T_STRING, expecting ')' in /home2/gbb/public_html/threads/libs/ubbthreads.inc.php on line 1011


GangsterBB.NET (Ver. 7.3)
2007 Content Rulez Contest - Honorable Mention
UBB.classic 6.7.2 - RIP
Browser: Firefox 2.0
Re: [7.x] UBB Spoiler Tags [Re: jgeoff] #313594
03/17/2007 7:23 PM
03/17/2007 7:23 PM
Joined: Jan 2000
Posts: 5,936
Portland, OR, USA
Gizmo Offline OP

UBB.Dev / UBB.Wiki Owner
Time Lord
Gizmo  Offline OP

UBB.Dev / UBB.Wiki Owner
Time Lord
Joined: Jan 2000
Posts: 5,936
Portland, OR, USA
Could you paste me exactly what you put in the ubbcode block for the spoiler tag? What it looks like is that you're missing the ),


UBB.Dev - Putting Dev into UBB.threads
Company: VNC Web Services - UBB.threads Scripts and Scripting, Install and Upgrade Services, Site and Server Maintenance.
Forums: A Gardeners Forum, Scouters World, and UGN Security
UBB.Threads: My UBB Themes, UBB.Sitemaps
Page 1 of 2 1 2

Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with, and recommend, the following Web Hosts:
· Stable Host
· Blue Host
· Interserver.net
Visit Us on Facebook
Member Spotlight
badfrog
badfrog
somewhere on the coast of Maine
Posts: 94
Joined: March 2007
Show All Member Profiles 
Forum Statistics
Forums64
Topics37,444
Posts293,463
Members13,787
Most Online1,498
Mar 17th, 2017
Top Posters(All Time)
AllenAyres 25,587
JoshPet 11,330
Rick 8,373
LK 7,396
Lord Dexter 6,503
Gizmo 5,936
Greg Hard 5,533
Top Posters(30 Days)
isaac 11
driv 6
Gizmo 2
ehill 1
Today's Statistics
Currently Online 682
Topics Created 1
Posts Made 2
Users Online 3
Birthdays 19
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2018 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 7.6.2
(Snapshot build 20180130.dev)
Page Time: 0.084s Queries: 18 (0.022s) Memory: 3.6313 MB (Peak: 4.1080 MB) Zlib enabled. Server Time: 2018-02-19 09:56:10 UTC