From 69d913bf7f8babd450b8dac3ab495f213595ea3b Mon Sep 17 00:00:00 2001 From: Jenny Date: Fri, 17 Nov 2023 10:08:53 +0800 Subject: [PATCH] minor update --- assets/js/historymanage-two.js | 7 +++++-- assets/js/historymanage-two.min.js | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/assets/js/historymanage-two.js b/assets/js/historymanage-two.js index 4d97948..2b47c73 100644 --- a/assets/js/historymanage-two.js +++ b/assets/js/historymanage-two.js @@ -193,8 +193,11 @@ function RequestNewPage(aTag, paramLink, onlyLoadContent=false) { if (hash && $("#" + hash).length > 0) { var scrollTop = $("#" + hash).offset().top setTimeout(function() { - window.scrollTo(0, scrollTop) - //$("a[href='#"+hash+"']").click() + if ($("a[href='#"+hash+"']").length > 0) { + $("a[href='#"+hash+"']").click() + } else { + window.scrollTo(0, scrollTop) + } }, 200) } else { if (sd > 0) { diff --git a/assets/js/historymanage-two.min.js b/assets/js/historymanage-two.min.js index 3f711e0..0f3ea2f 100644 --- a/assets/js/historymanage-two.min.js +++ b/assets/js/historymanage-two.min.js @@ -1 +1 @@ -function UrlReplace(){var e=document.URL,n=getUrlVars(e).ver,t=getUrlVars(e).matchVer,i="/v17.2.1/";if(null!=n&&"latest"!=n){var l=findNearestVersion(n);if("latest"!=l&&l!=n){var a=e.replace(n,l);a.indexOf("/docs/")>0&&(a=a.replace("/docs/","/docs-archive"+i),window.location.replace(a))}}null==t&&null!=n&&"latest"!=n&&e.indexOf("/docs/")>0&&(e=e.replace("/docs/","/docs-archive"+i),window.location.replace(e))}function allHerfClick(e,n){return addParam(e),!1}function GetVersionDiff(e,n){if("latest"==n)return 100;if(n=0?(o/=10,l+=o*f):(l-=o,o/=10,l+=o*(f+10))}return l}function addParam(e,n=null,t=!1){if($(e).hasClass("fullUrl"))window.location.href=e.href;else{var i=e.href,l=i;if(""!=i)if("sidebar"==n){var a=document.URL.split("/docs/")[0]+"/docs/";if(e.href.indexOf(a)<0)return void(window.location.href=e.href);$(e).hasClass("activeLink")||RequestNewPage(e,l)}else"docContainer"==n?"_blank"==e.target?window.open(l):findCurLinkOnFullTree(e,l):"_blank"==e.target?window.open(l):window.location.href=l}}function RequestNewPage(e,n,t=!1){$("#articleContent").addClass("hidden"),$("#loadingContent").show(),fetch(e.href).then(function(e){return e.text()}).then(function(i){document.title=$(i)[1].innerText,!t&&history.pushState(null,null,n);for(var l=0;l<$("#fullTreeMenuListContainer .activeLink").parents("li").length;l++){var a=$("#fullTreeMenuListContainer .activeLink").parents("li")[l];$(a).hasClass("hasActiveLinkList")&&$(a).removeClass("hasActiveLinkList")}$("#fullTreeMenuListContainer .activeLink").removeClass("activeLink"),$(e).addClass("activeLink"),$(e).parents("li.collapseListStyle").length>0&&($(e).parents("li.collapseListStyle").addClass("expandListStyle").removeClass("collapseListStyle"),$(e).parents("li.expandListStyle").find(" > ul").slideDown()),$(e).parents("li.expandListStyle").addClass("hasActiveLinkList");var o=$("#articleContent").hasClass("showRightSideMenu");$("#articleContent").html($(i).find("#articleContent").html()).removeClass("hidden"),o||$("#articleContent").find(".rightSideMenu, .markdown-body").removeClass("showRightSideMenu"),$("#loadingContent").hide(),needh3=1==$(i).find("#articleContent").data("needh3");var r=document.getElementsByClassName("mainPage")[0];if(r.scrollHeight>r.clientHeight){var s=$(".activeLink").offset().top-$(".mainPage").offset().top;s-r.scrollTop+40>r.clientHeight&&(r.scrollTop=s-200)}$(".headCounter").hasClass("noTitleIndex")?$("#AutoGenerateSidebar").addClass("noTitleIndex"):$("#AutoGenerateSidebar").removeClass("noTitleIndex");var d=$(i).find("#docHead").find(".iconsBox a")[0].href;$("#docHead .iconsBox a").attr("href",d);var f=$("#articleContent").find("a");for(l=0;l0&&GenerateContentByHead(!1),$("#crumbs > ul").html($("#crumbs > ul > li").eq(0)),initCrumbs();var c=$(".markdown-body .highlight pre");for(l=0;l1?n.split("#")[1].toLowerCase():null,p=$(window).scrollTop();if(u&&$("#"+u).length>0){var v=$("#"+u).offset().top;setTimeout(function(){window.scrollTo(0,v)},200)}else if(p>0){v=p>$("#overall-header").height()?$("#overall-header").height():p;setTimeout(function(){window.scrollTo(0,v)},200)}let m=$(".multi-panel-switching-prefix");for(let e=0;e li"),t=0;if(u&&""!=u)for(let e=0;e li").on("click",function(){$(this).parent("ul").find("li").removeClass("on"),$(this).addClass("on");let e=$(this).parent("ul").find("~");showSelectMultiPanel(e,$(this).index())}),$(".markdown-body .sample-code-prefix").length>0&&getUrlVars(document.URL).lang){var w=getUrlVars(document.URL).lang.toLowerCase().trim().split(",");w&&(1==w.length?sampleCodeSingleLangInit(w[0]):sampleCodeLangsInit(w))}else if($(".markdown-body .sample-code-prefix").length>0){$(".markdown-body .sample-code-prefix + blockquote > ul > li:first-child").addClass("on"),$(".markdown-body .sample-code-prefix + blockquote > ol > li:first-child").addClass("on");var g=$(".markdown-body .sample-code-prefix.template2 + blockquote");for(l=0;ldiv").eq(0).addClass("on")}anchors.add()})}function findCurLinkOnFullTree(e,n,t=!1){var i=$("#fullTreeMenuListContainer").find("a"),l=e.href.toLowerCase(),a=document.URL.toLowerCase();if(l=l.indexOf("?")>0?l.split("?")[0]:l.indexOf("#")>0?l.split("#")[0]:l,a=a.indexOf("?")>0?a.split("?")[0]:a.indexOf("#")>0?a.split("#")[0]:a,a==l&&(e.href.split("#").length>1||document.URL.split("#").length>1)){var o=e.href.split("#").length>1?e.href.split("#")[1].toLowerCase():null,r=o&&$("#"+o).length>0?$("#"+o).offset().top:0;setTimeout(function(){window.scrollTo(0,r)},200),!t&&history.pushState(null,null,n)}else{for(var s=!1,d=0;d0?f.replace("index.html",""):f,l=l.indexOf("index.html")>0?l.replace("index.html",""):l,f=f.indexOf("?")>0?f.split("?")[0]:f.indexOf("#")>0?f.split("#")[0]:f,f&&f.toLowerCase()==l&&(s=!0,RequestNewPage(i[d],n,t))}s||(window.location.href=n)}}function changeVersion(e){var n=e.innerText.toLowerCase(),t=null;t=n.indexOf("latest version")>=0?"latest":n.replace("version ","");var i=document.URL,l="/v"+t+"/";if(i.indexOf("web-twain/docs/")>0&&GetVersionDiff("17.2.1",t)<0&&(l="/v17.2.1/"),(i.indexOf("web-twain/docs/")>0||i.indexOf("remote-scan/docs/")>0)&&"latest"==t)window.location.href=i;else{i=i.replace("/docs/","/docs-archive"+l);var a=getUrlVars(i).src,o=void 0;-1!=i.indexOf("#")&&(o=i.split("#").pop()),-1!=i.indexOf("?")&&(i=i.substring(0,i.indexOf("?"))),-1!=i.indexOf("#")&&(i=i.substring(0,i.indexOf("#"))),i=i+"?ver="+t+"&&cVer=true",null!=a&&(i=i+"&&src="+a),null!=o&&(i=i+"#"+o),window.location.href=i}}function findNearestVersion(e){for(var n=$(".fullVersionInfo li"),t=e,i=null,l=0;l=0&&(o0&&(a=a.replace("/docs/","/docs-archive"+i),window.location.replace(a))}}null==t&&null!=n&&"latest"!=n&&e.indexOf("/docs/")>0&&(e=e.replace("/docs/","/docs-archive"+i),window.location.replace(e))}function allHerfClick(e,n){return addParam(e),!1}function GetVersionDiff(e,n){if("latest"==n)return 100;if(n=0?(o/=10,l+=o*f):(l-=o,o/=10,l+=o*(f+10))}return l}function addParam(e,n=null,t=!1){if($(e).hasClass("fullUrl"))window.location.href=e.href;else{var i=e.href,l=i;if(""!=i)if("sidebar"==n){var a=document.URL.split("/docs/")[0]+"/docs/";if(e.href.indexOf(a)<0)return void(window.location.href=e.href);$(e).hasClass("activeLink")||RequestNewPage(e,l)}else"docContainer"==n?"_blank"==e.target?window.open(l):findCurLinkOnFullTree(e,l):"_blank"==e.target?window.open(l):window.location.href=l}}function RequestNewPage(e,n,t=!1){$("#articleContent").addClass("hidden"),$("#loadingContent").show(),fetch(e.href).then(function(e){return e.text()}).then(function(i){document.title=$(i)[1].innerText,!t&&history.pushState(null,null,n);for(var l=0;l<$("#fullTreeMenuListContainer .activeLink").parents("li").length;l++){var a=$("#fullTreeMenuListContainer .activeLink").parents("li")[l];$(a).hasClass("hasActiveLinkList")&&$(a).removeClass("hasActiveLinkList")}$("#fullTreeMenuListContainer .activeLink").removeClass("activeLink"),$(e).addClass("activeLink"),$(e).parents("li.collapseListStyle").length>0&&($(e).parents("li.collapseListStyle").addClass("expandListStyle").removeClass("collapseListStyle"),$(e).parents("li.expandListStyle").find(" > ul").slideDown()),$(e).parents("li.expandListStyle").addClass("hasActiveLinkList");var o=$("#articleContent").hasClass("showRightSideMenu");$("#articleContent").html($(i).find("#articleContent").html()).removeClass("hidden"),o||$("#articleContent").find(".rightSideMenu, .markdown-body").removeClass("showRightSideMenu"),$("#loadingContent").hide(),needh3=1==$(i).find("#articleContent").data("needh3");var r=document.getElementsByClassName("mainPage")[0];if(r.scrollHeight>r.clientHeight){var s=$(".activeLink").offset().top-$(".mainPage").offset().top;s-r.scrollTop+40>r.clientHeight&&(r.scrollTop=s-200)}$(".headCounter").hasClass("noTitleIndex")?$("#AutoGenerateSidebar").addClass("noTitleIndex"):$("#AutoGenerateSidebar").removeClass("noTitleIndex");var d=$(i).find("#docHead").find(".iconsBox a")[0].href;$("#docHead .iconsBox a").attr("href",d);var f=$("#articleContent").find("a");for(l=0;l0&&GenerateContentByHead(!1),$("#crumbs > ul").html($("#crumbs > ul > li").eq(0)),initCrumbs();var c=$(".markdown-body .highlight pre");for(l=0;l1?n.split("#")[1].toLowerCase():null,p=$(window).scrollTop();if(u&&$("#"+u).length>0){var v=$("#"+u).offset().top;setTimeout(function(){$("a[href='#"+u+"']").length>0?$("a[href='#"+u+"']").click():window.scrollTo(0,v)},200)}else if(p>0){v=p>$("#overall-header").height()?$("#overall-header").height():p;setTimeout(function(){window.scrollTo(0,v)},200)}let m=$(".multi-panel-switching-prefix");for(let e=0;e li"),t=0;if(u&&""!=u)for(let e=0;e li").on("click",function(){$(this).parent("ul").find("li").removeClass("on"),$(this).addClass("on");let e=$(this).parent("ul").find("~");showSelectMultiPanel(e,$(this).index())}),$(".markdown-body .sample-code-prefix").length>0&&getUrlVars(document.URL).lang){var w=getUrlVars(document.URL).lang.toLowerCase().trim().split(",");w&&(1==w.length?sampleCodeSingleLangInit(w[0]):sampleCodeLangsInit(w))}else if($(".markdown-body .sample-code-prefix").length>0){$(".markdown-body .sample-code-prefix + blockquote > ul > li:first-child").addClass("on"),$(".markdown-body .sample-code-prefix + blockquote > ol > li:first-child").addClass("on");var g=$(".markdown-body .sample-code-prefix.template2 + blockquote");for(l=0;ldiv").eq(0).addClass("on")}anchors.add()})}function findCurLinkOnFullTree(e,n,t=!1){var i=$("#fullTreeMenuListContainer").find("a"),l=e.href.toLowerCase(),a=document.URL.toLowerCase();if(l=l.indexOf("?")>0?l.split("?")[0]:l.indexOf("#")>0?l.split("#")[0]:l,a=a.indexOf("?")>0?a.split("?")[0]:a.indexOf("#")>0?a.split("#")[0]:a,a==l&&(e.href.split("#").length>1||document.URL.split("#").length>1)){var o=e.href.split("#").length>1?e.href.split("#")[1].toLowerCase():null,r=o&&$("#"+o).length>0?$("#"+o).offset().top:0;setTimeout(function(){window.scrollTo(0,r)},200),!t&&history.pushState(null,null,n)}else{for(var s=!1,d=0;d0?f.replace("index.html",""):f,l=l.indexOf("index.html")>0?l.replace("index.html",""):l,f=f.indexOf("?")>0?f.split("?")[0]:f.indexOf("#")>0?f.split("#")[0]:f,f&&f.toLowerCase()==l&&(s=!0,RequestNewPage(i[d],n,t))}s||(window.location.href=n)}}function changeVersion(e){var n=e.innerText.toLowerCase(),t=null;t=n.indexOf("latest version")>=0?"latest":n.replace("version ","");var i=document.URL,l="/v"+t+"/";if(i.indexOf("web-twain/docs/")>0&&GetVersionDiff("17.2.1",t)<0&&(l="/v17.2.1/"),(i.indexOf("web-twain/docs/")>0||i.indexOf("remote-scan/docs/")>0)&&"latest"==t)window.location.href=i;else{i=i.replace("/docs/","/docs-archive"+l);var a=getUrlVars(i).src,o=void 0;-1!=i.indexOf("#")&&(o=i.split("#").pop()),-1!=i.indexOf("?")&&(i=i.substring(0,i.indexOf("?"))),-1!=i.indexOf("#")&&(i=i.substring(0,i.indexOf("#"))),i=i+"?ver="+t+"&&cVer=true",null!=a&&(i=i+"&&src="+a),null!=o&&(i=i+"#"+o),window.location.href=i}}function findNearestVersion(e){for(var n=$(".fullVersionInfo li"),t=e,i=null,l=0;l=0&&(o