diff --git a/game/static/js/main.ef7701ce.chunk.js b/game/static/js/main.ef7701ce.chunk.js index c7aec62..f2f0fbb 100644 --- a/game/static/js/main.ef7701ce.chunk.js +++ b/game/static/js/main.ef7701ce.chunk.js @@ -1 +1 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[0],[,,,,,,,,,,,,,,,,,function(e,t,n){e.exports=n.p+"static/media/dice.6ab220e5.wav"},function(e,t,n){e.exports=n(32)},,,,,function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){},,function(e,t,n){},function(e,t,n){"use strict";n.r(t);var o=n(6),a=n.n(o),r=n(16),i=n.n(r),c=(n(23),n(1)),l=n(2),s=n(4),u=n(0),d=n(3),h=n(12),f=n(9),m=n(13),p=n(8),v=n(10),y=n(7),b=n(14),w=(n(24),function(e){function t(e){var n;return Object(c.a)(this,t),(n=Object(s.a)(this,Object(u.a)(t).call(this,e))).handleClick=n.handleClick.bind(Object(p.a)(Object(p.a)(n))),n}return Object(d.a)(t,e),Object(l.a)(t,[{key:"handleClick",value:function(){this.props.handleClick(this.props.idx)}},{key:"render",value:function(){var e=this.props,t=e.numberWords,n=e.locked,o=e.val,r=e.disabled,i=e.rolling,c="Die fas fa-dice-".concat(t[o-1]," fa-5x ");return n&&(c+="Die-locked"),i&&(c+="Die-rolling"),document.querySelector("body").className=i?"rolling":"",a.a.createElement("i",{className:c,onClick:this.handleClick,disabled:r})}}]),t}(o.Component));w.defaultProps={numberWords:["one","two","three","four","five","six"],val:5};var g=w,S=(n(25),function(e){function t(){return Object(c.a)(this,t),Object(s.a)(this,Object(u.a)(t).apply(this,arguments))}return Object(d.a)(t,e),Object(l.a)(t,[{key:"render",value:function(){var e=this;return a.a.createElement("div",{className:"Dice"},this.props.dice.map(function(t,n){return a.a.createElement(g,{handleClick:e.props.handleClick,val:t,locked:e.props.locked[n],idx:n,key:n,disabled:e.props.disabled,rolling:e.props.rolling&&!e.props.locked[n]})}))}}]),t}(o.Component)),O=(n(26),function(e){function t(){return Object(c.a)(this,t),Object(s.a)(this,Object(u.a)(t).apply(this,arguments))}return Object(d.a)(t,e),Object(l.a)(t,[{key:"render",value:function(){var e=this.props,t=e.score,n=e.name,o=e.doScore,r=e.description,i=void 0!==t;return a.a.createElement("tr",{className:"RuleRow RuleRow-".concat(i?"disabled":"active"),onClick:i?null:o},a.a.createElement("td",{className:"RuleRow-name"},n),a.a.createElement("td",{className:"RuleRow-score"},a.a.createElement("span",null,i?t:r)))}}]),t}(o.Component));n(27);function j(e,t){var n="undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"===typeof e)return k(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return k(e,t)}(e))||t&&e&&"number"===typeof e.length){n&&(e=n);var o=0,a=function(){};return{s:a,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,i=!0,c=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){c=!0,r=e},f:function(){try{i||null==n.return||n.return()}finally{if(c)throw r}}}}function k(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n=n.count})?n.sum(e):0},n}return Object(d.a)(t,e),t}(E),z=function(e){function t(){var e,n;Object(c.a)(this,t);for(var o=arguments.length,a=new Array(o),r=0;rn&&Math.abs(e.y)>n&&Math.abs(e.z)>n?(r.normalize().multiplyScalar(oe.edgeRadius),e=o.add(r)):Math.abs(e.x)>n&&Math.abs(e.y)>n?(r.z=0,r.normalize().multiplyScalar(oe.edgeRadius),e.x=o.x+r.x,e.y=o.y+r.y):Math.abs(e.x)>n&&Math.abs(e.z)>n?(r.y=0,r.normalize().multiplyScalar(oe.edgeRadius),e.x=o.x+r.x,e.z=o.z+r.z):Math.abs(e.y)>n&&Math.abs(e.z)>n&&(r.x=0,r.normalize().multiplyScalar(oe.edgeRadius),e.y=o.y+r.y,e.z=o.z+r.z);var i=function(e){return e=1/oe.notchRadius*e,e=Math.PI*Math.max(-1,Math.min(1,e)),oe.notchDepth*(Math.cos(e)+1)},c=function(e){return i(e[0])*i(e[1])};.5===e.y?e.y-=c([e.x,e.z]):.5===e.x?(e.x-=c([e.y+.23,e.z+.23]),e.x-=c([e.y-.23,e.z-.23])):.5===e.z?(e.z-=c([e.x-.23,e.y+.23]),e.z-=c([e.x,e.y]),e.z-=c([e.x+.23,e.y-.23])):-.5===e.z?(e.z+=c([e.x+.23,e.y+.23]),e.z+=c([e.x+.23,e.y-.23]),e.z+=c([e.x-.23,e.y+.23]),e.z+=c([e.x-.23,e.y-.23])):-.5===e.x?(e.x+=c([e.y+.23,e.z+.23]),e.x+=c([e.y+.23,e.z-.23]),e.x+=c([e.y,e.z]),e.x+=c([e.y-.23,e.z+.23]),e.x+=c([e.y-.23,e.z-.23])):-.5===e.y&&(e.y+=c([e.x+.23,e.z+.23]),e.y+=c([e.x+.23,e.z]),e.y+=c([e.x+.23,e.z-.23]),e.y+=c([e.x-.23,e.z+.23]),e.y+=c([e.x-.23,e.z]),e.y+=c([e.x-.23,e.z-.23])),t.setXYZ(a,e.x,e.y,e.z)},a=0;a0&&(window.console.log("tempArrToKnowWhenRollingEnds.length > 0"),ae=[],e.throwDices())},5e3)})}},{key:"roll",value:function(e){localStorage.setItem("scores",JSON.stringify(this.state.scores)),this.setState(function(e){return{dice:e.dice.map(function(t,n){return e.locked[n]?t:ie[n].currentNum}),locked:e.rollsLeft>1?e.locked:Array(U).fill(!0),rollsLeft:e.rollsLeft-1,rolling:!1}});var t=Object.values(this.state.scores);if(0===(t=t.filter(function(e){return void 0===e})).length&&"1"!==localStorage.endGameState){if(document.querySelector("html").classList.add("endGame"),localStorage.endGameState,navigator.onLine){var n=new Date,o=["January","February","March","April","May","June","July","August","September","October","November","December"][n.getMonth()],a=document.querySelector("#userScore").innerHTML;window.console.log(document.querySelector("#userScore").innerHTML),function(e,t){var n=document.querySelector("[data-stats-url]").getAttribute("data-stats-url"),o=n+e;t.gameType&&(o=o+"&game_type="+t.gameType),t.gameScore&&(o=o+"&score="+t.gameScore),fetch(o).then(function(e){return e.json()}).then(function(e){if(console.log(e),e.success.position){var o="";for(localStorage.getItem("uname")&&(o=localStorage.getItem("uname"));!a;){var a=prompt("You are in the top players in position "+e.success.position+".\nPlease enter your name:",o);if("string"!==typeof a)return}localStorage.setItem("uname",a),fetch(n+"?set-stats&game_type="+t.gameType+"&score="+t.gameScore+"&uname="+a).then(function(e){return e.json()}).then(function(e){console.log(e),window.localStorage.clear(),window.location.reload()})}})}("?check-stats",{gameType:o+" "+n.getFullYear(),gameScore:a})}window.setTimeout(function(){localStorage.removeItem("endGameState")},1500)}}},{key:"toggleLocked",value:function(e){this.state.rollsLeft>0&&!this.state.rolling&&this.setState(function(t){return{locked:[].concat(Object(h.a)(t.locked.slice(0,e)),[!t.locked[e]],Object(h.a)(t.locked.slice(e+1)))}})}},{key:"doScore",value:function(e,t){var n=this;this.setState(function(o){return{scores:Object(m.a)({},o.scores,Object(f.a)({},e,t(n.state.dice))),rollsLeft:X,locked:Array(U).fill(!1)}}),this.throwDices()}},{key:"displayRollInfo",value:function(){return["0 Rolls Left. Choose Combination","1 Roll Left","2 Rolls Left","Starting Round"][this.state.rollsLeft]}},{key:"displayRollCounter",value:function(){return["0","1","2","\u27f3"][this.state.rollsLeft]}},{key:"toogleRerolButtonVisibility",value:function(){return["dn","","",""][this.state.rollsLeft]}},{key:"render",value:function(){var e=this.state,t=e.dice,n=e.locked,o=e.rollsLeft,r=e.rolling,i=e.scores;return a.a.createElement("div",{className:"Game"},a.a.createElement("canvas",{id:"canvas"}),a.a.createElement("header",{className:"Game-header"},a.a.createElement("div",{id:"score-result"}),a.a.createElement("section",{className:"Game-dice-section"},a.a.createElement("div",{className:"Game-button-wrapper"},a.a.createElement("button",{className:"Game-reroll rerollBtn "+this.toogleRerolButtonVisibility(),disabled:n.every(function(e){return e})||0===o||r,onClick:this.throwDices,title:this.displayRollInfo()},a.a.createElement("span",{className:"icon-dice"},"\ud83c\udfb2")," ",this.displayRollCounter())),a.a.createElement(S,{dice:t,locked:n,handleClick:this.toggleLocked,disabled:0===o,rolling:r}))),a.a.createElement(J,{doScore:this.doScore,scores:i}))}}]),t}(o.Component),pe=(n(29),function(e){function t(){return Object(c.a)(this,t),Object(s.a)(this,Object(u.a)(t).apply(this,arguments))}return Object(d.a)(t,e),Object(l.a)(t,[{key:"render",value:function(){return a.a.createElement("div",{className:"App"},a.a.createElement(me,null))}}]),t}(o.Component)),ve=(n(30),n(31),Boolean("localhost"===window.location.hostname||"[::1]"===window.location.hostname||window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/)));function ye(e){navigator.serviceWorker.register(e).then(function(e){e.onupdatefound=function(){var t=e.installing;t.onstatechange=function(){"installed"===t.state&&(navigator.serviceWorker.controller?console.log("New content is available; please refresh."):console.log("Content is cached for offline use."))}}}).catch(function(e){console.error("Error during service worker registration:",e)})}i.a.render(a.a.createElement(pe,null),document.getElementById("root")),function(){if("serviceWorker"in navigator){if(new URL(".",window.location).origin!==window.location.origin)return;window.addEventListener("load",function(){var e="".concat(".","/service-worker.js");ve?(function(e){fetch(e).then(function(t){404===t.status||-1===t.headers.get("content-type").indexOf("javascript")?navigator.serviceWorker.ready.then(function(e){e.unregister().then(function(){window.location.reload()})}):ye(e)}).catch(function(){console.log("No internet connection found. App is running in offline mode.")})}(e),navigator.serviceWorker.ready.then(function(){console.log("This web app is being served cache-first by a service worker. To learn more, visit https://goo.gl/SC7cgQ")})):ye(e)})}}()}],[[18,1,2]]]); +(window.webpackJsonp=window.webpackJsonp||[]).push([[0],[,,,,,,,,,,,,,,,,,function(e,t,n){e.exports=n.p+"static/media/dice.6ab220e5.wav"},function(e,t,n){e.exports=n(32)},,,,,function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){},,function(e,t,n){},function(e,t,n){"use strict";n.r(t);var o=n(6),a=n.n(o),r=n(16),i=n.n(r),c=(n(23),n(1)),l=n(2),s=n(4),u=n(0),d=n(3),h=n(12),f=n(9),m=n(13),p=n(8),v=n(10),y=n(7),b=n(14),w=(n(24),function(e){function t(e){var n;return Object(c.a)(this,t),(n=Object(s.a)(this,Object(u.a)(t).call(this,e))).handleClick=n.handleClick.bind(Object(p.a)(Object(p.a)(n))),n}return Object(d.a)(t,e),Object(l.a)(t,[{key:"handleClick",value:function(){this.props.handleClick(this.props.idx)}},{key:"render",value:function(){var e=this.props,t=e.numberWords,n=e.locked,o=e.val,r=e.disabled,i=e.rolling,c="Die fas fa-dice-".concat(t[o-1]," fa-5x ");return n&&(c+="Die-locked"),i&&(c+="Die-rolling"),document.querySelector("body").className=i?"rolling":"",a.a.createElement("i",{className:c,onClick:this.handleClick,disabled:r})}}]),t}(o.Component));w.defaultProps={numberWords:["one","two","three","four","five","six"],val:5};var g=w,S=(n(25),function(e){function t(){return Object(c.a)(this,t),Object(s.a)(this,Object(u.a)(t).apply(this,arguments))}return Object(d.a)(t,e),Object(l.a)(t,[{key:"render",value:function(){var e=this;return a.a.createElement("div",{className:"Dice"},this.props.dice.map(function(t,n){return a.a.createElement(g,{handleClick:e.props.handleClick,val:t,locked:e.props.locked[n],idx:n,key:n,disabled:e.props.disabled,rolling:e.props.rolling&&!e.props.locked[n]})}))}}]),t}(o.Component)),O=(n(26),function(e){function t(){return Object(c.a)(this,t),Object(s.a)(this,Object(u.a)(t).apply(this,arguments))}return Object(d.a)(t,e),Object(l.a)(t,[{key:"render",value:function(){var e=this.props,t=e.score,n=e.name,o=e.doScore,r=e.description,i=void 0!==t;return a.a.createElement("tr",{className:"RuleRow RuleRow-".concat(i?"disabled":"active"),onClick:i?null:o},a.a.createElement("td",{className:"RuleRow-name"},n),a.a.createElement("td",{className:"RuleRow-score"},a.a.createElement("span",null,i?t:r)))}}]),t}(o.Component));n(27);function j(e,t){var n="undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"===typeof e)return k(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return k(e,t)}(e))||t&&e&&"number"===typeof e.length){n&&(e=n);var o=0,a=function(){};return{s:a,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,i=!0,c=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){c=!0,r=e},f:function(){try{i||null==n.return||n.return()}finally{if(c)throw r}}}}function k(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n=n.count})?n.sum(e):0},n}return Object(d.a)(t,e),t}(E),z=function(e){function t(){var e,n;Object(c.a)(this,t);for(var o=arguments.length,a=new Array(o),r=0;rn&&Math.abs(e.y)>n&&Math.abs(e.z)>n?(r.normalize().multiplyScalar(oe.edgeRadius),e=o.add(r)):Math.abs(e.x)>n&&Math.abs(e.y)>n?(r.z=0,r.normalize().multiplyScalar(oe.edgeRadius),e.x=o.x+r.x,e.y=o.y+r.y):Math.abs(e.x)>n&&Math.abs(e.z)>n?(r.y=0,r.normalize().multiplyScalar(oe.edgeRadius),e.x=o.x+r.x,e.z=o.z+r.z):Math.abs(e.y)>n&&Math.abs(e.z)>n&&(r.x=0,r.normalize().multiplyScalar(oe.edgeRadius),e.y=o.y+r.y,e.z=o.z+r.z);var i=function(e){return e=1/oe.notchRadius*e,e=Math.PI*Math.max(-1,Math.min(1,e)),oe.notchDepth*(Math.cos(e)+1)},c=function(e){return i(e[0])*i(e[1])};.5===e.y?e.y-=c([e.x,e.z]):.5===e.x?(e.x-=c([e.y+.23,e.z+.23]),e.x-=c([e.y-.23,e.z-.23])):.5===e.z?(e.z-=c([e.x-.23,e.y+.23]),e.z-=c([e.x,e.y]),e.z-=c([e.x+.23,e.y-.23])):-.5===e.z?(e.z+=c([e.x+.23,e.y+.23]),e.z+=c([e.x+.23,e.y-.23]),e.z+=c([e.x-.23,e.y+.23]),e.z+=c([e.x-.23,e.y-.23])):-.5===e.x?(e.x+=c([e.y+.23,e.z+.23]),e.x+=c([e.y+.23,e.z-.23]),e.x+=c([e.y,e.z]),e.x+=c([e.y-.23,e.z+.23]),e.x+=c([e.y-.23,e.z-.23])):-.5===e.y&&(e.y+=c([e.x+.23,e.z+.23]),e.y+=c([e.x+.23,e.z]),e.y+=c([e.x+.23,e.z-.23]),e.y+=c([e.x-.23,e.z+.23]),e.y+=c([e.x-.23,e.z]),e.y+=c([e.x-.23,e.z-.23])),t.setXYZ(a,e.x,e.y,e.z)},a=0;a0&&(window.console.log("tempArrToKnowWhenRollingEnds.length > 0"),ae=[],e.throwDices())},5e3)})}},{key:"roll",value:function(e){localStorage.setItem("scores",JSON.stringify(this.state.scores)),this.setState(function(e){return{dice:e.dice.map(function(t,n){return e.locked[n]?t:ie[n].currentNum}),locked:e.rollsLeft>1?e.locked:Array(U).fill(!0),rollsLeft:e.rollsLeft-1,rolling:!1}});var t=Object.values(this.state.scores);if(0===(t=t.filter(function(e){return void 0===e})).length&&"1"!==localStorage.endGameState){if(document.querySelector("html").classList.add("endGame"),localStorage.endGameState,navigator.onLine){var n=new Date,o=["January","February","March","April","May","June","July","August","September","October","November","December"][n.getMonth()],a=document.querySelector("#userScore").innerHTML;window.console.log(document.querySelector("#userScore").innerHTML),function(e,t){var n=document.querySelector("[data-stats-url]").getAttribute("data-stats-url"),o=n+e;t.gameType&&(o=o+"&game_type="+t.gameType),t.gameScore&&(o=o+"&score="+t.gameScore),fetch(o).then(function(e){return e.json()}).then(function(e){if(console.log(e),e.success.position){var o="";for(localStorage.getItem("uname")&&(o=localStorage.getItem("uname"));!a;){var a=prompt("You are in the top players in position "+e.success.position+".\nPlease enter your name:",o);if("string"!==typeof a)return}localStorage.setItem("uname",a),fetch(n+"?set-stats&game_type="+t.gameType+"&score="+t.gameScore+"&uname="+a).then(function(e){return e.json()}).then(function(e){console.log(e),window.localStorage.clear(),window.location.reload()})}})}("?check-stats",{gameType:o+" "+n.getFullYear(),gameScore:a})}window.setTimeout(function(){localStorage.removeItem("endGameState")},1500)}}},{key:"toggleLocked",value:function(e){this.state.rollsLeft>0&&!this.state.rolling&&this.setState(function(t){return{locked:[].concat(Object(h.a)(t.locked.slice(0,e)),[!t.locked[e]],Object(h.a)(t.locked.slice(e+1)))}})}},{key:"doScore",value:function(e,t){var n=this;this.setState(function(o){return{scores:Object(m.a)({},o.scores,Object(f.a)({},e,t(n.state.dice))),rollsLeft:X,locked:Array(U).fill(!1)}}),this.throwDices()}},{key:"displayRollInfo",value:function(){return["0 Rolls Left. Choose Combination","1 Roll Left","2 Rolls Left","Starting Round"][this.state.rollsLeft]}},{key:"displayRollCounter",value:function(){return["0","1","2","\u27f3"][this.state.rollsLeft]}},{key:"toogleRerolButtonVisibility",value:function(){return["dn","","",""][this.state.rollsLeft]}},{key:"render",value:function(){var e=this.state,t=e.dice,n=e.locked,o=e.rollsLeft,r=e.rolling,i=e.scores;return a.a.createElement("div",{className:"Game"},a.a.createElement("canvas",{id:"canvas"}),a.a.createElement("header",{className:"Game-header"},a.a.createElement("div",{id:"score-result"}),a.a.createElement("section",{className:"Game-dice-section"},a.a.createElement("div",{className:"Game-button-wrapper"},a.a.createElement("button",{className:"Game-reroll rerollBtn "+this.toogleRerolButtonVisibility(),disabled:n.every(function(e){return e})||0===o||r,onClick:this.throwDices,title:this.displayRollInfo()},a.a.createElement("span",{className:"icon-dice"},"\ud83c\udfb2")," ",this.displayRollCounter())),a.a.createElement(S,{dice:t,locked:n,handleClick:this.toggleLocked,disabled:0===o,rolling:r}))),a.a.createElement(J,{doScore:this.doScore,scores:i}))}}]),t}(o.Component),pe=(n(29),function(e){function t(){return Object(c.a)(this,t),Object(s.a)(this,Object(u.a)(t).apply(this,arguments))}return Object(d.a)(t,e),Object(l.a)(t,[{key:"render",value:function(){return a.a.createElement("div",{className:"App"},a.a.createElement(me,null))}}]),t}(o.Component)),ve=(n(30),n(31),Boolean("localhost"===window.location.hostname||"[::1]"===window.location.hostname||window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/)));function ye(e){navigator.serviceWorker.register(e).then(function(e){e.onupdatefound=function(){var t=e.installing;t.onstatechange=function(){"installed"===t.state&&(navigator.serviceWorker.controller?console.log("New content is available; please refresh."):console.log("Content is cached for offline use."))}}}).catch(function(e){console.error("Error during service worker registration:",e)})}i.a.render(a.a.createElement(pe,null),document.getElementById("root")),function(){if("serviceWorker"in navigator){if(new URL(".",window.location).origin!==window.location.origin)return;window.addEventListener("load",function(){var e="".concat(".","/service-worker.js");ve?(function(e){fetch(e).then(function(t){404===t.status||-1===t.headers.get("content-type").indexOf("javascript")?navigator.serviceWorker.ready.then(function(e){e.unregister().then(function(){window.location.reload()})}):ye(e)}).catch(function(){console.log("No internet connection found. App is running in offline mode.")})}(e),navigator.serviceWorker.ready.then(function(){console.log("This web app is being served cache-first by a service worker. To learn more, visit https://goo.gl/SC7cgQ")})):ye(e)})}}()}],[[18,1,2]]]);