Simple Machines Community Forum

Customizing SMF => Tips and Tricks => Thema gestartet von: gbsothere in August 28, 2009, 01:30:18 NACHMITTAGS

Titel: __For those 1.x users who can't get the Shadow tag to work__
Beitrag von: gbsothere in August 28, 2009, 01:30:18 NACHMITTAGS
Most of my posters use Firefox.  The Shadow tag has never worked for us.  I've read that it only works for IE but my posters kept nagging me about it.... *sigh*......  that's what they do.

So, out of desperation, I found the code in Subs.php

array(
'tag' => 'shadow',
'type' => 'unparsed_commas',
'test' => '[#0-9a-zA-Z\-]{3,12},(left|right|top|bottom|[0123]\d{0,2})\]',
'before' => $context['browser']['is_ie'] ? '<span style="filter: Shadow(color=$1, direction=$2); height: 1.2em;\">' : '<span style="text-shadow: $1 $2">',
'after' => '</span>',
'validate' => $context['browser']['is_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))
return \'0 -2px\';
elseif ($data[1] == \'right\' || (is_numeric($data[1]) && $data[1] < 100))
return \'2px 0\';
elseif ($data[1] == \'bottom\' || (is_numeric($data[1]) && $data[1] < 190))
return \'0 2px\';
elseif ($data[1] == \'left\' || (is_numeric($data[1]) && $data[1] < 280))
return \'-2px 0\';
else
return \'0 0\';'),
),



and replaced it with this:

array(
'tag' => 'shadow',
'type' => 'unparsed_commas',
'test' => '[#0-9a-zA-Z\-]{3,12},(left|right|top|bottom|[0123]\d{0,2})\]',
'before' => $context['browser']['is_ie'] ? '<span style="display: inline-block; filter: Shadow(color=$1, direction=$2); height: 1.2em;">' : '<span style="text-shadow: $1 $2">',
'after' => '</span>',
'validate' => $context['browser']['is_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\';'),
),





and now it works (for us) in Firefox, Safari and Opera.   I'm no coder, trust me.  All this is, is the code from 2.x's Subs.php and, if it's a bad idea, someone whack my hands with a ruler and I'll go quietly. 

:-[

It's just that, while searching, I ran across several threads where others wanted it to work and I did, too ....  and, well, it does, now, with no errors.


It may not for you.   You may want to try it on a test board, first. 

If you have questions, I'm pretty much done.  All I can do, at this point, is tell you how great you look and smile alot.      :D
Titel: Re: __For those 1.x users who can't get the Shadow tag to work__
Beitrag von: shadow82x in August 28, 2009, 03:46:34 NACHMITTAGS
Moved to Tips and Tricks and added this to our index. :)
Titel: Re: __For those 1.x users who can't get the Shadow tag to work__
Beitrag von: gbsothere in August 28, 2009, 03:58:14 NACHMITTAGS
I'm honored!   :D

Thanks!



Titel: Re: __For those 1.x users who can't get the Shadow tag to work__
Beitrag von: Batchfiles in August 29, 2009, 01:32:24 NACHMITTAGS
Brilliant, thank you.
Titel: Re: __For those 1.x users who can't get the Shadow tag to work__
Beitrag von: LHW in August 29, 2009, 02:02:42 NACHMITTAGS
Never used it, so I didn't know it didn't work.  LOL

Thanks for letting us know how to fix it.  :D
Titel: Re: __For those 1.x users who can't get the Shadow tag to work__
Beitrag von: gbsothere in August 29, 2009, 02:12:06 NACHMITTAGS
I have a couple of posters in particular who find it necessary to follow me around telling me what doesn't work, which is how I found out.  I didn't even know what a Shadow tag was. 

:D