Custom BBCodes [Deprecated]

Get help developing custom BBCodes or request one.
User avatar
muggins
Registered User
Posts: 1183
Joined: Fri Feb 22, 2008 5:12 pm
Location: Texas
Name: Donovan
Contact:

Re: Custom BBCodes

Post by muggins »

Before I realized that I should be able to do this with a bbCode, I posted in Mod Requests. Sorry for the re-run, but I figure this is the right forum for it.
What I want is a mod that will allow a user to make a "pre-post", if you will, and set a date for the post to be activated. I don't think this should be difficult, but it's beyond my skills.

Any takers? I know there are about 30 of you here that can whip this out in a matter of minutes! :mrgreen:
muggins wrote:It occurs to me that I might use a custom bbCode and a bit o'JavaScript to accomplish the same thing.

The post contents will remain hidden, sort of like a spoiler, until the trigger date. I'll report back... :mrgreen:
muggins wrote:Hmm. I used this script, but it doesn't work.

Yet! ;)

bbCode:

Code: Select all

[countdown]{TEXT1},{TEXT2},{NUM1},{NUM2},{NUM3}[/countdown]  
Replacement:

Code: Select all

<script>

//From JavaScriptKit
//change the text below to reflect your own,

var before="{TEXT1}"
var current="{TEXT2}"
var montharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
function countdown(yr,m,d)
    {
    var today=new Date()
    var todayy=today.getYear()
    if (todayy < 1000)
    todayy+=1900
    var todaym=today.getMonth()
    var todayd=today.getDate()
    var todaystring=montharray[todaym]+" "+todayd+", "+todayy
    var futurestring=montharray[m-1]+" "+d+", "+yr
    var difference=(Math.round((Date.parse(futurestring)-Date.parse(todaystring))/(24*60*60*1000))*1)
    if (difference==0)
    document.write(current)
    else if (difference>0)
    document.write("Only "+difference+" days until "+before)
    }
//enter the count down date using the format year/month/day
countdown({NUM1},{NUM2},{NUM3})

</script>
Helpline:

Code: Select all

[countdown]Teaser text, Answer text, Year, Month, Day[/countdown]  
Do I need to escape the script with the CDATA thing? :?
Muggins
Jabhi
Registered User
Posts: 572
Joined: Mon Feb 27, 2012 6:12 am

Re: Custom BBCodes

Post by Jabhi »

How to change HTML replacement of image bb code ? Thanks.
Go phpBB go... Respected : Developers, Supporters.
User avatar
Lumpy Burgertushie
Registered User
Posts: 67775
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: Custom BBCodes

Post by Lumpy Burgertushie »

Jabhi wrote:How to change HTML replacement of image bb code ? Thanks.
change to what? please explain exactly what you want the end result to be.
what are you trying to do?


robert
I'm baaaaaccckkkk. still doing work on donation basis. PM your needs.

Premium phpBB 3.3 Styles by PlanetStyles.net

If nobody is in the forest, does a tree really fall?
Jabhi
Registered User
Posts: 572
Joined: Mon Feb 27, 2012 6:12 am

Re: Custom BBCodes

Post by Jabhi »

Sorry for the trouble, replace with :

Code: Select all

<div class="highslide-gallery">
<a href="{URL}" class="highslide" onclick="return hs.expand(this, { wrapperClassName: 'controls-in-heading', slideshowGroup: 'highslide' })"><img src="{URL}" alt="" title="Click to enlarge" style="max-width:300px; max-height:300px;" /></a><div class="highslide-heading"></div>
</div>
Go phpBB go... Respected : Developers, Supporters.
User avatar
AmigoJack
Registered User
Posts: 5715
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: Custom BBCodes

Post by AmigoJack »

Have a look at this post, which already describes how to implement Highslide.
The worst thing about censorship is ███████████
Affin wrote:
Tue Nov 20, 2018 9:51 am
The problem is probably not my English but you do not want to understand correctly.
...
We will not come anybody anyway, nevertheless, it's best to shit this.
Pony99CA
Registered User
Posts: 4783
Joined: Thu Sep 30, 2004 3:13 pm
Location: Hollister, CA
Name: Steve
Contact:

Re: Custom BBCodes

Post by Pony99CA »

muggins wrote:Before I realized that I should be able to do this with a bbCode, I posted in Mod Requests. Sorry for the re-run, but I figure this is the right forum for it.
What I want is a mod that will allow a user to make a "pre-post", if you will, and set a date for the post to be activated. I don't think this should be difficult, but it's beyond my skills.

Any takers? I know there are about 30 of you here that can whip this out in a matter of minutes! :mrgreen:
muggins wrote:It occurs to me that I might use a custom bbCode and a bit o'JavaScript to accomplish the same thing.

The post contents will remain hidden, sort of like a spoiler, until the trigger date. I'll report back... :mrgreen:
You realize that If you use JavaScript, unless you obfuscate your answer text somehow, anybody will be able to read the answer by doing a View Source, right?

Steve
Silicon Valley Pocket PC (http://www.svpocketpc.com)
Creator of manage_bots and spoof_user (ask me)
Need hosting for a small forum with full cPanel & MySQL access? Contact me or PM me.
Jabhi
Registered User
Posts: 572
Joined: Mon Feb 27, 2012 6:12 am

Re: Custom BBCodes

Post by Jabhi »

I am already using Stoker's highslide attachment mod. Please give further edits. Thanks.
Go phpBB go... Respected : Developers, Supporters.
Jabhi
Registered User
Posts: 572
Joined: Mon Feb 27, 2012 6:12 am

Re: Custom BBCodes

Post by Jabhi »

When applying that code image tag works properly, but attached image opens twice :o
Go phpBB go... Respected : Developers, Supporters.
User avatar
AmigoJack
Registered User
Posts: 5715
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: Custom BBCodes

Post by AmigoJack »

Jabhi wrote:I am already using Stoker's highslide attachment mod
I've linked to a distinct post, not the whole topic - so this has no relation to other MODs.
Jabhi wrote:When applying that code image tag works properly, but attached image opens twice :o
If that was meant to me: please reply in the other topic. Now I only know what happens and what you don't want - yet I don't know what you want instead (should image attachments also be affected by Highslide or not?)
The worst thing about censorship is ███████████
Affin wrote:
Tue Nov 20, 2018 9:51 am
The problem is probably not my English but you do not want to understand correctly.
...
We will not come anybody anyway, nevertheless, it's best to shit this.
Jabhi
Registered User
Posts: 572
Joined: Mon Feb 27, 2012 6:12 am

Re: Custom BBCodes

Post by Jabhi »

Attached images already have highslide effect by the mod. Your edited doubles the action. I replied in the other topic. Thanks.
Go phpBB go... Respected : Developers, Supporters.
User avatar
muggins
Registered User
Posts: 1183
Joined: Fri Feb 22, 2008 5:12 pm
Location: Texas
Name: Donovan
Contact:

Re: Custom BBCodes

Post by muggins »

Pony99CA wrote:
muggins wrote:Before I realized that I should be able to do this with a bbCode, I posted in Mod Requests. Sorry for the re-run, but I figure this is the right forum for it.
What I want is a mod that will allow a user to make a "pre-post", if you will, and set a date for the post to be activated. I don't think this should be difficult, but it's beyond my skills.

Any takers? I know there are about 30 of you here that can whip this out in a matter of minutes! :mrgreen:
muggins wrote:It occurs to me that I might use a custom bbCode and a bit o'JavaScript to accomplish the same thing.

The post contents will remain hidden, sort of like a spoiler, until the trigger date. I'll report back... :mrgreen:
You realize that If you use JavaScript, unless you obfuscate your answer text somehow, anybody will be able to read the answer by doing a View Source, right?

Steve
Good point, thanks. I'd still like to make the thing work, and let the obfuscation come later. :mrgreen:

Can you lend a hand with the basic problem?
Muggins
Pony99CA
Registered User
Posts: 4783
Joined: Thu Sep 30, 2004 3:13 pm
Location: Hollister, CA
Name: Steve
Contact:

Re: Custom BBCodes

Post by Pony99CA »

muggins wrote:Good point, thanks. I'd still like to make the thing work, and let the obfuscation come later. :mrgreen:
Actually, it's worse than I thought.

First, all anybody needs to do to see the "after" text is quote your post. Unless you lock the topic, there's not much you can do to prevent that (again, short of obfuscating the text and having the JavaScript fix it).

Second, if either of your text strings have commas in them, it will break the BBCode. You might be better off using some other delimiter and putting the time in the "equal part" of the BBCode, for example [countdown=year,month,day]teaser#answer[/countdown]. That way, if the delimiter does occur in the text, the countdown will still work.

Finally, I have no idea what will happen if you use that BBCode in the same topic with two different events (or if somebody else messes with you by posting their own countdown).
muggins wrote:Can you lend a hand with the basic problem?
Before anybody can help, you'll need a better description than saying "it doesn't work". What does that mean? Does any text get displayed ever? What happens when the time is reached?

One thing that I'd be wary of is this code: if (difference==0). Whenever you're using subtraction, you have to account for negative numbers, so I'd use this: if (difference<=0).

Other than that, I'm no JavaScript expert, so maybe somebody else can help. Given the various problems, though, I'd be careful.

Steve
Silicon Valley Pocket PC (http://www.svpocketpc.com)
Creator of manage_bots and spoof_user (ask me)
Need hosting for a small forum with full cPanel & MySQL access? Contact me or PM me.
User avatar
muggins
Registered User
Posts: 1183
Joined: Fri Feb 22, 2008 5:12 pm
Location: Texas
Name: Donovan
Contact:

Re: Custom BBCodes

Post by muggins »

All I see on posting is the literal string: [countdown] bla, bla... [/countdown]

If I can get the JavaScript to work, I can deal with the rest.
Muggins
Pony99CA
Registered User
Posts: 4783
Joined: Thu Sep 30, 2004 3:13 pm
Location: Hollister, CA
Name: Steve
Contact:

Re: Custom BBCodes

Post by Pony99CA »

muggins wrote:All I see on posting is the literal string: [countdown] bla, bla... [/countdown]

If I can get the JavaScript to work, I can deal with the rest.
Have you tried embedding the JavaScript in a simple HTML page (on your PC) to see if it works there? That's how I debug JavaScript when I need to.

Once you get the code working in an HTML page, try the BBCode again.

Steve
Silicon Valley Pocket PC (http://www.svpocketpc.com)
Creator of manage_bots and spoof_user (ask me)
Need hosting for a small forum with full cPanel & MySQL access? Contact me or PM me.
User avatar
muggins
Registered User
Posts: 1183
Joined: Fri Feb 22, 2008 5:12 pm
Location: Texas
Name: Donovan
Contact:

Re: Custom BBCodes

Post by muggins »

Well, crud. :?

I really should do that, eh? I don't try to make many changes to my site any more, so my coding skills are soggy and hard to light. :mrgreen:
Muggins
Locked

Return to “Custom BBCode Development and Requests”