Author

Topic: Cleaning up the [glow] tag (SMF patch) (Read 152 times)

sr. member
Activity: 658
Merit: 354
I stand with Ukraine!
August 18, 2023, 05:12:01 AM
#4
It is a good idea to replace the default Red color to Yellow. I agree that Red color is painful and I believe it does not have good effects in practice.

If you can have some other options for Glow effects as follows, that is cool as many newbies don't know about those color options. Generally before using Glow, a poster must know it will have bad effects on Dark background.
Test
Test
Test
Test

Code:
[glow=lightgreen,2,300]Test[/glow]
[glow=lightyellow,2,300]Test[/glow]
[glow=lightcyan,2,300]Test[/glow]
[glow=lightpink,2,300]Test[/glow]
legendary
Activity: 2212
Merit: 7064
Cashback 15%
August 17, 2023, 02:59:41 PM
#3
The patch below removes the extra parameters (without breaking old posts), sets the default to [glow=yellow][/glow], updates/repairs the example on the help page, and changes the icon so that it's yellow instead of green ( ).
New patch already?
What happened with previous one you worked on for adding 2FA functionality in forum?
If this one is done in your free time than I don't mind, but better look for other more serious issues to fix Wink
legendary
Activity: 1638
Merit: 4508
**In BTC since 2013**
August 16, 2023, 03:42:16 PM
#2
It may be something simple, but it really is a resource that could be better used and not, a little because of the points you mentioned.

So congratulations on this patch. We will see if it will be accepted. Well done.  Wink
hero member
Activity: 510
Merit: 4005
August 16, 2023, 01:44:58 PM
#1
This one is pretty unexciting, but I like doing these seemingly-unimportant small improvements (they're quick to do and I believe that they add up over time).

The four problems with this tag (as I see it) are as follows:

1. When you click the "Glow" button on the toolbar, you get this: [glow=red,2,300][/glow]. I don't think red is a good default (mostly I see this tag used with yellow, Husires suggested changing the default last year, and I think that's a good suggestion).

2. The extra stuff after the color (,2,300) has to do with an ancient Microsoft-specific CSS filter, and the final parameter (,300) isn't actually wired up to anything.

3. The example on the help page is broken (because the pre-rendered HTML is based on the old Microsoft-specific CSS filter).

4. The toolbar button being green doesn't make much sense (maybe it did when this tag produced a true glow effect on Internet Explorer, but now all this tag does is set the background-color on a , so it makes more sense for it to match whatever the default color is, IMO).

The patch below removes the extra parameters (without breaking old posts), sets the default to [glow=yellow][/glow], updates/repairs the example on the help page, and changes the icon so that it's yellow instead of green ( ).

Code:
--- baseline/Sources/Subs.php 2011-09-17 21:59:55.000000000 +0000
+++ modified/Sources/Subs.php 2023-08-16 15:41:43.000000000 +0000
@@ -1273,20 +1273,27 @@
  'after' => '',
  ),
  array(
  'tag' => 'glow',
  'type' => 'unparsed_commas',
  'test' => '[#0-9a-zA-Z\-]{3,12},([012]\d{1,2}|\d{1,2})(,[^]]+)?\]',
  'before' => $context['browser']['is_ie'] ? '
' : '',
  'after' => $context['browser']['is_ie'] ? '
' : '',
  ),
  array(
+ 'tag' => 'glow',
+ 'type' => 'unparsed_equals',
+ 'test' => '(#[\da-fA-F]{3}|#[\da-fA-F]{6}|[A-Za-z]{1,12})\]',
+ 'before' => '',
+ 'after' => '
',
+ ),
+ array(
  'tag' => 'hr',
  'type' => 'closed',
  'content' => '
',
  'block_level' => true,
  ),
  array(
  'tag' => 'html',
  'type' => 'unparsed_content',
  'content' => '$1',
  'block_level' => true,

Code:
--- baseline/Themes/default/Post.template.php 2008-04-30 18:30:34.000000000 +0000
+++ modified/Themes/default/Post.template.php 2023-08-16 15:44:50.000000000 +0000
@@ -752,21 +752,21 @@
  // ]]>';
 
  // The below array makes it dead easy to add images to this page. Add it to the array and everything else is done for you!
  $context['bbc_tags'] = array();
  $context['bbc_tags'][] = array(
  'bold' => array('code' => 'b', 'before' => '[b]', 'after' => '[/b]', 'description' => $txt[253]),
  'italicize' => array('code' => 'i', 'before' => '[i]', 'after' => '[/i]', 'description' => $txt[254]),
  'underline' => array('code' => 'u', 'before' => '[u]', 'after' => '[/u]', 'description' => $txt[255]),
  'strike' => array('code' => 's', 'before' => '[s]', 'after' => '[/s]', 'description' => $txt[441]),
  array(),
- 'glow' => array('code' => 'glow', 'before' => '[glow=red,2,300]', 'after' => '[/glow]', 'description' => $txt[442]),
+ 'glow' => array('code' => 'glow', 'before' => '[glow=yellow]', 'after' => '[/glow]', 'description' => $txt[442]),
  'shadow' => array('code' => 'shadow', 'before' => '[shadow=red,left]', 'after' => '[/shadow]', 'description' => $txt[443]),
  'move' => array('code' => 'move', 'before' => '[move]', 'after' => '[/move]', 'description' => $txt[439]),
  array(),
  'pre' => array('code' => 'pre', 'before' => '[pre]', 'after' => '[/pre]', 'description' => $txt[444]),
  'left' => array('code' => 'left', 'before' => '[left]', 'after' => '[/left]', 'description' => $txt[445]),
  'center' => array('code' => 'center', 'before' => '[center]', 'after' => '[/center]', 'description' => $txt[256]),
  'right' => array('code' => 'right', 'before' => '[right]', 'after' => '[/right]', 'description' => $txt[446]),
  array(),
  'hr' => array('code' => 'hr', 'before' => '[hr]', 'description' => $txt[531]),
  array(),

Code:
--- baseline/Themes/default/Help.template.php 2006-12-01 03:25:52.000000000 +0000
+++ modified/Themes/default/Help.template.php 2023-08-16 15:48:08.000000000 +0000
@@ -1780,23 +1780,23 @@
  ', $txt['manual_posting_bbc_strike'], '
  ', $txt['manual_posting_strike_code'], '
  ', $txt['manual_posting_strike_output'], '
  ', $txt['manual_posting_strike_comment'], '
 
 
  ', $txt['manual_posting_bbc_glow'], '
  ', $txt['manual_posting_bbc_glow'], '
  ', $txt['manual_posting_glow_code'], '
 
-

+
  ', $txt['manual_posting_glow_output'], '
-

+
 
  ', $txt['manual_posting_glow_comment'], '
 
 
  ', $txt['manual_posting_bbc_shadow'], '
  ', $txt['manual_posting_bbc_shadow'], '
  ', $txt['manual_posting_shadow_code'], '
 
 

  ', $txt['manual_posting_shadow_output'], '

Code:
--- baseline/Themes/default/languages/Manual.english.php 2011-02-07 16:45:09.000000000 +0000
+++ modified/Themes/default/languages/Manual.english.php 2023-08-16 15:50:43.000000000 +0000
@@ -463,23 +463,23 @@
 $txt['manual_posting_italic_comment'] = '*';
 $txt['manual_posting_bbc_underline'] = 'Underline';
 $txt['manual_posting_underline_code'] = '[u]underline[/u]';
 $txt['manual_posting_underline_output'] = 'underline';
 $txt['manual_posting_underline_comment'] = '*';
 $txt['manual_posting_bbc_strike'] = 'Strikethrough';
 $txt['manual_posting_strike_code'] = '[s]strikethrough[/s]';
 $txt['manual_posting_strike_output'] = 'strikethrough';
 $txt['manual_posting_strike_comment'] = '*';
 $txt['manual_posting_bbc_glow'] = 'Glow';
-$txt['manual_posting_glow_code'] = '[glow=red,2,50]glow[/glow]';
+$txt['manual_posting_glow_code'] = '[glow=yellow]glow[/glow]';
 $txt['manual_posting_glow_output'] = 'glow';
-$txt['manual_posting_glow_comment'] = 'The three attributes (eg red, 2, 50) in the \'glow\' tag are color, strength and width respectively.';
+$txt['manual_posting_glow_comment'] = '*';
 $txt['manual_posting_bbc_shadow'] = 'Shadow';
 $txt['manual_posting_shadow_code'] = '[shadow=red,left]
shadow
[/shadow]';
 $txt['manual_posting_shadow_output'] = 'shadow';
 $txt['manual_posting_shadow_comment'] = 'The two attributes (eg red, left) in the \'shadow\' tag are color and direction respectively.';
 $txt['manual_posting_bbc_move'] = 'Marquee';
 $txt['manual_posting_move_code'] = '[move]move[/move]';
 $txt['manual_posting_move_output'] = 'move';
 $txt['manual_posting_move_comment'] = 'Not valid XHTML, but can also be used for images!';
 $txt['manual_posting_bbc_pre'] = 'Preformatted Text';
 $txt['manual_posting_pre_comment'] = 'Preserves critical text formatting, rendered in a monospace font.';

This is the command sequence I used to produce the yellow version of the toolbar icon from the original (the second command requires ImageMagick):

Code:
$ cp ./Themes/default/images/bbc/glow.gif ./Themes/default/images/bbc/glow_original.gif

Code:
$ convert-im6 ./Themes/default/images/bbc/glow_original.gif -color-matrix '0 1.33 0 0 1.33 0 0 0 0' ./Themes/default/images/bbc/glow.gif
Jump to: