Skip to content

Commit b2f5ddd

Browse files
committed
update search page
1 parent 2d789cc commit b2f5ddd

File tree

2 files changed

+52
-1
lines changed

2 files changed

+52
-1
lines changed

_layouts/default-layout.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114
refinement = "c/c++"
115115
}
116116
let refinementTag = refinement ? ("&refinement=" + refinement) : ""
117-
window.location.href = '/label-recognition/docs/search.html?q=' + $('#txtSearch').val() + refinementTag;
117+
window.location.href = '/label-recognition/docs/core/search.html?q=' + $('#txtSearch').val() + refinementTag;
118118
}
119119
})
120120
})

_layouts/search-page.html

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,57 @@ <h1>Search</h1>
306306
}
307307
})
308308

309+
$("body").delegate("#searchResult .gsc-resultsRoot a.gs-title", "click", function(e) {
310+
e.preventDefault();
311+
312+
var link = $(this).eq(0).data("ctorig")
313+
if (link.indexOf("capture-vision/docs") > 0) {
314+
var repoType = getRepoType("core", link);
315+
if (link.indexOf("?") > 0) {
316+
var arr = link.split("?")
317+
if(arr[1].indexOf("#") > 0) {
318+
var subArr = arr[1].split("#")
319+
link = link +"?product=dbr&repoType="+ repoType +"&" + arr[1]
320+
} else {
321+
link = link + "&product=dbr&repoType=" + repoType
322+
}
323+
} else {
324+
link = link + "?product=dbr&repoType=" + repoType
325+
}
326+
}
327+
window.location.href = link
328+
});
329+
330+
function getRepoType(defaultValue, link) {
331+
var lang = getCurrentUrlLang(link, true)
332+
var repoType = defaultValue
333+
if (lang) {
334+
if (lang == 'android' || lang == 'objectivec-swift') {
335+
repoType = "mobile"
336+
} else if (lang == 'javascript') {
337+
repoType = "web"
338+
} else if (lang == 'cplusplus' || lang == 'c' || lang == 'java' || lang == 'dotnet') {
339+
repoType = "server"
340+
} else {
341+
repoType = "core"
342+
}
343+
} else {
344+
if(link.indexOf("/docs/server/") > 0) {
345+
repoType = "server"
346+
}
347+
if (link.indexOf("/docs/core/") > 0) {
348+
repoType = "core"
349+
}
350+
if (link.indexOf("/docs/mobile") > 0) {
351+
repoType = "mobile"
352+
}
353+
if (link.indexOf("/docs/web/") > 0) {
354+
repoType = "web"
355+
}
356+
}
357+
return repoType
358+
}
359+
309360
</script>
310361

311362
{%- include livehelp.html -%}

0 commit comments

Comments
 (0)