From 08fcdbeab369fc0cf1de32623799f6c490120e54 Mon Sep 17 00:00:00 2001 From: Jenny Date: Fri, 14 Jul 2023 14:05:44 +0800 Subject: [PATCH 1/2] search page update --- _layouts/default-layout.html | 2 +- _layouts/search-page.html | 50 ++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 1 deletion(-) diff --git a/_layouts/default-layout.html b/_layouts/default-layout.html index d056598..2e00237 100644 --- a/_layouts/default-layout.html +++ b/_layouts/default-layout.html @@ -93,7 +93,7 @@ $('#txtSearch').keydown(function(e) { if (e.keyCode == 13) { - window.location.href = '/document-normalizer/docs/search.html?q=' + $('#txtSearch').val(); + window.location.href = '/document-normalizer/docs/core/search.html?q=' + $('#txtSearch').val(); } }) }) diff --git a/_layouts/search-page.html b/_layouts/search-page.html index 58a7c8f..b010304 100644 --- a/_layouts/search-page.html +++ b/_layouts/search-page.html @@ -203,6 +203,56 @@

Search

} }) + $("body").delegate("#searchResult .gsc-resultsRoot a.gs-title", "click", function(e) { + e.preventDefault(); + + var link = $(this).eq(0).data("ctorig") + if (link.indexOf("capture-vision/docs") > 0) { + var repoType = getRepoType("core", link); + if (link.indexOf("?") > 0) { + var arr = link.split("?") + if(arr[1].indexOf("#") > 0) { + var subArr = arr[1].split("#") + link = link +"?product=dbr&repoType="+ repoType +"&" + arr[1] + } else { + link = link + "&product=dbr&repoType=" + repoType + } + } else { + link = link + "?product=dbr&repoType=" + repoType + } + } + window.location.href = link + }); + + function getRepoType(defaultValue, link) { + var lang = getCurrentUrlLang(link, true) + var repoType = defaultValue + if (lang) { + if (lang == 'android' || lang == 'objectivec-swift') { + repoType = "mobile" + } else if (lang == 'javascript') { + repoType = "web" + } else if (lang == 'cplusplus' || lang == 'c' || lang == 'java' || lang == 'dotnet') { + repoType = "server" + } else { + repoType = "core" + } + } else { + if(link.indexOf("/docs/server/") > 0) { + repoType = "server" + } + if (link.indexOf("/docs/core/") > 0) { + repoType = "core" + } + if (link.indexOf("/docs/mobile") > 0) { + repoType = "mobile" + } + if (link.indexOf("/docs/web/") > 0) { + repoType = "web" + } + } + return repoType + } {%- include livehelp.html -%} From 43e43a59c0d88694470879db31d57385f07ae4a3 Mon Sep 17 00:00:00 2001 From: Jenny Date: Fri, 14 Jul 2023 14:10:54 +0800 Subject: [PATCH 2/2] Update search-page.html --- _layouts/search-page.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/_layouts/search-page.html b/_layouts/search-page.html index b010304..9f74638 100644 --- a/_layouts/search-page.html +++ b/_layouts/search-page.html @@ -213,12 +213,12 @@

Search

var arr = link.split("?") if(arr[1].indexOf("#") > 0) { var subArr = arr[1].split("#") - link = link +"?product=dbr&repoType="+ repoType +"&" + arr[1] + link = link +"?product=ddn&repoType="+ repoType +"&" + arr[1] } else { - link = link + "&product=dbr&repoType=" + repoType + link = link + "&product=ddn&repoType=" + repoType } } else { - link = link + "?product=dbr&repoType=" + repoType + link = link + "?product=ddn&repoType=" + repoType } } window.location.href = link