Skip to content

Commit ca2e10c

Browse files
authored
Merge pull request #8 from dynamsoft-docs/main
synchronize changes from main
2 parents 2fc64db + a5602f4 commit ca2e10c

File tree

2 files changed

+29
-63
lines changed

2 files changed

+29
-63
lines changed

_layouts/default-layout.html

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -92,29 +92,47 @@
9292

9393
<!-- for dcv -->
9494
<script type="text/javascript">
95-
$(document).ready(function() {
96-
95+
$(document).ready(function(){
9796
$('#txtSearch').keydown(function(e) {
9897
if (e.keyCode == 13) {
9998
let lang = getCurrentUrlLang(document.URL, true)
99+
var searchUrl = getSearchUrl()
100100
if (!lang || lang == '') {
101-
window.location.href = '/capture-vision2/search.html?q=' + $('#txtSearch').val();
101+
window.location.href = searchUrl + '?q=' + $('#txtSearch').val();
102102
} 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();
104104
} 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();
106106
} 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();
108108
} 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();
110110
} 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();
112112
} else {
113-
window.location.href = '/capture-vision2/search.html?q=' + $('#txtSearch').val();
113+
window.location.href = searchUrl + '?q=' + $('#txtSearch').val();
114114
}
115115
}
116116
})
117117
})
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+
}
118136
</script>
119137

120138
<!-- Google Tag Manager -->

_layouts/search-page.html

Lines changed: 2 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@
122122
<div class="row">
123123
<div class="col-xs-12">
124124
<h1>Search</h1>
125-
<script async src="https://cse.google.com/cse.js?cx=32039cdf85bc7ae2b"></script>
125+
<script async src="https://cse.google.com/cse.js?cx=b5ca9ca31b6a640a2"></script>
126126
<div class="gcse-search"></div>
127127
</div>
128128
</div>
@@ -139,26 +139,6 @@ <h1>Search</h1>
139139
{%- include page_footer.html -%}
140140
</div>
141141

142-
<script src="https://cdnjs.cloudflare.com/ajax/libs/anchor-js/4.1.0/anchor.min.js"
143-
integrity="sha256-lZaRhKri35AyJSypXXs4o6OPFTbTmUoltBbDCbdzegg=" crossorigin="anonymous"></script>
144-
<script>anchors.add();</script>
145-
146-
{%- if page.needAutoGenerateSidebar -%}
147-
{%- unless page.needGenerateH3Content -%}
148-
<script>
149-
FullTreeMenuList(true, false);
150-
</script>
151-
{%- else -%}
152-
<script>
153-
FullTreeMenuList(true);
154-
</script>
155-
{%- endunless -%}
156-
{%- else -%}
157-
<script>
158-
FullTreeMenuList(false);
159-
</script>
160-
{%- endif -%}
161-
162142
<script type="text/javascript">
163143
$('#sideBarCnt').css({'width': $('.sideBar').width() + 'px'})
164144
$('.container .head').css({'width': $('.docContainer').width() + 'px'})
@@ -218,39 +198,7 @@ <h1>Search</h1>
218198
}
219199
}
220200
}
221-
222-
$('.sideBarIcon').click(function() {
223-
$(".sideBar").toggleClass('hide-sm');
224-
$(".sideBar").toggleClass('hide-xs');
225-
setTimeout(function() {
226-
$('#sideBarCnt').css({'width': $('.sideBar').width() + 'px'})
227-
}, 100)
228-
})
229-
230-
// let timeInt = setInterval(function() {
231-
// var container = $('#sideBarCnt'), scrollTo = $('#sideBarCnt .activeLink');
232-
// if (scrollTo.length>0) {
233-
// container.scrollTop(
234-
// scrollTo.offset().top - container.offset().top + container.scrollTop()
235-
// );
236-
// clearInterval(timeInt)
237-
// }
238-
// }, 500)
239-
240-
function onSearchFinish(e) {
241-
var evt = window.event || e;
242-
if (evt.keyCode == 13) {
243-
244-
}
245-
}
246-
247-
$('#txtSearch').keydown(function(e) {
248-
if (e.keyCode == 13) {
249-
window.location.href = '/barcode-reader/search.html?q=' + $('#txtSearch').val()
250-
}
251-
})
252-
253-
</script>
201+
</script>
254202

255203
{%- include livehelp.html -%}
256204
</body>

0 commit comments

Comments
 (0)