fix some bug

This commit is contained in:
Gitshaoxiang
2020-07-17 18:34:54 +08:00
parent ed08d475c9
commit f5c8cb274b
7 changed files with 34 additions and 29 deletions
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -286,7 +286,7 @@ body[data-page="zh_CN/quick_start/m5stickc/m5stickc_quick_start.md"] article.mar
left: 0;
width: 150px;
height: 100%;
background: rgba(0, 0, 0, 0.83);
background: rgba(0, 0, 0, 0.45);
color: #fff;
opacity: 0
}
+1 -1
View File
@@ -246,7 +246,7 @@ var scrollFunc = function (e) {
for (var i=0; i< anchor_list.length ; i++){
if(anchor_scroll(anchor_list[i].id.toUpperCase(), anchor_list[i].id, anchor_list.length)) break;
}
}
}
scrollFunc();
/*IE、Opera注册事件*/
+26 -20
View File
@@ -431,6 +431,8 @@
/**
* Render progress bar
*/
var position_times = 0;
function progressbar (ref) {
var loaded = ref.loaded;
@@ -456,13 +458,17 @@
if (num >= 95) {
clearTimeout(timeId);
timeId = setTimeout(function (_) {
// ProgressBar.percentage = 0
// barE2.style.display = "none";
window.header.done();
isSupportWebp();
img_zoom();
page_position();
}, 200);
position_timer = setInterval(function(){
page_position();
position_times++;
if(position_times>4){
clearInterval(position_timer);
}
},100);
}, 300);
}
}
@@ -3950,25 +3956,25 @@
var nav = {};
var hoverOver = false;
var scroller = null;
var enableScrollEvent = true;
var enableScrollEvent = false;
var coverHeight = 0;
function scrollTo(el) {
if (scroller) {
scroller.stop();
}
enableScrollEvent = false;
scroller = new Tweezer({
start: window.pageYOffset,
end: el.getBoundingClientRect().top + window.pageYOffset,
duration: 500
})
.on('tick', function (v) { return window.scrollTo(0, v); })
.on('done', function () {
enableScrollEvent = true;
scroller = null;
})
.begin();
// if (scroller) {
// scroller.stop();
// }
// enableScrollEvent = false;
// scroller = new Tweezer({
// start: window.pageYOffset,
// end: el.getBoundingClientRect().top + window.pageYOffset,
// duration: 500
// })
// .on('tick', function (v) { return window.scrollTo(0, v); })
// .on('done', function () {
// enableScrollEvent = true;
// scroller = null;
// })
// .begin();
}
function highlight(path) {
+3 -4
View File
@@ -36,9 +36,9 @@ var innerHTML='';toc.forEach(function(node){innerHTML+="<li><a class=\"section-l
function helper(className,content){return("<p class=\""+className+"\">"+(content.slice(5).trim())+"</p>")}
function theme(color){return("<style>:root{--theme-color: "+color+";}</style>")}
var barEl;var timeId;function init(){}
function progressbar(ref){var loaded=ref.loaded;var total=ref.total;var step=ref.step;var num;!barEl&&init();if(step){num=num+step;num=num>80?80:num;}else{num=Math.floor(loaded/total*100);}
var position_times=0;function progressbar(ref){var loaded=ref.loaded;var total=ref.total;var step=ref.step;var num;!barEl&&init();if(step){num=num+step;num=num>80?80:num;}else{num=Math.floor(loaded/total*100);}
if(num==Infinity){}else{}
if(num>=95){clearTimeout(timeId);timeId=setTimeout(function(_){window.header.done();isSupportWebp();img_zoom();page_position();},200);}}
if(num>=95){clearTimeout(timeId);timeId=setTimeout(function(_){window.header.done();isSupportWebp();img_zoom();position_timer=setInterval(function(){page_position();position_times++;if(position_times>4){clearInterval(position_timer);}},100);},300);}}
var cache={};function get(url,hasBar,headers){if(hasBar===void 0)hasBar=false;if(headers===void 0)headers={};var xhr=new XMLHttpRequest();var on=function(){xhr.addEventListener.apply(xhr,arguments);};var cached$$1=cache[url];if(cached$$1){return{then:function(cb){return cb(cached$$1.content,cached$$1.opt);},abort:noop}}
xhr.open('GET',url);for(var i in headers){if(hasOwn.call(headers,i)){xhr.setRequestHeader(i,headers[i]);}}
xhr.send();return{then:function(success,error){if(error===void 0)error=noop;if(hasBar){var id=setInterval(function(_){return progressbar({step:Math.floor(Math.random()*5+1)});},500);on('progress',progressbar);on('loadend',function(evt){progressbar(evt);clearInterval(id);});}
@@ -348,8 +348,7 @@ var Tweezer=function(){function Tweezer(){var opts=arguments.length>0&&arguments
_createClass(Tweezer,[{key:'begin',value:function begin(){if(!this.isRunning&&this.next!==this.end){this.frame=window.requestAnimationFrame(this._tick.bind(this));}
return this;}},{key:'stop',value:function stop(){window.cancelAnimationFrame(this.frame);this.isRunning=false;this.frame=null;this.timeStart=null;this.next=null;return this;}},{key:'on',value:function on(name,handler){this.events[name]=this.events[name]||[];this.events[name].push(handler);return this;}},{key:'emit',value:function emit(name,val){var _this=this;var e=this.events[name];e&&e.forEach(function(handler){return handler.call(_this,val);});}},{key:'_tick',value:function _tick(currentTime){this.isRunning=true;var lastTick=this.next||this.start;if(!this.timeStart){this.timeStart=currentTime;}
this.timeElapsed=currentTime-this.timeStart;this.next=Math.round(this.ease(this.timeElapsed,this.start,this.end-this.start,this.duration));if(this._shouldTick(lastTick)){this.emit('tick',this.next);this.frame=window.requestAnimationFrame(this._tick.bind(this));}else{this.emit('tick',this.end);this.emit('done',null);}}},{key:'_shouldTick',value:function _shouldTick(lastTick){return{up:this.next<this.end&&lastTick<=this.next,down:this.next>this.end&&lastTick>=this.next}[this.direction];}},{key:'_defaultEase',value:function _defaultEase(t,b,c,d){if((t/=d/2)<1){return c/2*t*t+b;}
return-c/2*(--t*(t-2)-1)+b;}}]);return Tweezer;}();var nav={};var hoverOver=false;var scroller=null;var enableScrollEvent=true;var coverHeight=0;function scrollTo(el){if(scroller){scroller.stop();}
enableScrollEvent=false;scroller=new Tweezer({start:window.pageYOffset,end:el.getBoundingClientRect().top+window.pageYOffset,duration:500}).on('tick',function(v){return window.scrollTo(0,v);}).on('done',function(){enableScrollEvent=true;scroller=null;}).begin();}
return-c/2*(--t*(t-2)-1)+b;}}]);return Tweezer;}();var nav={};var hoverOver=false;var scroller=null;var enableScrollEvent=false;var coverHeight=0;function scrollTo(el){}
function highlight(path){if(!enableScrollEvent){return}
var sidebar=getNode('.sidebar');var anchors=findAll('.anchor');var wrap=find(sidebar,'.sidebar-nav');var active=find(sidebar,'li.active');var doc=document.documentElement;var top=((doc&&doc.scrollTop)||document.body.scrollTop)-coverHeight;var last;for(var i=0,len=anchors.length;i<len;i+=1){var node=anchors[i];if(node.offsetTop>top){if(!last){last=node;}
break}else{last=node;}}
+1 -1
View File
@@ -55,7 +55,7 @@ const uielements = {
'UI Elements':'#/en/uiflow/ui_simulator?id=ui-elements',
'Unicode':'#/en/uiflow/ui_simulator?id=unicode',
'Image':'#/en/uiflow/ui_simulator?id=displaying-images',
'Screen':'#/en/uiflow/ui_simulator?id=screenF'
'Screen':'#/en/uiflow/ui_simulator?id=screen'
}
};
+1 -1
View File
@@ -54,7 +54,7 @@ const uielements = {
'UI Elements':'#/zh_CN/uiflow/ui_simulator?id=ui-elements',
'Unicode':'#/zh_CN/uiflow/ui_simulator?id=unicode',
'Image':'#/zh_CN/uiflow/ui_simulator?id=displaying-images',
'Screen':'#/zh_CN/uiflow/ui_simulator?id=screenF'
'Screen':'#/zh_CN/uiflow/ui_simulator?id=screen'
}
};