diff --git a/Packages/backups/2014-02-20_before_Spoiler-0.tar.gz b/Packages/backups/2014-02-20_before_Spoiler-0.tar.gz new file mode 100644 index 0000000..afea72a Binary files /dev/null and b/Packages/backups/2014-02-20_before_Spoiler-0.tar.gz differ diff --git a/Packages/installed.list b/Packages/installed.list index 5b8db9e..5958f50 100644 --- a/Packages/installed.list +++ b/Packages/installed.list @@ -1 +1 @@ -1391538735 \ No newline at end of file +1392908711 \ No newline at end of file diff --git a/Sources/ManageSettings.php b/Sources/ManageSettings.php index 6d75dbd..79ba7c8 100644 --- a/Sources/ManageSettings.php +++ b/Sources/ManageSettings.php @@ -453,6 +453,8 @@ function ModifyBasicSettings($return_config = false) $config_vars = array( // Big Options... polls, sticky, bbc.... array('select', 'pollMode', array($txt['disable_polls'], $txt['enable_polls'], $txt['polls_as_topics'])), + + array('select', 'defaultSpoilerStyle', array(1 => $txt['spoiler_tag_onhoverovershow'], 2 => $txt['spoiler_tag_onlinkclickshow'], 3 => $txt['spoiler_tag_onbuttonclickshow'])), '', // Basic stuff, titles, flash, permissions... array('check', 'allow_guestAccess'), diff --git a/Sources/Subs-Editor.php b/Sources/Subs-Editor.php index 036a0df..f41bab6 100644 --- a/Sources/Subs-Editor.php +++ b/Sources/Subs-Editor.php @@ -1674,6 +1674,14 @@ function create_control_richedit($editorOptions) 'after' => '[/quote]', 'description' => $txt['bbc_quote'] ), + + array( + 'image' => 'spoiler', + 'code' => 'spoiler', + 'before' => '[spoiler]', + 'after' => '[/spoiler]', + 'description' => $txt['bbc_spoiler'] + ), array(), array( 'image' => 'list', diff --git a/Sources/Subs.php b/Sources/Subs.php index 6876e86..db542e0 100644 --- a/Sources/Subs.php +++ b/Sources/Subs.php @@ -844,6 +844,87 @@ function shorten_subject($subject, $len) // Shorten it by the length it was too long, and strip off junk from the end. return $smcFunc['substr']($subject, 0, $len) . '...'; } +// Spoiler choosing function +function build_spoiler($position, $topic = '') +{ + global $txt, $settings, $context, $modSettings; + + // Optional topic if given + if($topic != '') + $topic = ': '.$topic; + + //Use global style if the theme-specific isn't set or is set to "follow global" (aka 0) + $spoilerTagStyle = isset($settings['spoiler_style']) ? $settings['spoiler_style'] : 0; + if($spoilerTagStyle == 0) + { + //Use "hover" if the global style isn't explicitly set + $spoilerTagStyle = isset($modSettings['defaultSpoilerStyle']) ? $modSettings['defaultSpoilerStyle'] : 1; + } + + /* + Styles: + 3: button + 2: link + 1: hover (default) + */ + $retval = ''; + + switch($position) + { + case 'before': + switch($spoilerTagStyle) + { + case 3: + $retval = ( + '
'. + ' '. + $txt['spoiler_tag_click_info'].'