Skip to main content
Topic: Subs.php stuff (basic tweaks). (Read 16578 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Subs.php stuff (basic tweaks).

I just opened Subs.php to take a look at this idea, and noticed something else (as ya do).

Quote tags (example):
Code: [Select]
			array(
'tag' => 'quote',
'parameters' => array(
'author' => array('match' => '(.{1,192}?)'),
),
'before' => '<div class="quoteheader"><div class="topslice_quote">' . $txt['quote_from'] . ': {author}</div></div><blockquote>',
'after' => '</blockquote><div class="quotefooter"><div class="botslice_quote"></div></div>',
'block_level' => true,
),

The topslice_quote, quotefooter and botslice_quote classes were one of my clever ideas (ahem) back in the stone age. Something about Salma Hayek's posterior, IIRC. :D

Anyway, nobody has ever used them. I suspect most themers have never even realised they exist. The extra quote markup classes, I mean. Most themers probably realise that they, personally, do in fact exist, although I have my doubts about some of them.

Point is that the additional markup for quotes has been proven to be redundant, so me kill. That will save three divs and three classes on every quote, which is worth saving. :)

Next bit: colour tags. I'm not sure why we need specific tags for red, green, blue and black and white. We already have the colour dropdown available, and in the event that is not available people can still use this:
Code: [Select]
[color=red]red stuff here[/color]

So, my 2c would be kill those tags. However, if they are to be kept, I suggest that the css for them be moved to the right place (_variantname.css). The reason is that if a site is running a non-standard background colour, it might be helpful to provide the admin with a way of tweaking those colours without having to hack Subs. The standard red, for example, can be very hard to read on some backgrounds. Also, it just gets some inline css out of the markup, which is usually a good thing.

So I'd be inclined to just use this in Subs:
Code: [Select]
			array(
'tag' => 'red',
'before' => '<span class="bbc_color bbc_red">',
'after' => '</span>',
),

With CSS as:
Code: [Select]
.bbc_red {
color: red;
}

This might seem ridiculously pedantic, but as I say it could be handy.
Master of Expletives: Now with improved family f@&king friendliness! :D

Sources code: making easy front end changes difficult since 1873. :P

Re: Subs.php stuff (basic tweaks).

Reply #1

Shadow tags. Meh. :D

Current tag code is this:
Code: [Select]
			array(
'tag' => 'shadow',
'type' => 'unparsed_commas',
'test' => '[#0-9a-zA-Z\-]{3,12},(left|right|top|bottom|[0123]\d{0,2})\]',
'before' => isBrowser('ie') ? '<span style="display: inline-block; filter: Shadow(color=$1, direction=$2); height: 1.2em;">' : '<span style="text-shadow: $1 $2">',
'after' => '</span>',
'validate' => isBrowser('ie') ? create_function('&$tag, &$data, $disabled', '
if ($data[1] == \'left\')
$data[1] = 270;
elseif ($data[1] == \'right\')
$data[1] = 90;
elseif ($data[1] == \'top\')
$data[1] = 0;
elseif ($data[1] == \'bottom\')
$data[1] = 180;
else
$data[1] = (int) $data[1];') : create_function('&$tag, &$data, $disabled', '
if ($data[1] == \'top\' || (is_numeric($data[1]) && $data[1] < 50))
$data[1] = \'0 -2px 1px\';
elseif ($data[1] == \'right\' || (is_numeric($data[1]) && $data[1] < 100))
$data[1] = \'2px 0 1px\';
elseif ($data[1] == \'bottom\' || (is_numeric($data[1]) && $data[1] < 190))
$data[1] = \'0 2px 1px\';
elseif ($data[1] == \'left\' || (is_numeric($data[1]) && $data[1] < 280))
$data[1] = \'-2px 0 1px\';
else
$data[1] = \'1px 1px 1px\';'),
),

The W3C text-shadow works in most browsers, including IE10. The filter fallback is for IE8 and 9 only, and looks like crap in them anyway. It's particularly bad if someone uses a shorthand hex code for the shadow. See attached screenshot.

Since this tag is hardly ever used, and since I don't care if people can't make text illegible in old versions of IE, I vote we kill the filter and just run the text-shadow option. :)

Code: [Select]
			array(
'tag' => 'shadow',
'type' => 'unparsed_commas',
'test' => '[#0-9a-zA-Z\-]{3,12},(left|right|top|bottom|[0123]\d{0,2})\]',
'before' => '<span style="text-shadow: $1 $2">',
'after' => '</span>',
'validate' => create_function('&$tag, &$data, $disabled', '
if ($data[1] == \'top\' || (is_numeric($data[1]) && $data[1] < 50))
$data[1] = \'0 -2px 1px\';
elseif ($data[1] == \'right\' || (is_numeric($data[1]) && $data[1] < 100))
$data[1] = \'2px 0 1px\';
elseif ($data[1] == \'bottom\' || (is_numeric($data[1]) && $data[1] < 190))
$data[1] = \'0 2px 1px\';
elseif ($data[1] == \'left\' || (is_numeric($data[1]) && $data[1] < 280))
$data[1] = \'-2px 0 1px\';
else
$data[1] = \'1px 1px 1px\';'),
),
Master of Expletives: Now with improved family f@&king friendliness! :D

Sources code: making easy front end changes difficult since 1873. :P

Re: Subs.php stuff (basic tweaks).

Reply #2

Hey what?  ;D Just looked at the code for glow tags. It does exactly the same thing as the show tags. Ipx offset, 1px blur radius.

Code: [Select]
			array(
'tag' => 'glow',
'type' => 'unparsed_commas',
'test' => '[#0-9a-zA-Z\-]{3,12},([012]\d{1,2}|\d{1,2})(,[^]]+)?\]',
'before' => isBrowser('ie') ? '<table style="border-collapse: collapse; border-spacing: 0;display: inline; vertical-align: middle; font: inherit;"><tr><td style="filter: Glow(color=$1, strength=$2); font: inherit;">' : '<span style="text-shadow: $1 1px 1px 1px">',
'after' => isBrowser('ie') ? '</td></tr></table> ' : '</span>',
),

That being the case, I think one of those tags should be deprecated. If we need a backwards compat fix, some sources trickery to meld the two in the array might be in order.

Since shadow is more in keeping with the CSS3 property being called, I think glow should be the one that is deprecated.

ETA: Ok, forget deprecation and funny array stuff. I just cleaned it up and made it do something a bit different to shadow. It will now give a 4px blur radius instead of 1px, and will be centered on the text instead of offset. Seems to make sense.

Code: [Select]
			array(
'tag' => 'glow',
'type' => 'unparsed_commas',
'test' => '[#0-9a-zA-Z\-]{3,12},([012]\d{1,2}|\d{1,2})(,[^]]+)?\]',
'before' => '<span style="text-shadow: $1 0 0 4px">',
'after' => '</span>',
),
Last Edit: June 26, 2013, 08:57:09 pm by Antechinus
Master of Expletives: Now with improved family f@&king friendliness! :D

Sources code: making easy front end changes difficult since 1873. :P

Re: Subs.php stuff (basic tweaks).

Reply #3

QuoteNext bit: colour tags. I'm not sure why we need specific tags for red, green, blue and black and white.
preparsecode() replaces them with the standardized color tag, even.
LiveGallery - Simple gallery addon for ElkArte