diff --git a/build/2.css b/build/2.css index 0cb2e0f..5e4dfde 100644 --- a/build/2.css +++ b/build/2.css @@ -1 +1 @@ -.icon14{height:14px;padding-bottom:2px}.icon16{height:16px}.icon20{height:20px}.icon24{height:24px}.bigger{font-size:14px}.name{-webkit-user-select:all;-moz-user-select:all;-ms-user-select:all;user-select:all}.name .subname:before{content:"\a ";white-space:pre}.name .subname{font-size:13px;padding-bottom:4px;display:inherit}@media only screen and (min-width:975px){.collection{margin-top:5px;margin-right:5px;margin-left:5px}}@media only screen and (min-width:975px){.collection>.left{font-family:Roboto,Arial,sans-serif;float:left;width:30%}.collection>.right{font-family:Roboto,Arial,sans-serif;float:right;width:70%}.collection .left>.fixed{position:fixed;top:0;overflow-y:auto;height:100vh;width:calc(30% - 30px)}.collection #buttons{margin:0 0 2% 1%}.collection #buttons,.collection .button,.collection input[type=button],.collection input[type=text]{border-radius:5px;border-color:transparent;text-align:center;outline:none}.collection input[type=text]{margin-bottom:2px}.collection .centeredCheckBox,.collection input[type=text]{width:220px}.collection .text-entry{display:flex;justify-content:center;align-items:center}.collection .text-entry input:focus{outline:none}.collection .card{text-align:left;display:flex;border:1px solid #aeaeae}.collection .card .left,.collection .card .right,.collection .card .stats{padding-top:4px}.collection .card .bigger{text-align:center;font-weight:700}.collection .card .energy{display:flex;width:20px!important}.collection .card .left{vertical-align:text-top;float:left;width:210px;padding-left:4px}.collection .card .right{float:left;width:calc(100% - 322px);border-left:2px solid #aeaeae;padding-left:4px;padding-right:4px;padding-bottom:6px;white-space:pre-line}.collection .creature .right{width:calc(100% - 366px)}.collection .creature .stats{vertical-align:text-top;float:left;text-align:right;width:40px}.collection .SearchForm{padding-top:3px;font-family:Roboto,Arial,sans-serif}.collection .searchName{display:flex;justify-content:center;align-items:center;padding:2%;font-size:16pt}.collection .centeredCheckBox{margin:0 auto;text-align:left}.collection .centeredSpacing{display:flex;justify-content:space-between}.collection .setBox{width:80%;float:right}.collection #sets{width:80%}.collection .centeredButtons{display:flex;justify-content:center;align-items:center}.collection #search{width:25%;margin:2%;border-radius:5px;border-color:transparent;text-align:center}.collection .minMax{display:flex;justify-content:space-between;margin:0 auto;width:50%;text-align:right}.collection .brainwashed{border-radius:3px;background-color:#dcdddf;color:#000!important}.collection .chieftain,.collection .flavortext{font-style:italic}.collection .mull input{margin-left:0;margin-top:1px}.collection .Collapsible__contentInner input,.collection .mull input{vertical-align:middle}.collection .Collapsible__contentInner .centeredCheckBox{width:50%}.collection .tribes{width:96%;text-align:center}.collection .and,.collection .disciplines{text-align:center}.collection .and{vertical-align:text-bottom;width:15%;border-radius:5px;border-color:transparent;margin:2%}}.collection .disciplines input{width:30px;height:14px;text-align:center;margin-top:2px}.collection .mcbp input{width:24px;height:14px;padding:unset;text-align:center;margin-top:2px}.collection .card .icon14,.collection .card .icon16,.collection .card .icon20,.collection .card .icon24{vertical-align:middle}.collection .thumb{width:100px;height:98px}.collection .card .thumb{float:left}.collection .attack .bp{vertical-align:middle}.collection .Collapsible{margin-bottom:5px;margin-top:5px;width:96%}.collection .Collapsible__trigger{background-color:#333;display:block;position:relative;padding-top:5px;padding-bottom:5px;text-indent:5px;font-weight:700;white-space:pre}.collection .Collapsible__trigger:hover{background-color:red}.collection .Collapsible__trigger:after{content:"^";position:absolute;right:10px;top:10px;display:block;transition:transform .4s}.collection .Collapsible__trigger.is-open:after{transform:rotate(180deg);right:5px;top:5px}.collection .Collapsible__trigger.is-disabled{opacity:.5;background-color:grey}.collection .Collapsible__contentInner{margin-top:5px}.collection .card_img{position:absolute;width:100%;z-index:2;left:-11px}.collection .card_img .hidden{display:none;max-height:0}.collection .card_img img{max-width:250px;max-height:350px}.collection .entries{text-align:left;width:100%}.collection .entries input[type=button]{margin:0 0 2% 1%}.collection .list-nav-top{display:flex}.collection .extended .fullcard{max-width:250px;max-height:350px}.collection hr{width:96%;margin-inline-start:0}.collection .none{display:inline}.collection .none>span{top:-3px;position:relative}.collection label{user-select:none;-webkit-user-select:none;-ms-user-select:none;-webkit-touch-callout:none;-o-user-select:none;-moz-user-select:none} \ No newline at end of file +.icon14{height:14px;padding-bottom:2px}.icon16{height:16px}.icon20{height:20px}.icon24{height:24px}.bigger{font-size:14px}.name{-webkit-user-select:all;-moz-user-select:all;-ms-user-select:all;user-select:all}.name .subname:before{content:"\a ";white-space:pre}.name .subname{font-size:13px;padding-bottom:4px;display:inherit}@media only screen and (min-width:975px){.collection{margin-top:5px;margin-right:5px;margin-left:5px}}@media only screen and (min-width:975px){.collection>.left{font-family:Roboto,Arial,sans-serif;float:left;width:30%}.collection>.right{font-family:Roboto,Arial,sans-serif;float:right;width:70%}.collection #side-menu{position:relative}.collection #buttons{margin:0 0 2% 1%}.collection #buttons,.collection .button,.collection input[type=button],.collection input[type=text]{border-radius:5px;border-color:transparent;text-align:center;outline:none}.collection input[type=text]{margin-bottom:2px}.collection .centeredCheckBox,.collection input[type=text]{width:220px}.collection .text-entry{display:flex;justify-content:center;align-items:center}.collection .text-entry input:focus{outline:none}.collection .card{text-align:left;display:flex;border:1px solid #aeaeae}.collection .card .left,.collection .card .right,.collection .card .stats{padding-top:4px}.collection .card .bigger{text-align:center;font-weight:700}.collection .card .energy{display:flex;width:20px!important}.collection .card .left{vertical-align:text-top;float:left;width:210px;padding-left:4px}.collection .card .right{float:left;width:calc(100% - 322px);border-left:2px solid #aeaeae;padding-left:4px;padding-right:4px;padding-bottom:6px;white-space:pre-line}.collection .creature .right{width:calc(100% - 366px)}.collection .creature .stats{vertical-align:text-top;float:left;text-align:right;width:40px}.collection .SearchForm{padding-top:3px;font-family:Roboto,Arial,sans-serif}.collection .searchName{display:flex;justify-content:center;align-items:center;padding:2%;font-size:16pt}.collection .centeredCheckBox{margin:0 auto;text-align:left}.collection .centeredSpacing{display:flex;justify-content:space-between}.collection .setBox{width:80%;float:right}.collection #sets{width:80%}.collection .centeredButtons{display:flex;justify-content:center;align-items:center}.collection #search{width:25%;margin:2%;border-radius:5px;border-color:transparent;text-align:center}.collection .minMax{display:flex;justify-content:space-between;margin:0 auto;width:50%;text-align:right}.collection .brainwashed{border-radius:3px;background-color:#dcdddf;color:#000!important}.collection .chieftain,.collection .flavortext{font-style:italic}.collection .mull input{margin-left:0;margin-top:1px}.collection .Collapsible__contentInner input,.collection .mull input{vertical-align:middle}.collection .Collapsible__contentInner .centeredCheckBox{width:50%}.collection .tribes{width:96%;text-align:center}.collection .and,.collection .disciplines{text-align:center}.collection .and{vertical-align:text-bottom;width:15%;border-radius:5px;border-color:transparent;margin:2%}}.collection .disciplines input{width:30px;height:14px;text-align:center;margin-top:2px}.collection .mcbp input{width:24px;height:14px;padding:unset;text-align:center;margin-top:2px}.collection .card .icon14,.collection .card .icon16,.collection .card .icon20,.collection .card .icon24{vertical-align:middle}.collection .thumb{width:100px;height:98px}.collection .card .thumb{float:left}.collection .attack .bp{vertical-align:middle}.collection .Collapsible{margin-bottom:5px;margin-top:5px;width:96%}.collection .Collapsible__trigger{background-color:#333;display:block;position:relative;padding-top:5px;padding-bottom:5px;text-indent:5px;font-weight:700;white-space:pre}.collection .Collapsible__trigger:hover{background-color:red}.collection .Collapsible__trigger:after{content:"^";position:absolute;right:10px;top:10px;display:block;transition:transform .4s}.collection .Collapsible__trigger.is-open:after{transform:rotate(180deg);right:5px;top:5px}.collection .Collapsible__trigger.is-disabled{opacity:.5;background-color:grey}.collection .Collapsible__contentInner{margin-top:5px}.collection .card_img{position:absolute;width:100%;z-index:2;left:-11px}.collection .card_img .hidden{display:none;max-height:0}.collection .card_img img{max-width:250px;max-height:350px}.collection .entries{text-align:left;width:100%}.collection .entries input[type=button]{margin:0 0 2% 1%}.collection .list-nav-top{display:flex}.collection .extended .fullcard{max-width:250px;max-height:350px}.collection hr{width:96%;margin-inline-start:0}.collection .none{display:inline}.collection .none>span{top:-3px;position:relative}.collection label{user-select:none;-webkit-user-select:none;-ms-user-select:none;-webkit-touch-callout:none;-o-user-select:none;-moz-user-select:none} \ No newline at end of file diff --git a/build/2.js b/build/2.js index 579da78..767fe2e 100644 --- a/build/2.js +++ b/build/2.js @@ -1 +1 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[2],{387:function(e,t,a){},390:function(e,t,a){"use strict";a.r(t);var n,i,r,l,s,c,m,o,u,g,p,d=a(122),x=a.n(d),h=a(64),f=a.n(h),b=a(62),y=a.n(b),$=a(52),E=a.n($),v=a(119),w=a.n(v),k=a(120),C=a.n(k),N=a(165),q=a.n(N),I=a(121),O=a.n(I),j=a(39),_=a.n(j),R=(a(164),a(0)),B=a.n(R),F=a(70),S=a(6),M=a(85),L=a(35),T=Object(M.a)(function(e,t,a){return t})(n=Object(M.b)(n=function(e){function t(){return y()(this,t),w()(this,C()(t).apply(this,arguments))}return O()(t,e),E()(t,[{key:"render",value:function(){var e=this,t=this.props.card;return 0==this.props.ext?B.a.createElement("div",{className:"card attack"},B.a.createElement("img",{className:"thumb",src:F.a.base_image+(t.gsx$thumb||F.a.thumb_missing),onClick:function(){return e.props.setImage(t.gsx$image)}}),B.a.createElement("div",{className:"left"},B.a.createElement(L.k,{name:t.gsx$name}),B.a.createElement("br",null),B.a.createElement(L.m,{set:t.gsx$set,rarity:t.gsx$rarity}),B.a.createElement("br",null),B.a.createElement("span",null,B.a.createElement(L.b,{bp:t.gsx$bp})," Attack - ",t.gsx$bp),B.a.createElement("br",null),B.a.createElement("div",null,B.a.createElement("span",{className:"bp bigger"},t.gsx$base)," | ",B.a.createElement(L.f,{element:"fire",value:t.gsx$fire}),t.gsx$fire," ",B.a.createElement(L.f,{element:"air",value:t.gsx$air}),t.gsx$air," ",B.a.createElement(L.f,{element:"earth",value:t.gsx$earth}),t.gsx$earth," ",B.a.createElement(L.f,{element:"water",value:t.gsx$water}),t.gsx$water)),B.a.createElement("br",null),B.a.createElement("div",{className:"right"},B.a.createElement(L.a,{ability:t.gsx$ability}),B.a.createElement(L.q,{data:{unique:t.gsx$unique,loyal:t.gsx$loyal,legendary:t.gsx$legendary}}),B.a.createElement("span",{className:"flavortext"},t.gsx$flavortext))):B.a.createElement("div",{className:"card attack"},B.a.createElement("img",{className:"fullcard",src:F.a.base_image+(t.gsx$image||F.a.card_back)}),B.a.createElement("div",{className:"right"},B.a.createElement(L.k,{name:t.gsx$name}),B.a.createElement("br",null),B.a.createElement(L.a,{ability:t.gsx$ability}),B.a.createElement(L.q,{data:{unique:t.gsx$unique,loyal:t.gsx$loyal,legendary:t.gsx$legendary}}),t.gsx$flavortext&&B.a.createElement(B.a.Fragment,null,B.a.createElement("span",{className:"flavortext"},t.gsx$flavortext),B.a.createElement("br",null)),B.a.createElement("span",null,"Art By: ",t.gsx$artist)))}}]),t}(B.a.Component))||n)||n,A=Object(M.a)(function(e,t,a){return t})(i=Object(M.b)(i=function(e){function t(){return y()(this,t),w()(this,C()(t).apply(this,arguments))}return O()(t,e),E()(t,[{key:"render",value:function(){var e=this,t=this.props.card;return 0==this.props.ext?B.a.createElement("div",{className:"card battlegear"},B.a.createElement("img",{className:"thumb",style:{float:"left"},src:F.a.base_image+(t.gsx$thumb||F.a.thumb_missing),onClick:function(){return e.props.setImage(t.gsx$image)}}),B.a.createElement("div",{className:"left"},B.a.createElement(L.k,{name:t.gsx$name}),B.a.createElement("br",null),B.a.createElement(L.m,{set:t.gsx$set,rarity:t.gsx$rarity}),B.a.createElement("br",null),B.a.createElement("span",null,B.a.createElement(L.c,null)," Battlegear",0=t.energy.min&&(l=l.find({gsx$energy:{$lte:t.energy.max}})),(0=t.mcbp.min&&(i=i.find({gsx$bp:{$lte:t.mcbp.max}}),l=l.find({gsx$mugicability:{$lte:t.mcbp.max}}),c=c.find({gsx$cost:{$lte:t.mcbp.max}})),(0=t[r]?de.setFixed(window.innerHeight):de.isFixed||de.setFixed(window.innerHeight)}else de.isFixed&&de.removeFixed()};var t=localStorage.getItem("extended");return null==t&&(e.ext=!1),e.ext=/true/i.test(t),e}return O()(a,e),E()(a,[{key:"componentDidMount",value:function(){window.addEventListener("scroll",this.handleScroll)}},{key:"componentWillUnmount",value:function(){window.removeEventListener("scroll",this.handleScroll)}},{key:"handleContent",value:function(e){this.content=e,this.p=1}},{key:"setImage",value:function(e){this.card_img=e||F.a.card_back,this.changeImage()}},{key:"setExt",value:function(){this.ext=!this.ext,localStorage.setItem("extended",this.ext)}},{key:"render",value:function(){var t=this;return B.a.createElement("div",{className:"collection "+(this.ext?"extended":"short")},B.a.createElement("div",{className:"left"},B.a.createElement("div",{id:"side-menu",style:de.fixed},B.a.createElement(fe,{url:F.a.base_image+this.card_img,ref:function(e){e&&(t.changeImage=e.getInstance().changeImage)}}),B.a.createElement(ge,x()({handleContent:this.handleContent.bind(this)},this.props)))),B.a.createElement("div",{className:"right"},B.a.createElement("div",{className:"list-nav-top"},this.navigation(),this.extended()),B.a.createElement("br",null),B.a.createElement(D,{ext:this.ext,cards:this.content.slice(this.n*(this.p-1),this.n*this.p),setImage:this.setImage.bind(this)}),B.a.createElement("br",null),this.navigation()))}},{key:"extended",value:function(){return B.a.createElement("div",{className:"ext-button"},B.a.createElement("button",{id:"buttons",onClick:this.setExt.bind(this)},this.ext?"Short Format":"Extended Format"))}},{key:"navigation",value:function(){var t=this,e=Math.ceil(this.content.length/this.n);return B.a.createElement("div",{className:"entries"},this.content.length," results - page ",this.p," of ",e," ",1=t.energy.min&&(l=l.find({gsx$energy:{$lte:t.energy.max}})),(0=t.mcbp.min&&(i=i.find({gsx$bp:{$lte:t.mcbp.max}}),l=l.find({gsx$mugicability:{$lte:t.mcbp.max}}),c=c.find({gsx$cost:{$lte:t.mcbp.max}})),(0 .left").getBoundingClientRect().width+2;this.style={position:"fixed",top:0,left:"".concat(t,"px"),overflowY:"auto",height:"".concat(e,"px"),width:"".concat(a,"px")}}},removeFixed:function(){this.style={}}},{setFixed:F.d,removeFixed:F.d},{deep:!1}),xe=Object(L.a)(function(e,t,a){return t})(ne=Object(L.b)((ie=function(e){function a(){var e;y()(this,a),e=w()(this,C()(a).call(this)),f()(e,"loaded",re,q()(e)),f()(e,"n",le,q()(e)),f()(e,"p",se,q()(e)),f()(e,"ext",ce,q()(e)),f()(e,"content",me,q()(e)),f()(e,"card_img",oe,q()(e)),f()(e,"fixedStyles",ue,q()(e)),e.handleScroll=function(e){if(e.preventDefault(),235<=window.pageYOffset){console.log(document.querySelector(".collection > .left").getBoundingClientRect().width);var t=document.documentElement,a=document.body,n="scrollTop",i="scrollHeight",r="clientHeight",l=(t[n]||a[n])/((t[i]||a[i])-t[r])*100,s=document.getElementById("side-menu");if(88<=l){var c=t[r]-t[r]*(l-85)/100;de.setFixed(c)}else s[i]>=t[r]?de.setFixed(window.innerHeight):de.isFixed||de.setFixed(window.innerHeight)}else de.isFixed&&de.removeFixed()};var t=localStorage.getItem("extended");return null==t&&(e.ext=!1),e.ext=/true/i.test(t),e}return O()(a,e),E()(a,[{key:"componentDidMount",value:function(){window.addEventListener("scroll",this.handleScroll),window.addEventListener("resize",this.handleScroll)}},{key:"componentWillUnmount",value:function(){window.removeEventListener("scroll",this.handleScroll),window.removeEventListener("resize",this.handleScroll)}},{key:"handleContent",value:function(e){this.content=e,this.p=1}},{key:"setImage",value:function(e){this.card_img=e||S.a.card_back,this.changeImage()}},{key:"setExt",value:function(){this.ext=!this.ext,localStorage.setItem("extended",this.ext)}},{key:"render",value:function(){var t=this;return _.a.createElement("div",{className:"collection "+(this.ext?"extended":"short")},_.a.createElement("div",{className:"left"},_.a.createElement("div",{id:"side-menu",style:de.fixed},_.a.createElement(fe,{url:S.a.base_image+this.card_img,ref:function(e){e&&(t.changeImage=e.getInstance().changeImage)}}),_.a.createElement(ge,x()({handleContent:this.handleContent.bind(this)},this.props)))),_.a.createElement("div",{className:"right"},_.a.createElement("div",{className:"list-nav-top"},this.navigation(),this.extended()),_.a.createElement("br",null),_.a.createElement(D,{ext:this.ext,cards:this.content.slice(this.n*(this.p-1),this.n*this.p),setImage:this.setImage.bind(this)}),_.a.createElement("br",null),this.navigation()))}},{key:"extended",value:function(){return _.a.createElement("div",{className:"ext-button"},_.a.createElement("button",{id:"buttons",onClick:this.setExt.bind(this)},this.ext?"Short Format":"Extended Format"))}},{key:"navigation",value:function(){var t=this,e=Math.ceil(this.content.length/this.n);return _.a.createElement("div",{className:"entries"},this.content.length," results - page ",this.p," of ",e," ",1new Date(t)&&(l[a].clear(),l[a].insert(e),k.set("".concat(l.format,"_").concat(a),e[0].updated,{path:"/"})):k.set("".concat(l.format,"_").concat(a),e[0].updated,{path:"/"})}),e.abrupt("return",t());e.next=5;break;case 5:if("building"==this.building[a].get())return r=Object(N.l)(this.building[a],function(e){r(),t()}),e.abrupt("return",r);e.next=8;break;case 8:if("setup"!=this.building[a].get()){e.next=16;break}if(this.building[a].set("building"),0==this[a].data.length)return e.abrupt("return",this.getSpreadsheetData(this.api.urls[n][this.format],n,function(e){return l[a].insert(e),l.building[a].set("built"),t()}));e.next=14;break;case 14:return this.building[a].set("built"),e.abrupt("return",t());case 16:e.next=21;break;case 18:return this.building[a]=N.k.box("wait"),i=Object(N.l)(this.building[a],function(){return i(),l.setupType(a,t)}),e.abrupt("return",i);case 21:case"end":return e.stop()}},e,this)})),function(e,t){return a.apply(this,arguments)})},{key:"setupDB",value:function(e){var n=new B.a("chaotic_".concat(e,".db"),{autosave:!0,autoload:!0,autoloadCallback:function(){var a=this;["attacks","battlegear","creatures","locations","mugic"].forEach(function(e){var t=n.getCollection(e);null===t||0===t.data.length?(a[e]=n.addCollection(e),a.building[e]?a.building[e].set("setup"):a.building[e]=N.k.box("setup")):(a[e]=t,a.building[e]?a.building[e].set("built"):a.building[e]=N.k.box("built"))})}.bind(this),autosaveInterval:4e3,persistenceMethod:"localStorage"});this.db=n}}]),n}(),l=A()(a.prototype,"building",[N.k],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return{}}}),A()(a.prototype,"setupType",[N.d],Object.getOwnPropertyDescriptor(a.prototype,"setupType"),a.prototype),A()(a.prototype,"setupDB",[N.d],Object.getOwnPropertyDescriptor(a.prototype,"setupDB"),a.prototype),a),C=(u=r=function(){function a(){b()(this,a),h()(this,"portal",c,this),h()(this,"cards",o,this),h()(this,"urls",s,this),this.instance=null,this.setupDB()}var t,n,r;return y()(a,[{key:"path",value:function(e){return a.path(e)}},{key:"base_image",get:function(){return"https://drive.google.com/uc?id="}},{key:"thumb_missing",get:function(){return"1JYjPzkv74IhzlHTyVh2niTDyui73HSfp"}},{key:"card_back",get:function(){return"1_MgWDPsPGf-gPBArn2v6ideJcqOPsSYC"}}],[{key:"getInstance",value:function(){return this.instance||(this.instance=new a),this.instance}},{key:"path",value:function(e){return a.base_url+e+a.data_format}}]),y()(a,[{key:"getSpreadsheet",value:(r=g()(p.a.mark(function e(t,a){return p.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:fetch(t).then(function(e){return e.json()}).then(function(e){return a(e.feed.entry)}).catch(function(e){return console.error("parsing failed",e),a(null)});case 1:case"end":return e.stop()}},e)})),function(e,t){return r.apply(this,arguments)})},{key:"setupDB",value:function(){try{var t={};i(360).forEach(function(e){t[e.gsx$type.$t]||(t[e.gsx$type.$t]={}),t[e.gsx$type.$t][e.gsx$subtype.$t]=a.path(e.gsx$url.$t)}),this.urls=t,this.portal=new M(this,"portal"),this.cards=new M(this,"cards")}catch(e){console.error("setting up database failed",e)}}},{key:"LoadDB",value:(n=g()(p.a.mark(function e(a){var n=this;return p.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise(function(e,t){null!==n.urls&&null!==n.portal&&null!==n.cards?n.buildCollection(a).then(function(){e()}):e()}));case 1:case"end":return e.stop()}},e)})),function(e){return n.apply(this,arguments)})},{key:"buildCollection",value:(t=g()(p.a.mark(function e(t){var n=this;return p.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all(t.map(function(a){return new Promise(function(e,t){return"cards"in a?n.cards.setupType(a.cards,e):"portal"in a?n.portal.setupType(a.portal,e):(console.error("cards or portal"),t())})}));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}},e)})),function(e){return t.apply(this,arguments)})},{key:"purgeDB",value:function(){this.cards.purgeDB(),this.portal.purgeDB(),window.location.reload()}},{key:"tribes",get:function(){return["Danian","Generic","Mipedian","M'arrillian","OverWorld","UnderWorld"]}},{key:"sets",get:function(){return{DOP:"Dawn of Perim",ZOTH:"Zenith of the Hive",SS:"Silent Sands",MI:"Beyond the Doors",ROTO:"Rise of the Oligarch",TOTT:"Turn of the Tide",FUN:"Forged Unity",AU:"Alliance Unraveled",FAS:"Fire and Stone",SAS:"Storm and Sea",EE:"Elemental Emperors",BR:"Beyond Rare",LR:"League Rewards",OP1:"Organized Play 1",PROMO:"Promotional",PROTO:"Prototype"}}}]),a}(),r.base_url="https://spreadsheets.google.com/feeds/list/",r.data_format="/od6/public/values?alt=json",n=u,c=A()(n.prototype,"portal",[N.k],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),o=A()(n.prototype,"cards",[N.k],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),s=A()(n.prototype,"urls",[N.k],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),n);t.a=C.getInstance()}}); \ No newline at end of file +!function(o){function e(e){for(var t,a,n=e[0],r=e[1],i=e[2],l=0,c=[];lnew Date(t)&&(l[a].clear(),l[a].insert(e),k.set("".concat(l.format,"_").concat(a),e[0].updated,{path:"/"})):k.set("".concat(l.format,"_").concat(a),e[0].updated,{path:"/"})}),e.abrupt("return",t());e.next=5;break;case 5:if("building"==this.building[a].get())return r=Object(N.l)(this.building[a],function(e){r(),t()}),e.abrupt("return",r);e.next=8;break;case 8:if("setup"!=this.building[a].get()){e.next=16;break}if(this.building[a].set("building"),0==this[a].data.length)return e.abrupt("return",this.getSpreadsheetData(this.api.urls[n][this.format],n,function(e){return l[a].insert(e),l.building[a].set("built"),t()}));e.next=14;break;case 14:return this.building[a].set("built"),e.abrupt("return",t());case 16:e.next=21;break;case 18:return this.building[a]=N.k.box("wait"),i=Object(N.l)(this.building[a],function(){return i(),l.setupType(a,t)}),e.abrupt("return",i);case 21:case"end":return e.stop()}},e,this)})),function(e,t){return a.apply(this,arguments)})},{key:"setupDB",value:function(e){var n=new B.a("chaotic_".concat(e,".db"),{autosave:!0,autoload:!0,autoloadCallback:function(){var a=this;["attacks","battlegear","creatures","locations","mugic"].forEach(function(e){var t=n.getCollection(e);null===t||0===t.data.length?(a[e]=n.addCollection(e),a.building[e]?a.building[e].set("setup"):a.building[e]=N.k.box("setup")):(a[e]=t,a.building[e]?a.building[e].set("built"):a.building[e]=N.k.box("built"))})}.bind(this),autosaveInterval:4e3,persistenceMethod:"localStorage"});this.db=n}}]),n}(),l=A()(a.prototype,"building",[N.k],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return{}}}),A()(a.prototype,"setupType",[N.d],Object.getOwnPropertyDescriptor(a.prototype,"setupType"),a.prototype),A()(a.prototype,"setupDB",[N.d],Object.getOwnPropertyDescriptor(a.prototype,"setupDB"),a.prototype),a),C=(u=r=function(){function a(){b()(this,a),h()(this,"portal",c,this),h()(this,"cards",o,this),h()(this,"urls",s,this),this.instance=null,this.setupDB()}var t,n,r;return y()(a,[{key:"path",value:function(e){return a.path(e)}},{key:"base_image",get:function(){return"https://drive.google.com/uc?id="}},{key:"thumb_missing",get:function(){return"1JYjPzkv74IhzlHTyVh2niTDyui73HSfp"}},{key:"card_back",get:function(){return"1_MgWDPsPGf-gPBArn2v6ideJcqOPsSYC"}}],[{key:"getInstance",value:function(){return this.instance||(this.instance=new a),this.instance}},{key:"path",value:function(e){return a.base_url+e+a.data_format}}]),y()(a,[{key:"getSpreadsheet",value:(r=g()(p.a.mark(function e(t,a){return p.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:fetch(t).then(function(e){return e.json()}).then(function(e){return a(e.feed.entry)}).catch(function(e){return console.error("parsing failed",e),a(null)});case 1:case"end":return e.stop()}},e)})),function(e,t){return r.apply(this,arguments)})},{key:"setupDB",value:function(){try{var t={};i(360).forEach(function(e){t[e.gsx$type.$t]||(t[e.gsx$type.$t]={}),t[e.gsx$type.$t][e.gsx$subtype.$t]=a.path(e.gsx$url.$t)}),this.urls=t,this.portal=new M(this,"portal"),this.cards=new M(this,"cards")}catch(e){console.error("setting up database failed",e)}}},{key:"LoadDB",value:(n=g()(p.a.mark(function e(a){var n=this;return p.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise(function(e,t){null!==n.urls&&null!==n.portal&&null!==n.cards?n.buildCollection(a).then(function(){e()}):e()}));case 1:case"end":return e.stop()}},e)})),function(e){return n.apply(this,arguments)})},{key:"buildCollection",value:(t=g()(p.a.mark(function e(t){var n=this;return p.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all(t.map(function(a){return new Promise(function(e,t){return"cards"in a?n.cards.setupType(a.cards,e):"portal"in a?n.portal.setupType(a.portal,e):(console.error("cards or portal"),t())})}));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}},e)})),function(e){return t.apply(this,arguments)})},{key:"purgeDB",value:function(){this.cards.purgeDB(),this.portal.purgeDB(),window.location.reload()}},{key:"tribes",get:function(){return["Danian","Generic","Mipedian","M'arrillian","OverWorld","UnderWorld"]}},{key:"sets",get:function(){return{DOP:"Dawn of Perim",ZOTH:"Zenith of the Hive",SS:"Silent Sands",MI:"Beyond the Doors",ROTO:"Rise of the Oligarch",TOTT:"Turn of the Tide",FUN:"Forged Unity",AU:"Alliance Unraveled",FAS:"Fire and Stone",SAS:"Storm and Sea",EE:"Elemental Emperors",BR:"Beyond Rare",LR:"League Rewards",OP1:"Organized Play 1",PROMO:"Promotional",PROTO:"Prototype"}}}]),a}(),r.base_url="https://spreadsheets.google.com/feeds/list/",r.data_format="/od6/public/values?alt=json",n=u,c=A()(n.prototype,"portal",[N.k],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),o=A()(n.prototype,"cards",[N.k],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),s=A()(n.prototype,"urls",[N.k],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),n);t.a=C.getInstance()}}); \ No newline at end of file diff --git a/src/components/collection/collection.scss b/src/components/collection/collection.scss index d41e22a..9e49091 100644 --- a/src/components/collection/collection.scss +++ b/src/components/collection/collection.scss @@ -24,12 +24,8 @@ width: 70%; } - .left > .fixed { - position: fixed; - top: 0; - overflow-y: auto; - height: 100vh; - width: calc(30% - 30px); + #side-menu { + position: relative; } #buttons { diff --git a/src/components/collection/index.js b/src/components/collection/index.js index 46b3541..7b5da2f 100644 --- a/src/components/collection/index.js +++ b/src/components/collection/index.js @@ -1,6 +1,6 @@ import React from 'react'; import API from '../SpreadsheetData'; -import {observable, action, autorun} from "mobx"; +import {observable, action} from "mobx"; import {observer, inject} from 'mobx-react'; import CardList from './List'; import SearchForm from './search/index.js'; @@ -12,14 +12,16 @@ const fixedStyles = observable({ get fixed() {return this.style}, get isFixed() {return (Object.entries(this.style).length !== 0)}, setFixed(height) { - if (window.matchMedia("(min-width: 975px)").matches) + if (!window.matchMedia("(min-width: 975px)").matches) return; + let left = document.getElementById('player').getBoundingClientRect().left + 4; + let width = document.querySelector('.collection > .left').getBoundingClientRect().width + 2; this.style = { position: "fixed", top: 0, - left: "31px", + left: `${left}px`, overflowY: "auto", height: `${height}px`, - width: "calc(30% - 20px)", + width: `${width}px`, } }, removeFixed() {this.style = {}} @@ -50,10 +52,12 @@ export default class Home extends React.Component { componentDidMount() { window.addEventListener('scroll', this.handleScroll); + window.addEventListener('resize', this.handleScroll); } componentWillUnmount() { window.removeEventListener('scroll', this.handleScroll); + window.removeEventListener('resize', this.handleScroll); } handleContent(content) { @@ -76,6 +80,8 @@ export default class Home extends React.Component { // Fix the side menu in place when scrolling down if (window.pageYOffset >= 235) { + console.log(document.querySelector('.collection > .left').getBoundingClientRect().width); + const h = document.documentElement, b = document.body, diff --git a/src/components/index.js b/src/components/index.js index 571acf5..b3757de 100644 --- a/src/components/index.js +++ b/src/components/index.js @@ -104,7 +104,7 @@ function Base(props) {
-
+
{children}
diff --git a/src/css/legacy.css b/src/css/legacy.css index 7e204dd..cfc641e 100644 --- a/src/css/legacy.css +++ b/src/css/legacy.css @@ -550,6 +550,11 @@ background-repeat:no-repeat; float:right; } + +.content-area-inner-space { + margin: 0 8px 0 10px; +} + .content-area-repeat-xy2{ width:100%; float:left; clear:both;