|
92 | 92 |
|
93 | 93 | <!-- for dcv --> |
94 | 94 | <script type="text/javascript"> |
95 | | - $(document).ready(function() { |
96 | | - |
| 95 | + $(document).ready(function(){ |
97 | 96 | $('#txtSearch').keydown(function(e) { |
98 | 97 | if (e.keyCode == 13) { |
99 | 98 | let lang = getCurrentUrlLang(document.URL, true) |
| 99 | + var searchUrl = getSearchUrl() |
100 | 100 | if (!lang || lang == '') { |
101 | | - window.location.href = '/capture-vision2/search.html?q=' + $('#txtSearch').val(); |
| 101 | + window.location.href = searchUrl + '?q=' + $('#txtSearch').val(); |
102 | 102 | } else if (lang == 'android' || lang == 'objectivec-swift') { |
103 | | - window.location.href = '/capture-vision2/search.html?refinement=mobile_native_app&q=' + $('#txtSearch').val(); |
| 103 | + window.location.href = searchUrl + '?refinement=mobile_native_app&q=' + $('#txtSearch').val(); |
104 | 104 | } else if (lang == 'javascript') { |
105 | | - window.location.href = '/capture-vision2/search.html?refinement=javascript_web&q=' + $('#txtSearch').val(); |
| 105 | + window.location.href = searchUrl + '?refinement=javascript_web&q=' + $('#txtSearch').val(); |
106 | 106 | } else if (lang == 'cplusplus' || lang == 'c') { |
107 | | - window.location.href = '/capture-vision2/search.html?refinement=c/c++&q=' + $('#txtSearch').val(); |
| 107 | + window.location.href = searchUrl + '?refinement=c/c++&q=' + $('#txtSearch').val(); |
108 | 108 | } else if (lang == 'java') { |
109 | | - window.location.href = '/capture-vision2/search.html?refinement=java&q=' + $('#txtSearch').val(); |
| 109 | + window.location.href = searchUrl + '?refinement=java&q=' + $('#txtSearch').val(); |
110 | 110 | } else if (lang == 'dotnet') { |
111 | | - window.location.href = '/capture-vision2/search.html?refinement=.net&q=' + $('#txtSearch').val(); |
| 111 | + window.location.href = searchUrl + '?refinement=.net&q=' + $('#txtSearch').val(); |
112 | 112 | } else { |
113 | | - window.location.href = '/capture-vision2/search.html?q=' + $('#txtSearch').val(); |
| 113 | + window.location.href = searchUrl + '?q=' + $('#txtSearch').val(); |
114 | 114 | } |
115 | 115 | } |
116 | 116 | }) |
117 | 117 | }) |
| 118 | + |
| 119 | + function getSearchUrl() { |
| 120 | + var searchUrl = ""; |
| 121 | + var product = getUrlVars(document.URL)["product"] |
| 122 | + var repoType = getUrlVars(document.URL)["repoType"] |
| 123 | + if (product) { |
| 124 | + product = getDoumentName(product) |
| 125 | + searchUrl += ("/" + product + "/docs") |
| 126 | + repoType = repoType && repoType == "js" ? "web" : repoType; |
| 127 | + if(repoType) { |
| 128 | + searchUrl += ("/" + repoType) |
| 129 | + } |
| 130 | + searchUrl += '/search.html' |
| 131 | + } else { |
| 132 | + searchUrl = '/capture-vision/docs/web/search.html' |
| 133 | + } |
| 134 | + return searchUrl |
| 135 | + } |
118 | 136 | </script> |
119 | 137 |
|
120 | 138 | <!-- Google Tag Manager --> |
|
0 commit comments