-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
1 lines (1 loc) · 14.8 KB
/
script.js
1
const a0_0x23d4b2=a0_0x8756;(function(_0x5dd4ad,_0x16936f){const _0x37d577=a0_0x8756,_0x482147=_0x5dd4ad();while(!![]){try{const _0x41cce2=-parseInt(_0x37d577(0x113))/0x1+-parseInt(_0x37d577(0x124))/0x2*(parseInt(_0x37d577(0xd7))/0x3)+-parseInt(_0x37d577(0x131))/0x4+-parseInt(_0x37d577(0xfa))/0x5*(-parseInt(_0x37d577(0xcb))/0x6)+parseInt(_0x37d577(0xd2))/0x7+-parseInt(_0x37d577(0xfe))/0x8*(-parseInt(_0x37d577(0xf6))/0x9)+parseInt(_0x37d577(0x10b))/0xa;if(_0x41cce2===_0x16936f)break;else _0x482147['push'](_0x482147['shift']());}catch(_0x487f15){_0x482147['push'](_0x482147['shift']());}}}(a0_0x1f61,0x7e0cd));let heatmap,isTracking=![],lastMoveTime=0x0,lastMoveTimeForEffects=0x0,positions=[],trackingTimer,lastKnownMousePosition={'x':0x0,'y':0x0};const interval=0x3e8/0x3c,controlPanel=document[a0_0x23d4b2(0x10c)](a0_0x23d4b2(0x104)),startButton=document[a0_0x23d4b2(0x10c)](a0_0x23d4b2(0xc0)),durationInput=document['getElementById']('durationInput'),backgroundInput=document[a0_0x23d4b2(0x10c)](a0_0x23d4b2(0x101)),resetBackgroundButton=document[a0_0x23d4b2(0x10c)]('resetBackgroundButton'),clearHeatmapButton=document[a0_0x23d4b2(0x10c)]('clearHeatmapButton'),exportButton=document['getElementById'](a0_0x23d4b2(0x111)),effectSelect=document[a0_0x23d4b2(0x10c)](a0_0x23d4b2(0xe9)),volumeControl=document[a0_0x23d4b2(0x10c)](a0_0x23d4b2(0xdf));heatmap=h337['create']({'container':document[a0_0x23d4b2(0x10c)](a0_0x23d4b2(0xb4)),'maxOpacity':0.6,'radius':0x23,'blur':0x1,'backgroundColor':a0_0x23d4b2(0xd0)});function a0_0x1f61(){const _0x4ec3e6=['playSound','error','Start\x20Tracking','heatmap_export.png','length','volume','setData','readAsDataURL','effectSelect','createElementNS','black','scrollHeight','arrayBuffer','click','translateY(-100px)','image/octet-stream','style','http://www.w3.org/2000/svg','href','ripple','none','92439bEUrjV','push','replace','line','4627585NfRjuj','state','resize','position','504KDREJM','setAttribute','webkitAudioContext','backgroundInput','createEffect','all\x202s\x20ease-out','controlPanel','Error\x20playing\x20sound:','disabled','hsl(','stroke-width','createBufferSource','random','3559260yqwScf','getElementById','appendChild','reduce','sqrt','points','exportButton','hidden','516849ZwTTEp','body','height','animate','0.75','log2','destination','effect','absolute','sounds/fuwa.mp3','top','mousemove','remove','target','width','connect','Tracking...','2sjdliP','fill','pulseSound','change','backgroundImage','transform','div','duration','15px','toDataURL','playbackRate','createElement','white','2054280aXQTLf','60px','result','heatmapContainer','now','then','svg','font-size','add','value','suspended',',\x20100%,\x2050%)','AudioContext','translateY(0)\x20scale(1)','download','startButton','start','className','backgroundColor','classList','element','addEventListener','float','left','circle','pageY','6voVNEL','showGazePlotButton','rippleSound','20px','100%','rgba(0,\x200,\x200,\x200)','log','2500659KqnDvF','files','decodeAudioData','pulse','audioContext','2217099aFJfuN','stroke','textContent','currentSound','initAudioContext','image/png','opacity','text','volumeControl','pageX'];a0_0x1f61=function(){return _0x4ec3e6;};return a0_0x1f61();}class Effect{static [a0_0x23d4b2(0xd6)]=null;static ['currentSound']=null;static[a0_0x23d4b2(0xdb)](){const _0x38a941=a0_0x23d4b2;!Effect[_0x38a941(0xd6)]&&(Effect[_0x38a941(0xd6)]=new(window[(_0x38a941(0xbd))]||window[(_0x38a941(0x100))])(),Effect['audioContext'][_0x38a941(0xfb)]===_0x38a941(0xbb)&&Effect[_0x38a941(0xd6)]['resume']());}constructor(_0x4cd2a6,_0xa90f0d,_0x33e06e,_0x7bca33=0x1){const _0xf7f3b7=a0_0x23d4b2;this[_0xf7f3b7(0xc5)]=document[_0xf7f3b7(0x12f)](_0xf7f3b7(0x12a)),this[_0xf7f3b7(0xc5)][_0xf7f3b7(0xf1)]['position']='absolute',this[_0xf7f3b7(0xc5)][_0xf7f3b7(0xf1)]['left']=_0x4cd2a6-0xa+'px',this[_0xf7f3b7(0xc5)][_0xf7f3b7(0xf1)][_0xf7f3b7(0x11d)]=_0xa90f0d-0xa+'px',this[_0xf7f3b7(0xc5)][_0xf7f3b7(0xf1)][_0xf7f3b7(0xc3)]=_0x33e06e,this['playbackRate']=_0x7bca33;}async['playSound'](_0x2af82a){const _0x32fa76=a0_0x23d4b2;!Effect['audioContext']&&Effect[_0x32fa76(0xdb)]();if(Effect[_0x32fa76(0xda)])return;try{const _0x921b10=await fetch(_0x2af82a),_0x28fa3f=await _0x921b10[_0x32fa76(0xed)](),_0x508726=await Effect[_0x32fa76(0xd6)][_0x32fa76(0xd4)](_0x28fa3f),_0x58b350=Effect[_0x32fa76(0xd6)][_0x32fa76(0x109)]();_0x58b350['buffer']=_0x508726,_0x58b350[_0x32fa76(0x12e)]['value']=this[_0x32fa76(0x12e)],_0x58b350[_0x32fa76(0x122)](Effect[_0x32fa76(0xd6)][_0x32fa76(0x119)]),Effect['currentSound']=_0x58b350,_0x58b350['onended']=()=>{Effect['currentSound']=null;},_0x58b350[_0x32fa76(0xc1)]();}catch(_0x3e45fb){console[_0x32fa76(0xe2)](_0x32fa76(0x105),_0x3e45fb);}}}class RippleEffect extends Effect{constructor(_0x437b2c,_0x314970,_0xb753e8){const _0x3212d4=a0_0x23d4b2;super(_0x437b2c,_0x314970,_0xb753e8,1.5),this[_0x3212d4(0xc5)][_0x3212d4(0xc2)]=_0x3212d4(0xf4);}[a0_0x23d4b2(0x116)](){const _0x94d099=a0_0x23d4b2;document[_0x94d099(0x114)][_0x94d099(0x10d)](this[_0x94d099(0xc5)]),this[_0x94d099(0xe1)]('sounds/fuwa.mp3'),setTimeout(()=>this[_0x94d099(0xc5)][_0x94d099(0x11f)](),0x4e20);}}class PulseEffect extends Effect{constructor(_0x37ac3b,_0x3fb817,_0x1edb6c){const _0x2c009d=a0_0x23d4b2;super(_0x37ac3b,_0x3fb817,_0x1edb6c,0x2),this[_0x2c009d(0xc5)][_0x2c009d(0xc2)]='pulse';}['animate'](){const _0x59aced=a0_0x23d4b2;document[_0x59aced(0x114)][_0x59aced(0x10d)](this[_0x59aced(0xc5)]),this[_0x59aced(0xe1)](_0x59aced(0x11c)),setTimeout(()=>this[_0x59aced(0xc5)][_0x59aced(0x11f)](),0x3e8);}}class FloatEffect extends Effect{constructor(_0x336f7c,_0x19b633,_0x3e22f7){const _0x43c2c7=a0_0x23d4b2;super(_0x336f7c,_0x19b633,_0x3e22f7,0x1),this[_0x43c2c7(0xc5)][_0x43c2c7(0xc2)]=_0x43c2c7(0xc7);}['animate'](){const _0x364d03=a0_0x23d4b2;document[_0x364d03(0x114)]['appendChild'](this[_0x364d03(0xc5)]),this[_0x364d03(0xe1)]('sounds/short_float.mp3'),this[_0x364d03(0xc5)]['style'][_0x364d03(0x121)]=_0x364d03(0xce),this[_0x364d03(0xc5)]['style'][_0x364d03(0x115)]='20px',this[_0x364d03(0xc5)]['style'][_0x364d03(0x129)]=_0x364d03(0xbe),this['element']['style'][_0x364d03(0xdd)]='1',requestAnimationFrame(()=>{const _0x265702=_0x364d03;this['element'][_0x265702(0xf1)]['transition']=_0x265702(0x103),this[_0x265702(0xc5)]['style'][_0x265702(0x121)]=_0x265702(0xb2),this[_0x265702(0xc5)][_0x265702(0xf1)][_0x265702(0x115)]=_0x265702(0xb2),this[_0x265702(0xc5)][_0x265702(0xf1)][_0x265702(0x129)]=_0x265702(0xef),this[_0x265702(0xc5)][_0x265702(0xf1)][_0x265702(0xdd)]='0';}),setTimeout(()=>this[_0x364d03(0xc5)][_0x364d03(0x11f)](),0x7d0);}}class EffectFactory{static[a0_0x23d4b2(0x102)](_0x200765,_0x15fefa,_0x5dbb3d){const _0x536882=a0_0x23d4b2,_0x4e8b6f=_0x536882(0x107)+Math[_0x536882(0x10a)]()*0x168+_0x536882(0xbc);switch(_0x200765){case'ripple':return new RippleEffect(_0x15fefa,_0x5dbb3d,_0x4e8b6f);case _0x536882(0xd5):return new PulseEffect(_0x15fefa,_0x5dbb3d,_0x4e8b6f);case _0x536882(0xc7):return new FloatEffect(_0x15fefa,_0x5dbb3d,_0x4e8b6f);case _0x536882(0xf5):default:return null;}}}function createGazePlot(){const _0x4a2d4b=a0_0x23d4b2,_0x45d6b3=document[_0x4a2d4b(0xea)](_0x4a2d4b(0xf2),_0x4a2d4b(0xb7));_0x45d6b3['setAttribute']('width','100%'),_0x45d6b3[_0x4a2d4b(0xff)](_0x4a2d4b(0x115),_0x4a2d4b(0xcf)),_0x45d6b3[_0x4a2d4b(0xf1)][_0x4a2d4b(0xfd)]=_0x4a2d4b(0x11b),_0x45d6b3[_0x4a2d4b(0xf1)][_0x4a2d4b(0x11d)]='0',_0x45d6b3[_0x4a2d4b(0xf1)][_0x4a2d4b(0xc8)]='0',_0x45d6b3[_0x4a2d4b(0xf1)]['pointerEvents']='none',document['body'][_0x4a2d4b(0x10d)](_0x45d6b3);const _0x23b64b=0x3c,_0x4665e0=0x12c;let _0xddcdac=[],_0x407c6b={'x':positions[0x0]['x'],'y':positions[0x0]['y'],'duration':interval,'points':[positions[0x0]]};for(let _0x1e454f=0x1;_0x1e454f<positions[_0x4a2d4b(0xe5)];_0x1e454f++){const _0xad3e2c=positions[_0x1e454f],_0x5edc99=_0xad3e2c['x']-_0x407c6b['x'],_0x423b74=_0xad3e2c['y']-_0x407c6b['y'],_0x44ef9a=Math[_0x4a2d4b(0x10f)](_0x5edc99*_0x5edc99+_0x423b74*_0x423b74);_0x44ef9a<_0x23b64b?(_0x407c6b[_0x4a2d4b(0x110)][_0x4a2d4b(0xf7)](_0xad3e2c),_0x407c6b[_0x4a2d4b(0x12b)]+=interval):(_0x407c6b[_0x4a2d4b(0x12b)]>=_0x4665e0&&_0xddcdac[_0x4a2d4b(0xf7)](_0x407c6b),_0x407c6b={'x':_0xad3e2c['x'],'y':_0xad3e2c['y'],'duration':interval,'points':[_0xad3e2c]});}_0x407c6b['duration']>=_0x4665e0&&_0xddcdac[_0x4a2d4b(0xf7)](_0x407c6b);let _0x570135=null,_0x29b41a=null;_0xddcdac['forEach']((_0x21cc80,_0x21ff93)=>{const _0x1acaa0=_0x4a2d4b,_0x537519=_0x21cc80[_0x1acaa0(0x110)][_0x1acaa0(0x10e)]((_0x447a7a,_0x4f4d60)=>_0x447a7a+_0x4f4d60['x'],0x0)/_0x21cc80[_0x1acaa0(0x110)][_0x1acaa0(0xe5)],_0x536f5c=_0x21cc80[_0x1acaa0(0x110)][_0x1acaa0(0x10e)]((_0x3b524f,_0x135bb7)=>_0x3b524f+_0x135bb7['y'],0x0)/_0x21cc80[_0x1acaa0(0x110)][_0x1acaa0(0xe5)];if(_0x570135!==null&&_0x29b41a!==null){const _0x3b8bb1=document[_0x1acaa0(0xea)](_0x1acaa0(0xf2),_0x1acaa0(0xf9));_0x3b8bb1[_0x1acaa0(0xff)]('x1',_0x570135),_0x3b8bb1['setAttribute']('y1',_0x29b41a),_0x3b8bb1[_0x1acaa0(0xff)]('x2',_0x537519),_0x3b8bb1['setAttribute']('y2',_0x536f5c),_0x3b8bb1[_0x1acaa0(0xff)]('stroke',_0x1acaa0(0x107)+_0x21ff93*0x168/_0xddcdac[_0x1acaa0(0xe5)]+',\x20100%,\x2050%)'),_0x3b8bb1[_0x1acaa0(0xff)](_0x1acaa0(0x108),'2'),_0x45d6b3[_0x1acaa0(0x10d)](_0x3b8bb1);}const _0x292609=document[_0x1acaa0(0xea)](_0x1acaa0(0xf2),_0x1acaa0(0xc9));_0x292609[_0x1acaa0(0xff)]('cx',_0x537519),_0x292609[_0x1acaa0(0xff)]('cy',_0x536f5c),_0x292609[_0x1acaa0(0xff)]('r',Math[_0x1acaa0(0x118)](_0x21cc80[_0x1acaa0(0x12b)]/ interval)*0x5),_0x292609[_0x1acaa0(0xff)](_0x1acaa0(0xd8),_0x1acaa0(0x130)),_0x292609[_0x1acaa0(0xff)](_0x1acaa0(0x108),'4'),_0x292609[_0x1acaa0(0xff)]('fill',_0x1acaa0(0x107)+_0x21ff93*0x168/_0xddcdac['length']+_0x1acaa0(0xbc)),_0x292609[_0x1acaa0(0xff)]('fill-opacity',_0x1acaa0(0x117)),_0x45d6b3['appendChild'](_0x292609);const _0x7bacfd=document[_0x1acaa0(0xea)](_0x1acaa0(0xf2),_0x1acaa0(0xde));_0x7bacfd['setAttribute']('x',_0x537519+0xf),_0x7bacfd[_0x1acaa0(0xff)]('y',_0x536f5c-0xf),durationTime=Math['round'](_0x21cc80[_0x1acaa0(0x12b)]),_0x7bacfd[_0x1acaa0(0xd9)]=durationTime+'ms',_0x7bacfd[_0x1acaa0(0xff)](_0x1acaa0(0x125),_0x1acaa0(0x130)),_0x7bacfd[_0x1acaa0(0xff)](_0x1acaa0(0xb8),'12px'),_0x45d6b3['appendChild'](_0x7bacfd),_0x570135=_0x537519,_0x29b41a=_0x536f5c;const _0xa628b7=document['createElementNS'](_0x1acaa0(0xf2),_0x1acaa0(0xde));_0xa628b7['setAttribute']('x',_0x537519+0x5),_0xa628b7[_0x1acaa0(0xff)]('y',_0x536f5c+0x5),_0xa628b7[_0x1acaa0(0xd9)]=_0x21ff93+0x1,_0xa628b7['setAttribute']('fill','white'),_0xa628b7[_0x1acaa0(0xff)](_0x1acaa0(0xb8),_0x1acaa0(0x12c)),_0x45d6b3[_0x1acaa0(0x10d)](_0xa628b7);});}startButton['addEventListener']('click',startTracking),resetBackgroundButton[a0_0x23d4b2(0xc6)](a0_0x23d4b2(0xee),resetBackground),clearHeatmapButton['addEventListener'](a0_0x23d4b2(0xee),clearHeatmap),exportButton[a0_0x23d4b2(0xc6)]('click',exportHeatmap),backgroundInput[a0_0x23d4b2(0xc6)](a0_0x23d4b2(0x127),setBackgroundImage),document['addEventListener'](a0_0x23d4b2(0x11e),trackMouseMovement),document[a0_0x23d4b2(0xc6)](a0_0x23d4b2(0x11e),_0x5c3002=>{const _0x323a99=a0_0x23d4b2;lastKnownMousePosition['x']=_0x5c3002[_0x323a99(0xe0)],lastKnownMousePosition['y']=_0x5c3002[_0x323a99(0xca)];}),window[a0_0x23d4b2(0xc6)](a0_0x23d4b2(0xfc),()=>heatmap[a0_0x23d4b2(0xfc)]()),volumeControl[a0_0x23d4b2(0xc6)]('input',function(){const _0x162587=a0_0x23d4b2,_0x25da39=this[_0x162587(0xba)];document[_0x162587(0x10c)](_0x162587(0xcd))[_0x162587(0xe6)]=_0x25da39,document[_0x162587(0x10c)](_0x162587(0x126))[_0x162587(0xe6)]=_0x25da39;}),document[a0_0x23d4b2(0x10c)](a0_0x23d4b2(0xcc))[a0_0x23d4b2(0xc6)](a0_0x23d4b2(0xee),createGazePlot);function startTracking(){const _0x5597f4=a0_0x23d4b2;if(isTracking)return;const _0x435cbb=parseInt(durationInput[_0x5597f4(0xba)]);if(isNaN(_0x435cbb)||_0x435cbb<0x1||_0x435cbb>0x3c){alert('Please\x20enter\x20a\x20valid\x20duration\x20between\x201\x20and\x2060\x20seconds.');return;}Effect[_0x5597f4(0xdb)](),clearHeatmap(),isTracking=!![],controlPanel[_0x5597f4(0xc4)][_0x5597f4(0xb9)]('hidden'),disableControls(!![]),startButton[_0x5597f4(0xd9)]=_0x5597f4(0x123),trackingTimer=setTimeout(endTracking,_0x435cbb*0x3e8),updateMousePosition();}function endTracking(){const _0xbc8337=a0_0x23d4b2;isTracking=![],heatmap[_0xbc8337(0xe7)]({'max':0x1,'data':positions}),controlPanel[_0xbc8337(0xc4)][_0xbc8337(0x11f)](_0xbc8337(0x112)),disableControls(![]),startButton[_0xbc8337(0xd9)]=_0xbc8337(0xe3);}function resetBackground(){const _0x834182=a0_0x23d4b2;document[_0x834182(0x114)]['style']['backgroundImage']=_0x834182(0xf5),document['body'][_0x834182(0xf1)][_0x834182(0xc3)]=_0x834182(0xeb),backgroundInput['value']='';}function clearHeatmap(){heatmap['setData']({'max':0x1,'data':[]}),positions=[];}function exportHeatmap(){const _0x3358be=a0_0x23d4b2;controlPanel[_0x3358be(0xc4)][_0x3358be(0xb9)](_0x3358be(0x112)),setTimeout(()=>{const _0x162093=_0x3358be;html2canvas(document['body'],{'width':document['body']['scrollWidth'],'height':document[_0x162093(0x114)][_0x162093(0xec)],'scale':0x1,'useCORS':!![]})[_0x162093(0xb6)](_0x10cbb0=>{const _0x41ec77=_0x162093,_0x11c659=_0x10cbb0[_0x41ec77(0x12d)]('image/png')[_0x41ec77(0xf8)](_0x41ec77(0xdc),_0x41ec77(0xf0)),_0x388161=document[_0x41ec77(0x12f)]('a');_0x388161[_0x41ec77(0xbf)]=_0x41ec77(0xe4),_0x388161[_0x41ec77(0xf3)]=_0x11c659,_0x388161[_0x41ec77(0xee)](),controlPanel[_0x41ec77(0xc4)][_0x41ec77(0x11f)](_0x41ec77(0x112));});},0x12c);}function setBackgroundImage(_0x2237f7){const _0x5093f8=a0_0x23d4b2,_0x588ad1=_0x2237f7[_0x5093f8(0x120)][_0x5093f8(0xd3)][0x0];if(_0x588ad1){const _0x548c5d=new FileReader();_0x548c5d['onload']=function(_0x39a141){const _0x47a6a0=_0x5093f8;document['body'][_0x47a6a0(0xf1)][_0x47a6a0(0x128)]='url(\x27'+_0x39a141['target'][_0x47a6a0(0xb3)]+'\x27)';},_0x548c5d[_0x5093f8(0xe8)](_0x588ad1);}else resetBackground();}function a0_0x8756(_0x3e222a,_0x956482){const _0x1f614a=a0_0x1f61();return a0_0x8756=function(_0x875640,_0xc4195e){_0x875640=_0x875640-0xb2;let _0x109f3b=_0x1f614a[_0x875640];return _0x109f3b;},a0_0x8756(_0x3e222a,_0x956482);}function trackMouseMovement(_0x486065){const _0x236579=a0_0x23d4b2;if(!isTracking)return;const _0xcf10f7=performance['now'](),_0x2d86b6=performance[_0x236579(0xb5)]();_0xcf10f7-lastMoveTime>interval&&(lastMoveTime=_0xcf10f7);if(_0x2d86b6-lastMoveTimeForEffects>0x64){console[_0x236579(0xd1)](_0x236579(0x11a)),lastMoveTimeForEffects=_0x2d86b6;const _0x5e09e5=effectSelect[_0x236579(0xba)],_0x5b3741=EffectFactory[_0x236579(0x102)](_0x5e09e5,_0x486065[_0x236579(0xe0)],_0x486065[_0x236579(0xca)]);_0x5b3741&&_0x5b3741[_0x236579(0x116)]();}}function updateMousePosition(){const _0x5f4646=a0_0x23d4b2;if(!isTracking)return;positions[_0x5f4646(0xf7)]({'x':lastKnownMousePosition['x'],'y':lastKnownMousePosition['y'],'value':0x1}),setTimeout(updateMousePosition,interval);}function disableControls(_0x2c33c2){const _0x154d59=a0_0x23d4b2;startButton['disabled']=_0x2c33c2,durationInput[_0x154d59(0x106)]=_0x2c33c2,backgroundInput[_0x154d59(0x106)]=_0x2c33c2,resetBackgroundButton[_0x154d59(0x106)]=_0x2c33c2,clearHeatmapButton['disabled']=_0x2c33c2,exportButton[_0x154d59(0x106)]=_0x2c33c2,effectSelect['disabled']=_0x2c33c2;}