[fix #50] spoiler tags suck less now! wow

This commit is contained in:
Xkeeper 2018-11-04 15:54:15 -08:00
parent ff64c3cd2a
commit ffaaed9134
No known key found for this signature in database
GPG Key ID: 397C04773ABE4045
2 changed files with 23 additions and 2 deletions

View File

@ -54,3 +54,22 @@ input[type=radio] { color: black; background: white; }
max-height: 100%; max-height: 100%;
max-width: 100%; max-width: 100%;
} }
.spoiler-label:after { content: 'Spoiler'; color: white; background: black; font-style: italic; font-weight: bold; margin: 0 .2em; padding: 0.1em 0.4em; font-size: 80%; vertical-align: 10%; }
.spoiler > input[type="checkbox"] { display: none; }
.spoiler > .hidden { background: rgba(128, 128, 128, .5); }
.spoiler > input[type="checkbox"]:checked + .hidden {
background: unset;
}
.spoiler-b > .spoiler-label:after { width: 100%; display: block; margin: 0; vertical-align: unset; padding: 1em; box-sizing: border-box; content: 'Spoiler content - click to show/hide'; }
.spoiler-label:hover:after { background: #444; }
.spoiler-label:hover + input[type="checkbox"]:checked ~ .hidden { background: rgba(128, 128, 128, .5); }
.spoiler > .hidden > * {
visibility: hidden;
}
.spoiler > input[type="checkbox"]:checked + .hidden > * {
visibility: visible;
}

View File

@ -529,8 +529,10 @@ function doreplace2($msg, $options='0|0'){
$msg=str_replace('[/quote]','<hr></blockquote>',$msg); $msg=str_replace('[/quote]','<hr></blockquote>',$msg);
$msg=preg_replace("'\[sp=(.*?)\](.*?)\[/sp\]'si", '<span style="border-bottom: 1px dotted #f00;" title="did you mean: \\1">\\2</span>', $msg); $msg=preg_replace("'\[sp=(.*?)\](.*?)\[/sp\]'si", '<span style="border-bottom: 1px dotted #f00;" title="did you mean: \\1">\\2</span>', $msg);
$msg=preg_replace("'\[abbr=(.*?)\](.*?)\[/abbr\]'si", '<span style="border-bottom: 1px dotted;" title="\\1">\\2</span>', $msg); $msg=preg_replace("'\[abbr=(.*?)\](.*?)\[/abbr\]'si", '<span style="border-bottom: 1px dotted;" title="\\1">\\2</span>', $msg);
$msg=str_replace('[spoiler]','<div class="fonts pstspl2"><b>Spoiler:</b><div class="pstspl1">',$msg); $msg=str_replace('[spoiler]','<label class="spoiler spoiler-b"><div class="spoiler-label"></div><input type="checkbox"><div class="hidden"><div>',$msg);
$msg=str_replace('[/spoiler]','</div></div>',$msg); $msg=str_replace('[/spoiler]','</div></div></label>',$msg);
$msg=str_replace('[spoileri]','<label class="spoiler"><span class="spoiler-label"></span><input type="checkbox"><span class="hidden"><span>',$msg);
$msg=str_replace('[/spoileri]','</span></span></label>',$msg);
$msg=preg_replace("'\[(b|i|u|s)\]'si",'<\\1>',$msg); $msg=preg_replace("'\[(b|i|u|s)\]'si",'<\\1>',$msg);
$msg=preg_replace("'\[/(b|i|u|s)\]'si",'</\\1>',$msg); $msg=preg_replace("'\[/(b|i|u|s)\]'si",'</\\1>',$msg);
$msg=preg_replace("'\[img\](.*?)\[/img\]'si", '<img src=\\1>', $msg); $msg=preg_replace("'\[img\](.*?)\[/img\]'si", '<img src=\\1>', $msg);