Page Index Toggle Pages: 1
Topic Tools
Hot Topic (More than 10 Replies) Add [thread] and [post] tags to YaBBC (Read 2,875 times)
Carsten
Ex Member


Re: Add [thread] and [post] tags to YaBBC
Reply #10 - May 26th, 2009 at 6:54pm
Post Tools
OH Eng wrote on May 25th, 2009 at 9:26pm:
Yes, I'm saying that's a way I would prefer over having a URL tag, a Post tag, and Thread tag.  It's also confusing to users when you have some tags with an available button and others without one.  

I knew you'd understand - just wanted to make sure  Wink

To make this complete here's the code to parse the URL tags with only the topic/reply id - making the changes much more simple (replacing the code in reply #4):

In YaBBC.pl find
Code
Select All
	$message =~ s~\[url=\s*(.+?)\s*\]\s*(.+?)\s*\[/url\]~&format_url2($1, $2)~eisg; 


and add before
Code
Select All
	$message =~ s~(\[url)(\]|=)([\d]{9,10})~$1$2$scripturl?num=$3~isg; 



In yabbc.js find
Code
Select All
	ubbcstr=ubbcstr.replace(/\[url\]\s*www\.(\S+?)\s*\[\/url\]/ig, "<a href='http://www.$1' target='_blank'>www.$1</a>"); 


and add before
Code
Select All
	ubbcstr=ubbcstr.replace(/(\[url)(\]|\=)([\d]{9,10})/ig, "$1$2" + scriptul + "?num=$3"); 



In ubbc.js find two instances of
Code
Select All
		if ( spliturl.length > 1 && (theurl.match(/\S\.\S/)) ) { 


and replace both with
Code
Select All
		if ( spliturl.length > 1 && ((theurl.match(/\S\.\S/)) || theurl.match(/[\d]{9,10}/)) ) { 

« Last Edit: May 26th, 2009 at 9:32pm by »  
Back to top
 
IP Logged
 
OH Eng
Past Team Members
Documentation Team
Offline



Posts: 4,026
Location: Pensacola, Florida USA
Re: Add [thread] and [post] tags to YaBBC
Reply #9 - May 25th, 2009 at 9:26pm
Post Tools
Yes, I'm saying that's a way I would prefer over having a URL tag, a Post tag, and Thread tag.  It's also confusing to users when you have some tags with an available button and others without one.
« Last Edit: May 25th, 2009 at 9:27pm by OH Eng »  

 
Back to top
 
IP Logged
 
Carsten
Ex Member


Re: Add [thread] and [post] tags to YaBBC
Reply #8 - May 25th, 2009 at 7:14pm
Post Tools
OH Eng wrote on May 25th, 2009 at 1:17pm:
The 3-different-ways feature might be best added as a MOD.

Just to make sure there's no misunderstanding - the code above does give you all 3 ways - but only using one button (tag) the URL button (tag)  Wink
  
Back to top
 
IP Logged
 
OH Eng
Past Team Members
Documentation Team
Offline



Posts: 4,026
Location: Pensacola, Florida USA
Re: Add [thread] and [post] tags to YaBBC
Reply #7 - May 25th, 2009 at 1:17pm
Post Tools
I agree with Carsten.  Remember these forums are trying to attract general users who don't use forums.  They need a simple way to tag a post, and making 3 ways is nice for experienced users but makes it seem overwhelming to others.

The 3-different-ways feature might be best added as a MOD.

  

 
Back to top
 
IP Logged
 
Carsten
Ex Member


Re: Add [thread] and [post] tags to YaBBC
Reply #6 - May 25th, 2009 at 12:49pm
Post Tools
Hmm - well it's actually the url to that post/topic you want to insert. To me it seems more confusing to have 3 different ways to insert url's  Smiley
  
Back to top
 
IP Logged
 
cepheid
Senior Member
****
Offline



Posts: 516
Re: Add [thread] and [post] tags to YaBBC
Reply #5 - May 25th, 2009 at 12:46pm
Post Tools
Carsten, thanks for the code.  The problem is that it will likely be confusing to users if the [url] tag is used both for regular URLs and for threadid/postid links, because URL has a very specific meaning to most people... hence why I recommended using [thread] and/or [post] for those.

Just my opinion.
  
Back to top
WWW  
IP Logged
 
Carsten
Ex Member


Re: Add [thread] and [post] tags to YaBBC
Reply #4 - May 25th, 2009 at 12:42pm
Post Tools
Why not ues what we already have. With very small changes it's possible to use the "URL" yabbc button:

Code removed - see reply #10

This will give you the same options as when inserting complete url - except that you'll have to use the URL button to insert topic/post id.
« Last Edit: May 26th, 2009 at 9:17pm by »  
Back to top
 
IP Logged
 
deti
Legacy Dev Team
Development Team
****
Offline



Posts: 2,650
Location: Prien am Chiemsee, Germany
Re: Add [thread] and [post] tags to YaBBC
Reply #3 - May 25th, 2009 at 11:01am
Post Tools
Hmmm, maybe some day ... every additional RegEx is extra work when parsing each message.

At least for me it's easier to copy the URL from the browser address line because it is marked at all when I click in the field. It would be more to do if I had to only mark the number before I copy it and this can make more errors too if you forget the first or last number.
  

Was immer Du tun kannst
oder erträumst tun zu können,
beginne es.
Kühnheit besitzt Genie,
Macht und magische Kraft.
Beginne es jetzt.
Whatever you can do
or dream you can,
begin it.
Boldness has genius,
power and magic in it.
Begin it now.
J. W. Goethe
Back to top
WWW  
IP Logged
 
cepheid
Senior Member
****
Offline



Posts: 516
Re: Add [thread] and [post] tags to YaBBC
Reply #2 - May 25th, 2009 at 10:47am
Post Tools
What I mean is that someone enters something like:
[thread=12345]look at this thread[/thread]

And YaBB parses it to turn it into:
look at this thread

So, YaBB turns the [thread] tag into an [url] tag automatically, filling in the appropriate details.

The advantage to this is that all a user has to enter is the thread id, not the entire URL.

This is something I use a lot on vBulletin... that doesn't mean YaBB has to have it, of course!  But, it would be nice, in my opinion.  I know lots of vB users use it, and I think YaBB users would, too.
« Last Edit: May 25th, 2009 at 10:48am by cepheid »  
Back to top
WWW  
IP Logged
 
deti
Legacy Dev Team
Development Team
****
Offline



Posts: 2,650
Location: Prien am Chiemsee, Germany
Re: Add [thread] and [post] tags to YaBBC
Reply #1 - May 25th, 2009 at 10:38am
Post Tools
Hmmm, I can't see any advantage in using thread or post instead of url tags Huh
What do you mean with autolinks??
  

Was immer Du tun kannst
oder erträumst tun zu können,
beginne es.
Kühnheit besitzt Genie,
Macht und magische Kraft.
Beginne es jetzt.
Whatever you can do
or dream you can,
begin it.
Boldness has genius,
power and magic in it.
Begin it now.
J. W. Goethe
Back to top
WWW  
IP Logged
 
cepheid
Senior Member
****
Offline



Posts: 516
Add [thread] and [post] tags to YaBBC
May 20th, 2009 at 11:22pm
Post Tools
Right now there is no "automated" way to link to certain threads or posts - we must manually copy the URL to that thread/post and use an [url] tag.  Some other forum software provides [thread] and [post] tags for this purpose, to provide the linking capability automatically.

I'd like to request those tags in YaBB, as well.  The preferred format would be, for example:
[thread]threadid[/thread] <--- autolinks to thread and auto-inserts thread subject (retrieved from thread file) as link text

[thread=threadid]link text[/thread] <-- like [url], but auto-links to thread based on threadid

[post]postid[/post] <-- as above, but auto-links to specific post... not sure what the automatic link text would be.

[post=postid]link text[/post] <-- as above, but links to post
Implementing the [thread] tag should be fairly easy; the [post] tag would be a bit more difficult since posts are generally indexed by their position within a thread, so a possible syntax would be postid == threadid/postnum, which YaBB would then parse and turn into the proper post link.  (Parsing this should be pretty easy since something similar is already done by the quoteSelection() javascript function.)
  
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Topic Tools
 
  « Board Index ‹ Board  ^Top