This repository has been archived by the owner on Jul 29, 2021. It is now read-only.
forked from timesheets/timesheets.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
timesheets-navigation.min.js
1 lines (1 loc) · 1.65 KB
/
timesheets-navigation.min.js
1
(function(){function a(j,c){function e(k){var i=new RegExp("(^|[\\s;]+)"+k+"([\\s;]+|$)","i");return i.test(c)}var g=j.target;if(!g){g=j.timeNodes[0].target.parentNode}if(e("arrows")){EVENTS.bind(document,"keydown",function(m){var k=j.currentIndex;var l=j.timeNodes.length;var i=j.timeNodes[k];switch(m.keyCode){case 32:EVENTS.preventDefault(m);if(m.shiftKey){j.selectIndex(k-1)}else{j.selectIndex(k+1)}break;case 35:EVENTS.preventDefault(m);j.selectIndex(l-1);break;case 36:EVENTS.preventDefault(m);j.selectIndex(0);break;case 37:EVENTS.preventDefault(m);j.selectIndex(k-1);break;case 38:EVENTS.preventDefault(m);i.reset();i.show();break;case 39:EVENTS.preventDefault(m);j.selectIndex(k+1);break;case 40:EVENTS.preventDefault(m);EVENTS.trigger(i.target,"click");break;default:break}})}if(e("click")){EVENTS.bind(g,"mousedown",function(k){var i=k.which||([0,1,3,0,2])[k.button];if(i==1){j.selectIndex(j.currentIndex+1)}else{if(i==2){j.selectIndex(j.currentIndex-1)}}})}if(e("scroll")){function d(i){if(i){if(i.ctrlKey){return}i.preventDefault()}else{i=window.event;if(i.ctrlKey){return}i.returnValue=false}var k=0;if(i.wheelDelta){k=i.wheelDelta/120}else{if(i.detail){k=-i.detail/3}}if(k<0){j.selectIndex(j.currentIndex+1)}else{if(k>0){j.selectIndex(j.currentIndex-1)}}}if(window.addEventListener){g.addEventListener("DOMMouseScroll",d,false)}g.onmousewheel=d}if(e("hash")){var b=j.timeNodes;for(var f=0;f<b.length;f++){var h=b[f].target;if(h.id){EVENTS.bind(h,"begin",function(){document.location.hash="#"+this.id})}}}}EVENTS.onSMILReady(function(){var d=document.getTimeContainersByTagName("*");for(var c=0;c<d.length;c++){var b=d[c].parseAttribute("navigation");if(b){a(d[c],b)}}})})();