@@ -2,6 +2,8 @@ var DcvProducts = ["dlr", "dce", "ddn", "dcv", "dcp"]
22var isArchiveDocsLink = null
33var FullTreePageDoc = null
44var docsFolderName = "/docs/"
5+ var releasedDocsFolderName = "/docs/"
6+ var docsLangLatestVersion = null
57// #region about full tree
68async function PageCreateInit ( generateDocHead , needh3 = true , pageStartVer = undefined , useVersionTree = false ) {
79 await UrlReplace ( )
@@ -294,8 +296,6 @@ function FullTreeMenuList(generateDocHead, needh3 = true, pageStartVer = undefin
294296 var curProduct = getCurrentUrlProductName ( document . URL )
295297 var curLang = getCurrentUrlLang ( document . URL , true )
296298
297- //var productLatestVersion = getProductLangLatestVersion(product?product:curProduct, curLang)
298-
299299 if ( product && productVersion && curProduct != product ) {
300300 curPageVersion = ( productVersion == 'latest' ? 'latest_version' : productVersion )
301301 }
@@ -310,10 +310,6 @@ function FullTreeMenuList(generateDocHead, needh3 = true, pageStartVer = undefin
310310 isFindVersionTree = true
311311 findIndex = i
312312 }
313- // if (curPageVersion == "latest_version" && $(version_tree_list[i]).attr('id') == 'version_tree_' + productLatestVersion) {
314- // isFindVersionTree = true
315- // findIndex = i
316- // }
317313 }
318314 }
319315 $ ( '#fullTreeMenuListContainer' ) . html ( "" ) ;
@@ -891,8 +887,6 @@ function getDoumentName(product) {
891887 return 'license-server' ;
892888 case 'mrz' :
893889 return 'mrz-scanner' ;
894- case 'mds' :
895- return 'mobile-document-scanner' ;
896890 default :
897891 return '' ;
898892 }
@@ -927,8 +921,6 @@ function getCurrentUrlProductName(url = null) {
927921 return 'lts' ;
928922 case 'mrz-scanner' :
929923 return 'mrz' ;
930- case 'mobile-document-scanner' :
931- return 'mds' ;
932924 default :
933925 return '' ;
934926 }
@@ -1034,8 +1026,13 @@ function initCrumbs() {
10341026 $ ( crumbul [ 0 ] ) . append ( appendText ) ;
10351027 }
10361028
1037- $ ( "#versionNote" ) . hide ( ) ;
1038- transformRougeToPrism ( document . getElementById ( 'articleContent' ) ) ;
1029+ let productName = getUrlVars ( document . URL ) [ "product" ] || getCurrentUrlProductName ( document . URL ) ;
1030+ var firstItem = $ ( ".fullVersionInfo li:not(.hideLi)" ) . eq ( 0 )
1031+ if ( firstItem . text ( ) . toLowerCase ( ) != "latest version" ) {
1032+ let latestVersion = getProductLangLatestVersion ( productName , lang == "" ? "core" : lang , true )
1033+ $ ( "#versionNoteLatestVersion" ) . text ( `(${ latestVersion } )` ) ;
1034+ $ ( "#versionNoteOldVersion" ) . text ( "Version " + ( productName == "dbr" ? "10.x" : "2.x" ) ) ;
1035+ }
10391036}
10401037
10411038function UrlSearch ( docUrl , listUrl ) {
@@ -1261,22 +1258,43 @@ function titleCase(s) {
12611258 return ss && ss . length > 0 ? ss . join ( ' ' ) : "" ;
12621259}
12631260
1264- function getProductLangLatestVersion ( product , lang ) {
1261+ function getProductLangLatestVersion ( product , lang , isLatest = false ) {
1262+ let latestVersionList = curDocsLangVersion
1263+ if ( isLatest ) {
1264+ latestVersionList = docsLangLatestVersion
1265+ }
1266+ console . log ( "getProductLangLatestVersion" , latestVersionList )
12651267 lang = lang == "react-native" ? "reactNative" : lang
12661268 product = DcvProducts . indexOf ( product ) >= 0 ? "dcv" : product
1267- var productMatch = docsLangLatestVersion [ product ]
1269+ var productMatch = latestVersionList [ product ]
12681270 var langVersion = productMatch ? productMatch [ lang ] : null
12691271 return langVersion
12701272}
12711273
1274+ function getLatestVersionFile ( product , lang ) {
1275+ return fetch ( `${ location . origin } /${ getDoumentName ( product ) } /docs/${ getRepoTypeByLang ( lang , null ) } /assets/js/docsLangLatestVersion.js` ) . then ( response => {
1276+ if ( ! response . ok ) {
1277+ throw new Error ( 'NET Work Error: ' + response . status ) ;
1278+ }
1279+ return response . text ( )
1280+ } ) . then ( data => {
1281+ const getVariable = new Function ( `${ data } ; return typeof docsLangLatestVersion !== "undefined" ? docsLangLatestVersion : undefined;` ) ;
1282+ const variableValue = getVariable ( ) ;
1283+
1284+ if ( variableValue !== undefined ) {
1285+ return variableValue ;
1286+ } else {
1287+ return null ;
1288+ }
1289+ } ) . catch ( error => {
1290+ console . error ( 'Error fetching latest version file:' , error ) ;
1291+ return null
1292+ } )
1293+ }
1294+
12721295// 2025/06/25 add first archive version for dbr/dcv/mrz...
12731296function getProductLangFirstArchiveVersion ( product , lang = null ) {
12741297 return docsFirstArchiveVersion [ product ] ;
1275- // lang = lang == "react-native" ? "reactNative" : lang
1276- // product = DcvProducts.indexOf(product) >= 0 ? "dcv" : product
1277- // var productMatch = docsFirstArchiveVersion[product]
1278- // var langVersion = productMatch ? (lang ? productMatch[lang] : null) : null
1279- // return langVersion
12801298}
12811299
12821300function showPageContentInModal ( fetchUrl ) {
@@ -1467,11 +1485,12 @@ function onSubsetBtnLineClick(randomId, fromJS) {
14671485 $ ( `#${ randomId } ` ) . removeAttr ( "id" )
14681486}
14691487
1470- function transformRougeToPrism ( root = document ) {
1471- Prism . highlightAll ( ) ;
1472-
1473- var template2Objs = $ ( '.markdown-body .sample-code-prefix.template2 + blockquote' )
1474- for ( var i = 0 ; i < template2Objs . length ; i ++ ) {
1475- $ ( template2Objs [ i ] ) . find ( ">div" ) . eq ( 0 ) . addClass ( 'on' )
1488+ function getDocsFolderName ( product ) {
1489+ if ( product == "dbr" ) {
1490+ releasedDocsFolderName = "/docs/v2/"
1491+ return "/docs/v10/"
1492+ } else if ( product == "dcv" ) {
1493+ releasedDocsFolderName = "/docs/v10/"
1494+ return "/docs/v2/"
14761495 }
14771496}
0 commit comments