diff --git a/Plugin.php b/Plugin.php index b0eae90..7780527 100644 --- a/Plugin.php +++ b/Plugin.php @@ -2,12 +2,15 @@ /** * 文章目录树 * - * @package MenuTree + * @package MenuTree * @author hongweipeng - * @version 0.6.1 + * @version 0.7.0 * @link https://www.hongweipeng.com */ class MenuTree_Plugin implements Typecho_Plugin_Interface { + + public static $v = '0.7.0'; + /** * 索引ID */ @@ -56,6 +59,11 @@ class MenuTree_Plugin implements Typecho_Plugin_Interface { ), 1, _t('是否引入jQuery'), _t('此插件需要jQuery,如已有选择不引入避免引入多余jQuery')); $form->addInput($jq_import->addRule('enum', _t('必须选择一个模式'), array(0, 1))); + $hidden_set = new Typecho_Widget_Helper_Form_Element_Radio('hidden_no_title', array( + 0 => _t('否'), + 1 => _t('是') + ), 0, _t('文章无标题时隐藏'), _t('文章中无h1、h2、h3...时隐藏')); + $form->addInput($hidden_set->addRule('enum', _t('必须选择一个模式'), array(0, 1))); } @@ -189,7 +197,7 @@ class MenuTree_Plugin implements Typecho_Plugin_Interface { if (!self::is_content()) { return; } - $cssUrl = Helper::options()->pluginUrl . '/MenuTree/menutree.css'; + $cssUrl = Helper::options()->pluginUrl . '/MenuTree/menutree.css?v=' . self::$v; echo ''; } @@ -205,8 +213,12 @@ class MenuTree_Plugin implements Typecho_Plugin_Interface { echo ''; } - $html = '
'; - $js = Helper::options()->pluginUrl . '/MenuTree/dropdown.js'; + if (empty(self::$tree) && Helper::options()->plugin('MenuTree')->hidden_no_title) { + return; + } + + $html = ''; + $js = Helper::options()->pluginUrl . '/MenuTree/dropdown.js?v=' . self::$v; echo <<