@@ -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