update [code] and [img] tags

[close #52] [code] changes
[close #51] [img] changes
This commit is contained in:
Xkeeper 2018-12-11 14:26:35 -08:00
parent 17e04a55bc
commit e3bb327a21
No known key found for this signature in database
GPG Key ID: 397C04773ABE4045
3 changed files with 27 additions and 12 deletions

View File

@ -18,16 +18,17 @@ img { border:none; }
.center {text-align:center} .center {text-align:center}
.right {text-align:right} .right {text-align:right}
/* Make code blocks scroll instead of stretching the page */ /* Make code blocks slightly less likely to go haywire, since apparently
code { "don't stretch the entire gat dang page" is not possible in HTML, lol */
overflow: auto; .code pre {
max-width: 100%;
width: 100%; width: 100%;
white-space: pre; overflow-x: auto;
display: block; white-space: pre-wrap;
} }
/* "Fix" for auto-generated <br> tags in <code> and <pre> blocks */ /* "Fix" for auto-generated <br> tags in <pre> blocks */
code br, pre br { display: none; } pre br { display: none; }
/* Make radio buttons look not terrible */ /* Make radio buttons look not terrible */
input[type=radio] { color: black; background: white; } input[type=radio] { color: black; background: white; }
@ -73,3 +74,5 @@ input[type=radio] { color: black; background: white; }
.spoiler > input[type="checkbox"]:checked + .hidden > * { .spoiler > input[type="checkbox"]:checked + .hidden > * {
visibility: visible; visibility: visible;
} }
.imgtag { max-width: 100%; }

View File

@ -25,9 +25,20 @@ div.lastpost { font-size: 90%; text-align: right !important; }
.center, center { text-align: center; } .center, center { text-align: center; }
.right { text-align: right; } .right { text-align: right; }
code { overflow: auto; width: 100%; white-space: pre; display: block; } /* Make code blocks slightly less likely to go haywire, since apparently
code br { display: none; } "don't stretch the entire gat dang page" is not possible in HTML, lol */
.code pre {
max-width: 100%;
width: 100%;
overflow-x: auto;
white-space: pre-wrap;
}
/* "Fix" for auto-generated <br> tags in <pre> blocks */
pre br { display: none; }
.pstspl1 {opacity:0;} .pstspl1 {opacity:0;}
.pstspl1:hover {opacity:1;} .pstspl1:hover {opacity:1;}
.pstspl2 {background:#000;color:#FFF;display:block;} .pstspl2 {background:#000;color:#FFF;display:block;}
.imgtag { max-width: 100%; }

View File

@ -486,7 +486,8 @@ function escape_codeblock($text) {
$list2 = array("", "", "&lt;", "\"", "\\", "\'", "&#91;", "&#58;", "&#41;", "&#95;"); $list2 = array("", "", "&lt;", "\"", "\\", "\'", "&#91;", "&#58;", "&#41;", "&#95;");
// @TODO why not just use htmlspecialchars() or htmlentities() // @TODO why not just use htmlspecialchars() or htmlentities()
return "[quote]<code>". str_replace($list, $list2, $text[0]) ."</code>[/quote]"; //return "<blockquote class='code'><hr><pre><code>". str_replace($list, $list2, $text[0]) ."</code></pre><hr></blockquote>";
return "<blockquote class='code'><hr><pre><code>". str_replace($list, $list2, $text[0]) ."</code></pre><hr></blockquote>";
} }
function doreplace2($msg, $options='0|0'){ function doreplace2($msg, $options='0|0'){
@ -535,7 +536,7 @@ function doreplace2($msg, $options='0|0'){
$msg=str_replace('[/spoileri]','</span></span></label>',$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 class="imgtag" src=\\1>', $msg);
$msg=preg_replace("'\[url\](.*?)\[/url\]'si", '<a href=\\1>\\1</a>', $msg); $msg=preg_replace("'\[url\](.*?)\[/url\]'si", '<a href=\\1>\\1</a>', $msg);
$msg=preg_replace("'\[url=(.*?)\](.*?)\[/url\]'si", '<a href=\\1>\\2</a>', $msg); $msg=preg_replace("'\[url=(.*?)\](.*?)\[/url\]'si", '<a href=\\1>\\2</a>', $msg);
$msg=str_replace('http://nightkev.110mb.com/justus_layout.css','about:blank',$msg); $msg=str_replace('http://nightkev.110mb.com/justus_layout.css','about:blank',$msg);