From d795ca0957191be8fa2073d9779a3d74d04a5cae Mon Sep 17 00:00:00 2001 From: HongWeipeng Date: Thu, 13 Feb 2020 20:34:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=87=E7=AB=A0=E6=97=A0=E6=A0=87=E9=A2=98?= =?UTF-8?q?=E6=97=B6=E5=8F=AF=E9=9A=90=E8=97=8F=E9=80=89=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Plugin.php | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) 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 <<