From 40b99b2b10aeb38daa2ec9e2fc2ce7ec3dfb4335 Mon Sep 17 00:00:00 2001 From: hongweipeng <hongweichen8888@sina.com> Date: Wed, 27 May 2020 17:49:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B4=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Plugin.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Plugin.php b/Plugin.php index 585c28e..53e49f2 100644 --- a/Plugin.php +++ b/Plugin.php @@ -225,13 +225,15 @@ class MenuTree_Plugin implements Typecho_Plugin_Interface { $html = '<div class="in-page-preview-buttons in-page-preview-buttons-full-reader"><svg data-toggle="dropdown" aria-expanded="false" class="dropdown-toggle icon-list" version="1.1" id="tree_nav" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="104.5 -245.5 51 51" style="enable-background:new 104.5 -245.5 50 50;" xml:space="preserve"><path d="M130.895-218.312c-0.922,0-1.842-0.317-2.59-0.951l-11.01-9.352c-1.684-1.43-1.889-3.955-0.459-5.638c1.43-1.684,3.953-1.89,5.639-0.459l8.42,7.152l8.42-7.152c1.686-1.43,4.211-1.225,5.639,0.459c1.43,1.684,1.225,4.208-0.459,5.638l-11.01,9.352C132.738-218.628,131.816-218.312,130.895-218.312z M133.486-206.289l11.008-9.352c1.684-1.43,1.889-3.955,0.459-5.638c-1.43-1.682-3.955-1.89-5.639-0.458l-8.418,7.152l-8.422-7.152c-1.686-1.431-4.209-1.225-5.639,0.459c-1.43,1.684-1.225,4.208,0.461,5.638l11.012,9.352c0.746,0.634,1.668,0.951,2.588,0.951C131.818-205.337,132.74-205.654,133.486-206.289z"/></svg><div class="dropdown-menu theme pull-right theme-white keep-open" id="toc-list"><h3>内容目录</h3><hr><div class="table-of-contents"><div class="toc"><ul><li>'. self::buildMenuHtml( self::$tree ) .'</div></div></div></li></ul></div>'; $js = Helper::options()->pluginUrl . '/MenuTree/dropdown.js?v=' . self::$v; echo <<<HTML - <script src="{$js}"></script> - <script type="text/javascript"> - jQuery('body').append('$html'); - jQuery('.in-page-preview-buttons .dropdown-menu.keep-open').on('click', function (e) { + <script src="{$js}"></script> + <script type="text/javascript"> + (function($) { + $('body').append('$html'); + $('.in-page-preview-buttons .dropdown-menu.keep-open').on('click', function (e) { e.stopPropagation(); }); - </script> + })(jQuery); + </script> HTML; self::$id = 1; self::$tree = array();