From 8ca6d8b9f799d06cfa538e5701c0411844f60bf7 Mon Sep 17 00:00:00 2001 From: Sean <1026025056@qq.com> Date: Sat, 27 Jun 2020 14:58:19 +0800 Subject: [PATCH] change nav position --- docs/assets/js/custom.js | 8 ++++-- docs/assets/js/custom.min.js | 53 +++++++++++++++++++++++++++++++++++- 2 files changed, 57 insertions(+), 4 deletions(-) diff --git a/docs/assets/js/custom.js b/docs/assets/js/custom.js index d9f9ca1f..636249f6 100644 --- a/docs/assets/js/custom.js +++ b/docs/assets/js/custom.js @@ -77,11 +77,13 @@ function anchor_search(purchase_link="none",quickstart_link="none"){ var quickstart_name = "QUICK START" } if(purchase_link!="none"){ - $(".anchor-box").append(''+purchase_icon+''+purchase_name+''+''); + // $(".anchor-box").append(''+purchase_icon+''+purchase_name+''+''); + $(".anchor-box").after(''); } if(quickstart_link!="none"){ - $(".anchor-box").append(''+quickstart_icon+''+quickstart_name+''+''); - } + // $(".anchor-box").append(''+quickstart_icon+''+quickstart_name+''+''); + $(".anchor-box").after(''); + } } function anchor_scroll(anchor_name,anchor_id,anchor_length){ diff --git a/docs/assets/js/custom.min.js b/docs/assets/js/custom.min.js index 45527ab2..ab31648a 100644 --- a/docs/assets/js/custom.min.js +++ b/docs/assets/js/custom.min.js @@ -1 +1,52 @@ -const description_icon='',purchase_icon='',example_icon='',video_icon='',quickstart_icon='',schematic_icon='',icon_list={EASYLOADER:"https://m5stack.oss-cn-shenzhen.aliyuncs.com/image/m5-docs_logo/EASYLOADER_ICON.png",CORE:"https://m5stack.oss-cn-shenzhen.aliyuncs.com/image/m5-docs_logo/CORE_ICON.png",MODULE:"https://m5stack.oss-cn-shenzhen.aliyuncs.com/image/m5-docs_logo/MODULE_ICON.png",BASE:"https://m5stack.oss-cn-shenzhen.aliyuncs.com/image/m5-docs_logo/BASE_ICON.png",UNIT:"https://m5stack.oss-cn-shenzhen.aliyuncs.com/image/m5-docs_logo/UNIT_ICON.png",HAT:"https://m5stack.oss-cn-shenzhen.aliyuncs.com/image/m5-docs_logo/HAT_ICON.png",ATOM:"https://m5stack.oss-cn-shenzhen.aliyuncs.com/image/m5-docs_logo/ATOM_BASE_ICON.png",APPLICATION:"https://m5stack.oss-cn-shenzhen.aliyuncs.com/image/m5-docs_logo/APPLICATION_ICON.png",ACCESSORY:"https://m5stack.oss-cn-shenzhen.aliyuncs.com/image/m5-docs_logo/ACCESSORY_ICON.png",ALUMINIUM:"https://m5stack.oss-cn-shenzhen.aliyuncs.com/image/m5-docs_logo/ALUMINIUM_ICON.png"};var Label1="",Label2='here is the anchor_name';function anchor_create(e,t){var c=window.location.href,n=Label1.replace(/here is the anchor_id/,t),o=Label2.replace(/here is the anchor_name/,e.toUpperCase());"DESCRIPTION"==e||"描述"==e?$(".anchor-box").append(n+description_icon+o):"EXAMPLE"==e||"案例程序"==e?$(".anchor-box").append(n+example_icon+o):"SCHEMATIC"==e||"原理图"==e?$(".anchor-box").append(n+schematic_icon+o):"VIDEO"==e||"相关视频"==e?$(".anchor-box").append(n+video_icon+o):icon_list.hasOwnProperty(e)?($(".anchor-box").append(n+""+o),"EASYLOADER"==e&&("#example_video".length>0&&$("#play-btn").on("click",function(e){e.stopPropagation(),$(".easyloader-mask").toggleClass("video_play"),$("#example_video")[0].play()}),$("#example_video").on("click",function(e){e.preventDefault(),$(".easyloader-mask").toggleClass("video_play"),$("#example_video")[0].pause()}))):-1==c.indexOf(/uiflow/)&&-1==c.indexOf(/arduino/)&&-1==c.indexOf(/quick_start/)&&-1==c.indexOf(/related_documents/)||$(".anchor-box").append(n+quickstart_icon+'"+e+"")}function anchor_search(e="none",t="none"){var c=window.location.href;if("/en/"==c.slice(-4)||"/zh_CN/"==c.slice(-7)||"/#/"==c.slice(-3)){$("#search_note").eq(0).after("
");var n=$(".product_page > div:gt(1)")}else{$("h2").eq(0).before("
");n=$("#main h2")}for(var o=0;o'+purchase_icon+''+a+""),"none"!=t&&$(".anchor-box").append("'+quickstart_icon+''+s+"")}function anchor_scroll(e,t,c){var n=window.location.href,o=$("#"+t).offset().top+$("#"+t).height()-$(window).scrollTop();if(o>100&&o<$("#"+t).height()+700)for(var a=0;a div:gt(1)");else c=$("#main h2");for(var n=0;n${c[o].textContent}`;if(-1!=kw_content.toLocaleLowerCase().indexOf(n)){var i=kw_content.toLocaleLowerCase().indexOf(n),l=function(){for(var e=i;e>=0;e--)if(" "==kw_content[e]||0==e)return e}(),r=function(){for(var e=i;e<=kw_content.length;e++)if(" "==kw_content[e]||e==kw_content.length)return e}(),h=kw_content.substring(0,l),p=kw_content.substring(r);a=`--${kw_content.substring(l,r)} ${h}${p}`}""!=n?$(".search_point").append(`${t[o].textContent+a+s}`):$(".item").parent().css("display","block")}else $(".item").eq(o).css("display","none"),$(".item").parent().children("p").css("display","none"),$(".item").eq(o).parent().next("hr").css("display","none")}function faq_search(e){$(".search-tips").css("display","block"),$(".faq-class").css("display","none");for(var t=$(".faq-item h5"),c=0;c0;)l.addImage(i,"JPEG",0,a,595.28,s),a-=841.89,(o-=n)>0&&l.addPage();var r=window.location.href,h=r.indexOf("#"),p=r.slice(h+2);l.save(p+".pdf")}}),$(".anchor-box").removeAttr("style"),$(".related_links").removeAttr("style"),$(".easyloader-box").removeAttr("style")}Input.focusin(function(){Input.animate({width:300}),$(".search_point").show(240)}),Input.focusout(function(){Input.animate({width:240}),setTimeout(function(){$(".search_point").hide(140)},160)}),$(document).ready(function(){$(".btn-toggle").on("click",function(){$(".btn-toggle").toggleClass("open"),$(".d-flex").toggleClass("open")})}),window.onhashchange=page_loading,page_loading();$(document).on("keypress", "form", function(event) { return event.keyCode != 13;}); \ No newline at end of file +const description_icon='';const purchase_icon='';const example_icon='';const video_icon='';const quickstart_icon='';const schematic_icon='';const icon_list={"EASYLOADER":"https://m5stack.oss-cn-shenzhen.aliyuncs.com/image/m5-docs_logo/EASYLOADER_ICON.png","CORE":"https://m5stack.oss-cn-shenzhen.aliyuncs.com/image/m5-docs_logo/CORE_ICON.png","MODULE":"https://m5stack.oss-cn-shenzhen.aliyuncs.com/image/m5-docs_logo/MODULE_ICON.png","BASE":"https://m5stack.oss-cn-shenzhen.aliyuncs.com/image/m5-docs_logo/BASE_ICON.png","UNIT":"https://m5stack.oss-cn-shenzhen.aliyuncs.com/image/m5-docs_logo/UNIT_ICON.png","HAT":"https://m5stack.oss-cn-shenzhen.aliyuncs.com/image/m5-docs_logo/HAT_ICON.png","ATOM":"https://m5stack.oss-cn-shenzhen.aliyuncs.com/image/m5-docs_logo/ATOM_BASE_ICON.png","APPLICATION":"https://m5stack.oss-cn-shenzhen.aliyuncs.com/image/m5-docs_logo/APPLICATION_ICON.png","ACCESSORY":"https://m5stack.oss-cn-shenzhen.aliyuncs.com/image/m5-docs_logo/ACCESSORY_ICON.png","ALUMINIUM":"https://m5stack.oss-cn-shenzhen.aliyuncs.com/image/m5-docs_logo/ALUMINIUM_ICON.png"};var Label1='';var Label2='here is the anchor_name';function anchor_create(anchor_name,anchor_id){var page_url=window.location.href;var Part_A=Label1.replace(/here is the anchor_id/,anchor_id);var Part_B=Label2.replace(/here is the anchor_name/,anchor_name.toUpperCase());if((anchor_name=="DESCRIPTION")||(anchor_name=="描述")){$(".anchor-box").append(Part_A+description_icon+Part_B);} +else if((anchor_name=="EXAMPLE")||(anchor_name=="案例程序")){$(".anchor-box").append(Part_A+example_icon+Part_B);} +else if((anchor_name=="SCHEMATIC")||(anchor_name=="原理图")){$(".anchor-box").append(Part_A+schematic_icon+Part_B);} +else if((anchor_name=="VIDEO")||(anchor_name=="相关视频")){$(".anchor-box").append(Part_A+video_icon+Part_B);} +else if(icon_list.hasOwnProperty(anchor_name)){$(".anchor-box").append(Part_A+""+Part_B);if(anchor_name=="EASYLOADER"){if(("#example_video").length>0) +$("#play-btn").on("click",function(ev){ev.stopPropagation();$(".easyloader-mask").toggleClass('video_play');$("#example_video")[0].play();}) +$("#example_video").on("click",function(ev){ev.preventDefault();$(".easyloader-mask").toggleClass('video_play');$("#example_video")[0].pause();})}}else if((page_url.indexOf(/uiflow/)!=-1)||(page_url.indexOf(/arduino/)!=-1)||(page_url.indexOf(/quick_start/)!=-1)||(page_url.indexOf(/related_documents/)!=-1)){$(".anchor-box").append(Part_A+quickstart_icon+''+anchor_name+'');}} +function anchor_search(purchase_link="none",quickstart_link="none"){var page_url=window.location.href;if((page_url.slice(-4)=="/en/")||(page_url.slice(-7)=="/zh_CN/")||(page_url.slice(-3)=="/#/")){$("#search_note").eq(0).after("
");var anchor_list=$(".product_page > div:gt(1)");} +else{$("h2").eq(0).before("
");var anchor_list=$("#main h2");} +for(var i=0;i');} +if(quickstart_link!="none"){$(".anchor-box").after('');}} +function anchor_scroll(anchor_name,anchor_id,anchor_length){var page_url=window.location.href;var offset=$("#"+anchor_id).offset().top+$("#"+anchor_id).height()-$(window).scrollTop();if((offset>100)&&(offset<($("#"+anchor_id).height()+700))){for(var i=0;i div:gt(1)");} +else{var anchor_list=$("#main h2");} +for(var i=0;i${sku_list[i].textContent}`;if(kw_content.toLocaleLowerCase().indexOf(textEnter)!=-1){var kw_index=kw_content.toLocaleLowerCase().indexOf(textEnter);var kw_index_start=(function(){for(var index=kw_index;index>=0;index--){if((kw_content[index]==" ")||(index==0)){return index;}}})();var kw_index_end=(function(){for(var index=kw_index;index<=kw_content.length;index++){if((kw_content[index]==" ")||(index==kw_content.length)){return index;}}})();var kw_part1=kw_content.substring(0,kw_index_start);var kw_part2=kw_content.substring(kw_index_end,);var kw_part3=kw_content.substring(kw_index_start,kw_index_end);kw=`--${kw_part3} ${kw_part1}${kw_part2}`} +if(textEnter!=""){$(".search_point").append(`${p[i].textContent+kw+sku}`);}else{$(".item").parent().css("display","block");}} +else{$(".item").eq(i).css("display","none");$(".item").parent().children("p").css("display","none");$(".item").eq(i).parent().next("hr").css("display","none");}}} +function faq_search(onEnter_content){$(".search-tips").css("display","block");$(".faq-class").css("display","none");var faq_title=$(".faq-item h5");for(var i=0;i0){pdf.addImage(pageData,'JPEG',0,position,imgWidth,imgHeight) +leftHeight-=pageHeight;position-=841.89;if(leftHeight>0){pdf.addPage();}}} +var page_url=window.location.href;var a=page_url.indexOf('#') +var pdf_name=page_url.slice(a+2);pdf.save(pdf_name+".pdf");}}) +$(".anchor-box").removeAttr("style");$(".related_links").removeAttr("style");$(".easyloader-box").removeAttr("style");} +$(document).on("keypress","form",function(event){return event.keyCode!=13;}); \ No newline at end of file