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