Skip to content

Commit

Permalink
Merge pull request #99 from dynamsoft-docs/preview
Browse files Browse the repository at this point in the history
update to internal commit f419eb5a
  • Loading branch information
Jenny-Jiani authored Jul 9, 2024
2 parents a40dc43 + 5b96c80 commit 6156423
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 3 deletions.
19 changes: 19 additions & 0 deletions assets/js/historymanage-two.js
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,25 @@ function findNearestVersion(ver) {
if (verDiff) {return bestVer} else {return "latest"}
}

function getCurrentUrlProductName(url=null) {
url = url ? url.replace("https://", "") : null
url = url ? url.replace("http://", "") : null
var currentPath = url ? url.replace(url.split('/')[0], "") : document.location.pathname
currentPath = currentPath.slice(1, currentPath.length)
var productParam = currentPath.split('/')[0]
switch (productParam) {
case 'web-twain': return 'dwt';
case 'barcode-reader': return 'dbr';
case 'label-recognition': return 'dlr';
case 'camera-enhancer': return 'dce';
case 'code-parser': return 'dcp';
case 'document-normalizer': return 'ddn';
case 'capture-vision': return 'dcv';
case 'mobile-web-capture': return 'mwc';
default: return '';
}
}


window.addEventListener("popstate", function(e) {
findCurLinkOnFullTree({href: location.href}, location.href, true, true)
Expand Down
2 changes: 1 addition & 1 deletion assets/js/historymanage-two.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

63 changes: 62 additions & 1 deletion assets/js/index-banner-two.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,4 +256,65 @@ function showSelectMultiPanel(nextSiblings, findItemIndex, needh3) {
// $(sidebarList[i]).hide()
// }
// }
}
}

function getCurrentUrlLang(url, needFilterLang=false) {
if (getUrlVars(url)["lang"] || getUrlVars(url)["src"]) {
var result = ""
if (!getUrlVars(url)["lang"]) {
result = getUrlVars(url)["src"]
} else {
result = getUrlVars(url)["lang"].toLowerCase().trim().split(",")[0]
}
if (result == "js") {
result = "javascript"
}
if (result == "ios" || result == "objective-c" || result == "objc" || result == "swift") {
result = "objectivec-swift"
}
if (result == "c++" || result == "cpp") {
result = "cplusplus"
}
if (result == "c") {
result = "c"
}
if(result == 'csharp') {
result = "dotnet"
}
return result
}
let reporType = getCurrentUrlRepoType(url)
if (reporType == "server" || reporType == "mobile" || needFilterLang) {
if (url.indexOf("/c-cplusplus/") > 0) {
if (getUrlVars(url)["src"]) {
var src = getUrlVars(url)["src"].toLowerCase().trim()
if (src == "c") {
return "c"
} else if (src == "cplusplus" || src == "cpp") {
return "cplusplus"
} else {
return "c"
}
} else {
return "c"
}
} else {
var arr = []
if (reporType == "server" && url.split("/docs/server/").length > 1) {
arr = url.split("/docs/server/")[1].split("/")
}
if (reporType == "mobile" && url.split("/docs/mobile/").length > 1) {
arr = url.split("/docs/mobile/")[1].split("/")
}
if (reporType == "mobile" && ["objectivec-swift", "android", "xamarin", "react-native", "flutter", "cordova", "maui"].indexOf(arr[1]) < 0) {
return "objectivec-swift"
} else if (reporType == "web" || reporType == "js") {
return "javascript"
} else {
return arr.length > 1 ? arr[1] : ''
}
}
} else {
return ""
}
}
Loading

0 comments on commit 6156423

Please sign in to comment.