Skip to content

Commit dbfc329

Browse files
Merge pull request #65 from dynamsoft-docs/Jenny
search page update
2 parents a482868 + 43e43a5 commit dbfc329

File tree

2 files changed

+51
-1
lines changed

2 files changed

+51
-1
lines changed

_layouts/default-layout.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393

9494
$('#txtSearch').keydown(function(e) {
9595
if (e.keyCode == 13) {
96-
window.location.href = '/document-normalizer/docs/search.html?q=' + $('#txtSearch').val();
96+
window.location.href = '/document-normalizer/docs/core/search.html?q=' + $('#txtSearch').val();
9797
}
9898
})
9999
})

_layouts/search-page.html

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,56 @@ <h1>Search</h1>
203203
}
204204
})
205205

206+
$("body").delegate("#searchResult .gsc-resultsRoot a.gs-title", "click", function(e) {
207+
e.preventDefault();
208+
209+
var link = $(this).eq(0).data("ctorig")
210+
if (link.indexOf("capture-vision/docs") > 0) {
211+
var repoType = getRepoType("core", link);
212+
if (link.indexOf("?") > 0) {
213+
var arr = link.split("?")
214+
if(arr[1].indexOf("#") > 0) {
215+
var subArr = arr[1].split("#")
216+
link = link +"?product=ddn&repoType="+ repoType +"&" + arr[1]
217+
} else {
218+
link = link + "&product=ddn&repoType=" + repoType
219+
}
220+
} else {
221+
link = link + "?product=ddn&repoType=" + repoType
222+
}
223+
}
224+
window.location.href = link
225+
});
226+
227+
function getRepoType(defaultValue, link) {
228+
var lang = getCurrentUrlLang(link, true)
229+
var repoType = defaultValue
230+
if (lang) {
231+
if (lang == 'android' || lang == 'objectivec-swift') {
232+
repoType = "mobile"
233+
} else if (lang == 'javascript') {
234+
repoType = "web"
235+
} else if (lang == 'cplusplus' || lang == 'c' || lang == 'java' || lang == 'dotnet') {
236+
repoType = "server"
237+
} else {
238+
repoType = "core"
239+
}
240+
} else {
241+
if(link.indexOf("/docs/server/") > 0) {
242+
repoType = "server"
243+
}
244+
if (link.indexOf("/docs/core/") > 0) {
245+
repoType = "core"
246+
}
247+
if (link.indexOf("/docs/mobile") > 0) {
248+
repoType = "mobile"
249+
}
250+
if (link.indexOf("/docs/web/") > 0) {
251+
repoType = "web"
252+
}
253+
}
254+
return repoType
255+
}
206256
</script>
207257

208258
{%- include livehelp.html -%}

0 commit comments

Comments
 (0)