]> git.mxchange.org Git - friendica.git/commitdiff
Use <details> tag for spoilers BCode
authorHypolite Petovan <hypolite@mrpetovan.com>
Fri, 13 Sep 2019 02:17:55 +0000 (22:17 -0400)
committerHypolite Petovan <hypolite@mrpetovan.com>
Fri, 13 Sep 2019 02:17:55 +0000 (22:17 -0400)
src/Content/Text/BBCode.php

index 65d037b83d2a4809f75ee188f1ab5ee6b678d7e6..02c9551027283d9b49f44b1e9a4b0f109deb924e 100644 (file)
@@ -1475,24 +1475,22 @@ class BBCode extends BaseObject
                $text = preg_replace("/\[font=(.*?)\](.*?)\[\/font\]/sm", "<span style=\"font-family: $1;\">$2</span>", $text);
 
                // Declare the format for [spoiler] layout
-               $SpoilerLayout = '<blockquote class="spoiler">$1</blockquote>';
+               $SpoilerLayout = '<details class="spoiler"><summary>' . L10n::t('Click to open/close') . '</summary>$1</details>';
 
                // Check for [spoiler] text
                // handle nested quotes
                $endlessloop = 0;
                while ((strpos($text, "[/spoiler]") !== false) && (strpos($text, "[spoiler]") !== false) && (++$endlessloop < 20)) {
-                       $text = preg_replace("/\[spoiler\](.*?)\[\/spoiler\]/ism", "$SpoilerLayout", $text);
+                       $text = preg_replace("/\[spoiler\](.*?)\[\/spoiler\]/ism", $SpoilerLayout, $text);
                }
 
-               // Check for [spoiler=Author] text
-
-               $t_wrote = L10n::t('$1 wrote:');
+               // Check for [spoiler=Title] text
 
                // handle nested quotes
                $endlessloop = 0;
                while ((strpos($text, "[/spoiler]")!== false)  && (strpos($text, "[spoiler=") !== false) && (++$endlessloop < 20)) {
                        $text = preg_replace("/\[spoiler=[\"\']*(.*?)[\"\']*\](.*?)\[\/spoiler\]/ism",
-                               "<br /><strong class=".'"spoiler"'.">" . $t_wrote . "</strong><blockquote class=".'"spoiler"'.">$2</blockquote>",
+                               '<details class="spoiler"><summary>$1</summary>$2</details>',
                                $text);
                }