From 9b0fdc5323cd62aa7e569ec9af84ff116e53409e Mon Sep 17 00:00:00 2001 From: yangjian Date: Sat, 6 Mar 2021 10:39:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=90=9C=E7=B4=A2=E7=BB=93=E6=9E=9C=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E7=AE=80=E6=98=93=E9=AB=98=E4=BA=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- static/mrdoc/mrdoc-docs.js | 37 +++++++++++++++++++++++++++++++++ template/app_doc/docs_base.html | 2 +- template/search/search.html | 2 +- 3 files changed, 39 insertions(+), 2 deletions(-) diff --git a/static/mrdoc/mrdoc-docs.js b/static/mrdoc/mrdoc-docs.js index 03c2fb5..121a3da 100644 --- a/static/mrdoc/mrdoc-docs.js +++ b/static/mrdoc/mrdoc-docs.js @@ -341,3 +341,40 @@ textBecomeImg = function(text,fontsize,fontcolor){ ### 文档阅读页面JavaScript函数和变量定义 ### ######################################################## */ + + // URL参数解析 + function getQueryVariable(variable) + { + var query = window.location.search.substring(1); + var vars = query.split("&"); + for (var i=0;i"+key+"", + num = -1, + rStr = new RegExp(key, "ig"), + rHtml = new RegExp("\<.*?\>","ig"), //匹配html元素 + aHtml = sText.match(rHtml); //存放html元素的数组 + sText = sText.replace(rHtml, '{~}'); //替换html标签 + // sText = sText.replace(rStr,sKey); //替换key + sText = sText.replace(rStr,function(text){ + return ""+text+"" + }); //替换key + sText = sText.replace(/{~}/g,function(){ //恢复html标签 + num++; + return aHtml[num]; + }); + oDiv.innerHTML = sText; + }; + keyLight('doc-content',getQueryVariable("highlight")) \ No newline at end of file diff --git a/template/app_doc/docs_base.html b/template/app_doc/docs_base.html index 7c59017..46388e5 100644 --- a/template/app_doc/docs_base.html +++ b/template/app_doc/docs_base.html @@ -187,7 +187,7 @@
{% endif %} -
+
diff --git a/template/search/search.html b/template/search/search.html index 056006e..8d6b6e4 100644 --- a/template/search/search.html +++ b/template/search/search.html @@ -187,7 +187,7 @@

- {% highlight result.object.name with query %} + {% highlight result.object.name with query %}

{% highlight result.object.pre_content with query %}