This topic was marked solved by its starter, on May 24th, 2013, 02:55 AM
Color BB code Issue when combined with url BB code

xrunner

  • Posts: 192

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Color BB code Issue when combined with url BB code
« Reply #1, on May 5th, 2013, 01:32 AM »
Put the colour outside the link rather than inside. It's a side effect of the shortening facility we have for links:

Code: [Select]
[color=teal][url=http://www.atheistthinktank.net/thinktank/index.php]Atheist Think Tank[/url][/color]

Atheist Think Tank


:edit: Huh. That doesn't work. Time for plan B.

@Nao Yay for styling that auto link shortener in CSS.
When we unite against a common enemy that attacks our ethos, it nurtures group solidarity. Trolls are sensational, yes, but we keep everyone honest. | Game Memorial

xrunner

  • Posts: 192

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278

xrunner

  • Posts: 192

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: Color BB code Issue when combined with url BB code
« Reply #5, on May 5th, 2013, 05:08 PM »
Quote from Arantor on May 5th, 2013, 01:32 AM
@Nao Yay for styling that auto link shortener in CSS.
Actually, it's not the link shortener that's changing the style, it's the .bbc_link class, which is shown on all parsed links...

Hmm, I don't know how to 'fix this'... (Does it REALLY need fixing..? :^^;:)
Taking apart the cool existing code to add some stuff to remove BBC tags from the char counter...? (Hmm, I don't even remember how I did that one...)

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Color BB code Issue when combined with url BB code
« Reply #6, on May 5th, 2013, 05:11 PM »
Right, let me explain the problem here.

url inside a color tag doesn't work.

color inside a url tag adds a spurious ... to it because of the .bbc_link span styling. It's not based on the number of characters as far as I can tell because the ... is prepended and is straight-up because of the fact it's a .bbc_link containing a span.

One of these two needs to be fixed, whichever one we don't fix, we add a rule to bbc parsing to prevent.

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: Color BB code Issue when combined with url BB code
« Reply #7, on May 5th, 2013, 05:40 PM »
It's not a JS problem... Thought so.
In fact, it's just something that happens even with JS disabled.

This is due to this rule:
.bbc_link span:before

Uh...
I guess I should be doing something like using a specific class for it. Don't like the idea, as it costs more bytes in JS, but... whatever.
Re: Color BB code Issue when combined with url BB code
« Reply #8, on May 5th, 2013, 05:56 PM »
So, I fixed it in two different ways...

- a CSS-only fix, doesn't work in IE 6-8 (it'll still work -- just not that particular bug.)[1]
- a JS+CSS fix, works everywhere.[2]

CSS version adds 12 bytes to CSS file, and 0 byte to JS file.
JS version adds 1 byte to CSS file, and 6 bytes to JS file.

JS version seems like a no-brainer, but I prefer adding bytes to CSS (= doesn't stall page loading), and it's easier to save bytes in CSS than in JS, because the JS file is already optimized for size, and by a wide margin...

Any opinions...?

PS: that particular link brings back bad memories... >_<
 1. .bbc_link span:not([class]):before
 2. .bbc_link .cut:before in CSS, and <span class="cut"> in JS.

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Color BB code Issue when combined with url BB code
« Reply #9, on May 5th, 2013, 06:47 PM »
I'd rather have the CSS+JS solution personally. IE8 is still around and as the highest version supported by XP, it's not something we can easily ignore at this stage.

While it adds JS bytes, it's adding a total of 7 bytes to something that will likely be cached with the user in most cases anyway.