diff --git a/css/global.css b/css/global.css index 4e7661f..9f5ab2b 100644 --- a/css/global.css +++ b/css/global.css @@ -82,6 +82,17 @@ hr { border-bottom-color: rgba(0, 0, 0, .5); } +.spoiler { + text-decoration: none; + color: transparent; + text-shadow: 0 0 10px #000000; +} + +.spoiler:hover { + color: inherit; + text-shadow: none; +} + .userdelete { float: right; text-align: center; diff --git a/imgboard.php b/imgboard.php index 1085eff..4ef73d9 100644 --- a/imgboard.php +++ b/imgboard.php @@ -333,6 +333,13 @@ if (!isset($_GET['delete']) && !isset($_GET['manage']) && (isset($_POST['name']) $post['message'] = preg_replace('/([^\s]{' . TINYIB_WORDBREAK . '})(?=[^\s])/', '$1' . TINYIB_WORDBREAK_IDENTIFIER, $post['message']); } $post['message'] = str_replace("\n", '
', makeLinksClickable(colorQuote(postLink(cleanString(rtrim($post['message'])))))); + + if (TINYIB_SPOILERTEXT) { + $post['message'] = preg_replace('/<s>(.*?)<\/s>/i', '$1', $post['message']); + $post['message'] = preg_replace('/<spoiler>(.*?)<\/spoiler>/i', '$1', $post['message']); + $post['message'] = preg_replace('/<spoilers>(.*?)<\/spoilers>/i', '$1', $post['message']); + } + if (TINYIB_WORDBREAK > 0) { $post['message'] = finishWordBreak($post['message']); } diff --git a/inc/defines.php b/inc/defines.php index 1520a31..c21ec3d 100644 --- a/inc/defines.php +++ b/inc/defines.php @@ -79,6 +79,12 @@ if (!defined('TINYIB_AUTOHIDE')) { if (!defined('TINYIB_REQMOD')) { define('TINYIB_REQMOD', ''); } +if (!defined('TINYIB_SPOILERTEXT')) { + define('TINYIB_SPOILERTEXT', false); +} +if (!defined('TINYIB_SPOILERIMAGE')) { + define('TINYIB_SPOILERIMAGE', false); +} if (!defined('TINYIB_AUTOREFRESH')) { define('TINYIB_AUTOREFRESH', 30); } diff --git a/settings.default.php b/settings.default.php index 6a091b9..c65d94e 100644 --- a/settings.default.php +++ b/settings.default.php @@ -30,6 +30,8 @@ define('TINYIB_MANAGECAPTCHA', ''); // Improve security by requiring users to define('TINYIB_REPORT', false); // Allow users to report posts define('TINYIB_AUTOHIDE', 0); // Amount of reports which will cause a post to be hidden until it is approved [0 to disable] define('TINYIB_REQMOD', ''); // Require moderation before displaying posts: files / all ['' to disable] +define('TINYIB_SPOILERTEXT', false); // Allow users to hide text until it is hovered over using the tags text here or text here +define('TINYIB_SPOILERIMAGE', false); // Allow users to blur thumbnails via a "Spoiler" checkbox define('TINYIB_AUTOREFRESH', 30); // Delay (in seconds) between attempts to refresh a thread automatically [0 to disable] define('TINYIB_CLOUDFLARE', false); // Only enable when the site is served via Cloudflare to identify IP addresses correctly define('TINYIB_DISALLOWTHREADS', ''); // When set, users attempting to post a new thread are shown this message instead ['' to disable]