mirror of
https://github.com/ENSL/ensl_gathers.git
synced 2025-01-24 18:20:59 +00:00
1 line
No EOL
134 KiB
Text
1 line
No EOL
134 KiB
Text
{"version":3,"sources":["app.js","event.js","gather.js","main.js","message.js","settings.js","snowMachine.js","sound.js","user.js","helper.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAM,WAAW,QAAQ,WAAR,CAAX;;AAEN,IAAM,MAAM,QAAQ,iBAAR,CAAN;;AAEN,OAAO,OAAP,GAAiB,iBAAS;AAAE,WAAS,MAAT,CAAgB,GAAhB,EAAqB,KAArB,EAAF;CAAT;;;;;;ACJjB,IAAM,IAAI,QAAQ,QAAR,CAAJ;AACN,IAAM,QAAQ,QAAQ,OAAR,CAAR;;AAEN,IAAM,SAAS,MAAM,WAAN,CAAkB;;;AAChC,YAAW;AACV,UAAQ,MAAM,SAAN,CAAgB,KAAhB,CAAsB,UAAtB;EADT;;AAIA,2BAAQ,YAAY;AACnB,SAAO,IAAK,IAAJ,CAAS,UAAT,CAAD,CAAuB,YAAvB,GAAsC,KAAtC,CAA4C,SAA5C,EAAuD,CAAvD,CAAP,CADmB;EALY;AAShC,2BAAS;;;AACR,MAAI,kBAAJ,CADQ;AAER,MAAI,KAAK,KAAL,CAAW,MAAX,CAAkB,MAAlB,EAA0B;AAC7B,YAAS,KAAK,KAAL,CAAW,MAAX,CAAkB,GAAlB,CAAsB,iBAAS;AACvC,WAAU,MAAK,OAAL,CAAa,MAAM,SAAN,UAAoB,MAAM,WAAN,CADJ;IAAT,CAAtB,CAEN,IAFM,CAED,IAFC,CAAT,CAD6B;GAA9B,MAIO;AACN,YAAS;;;IAAI;;;;KAAJ;IAAT,CADM;GAJP;;AAQA,SACC;;KAAK,WAAU,cAAV,EAAL;GACE,MADF;GADD,CAVQ;EATuB;CAA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AAO,EAAE,EAAF,CADU;GAAzB,MAEO;AACN,UAAO,EAAE,KAAF,GAAU,EAAE,KAAF,CADX;GAFP;EADgB,CAAV,CAMJ,GANI,CAMA,UAAU,KAAV,EAAiB;AACvB,SAAO,MAAM,EAAN,CADgB;EAAjB,CANA,CAQJ,GARI,CAQA,UAAU,EAAV,EAAc;AACpB,SAAO,WAAW,MAAX,CAAkB,UAAU,GAAV,EAAe,SAAf,EAA0B;AAClD,OAAI,UAAU,EAAV,KAAiB,EAAjB,EAAqB,OAAO,SAAP,CAAzB;AACA,UAAO,GAAP,CAFkD;GAA1B,CAAzB,CADoB;EAAd,CARP,CAxBkE;CAA7B;;AAwCtC,IAAM,UAAU,QAAQ,OAAR,GAAkB,UAAC,QAAD,EAAc;AAC/C,uCAAoC,SAAS,EAAT,CADW;CAAd;;AAIlC,IAAM,UAAU,QAAQ,OAAR,GAAkB,UAAC,QAAD,EAAc;AAC/C,KAAM,SAAS,SAAS,IAAT,CAAc,IAAd,CAAmB,EAAnB,CADgC;AAE/C,KAAI,MAAJ,EAAY;AACX,wDAAoD,MAApD,CADW;EAAZ,MAEO;AACN,SAAO,IAAP,CADM;EAFP;CAFiC;;AASlC,IAAM,UAAU,QAAQ,OAAR,GAAkB,UAAC,IAAD,EAAU;AAC3C,wBAAqB,KAAK,EAAL,CADsB;CAAV;;AAIlC,IAAM,mBAAmB,QAAQ,gBAAR,GAA2B,UAAC,IAAD,EAAU;AAC7D,KAAI;AACH,MAAI,UAAU,OAAO,IAAP,CAAV;MACH,IAAI,kBAAJ,CAFE;AAGH,UAAQ,OAAR,CAAgB,CAAhB,EAAmB,CAAnB,EAHG;AAIH,UAAQ,UAAR,CAAmB,CAAnB,EAJG;AAKH,SAAO,IAAP,CALG;EAAJ,CAOA,OAAM,CAAN,EAAS;AACR,SAAO,KAAP,CADQ;EAAT;CARmD","file":"public/app.js","sourcesContent":["const ReactDOM = require(\"react-dom\");\n\nconst App = require(\"components/main\");\n\nmodule.exports = mount => { ReactDOM.render(App, mount) };\n","const $ = require(\"jquery\");\nconst React = require(\"react\");\n\nconst Events = React.createClass({\n\tpropTypes: {\n\t\tevents: React.PropTypes.array.isRequired\n\t},\n\n\tgetTime(timeString) {\n\t\treturn (new Date(timeString)).toTimeString().match(/^[\\d:]*/)[0];\n\t},\n\n\trender() {\n\t\tlet events;\n\t\tif (this.props.events.length) {\n\t\t\tevents = this.props.events.map(event => {\n\t\t\t\treturn `${this.getTime(event.createdAt)} ${event.description}`;\n\t\t\t}).join(\"\\n\");\n\t\t} else {\n\t\t\tevents = <tr><td>Listening for new events...</td></tr>\n\t\t}\n\n\t\treturn (\n\t\t\t<pre className=\"events-panel\">\n\t\t\t\t{events}\n\t\t\t</pre>\n\t\t);\n\t}\n});\n\nmodule.exports = Events;","const React = require(\"react\");\nconst helper = require(\"javascripts/helper\");\nconst enslUrl = helper.enslUrl;\nconst rankVotes = helper.rankeVotes;\nconst hiveUrl = helper.hiveUrl;\n\nvar SelectPlayerButton = React.createClass({\n\tselectPlayer(e) {\n\t\te.preventDefault();\n\t\tsocket.emit(\"gather:select\", {\n\t\t\tplayer: parseInt(e.target.value, 10)\n\t\t})\n\t},\n\n\trender() {\n\t\tlet button;\n\t\tif (this.props.gatherer.leader) {\n\t\t\tbutton = <button \n\t\t\t\tclassName=\"btn btn-xs btn-default team-label\"\n\t\t\t\tdata-disabled=\"true\">Leader</button>;\n\t\t} else if (this.props.gatherer.team !== \"lobby\") {\n\t\t\tbutton = <button\n\t\t\t\tdata-disabled=\"true\"\n\t\t\t\tclassName=\"btn btn-xs btn-default team-label\"> \n\t\t\t\t\t{_.capitalize(this.props.gatherer.team)}\n\t\t\t\t</button>;\n\t\t} else {\n\t\t\tbutton = <button\n\t\t\t\tonClick={this.selectPlayer}\n\t\t\t\tvalue={this.props.gatherer.id}\n\t\t\t\tclassName=\"btn btn-xs btn-primary team-label\"> Select\n\t\t\t\t</button>;\n\t\t}\n\t\treturn button;\n\t}\n});\n\nvar GathererList = React.createClass({\n\tmemberList() {\n\t\tvar self = this;\n\t\treturn this.props.gather.gatherers\n\t\t\t.filter(gatherer => gatherer.team === self.props.team)\n\t\t\t.sort(gatherer => { return gatherer.leader ? 1 : -1 });\n\t},\n\n\trender() {\n\t\tvar extractGatherer = gatherer => {\n\t\t\tlet image;\n\t\t\tif (gatherer.leader) {\n\t\t\t\timage = <i className=\"fa fa-star add-right\"></i>;\n\t\t\t}\n\t\t\treturn (\n\t\t\t\t<tr key={gatherer.id}>\n\t\t\t\t\t<td className=\"col-md-12\">\n\t\t\t\t\t\t{image}{gatherer.user.username}\n\t\t\t\t\t\t<span className=\"pull-right\">\n\t\t\t\t\t\t\t<LifeformIcons gatherer={gatherer} />\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t);\n\t\t}\n\t\tvar members = this.memberList()\n\t\t\t.map(extractGatherer);\n\t\treturn (\n\t\t\t<table className=\"table\">\n\t\t\t\t<tbody>\n\t\t\t\t\t{members}\n\t\t\t\t</tbody>\n\t\t\t</table>\n\t\t);\n\t}\n});\n\nvar GatherTeams = React.createClass({\n\trender() {\n\t\treturn (\n\t\t\t<div className=\"row add-top\">\n\t\t\t\t<div className=\"col-sm-6\">\n\t\t\t\t\t<div className=\"panel panel-primary panel-light-background\">\n\t\t\t\t\t\t<div className=\"panel-heading\">\n\t\t\t\t\t\t\tMarines\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<GathererList gather={this.props.gather} team=\"marine\" />\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<div className=\"col-sm-6\">\n\t\t\t\t\t<div className=\"panel panel-primary panel-light-background\">\n\t\t\t\t\t\t<div className=\"panel-heading\">\n\t\t\t\t\t\t\tAliens\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<GathererList gather={this.props.gather} team=\"alien\" />\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t);\n\t}\n});\n\nvar ElectionProgressBar = React.createClass({\n\tcomponentDidMount() {\n\t\tvar self = this;\n\t\tthis.timer = setInterval(() => {\n\t\t\tself.forceUpdate();\n\t\t}, 900);\n\t},\n\n\tprogress() {\n\t\tvar interval = this.props.gather.election.interval;\n\t\tvar startTime = (new Date(this.props.gather.election.startTime)).getTime();\n\t\tvar msTranspired = Math.floor((new Date()).getTime() - startTime);\n\n\t\treturn {\n\t\t\tnum: msTranspired,\n\t\t\tden: interval,\n\t\t\tbarMessage: Math.floor((interval - msTranspired) / 1000) + \"s remaining\"\n\t\t}\n\t},\n\n\tcomponentWillUnmount() {\n\t\tclearInterval(this.timer);\n\t},\n\n\trender() {\n\t\treturn (<ProgressBar progress={this.progress()} />);\n\t}\n});\n\nvar ProgressBar = React.createClass({\n\trender() {\n\t\tlet progress = this.props.progress;\n\t\tvar style = {\n\t\t\twidth: Math.round((progress.num / progress.den * 100)) + \"%\"\n\t\t};\n\t\tvar barMessage = progress.barMessage || \"\";\n\t\treturn (\n\t\t\t<div className=\"progress\">\n\t\t\t\t<div className=\"progress-bar progress-bar-striped active\" \n\t\t\t\t\tdata-role=\"progressbar\" \n\t\t\t\t\tdata-aria-valuenow={progress.num} \n\t\t\t\t\tdata-aria-valuemin=\"0\" \n\t\t\t\t\tdata-aria-valuemax={progress.den} \n\t\t\t\t\tstyle={style}>{barMessage}\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t);\n\t}\n});\n\nvar GatherProgress = React.createClass({\n\tstateDescription() {\n\t\tswitch(this.props.gather.state) {\n\t\t\tcase \"gathering\":\n\t\t\t\treturn \"Waiting for more gatherers.\";\n\t\t\tcase \"election\":\n\t\t\t\treturn \"Currently voting for team leaders.\";\n\t\t\tcase \"selection\":\n\t\t\t\treturn \"Waiting for leaders to pick teams.\";\n\t\t\tcase \"done\":\n\t\t\t\treturn \"Gather completed.\";\n\t\t\tdefault:\n\t\t\t\treturn \"Initialising gather.\";\n\t\t}\n\t},\n\n\tgatheringProgress() {\n\t\tvar num = this.props.gather.gatherers.length;\n\t\tvar den = 12;\n\t\tvar remaining = den - num;\n\t\tvar message = (remaining === 1) ? \n\t\t\t\"Waiting for last player\" : `Waiting for ${remaining} more players`;\n\t\treturn {\n\t\t\tnum: num,\n\t\t\tden: den,\n\t\t\tmessage: message\n\t\t};\n\t},\n\n\telectionProgress() {\n\t\tvar num = this.props.gather.gatherers.reduce((acc, gatherer) => {\n\t\t\tif (gatherer.leaderVote) acc++;\n\t\t\treturn acc;\n\t\t}, 0);\n\t\tvar den = 12;\n\t\treturn {\n\t\t\tnum: num,\n\t\t\tden: den,\n\t\t\tmessage: den - num + \" more votes required\"\n\t\t};\n\t},\n\n\tselectionProgress() {\n\t\tvar num = this.props.gather.gatherers.reduce((acc, gatherer) => {\n\t\t\tif (gatherer.team !== \"lobby\") acc++;\n\t\t\treturn acc;\n\t\t}, 0);\n\t\tvar den = 12;\n\n\t\treturn {\n\t\t\tnum: num,\n\t\t\tden: den,\n\t\t\tmessage: `${num} out of ${den} players assigned. Waiting \n\t\t\t\ton ${_.capitalize(this.props.gather.pickingTurn)}s to pick next...`\n\t\t};\n\t},\n\n\trender() {\n\t\tvar progress, progressBar;\n\t\tvar gatherState = this.props.gather.state;\n\t\tif (gatherState === 'gathering' && this.props.gather.gatherers.length) {\n\t\t\tprogress = this.gatheringProgress();\n\t\t\tprogressBar = (<ProgressBar progress={progress} />);\n\t\t} else if (gatherState === 'election') {\n\t\t\tprogress = this.electionProgress();\n\t\t\tprogressBar = (<ElectionProgressBar {...this.props} progress={progress} />);\n\t\t} else if (gatherState === 'selection') {\n\t\t\tprogress = this.selectionProgress();\n\t\t\tprogressBar = (<ProgressBar progress={progress} />);\n\t\t}\n\n\t\tif (!progress) return false;\n\n\t\treturn (\n\t\t\t<div className=\"no-bottom\">\n\t\t\t\t<p><strong>{this.stateDescription()}</strong> {progress.message}</p>\n\t\t\t\t{progressBar}\n\t\t\t</div>\n\t\t);\n\t}\n});\n\nlet teamspeakDefaults = {\n\turl: \"ts3server://ensl.org/\",\n\tpassword: \"ns2gather\",\n\talien: {\n\t\tchannel: \"NS2 Gather/Gather #1/Alien\",\n\t\tpassword: \"ns2gather\"\n\t},\n\tmarine: {\n\t\tchannel: \"NS2 Gather/Gather #1/Marine\",\n\t\tpassword: \"ns2gather\"\n\t}\n};\n\nvar TeamSpeakButton = React.createClass({\n\tgetDefaultProps() {\n\t\treturn teamspeakDefaults\n\t},\n\tmarineUrl() {\n\t\treturn this.teamSpeakUrl(this.props.marine);\n\t},\n\talienUrl() {\n\t\treturn this.teamSpeakUrl(this.props.alien);\n\t},\n\tteamSpeakUrl(conn) {\n\t\tlet params = `channel=${encodeURIComponent(conn.channel)}&\n\t\t\tchannelpassword=${encodeURIComponent(conn.password)}`;\n\t\treturn (`${this.props.url}?${params}`);\n\t},\n\trender() {\n\t\treturn (\n\t\t\t<ul className=\"nav navbar-top-links navbar-right\">\n\t\t\t <li className=\"dropdown\">\n\t\t\t\t\t<a className=\"dropdown-toggle\" data-toggle=\"dropdown\" href=\"#\">\n\t\t\t\t\t\tTeamspeak <i className=\"fa fa-caret-down\"></i>\n\t\t\t\t\t</a>\n\t\t\t\t\t<ul className=\"dropdown-menu\">\n\t\t\t\t\t\t<li><a href={this.props.url}>Join Teamspeak Lobby</a></li>\n\t\t\t\t\t\t<li><a href={this.marineUrl()}>Join Marine Teamspeak</a></li>\n\t\t\t\t\t\t<li><a href={this.alienUrl()}>Join Alien Teamspeak</a></li>\n\t\t\t\t\t\t<li role=\"separator\" className=\"divider\"></li>\n\t\t\t\t\t\t<li><a href=\"#\" data-toggle=\"modal\" data-target=\"#teamspeakmodal\">Teamspeak Details</a></li>\n\t\t\t\t\t</ul>\n\t\t\t\t</li>\n\t\t </ul>\n\t\t);\n\t}\n});\n\nvar TeamSpeakModal = React.createClass({\n\tgetDefaultProps() {\n\t\treturn teamspeakDefaults;\n\t},\n\n\trender() {\n\t\treturn <div className=\"modal fade text-left\" id=\"teamspeakmodal\">\n\t\t\t<div className=\"modal-dialog\">\n\t\t\t\t<div className=\"modal-content\">\n\t\t\t\t\t<div className=\"modal-header\">\n\t\t\t\t\t\t<button type=\"button\" \n\t\t\t\t\t\t\tclassName=\"close\" \n\t\t\t\t\t\t\tdata-dismiss=\"modal\" \n\t\t\t\t\t\t\taria-label=\"Close\"><span aria-hidden=\"true\">×</span></button>\n\t\t\t\t\t\t<h4 className=\"modal-title\">Teamspeak Server Information</h4>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div className=\"modal-body\">\n\t\t\t\t\t\t<dl className=\"dl-horizontal\">\n\t\t\t\t\t\t\t<dt>Server</dt>\n\t\t\t\t\t\t\t<dd>{this.props.url}</dd>\n\t\t\t\t\t\t\t<dt>Password</dt>\n\t\t\t\t\t\t\t<dd>{this.props.password}</dd>\n\t\t\t\t\t\t\t<dt>Marine Channel</dt>\n\t\t\t\t\t\t\t<dd>{this.props.marine.channel}</dd>\n\t\t\t\t\t\t\t<dt>Alien Channel</dt>\n\t\t\t\t\t\t\t<dd>{this.props.alien.channel}</dd>\n\t\t\t\t\t\t</dl>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t}\n});\n\nvar JoinGatherButton = React.createClass({\n\tcomponentDidMount() {\n\t\tvar self = this;\n\t\tthis.timer = setInterval(() => {\n\t\t\tself.forceUpdate();\n\t\t}, 30000);\n\t},\n\n\tcomponentWillUnmount() {\n\t\tclearInterval(this.timer);\n\t},\n\n\tjoinGather(e) {\n\t\te.preventDefault();\n\t\tsocket.emit(\"gather:join\");\n\t},\n\n\tleaveGather(e) {\n\t\te.preventDefault();\n\t\tsocket.emit(\"gather:leave\");\n\t},\n\n\tcooldownTime() {\n\t\tlet user = this.props.user;\n\t\tif (!user) return false;\n\t\tlet cooloffTime = this.props.gather.cooldown[user.id];\n\t\tif (!cooloffTime) return false;\n\t\tlet timeRemaining = new Date(cooloffTime) - new Date();\n\t\treturn timeRemaining > 0 ? timeRemaining : false;\n\t},\n\n\trender() {\n\t\tlet gather = this.props.gather;\n\t\tlet thisGatherer = this.props.thisGatherer;\n\t\tif (thisGatherer) {\n\t\t\treturn <button \n\t\t\t\t\t\t\tonClick={this.leaveGather} \n\t\t\t\t\t\t\tclassName=\"btn btn-danger\">Leave Gather</button>;\n\t\t} \n\t\tif (gather.state === 'gathering') {\n\t\t\tlet cooldownTime = this.cooldownTime();\n\t\t\tif (cooldownTime) {\n\t\t\t\treturn <CooloffButton timeRemaining={cooldownTime} />;\n\t\t\t} else {\n\t\t\t\treturn <button \n\t\t\t\t\t\tonClick={this.joinGather} \n\t\t\t\t\t\tclassName=\"btn btn-success\">Join Gather</button>;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n});\n\nvar CooloffButton = React.createClass({\n\ttimeRemaining() {\n\t\treturn `${Math.floor(this.props.timeRemaining / 60000) + 1} minutes remaining`;\n\t},\n\n\trender() {\n\t\treturn <button \n\t\t\tdisabled=\"true\"\n\t\t\tclassName=\"btn btn-success\">\n\t\t\t\tLeaver Cooloff ({this.timeRemaining()})\n\t\t</button>\n\t}\n})\n\nvar GatherActions = React.createClass({\n\tvoteRegather(e) {\n\t\te.preventDefault(e);\n\t\tsocket.emit(\"gather:vote\", {\n\t\t\tregather: (e.target.value === \"true\")\n\t\t});\n\t},\n\n\tregatherVotes() {\n\t\tlet gather = this.props.gather;\n\t\tif (!gather) return 0;\n\t\treturn gather.gatherers.reduce((acc, gatherer) => {\n\t\t\tif (gatherer.regatherVote) acc++;\n\t\t\treturn acc;\n\t\t}, 0);\n\t},\n\n\trender() {\n\t\tlet regatherButton;\n\t\tlet user = this.props.user;\n\t\tlet gather = this.props.gather;\n\t\tlet thisGatherer = this.props.thisGatherer;\n\t\tif (thisGatherer) {\n\t\t\tlet regatherVotes = this.regatherVotes();\n\t\t\tif (thisGatherer.regatherVote) {\n\t\t\t\tregatherButton = <button value=\"false\" onClick={this.voteRegather} \n\t\t\t\t\t\tclassName=\"btn btn-danger\">\n\t\t\t\t\t\t\t{`Voted Regather (${regatherVotes}/8)`}\n\t\t\t\t\t</button>;\n\t\t\t} else {\n\t\t\t\tregatherButton = <button value=\"true\" onClick={this.voteRegather} \n\t\t\t\t\t\tclassName=\"btn btn-danger\">\n\t\t\t\t\t\t\t{`Vote Regather (${regatherVotes}/8)`}\n\t\t\t\t\t</button>;\n\t\t\t}\n\t\t}\n\n\t\treturn (\n\t\t\t<div>\n\t\t\t\t<div className=\"text-right\">\n\t\t\t\t\t<ul className=\"list-inline no-bottom\">\n\t\t\t\t\t\t<li>\n\t\t\t\t\t\t\t{regatherButton}\n\t\t\t\t\t\t</li>\n\t\t\t\t\t\t<li>\n\t\t\t\t\t\t\t<JoinGatherButton gather={gather} thisGatherer={thisGatherer}\n\t\t\t\t\t\t\t\tuser={user} />\n\t\t\t\t\t\t</li>\n\t\t\t\t\t</ul>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t);\n\t}\n});\n\nvar VoteButton = React.createClass({\n\tcancelVote(e) {\n\t\tsocket.emit(\"gather:vote\", {\n\t\t\tleader: {\n\t\t\t\tcandidate: null\n\t\t\t}\n\t\t});\n\t},\n\n\tvote(e) {\n\t\te.preventDefault();\n\t\tsocket.emit(\"gather:vote\", {\n\t\t\tleader: {\n\t\t\t\tcandidate: parseInt(e.target.value, 10)\n\t\t\t}\n\t\t});\n\t},\n\n\tstopGatherMusic() {\n\t\tsoundController.stop();\n\t},\n\n\trender() {\n\t\tlet candidate = this.props.candidate;\n\t\tlet thisGatherer = this.props.thisGatherer;\n\t\tif (thisGatherer === null) {\n\t\t\treturn false;\n\t\t}\n\t\tif (thisGatherer.leaderVote === candidate.id) {\n\t\t\treturn (\n\t\t\t\t<button \n\t\t\t\t\tonClick={this.cancelVote} \n\t\t\t\t\tclassName=\"btn btn-xs btn-success vote-button\">Voted\n\t\t\t\t</button>\n\t\t\t);\n\t\t} else {\n\t\t\treturn (\n\t\t\t\t<button \n\t\t\t\t\tonClick={this.vote} \n\t\t\t\t\tclassName=\"btn btn-xs btn-primary vote-button\"\n\t\t\t\t\tvalue={candidate.id}>Vote\n\t\t\t\t</button>\n\t\t\t);\n\t\t}\n\t}\n});\n\nvar ServerVoting = React.createClass({\n\tvoteHandler(serverId) {\n\t\treturn function (e) {\n\t\t\te.preventDefault();\n\t\t\tsocket.emit(\"gather:vote\", {\n\t\t\t\tserver: {\n\t\t\t\t\tid: serverId\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t},\n\n\tvotesForServer(server) {\n\t\treturn this.props.gather.gatherers.reduce((acc, gatherer) => {\n\t\t\tif (gatherer.serverVote.some(voteId => voteId === server.id)) acc++;\n\t\t\treturn acc;\n\t\t}, 0);\n\t},\n\n\trender() {\n\t\tlet self = this;\n\t\tlet thisGatherer = self.props.thisGatherer;\n\t\tlet servers = self.props.servers.sort((a, b) => {\n\t\t\t\tvar aVotes = self.votesForServer(a);\n\t\t\t\tvar bVotes = self.votesForServer(b);\n\t\t\t\treturn bVotes - aVotes;\n\t\t\t}).map(server => {\n\t\t\tlet votes = self.votesForServer(server);\n\t\t\tlet style = thisGatherer.serverVote.some(voteId => voteId === server.id) ? \n\t\t\t\t\"list-group-item list-group-item-success\" : \"list-group-item\";\n\t\t\treturn (\n\t\t\t\t<a href=\"#\" \n\t\t\t\t\tclassName={style} \n\t\t\t\t\tonClick={self.voteHandler(server.id)} \n\t\t\t\t\tkey={server.id}>\n\t\t\t\t\t<span className=\"badge\">{votes}</span>\n\t\t\t\t\t{server.name || server.description}\n\t\t\t\t</a>\n\t\t\t);\n\t\t});\n\n\t\tlet votes = thisGatherer.serverVote.length;\n\n\t\treturn (\n\t\t\t<div className=\"panel panel-primary\">\n\t\t\t\t<div className=\"panel-heading\">\n\t\t\t\t\t{votes === 2 ? \"Server Votes\" : \n\t\t\t\t\t`Please Vote for a Server. ${2 - votes} votes remaining` }\n\t\t\t\t</div>\n\t\t\t\t<div className=\"list-group gather-voting\">\n\t\t\t\t\t{servers}\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t);\n\t}\n})\n\nvar MapVoting = React.createClass({\n\tvoteHandler(mapId) {\n\t\treturn function (e) {\n\t\t\te.preventDefault();\n\t\t\tsocket.emit(\"gather:vote\", {\n\t\t\t\tmap: {\n\t\t\t\t\tid: mapId\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t},\n\n\tvotesForMap(map) {\n\t\treturn this.props.gather.gatherers.reduce((acc, gatherer) => {\n\t\t\tif (gatherer.mapVote.some(voteId => voteId === map.id)) acc++;\n\t\t\treturn acc;\n\t\t}, 0);\n\t},\n\n\trender() {\n\t\tvar self = this;\n\t\tlet thisGatherer = self.props.thisGatherer\n\t\tlet maps = self.props.maps.sort((a, b) => {\n\t\t\t\t\tvar aVotes = self.votesForMap(a);\n\t\t\t\t\tvar bVotes = self.votesForMap(b);\n\t\t\t\t\treturn bVotes - aVotes;\n\t\t\t\t}).map(map => {\n\t\t\t\tlet votes = self.votesForMap(map);\n\t\t\t\tlet style = thisGatherer.mapVote.some(voteId => voteId === map.id) ? \n\t\t\t\t\t\"list-group-item list-group-item-success\" : \"list-group-item\";\n\t\t\t\treturn (\n\t\t\t\t\t<a href=\"#\" \n\t\t\t\t\t\tkey={map.id} \n\t\t\t\t\t\tonClick={self.voteHandler(map.id)}\n\t\t\t\t\t\tclassName={style}>\n\t\t\t\t\t\t\t<span className=\"badge\">{votes}</span>\n\t\t\t\t\t\t\t{map.name}\n\t\t\t\t\t</a>\n\t\t\t\t);\n\t\t\t});\n\n\t\tlet votes = thisGatherer.mapVote.length;\n\n\t\treturn (\n\t\t\t<div className=\"panel panel-primary\">\n\t\t\t\t<div className=\"panel-heading\">\n\t\t\t\t\t{votes === 2 ? \"Map Votes\" : \n\t\t\t\t\t\t`Please Vote for a Map. ${2 - votes} votes remaining` }\n\t\t\t\t</div>\n\t\t\t\t<div className=\"list-group gather-voting\">\n\t\t\t\t\t{maps}\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t);\n\t}\n})\n\nvar Gather = React.createClass({\n\trender() {\n\t\tlet gather = this.props.gather;\n\t\tlet thisGatherer = this.props.thisGatherer;\n\t\tlet servers = this.props.servers;\n\t\tlet maps = this.props.maps;\n\t\tlet user = this.props.user;\n\t\tif (gather === null) return <div></div>;\n\n\t\tlet voting;\n\t\tif (thisGatherer) {\n\t\t\tlet state = gather.state;\n\t\t\tif (state === 'gathering' || state === 'election') {\n\t\t\t\tvoting = (\n\t\t\t\t\t<div className=\"row add-top\">\n\t\t\t\t\t\t<div className=\"col-sm-6\">\n\t\t\t\t\t\t\t<MapVoting gather={gather} maps={maps} \n\t\t\t\t\t\t\t\tthisGatherer={thisGatherer} />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div className=\"col-sm-6\">\n\t\t\t\t\t\t\t<ServerVoting gather={gather} servers={servers}\n\t\t\t\t\t\t\t\tthisGatherer={thisGatherer} />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tvoting = <GatherVotingResults gather={gather} \n\t\t\t\t\tservers={servers} \n\t\t\t\t\tmaps={maps} />;\n\t\t\t}\n\t\t}\n\n\t\tlet gatherTeams;\n\t\tif (gather.state === 'selection') {\n\t\t\tgatherTeams = <GatherTeams gather={gather} />;\n\t\t}\n\n\t\tif (gather.gatherers.length > 0) {\n\t\t\treturn (\n\t\t\t\t<div>\n\t\t\t\t\t<div className=\"panel panel-primary add-bottom\">\n\t\t\t\t\t\t<div className=\"panel-heading\">Current Gather</div>\n\t\t\t\t\t\t<div className=\"panel-body\">\n\t\t\t\t\t\t\t<GatherProgress gather={gather} />\n\t\t\t\t\t\t\t<GatherActions gather={gather} user={user} thisGatherer={thisGatherer} />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<Gatherers gather={gather} user={user} \n\t\t\t\t\t\tsoundController={this.props.soundController}\n\t\t\t\t\t\tthisGatherer={thisGatherer} />\n\t\t\t\t\t{gatherTeams}\n\t\t\t\t\t{voting}\n\t\t\t\t</div>\n\t\t\t);\n\t\t} else {\n\t\t\treturn (\n\t\t\t\t<div>\n\t\t\t\t\t<div className=\"panel panel-primary add-bottom\">\n\t\t\t\t\t\t<div className=\"panel-heading\">Current Gather</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<Gatherers gather={gather} user={user} thisGatherer={thisGatherer} />\n\t\t\t\t</div>\n\t\t\t);\n\t\t}\n\n\t}\n});\n\nvar LifeformIcons = React.createClass({\n\tavailableLifeforms() {\n\t\treturn [\"skulk\", \"gorge\", \"lerk\", \"fade\", \"onos\", \"commander\"];\n\t},\n\n\tgathererLifeforms() {\n\t\tlet lifeforms = [];\n\t\tlet gatherer = this.props.gatherer;\n\t\tlet abilities = gatherer.user.profile.abilities;\n\t\tfor (let attr in abilities) {\n\t\t\tif (abilities[attr]) lifeforms.push(_.capitalize(attr));\n\t\t}\n\t\treturn lifeforms;\n\t},\n\n\trender() {\n\t\tlet lifeforms = this.gathererLifeforms();\t\n\t\tlet availableLifeforms = this.availableLifeforms();\n\t\tlet icons = availableLifeforms.map(lifeform => {\n\t\t\tlet containsAbility = lifeforms.some(gathererLifeform => {\n\t\t\t\treturn gathererLifeform.toLowerCase() === lifeform.toLowerCase()\n\t\t\t});\n\t\t\tif (containsAbility) {\n\t\t\t\treturn <img \n\t\t\t\t\tclassName=\"lifeform-icon\"\n\t\t\t\t\tkey={lifeform}\n\t\t\t\t\tsrc={`/${lifeform.toLowerCase()}.png`} />\n\t\t\t} else {\n\t\t\t\treturn <img \n\t\t\t\t\tclassName=\"lifeform-icon\"\n\t\t\t\t\tkey={lifeform}\n\t\t\t\t\tsrc={`/blank.gif`} />\n\t\t\t}\n\t\t});\n\t\treturn <span className=\"add-right hidden-xs\">{icons}</span>\n\t}\n});\n\nvar Gatherers = React.createClass({\n\tjoinGather(e) {\n\t\te.preventDefault();\n\t\tsocket.emit(\"gather:join\");\n\t},\n\n\tbootGatherer(e) {\n\t\te.preventDefault();\n\t\tsocket.emit(\"gather:leave\", {\n\t\t\tgatherer: parseInt(e.target.value, 10) || null\n\t\t});\n\t},\n\n\trender() {\n\t\tlet self = this;\n\t\tlet user = this.props.user;\n\t\tlet gather = this.props.gather;\n\t\tlet admin = (user && user.admin) || (user && user.moderator);\n\t\tlet thisGatherer = this.props.thisGatherer;\n\t\tlet gatherers = gather.gatherers\n\t\t.sort((a, b) => {\n\t\t\t\treturn (b.user.hive.skill || 1000) - (a.user.hive.skill || 1000);\n\t\t\t})\n\t\t.map(gatherer => {\n\t\t\tif (gatherer.user.country) {\n\t\t\t\tvar country = (\n\t\t\t\t\t<img src=\"/blank.gif\" \n\t\t\t\t\t\tclassName={\"flag flag-\" + gatherer.user.country.toLowerCase()} \n\t\t\t\t\t\talt={gatherer.user.country} />\n\t\t\t\t);\n\t\t\t};\n\n\t\t\tlet skill = gatherer.user.profile.skill || \"Not Available\";\n\n\t\t\tlet hiveStats = [];\n\t\t\tif (gatherer.user.hive.skill) hiveStats.push(`${gatherer.user.hive.skill} ELO`);\n\n\t\t\tif (gatherer.user.hive.playTime) {\n\t\t\t\thiveStats.push(`${Math.floor(gatherer.user.hive.playTime / 3600)} Hours`);\n\t\t\t}\n\n\t\t\tlet hive = (hiveStats.length) ? hiveStats.join(\", \") : \"Not Available\";\n\t\t\t\n\t\t\tlet team = (gatherer.user.team) ? gatherer.user.team.name : \"None\";\n\n\t\t\tlet action;\n\t\t\tif (gather.state === \"election\") {\n\t\t\t\tlet votes = gather.gatherers.reduce((acc, voter) => {\n\t\t\t\t\tif (voter.leaderVote === gatherer.id) acc++;\n\t\t\t\t\treturn acc;\n\t\t\t\t}, 0)\n\t\t\t\taction = (\n\t\t\t\t\t<span>\n\t\t\t\t\t\t<span className=\"badge add-right\">{votes + \" votes\"}</span>\n\t\t\t\t\t\t<VoteButton \n\t\t\t\t\t\t\tthisGatherer={thisGatherer} \n\t\t\t\t\t\t\tsoundController={this.props.soundController}\n\t\t\t\t\t\t\tcandidate={gatherer} />\n\t\t\t\t\t</span>\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (gather.state === 'selection') {\n\t\t\t\tif (thisGatherer && \n\t\t\t\t\t\tthisGatherer.leader &&\n\t\t\t\t\t\tthisGatherer.team === gather.pickingTurn) {\n\t\t\t\t\taction = (\n\t\t\t\t\t\t<span>\n\t\t\t\t\t\t\t<SelectPlayerButton gatherer={gatherer} />\n\t\t\t\t\t\t</span>\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\tif (gatherer.leader) {\n\t\t\t\t\t\taction = (<span className={`label label-padding \n\t\t\t\t\t\t\tlabel-${gatherer.team} \n\t\t\t\t\t\t\tteam-label`}>Leader</span>);\n\t\t\t\t\t} else if (gatherer.team !== \"lobby\") {\n\t\t\t\t\t\taction = (<span className={`label label-padding \n\t\t\t\t\t\t\tlabel-${gatherer.team} \n\t\t\t\t\t\t\tteam-label`}>{_.capitalize(gatherer.team)}</span>);\n\t\t\t\t\t} else {\n\t\t\t\t\t\taction = (<span className=\"label label-padding label-default team-label\">\n\t\t\t\t\t\t\tLobby</span>);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlet adminOptions;\n\t\t\tif (admin) {\n\t\t\t\tadminOptions = [\n\t\t\t\t\t<hr />,\n\t\t\t\t\t<dt>Admin</dt>,\n\t\t\t\t\t<dd>\n\t\t\t\t\t\t<button\n\t\t\t\t\t\t\tclassName=\"btn btn-xs btn-danger\"\n\t\t\t\t\t\t\tvalue={gatherer.user.id}\n\t\t\t\t\t\t\tonClick={this.bootGatherer}>\n\t\t\t\t\t\t\tBoot from Gather\n\t\t\t\t\t\t</button> \n\t\t\t\t\t\t<AssumeUserIdButton \n\t\t\t\t\t\t\tgatherer={gatherer} \n\t\t\t\t\t\t\tcurrentUser={user} />\n\t\t\t\t\t</dd>\n\t\t\t\t]\n\t\t\t}\n\n\t\t\tlet tabColor = gatherer.team !== \"lobby\" ? `panel-${gatherer.team}` : \"panel-info\";\n\t\t\treturn (\n\t\t\t\t<div className={`panel ${tabColor} gatherer-panel`} \n\t\t\t\t\tkey={gatherer.user.id} data-userid={gatherer.user.id}>\n\t\t\t\t\t<div className=\"panel-heading\">\n\t\t\t\t\t\t<h4 className=\"panel-title\">\n\t\t\t\t\t\t\t{country} {gatherer.user.username}\n\t\t\t\t\t\t\t<span className=\"pull-right\">\n\t\t\t\t\t\t\t\t<a data-toggle=\"collapse\"\n\t\t\t\t\t\t\t\t\thref={\"#\"+gatherer.user.id.toString() + \"-collapse\"} \n\t\t\t\t\t\t\t\t\taria-expanded=\"false\" \n\t\t\t\t\t\t\t\t\tclassName=\"btn btn-xs btn-primary add-right\"\n\t\t\t\t\t\t\t\t\taria-controls={gatherer.user.id.toString() + \"-collapse\"}>\n\t\t\t\t\t\t\t\t\tInfo <span className=\"caret\"></span></a>\n\t\t\t\t\t\t\t\t<LifeformIcons gatherer={gatherer} />\n\t\t\t\t\t\t\t\t{action}\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</h4>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div id={gatherer.user.id.toString() + \"-collapse\"} \n\t\t\t\t\t\tclassName=\"panel-collapse collapse out\" >\n\t\t\t\t\t\t<div className=\"panel-body\">\n\t\t\t\t\t\t\t<dl className=\"dl-horizontal\">\n\t\t\t\t\t\t\t\t<dt>Skill Level</dt>\n\t\t\t\t\t\t\t\t<dd>{skill}</dd>\n\t\t\t\t\t\t\t\t<dt>Team</dt>\n\t\t\t\t\t\t\t\t<dd>{team}</dd>\n\t\t\t\t\t\t\t\t<dt>Hive Stats</dt>\n\t\t\t\t\t\t\t\t<dd>{hive}</dd>\n\t\t\t\t\t\t\t\t<dt>Links</dt>\n\t\t\t\t\t\t\t\t<dd>\n\t\t\t\t\t\t\t\t\t<a href={enslUrl(gatherer)} \n\t\t\t\t\t\t\t\t\t\tclassName=\"btn btn-xs btn-primary\"\n\t\t\t\t\t\t\t\t\t\ttarget=\"_blank\">ENSL Profile</a> \n\t\t\t\t\t\t\t\t\t<a href={hiveUrl(gatherer)} \n\t\t\t\t\t\t\t\t\t\tclassName=\"btn btn-xs btn-primary\"\n\t\t\t\t\t\t\t\t\t\ttarget=\"_blank\">Hive Profile</a>\n\t\t\t\t\t\t\t\t</dd>\n\t\t\t\t\t\t\t\t{adminOptions}\n\t\t\t\t\t\t\t</dl>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t);\n\t\t})\n\t\tif (gather.gatherers.length) {\n\t\t\treturn (\n\t\t\t\t<div class=\"panel-group\" \n\t\t\t\t\trole=\"tablist\" \n\t\t\t\t\taria-multiselectable=\"true\" \n\t\t\t\t\tid=\"gatherers-panel\">\n\t\t\t\t\t{gatherers}\n\t\t\t\t</div>\n\t\t\t);\n\t\t} else {\n\t\t\treturn (\n\t\t\t\t<div className=\"panel panel-primary add-bottom\">\n\t\t\t\t\t<div className=\"panel-body text-center join-hero\">\n\t\t\t\t\t\t<button \n\t\t\t\t\t\t\tonClick={this.joinGather} \n\t\t\t\t\t\t\tclassName=\"btn btn-success btn-lg\">Start a Gather</button>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t);\n\t\t}\n\t}\n});\n\nvar CompletedGather = React.createClass({\n\tcompletionDate() {\n\t\tlet d = new Date(this.props.gather.done.time);\n\t\tif (d) {\n\t\t\treturn d.toLocaleTimeString();\n\t\t} else {\n\t\t\treturn \"Completed Gather\"\n\t\t}\n\t},\n\n\tgetInitialState() {\n\t\treturn {\n\t\t\tshow: !!this.props.show\n\t\t};\n\t},\n\n\ttoggleGatherInfo() {\n\t\tlet newState = !this.state.show;\n\t\tthis.setState({\n\t\t\tshow: newState\n\t\t});\n\t},\n\n\trender() {\n\t\tlet gatherInfo = [];\n\t\tlet gather = this.props.gather;\n\t\tlet maps = this.props.maps;\n\t\tlet servers = this.props.servers;\n\t\tif (this.state.show) {\n\t\t\tgatherInfo.push(<GatherTeams gather={gather} />);\n\t\t\tgatherInfo.push(<GatherVotingResults gather={gather} \n\t\t\t\tmaps={maps} \n\t\t\t\tservers={servers}/>);\n\t\t}\n\t\treturn (\n\t\t\t<div>\n\t\t\t\t<div className=\"panel panel-success add-bottom pointer\"\n\t\t\t\t\tonClick={this.toggleGatherInfo}>\n\t\t\t\t\t<div className=\"panel-heading\"><strong>{this.completionDate()}</strong></div>\n\t\t\t\t</div>\n\t\t\t\t{gatherInfo}\n\t\t\t</div>\n\t\t);\n\t}\n});\n\nvar GatherVotingResults = React.createClass({\n\t// Returns an array of ids voted for e.g. [1,2,5,1,1,3,2]\n\tcountVotes(voteType) {\n\t\treturn this.props.gather.gatherers.reduce((acc, gatherer) => {\n\t\t\tlet votes = gatherer[voteType];\n\n\t\t\t// Temporary fix because some mapvotes are ints and not arrays\n\t\t\tif (!Array.isArray(votes)) votes = [votes];\n\n\t\t\tif (votes.length > 0) votes.forEach(vote => acc.push(vote));\n\t\t\treturn acc;\n\t\t}, []);\n\t},\n\n\tselectedMaps() {\n\t\treturn rankVotes(this.countVotes('mapVote'), this.props.maps).slice(0, 2)\n\t},\n\n\tselectedServer() {\n\t\treturn rankVotes(this.countVotes('serverVote'), this.props.servers).slice(0, 1);\n\t},\n\n\trender() {\n\t\tlet maps = this.selectedMaps();\n\t\tlet server = this.selectedServer().pop();\n\t\tlet password;\n\t\tif (server.password) {\n\t\t\tpassword = [\n\t\t\t\t<dt>Password</dt>,\n\t\t\t\t<dd>{server.password}</dd>\n\t\t\t];\n\t\t}\n\t\treturn (\n\t\t\t<div className=\"panel panel-primary\">\n\t\t\t\t<div className=\"panel-heading\">\n\t\t\t\t\tServer\n\t\t\t\t</div>\n\t\t\t\t<div className=\"panel-body\">\n\t\t\t\t\t<dl className=\"dl-horizontal\">\n\t\t\t\t\t\t<dt>Maps</dt>\n\t\t\t\t\t\t<dd>{maps.map(map => map.name).join(\" & \")}</dd>\n\t\t\t\t\t\t<dt>Server</dt>\n\t\t\t\t\t\t<dd>{server.name}</dd>\n\t\t\t\t\t\t<dt>Address</dt>\n\t\t\t\t\t\t<dd>{server.ip}:{server.port}</dd>\n\t\t\t\t\t\t{password}\n\t\t\t\t\t</dl>\n\t\t\t\t\t<p>\n\t\t\t\t\t\t<a href={`steam://run/4920/connect+%20${server.ip}:${server.port}%20+password%20${server.password}`}\n\t\t\t\t\t\t\tclassName=\"btn btn-primary max-width\">Join Server</a>\n\t\t\t\t\t</p>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t);\n\t}\n});\n\nvar ArchivedGathers = React.createClass({\n\trender() {\n\t\tlet archive = this.props.archive\n\t\t\t.sort((a, b) => {\n\t\t\t\treturn new Date(b.createdAt) - new Date(a.createdAt);\n\t\t\t})\n\t\t\t.map((archivedGather, index) => {\n\t\t\t\treturn <CompletedGather \n\t\t\t\t\tid={archivedGather.gather.done.time}\n\t\t\t\t\tshow={(index === 0) ? true : false}\n\t\t\t\t\tgather={archivedGather.gather} \n\t\t\t\t\tmaps={this.props.maps}\n\t\t\t\t\tservers={this.props.servers} />\n\t\t\t});\n\n\t\treturn (\n\t\t\t<div className=\"panel panel-primary\">\n\t\t\t\t<div className=\"panel-heading\">Archived Gathers</div>\n\t\t\t\t<div className=\"panel-body\">\n\t\t\t\t\t{archive}\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t);\n\t}\n});\n","const React = require(\"react\");\nconst Gather = require(\"javascripts/components/gather\").Gather;\nconst ArchivedGather = require(\"javascripts/components/gather\").ArchivedGather;\nconst Event = require(\"javascripts/components/event\");\nconst Message = require(\"javascripts/components/message\");\nconst Settings = require(\"javascripts/components/settings\");\nconst Sound = require(\"javascripts/components/sound\");\nconst User = require(\"javascripts/components/user\");\nconst helper = require(\"javascripts/helper\");\nconst storageAvailable = helper.storageAvailable;\n\nconst SplashScreen = React.createClass({\n\tgetInitialState() {\n\t\treturn {\n\t\t\tstatus: \"connecting\", // connected, authFailed, banned\n\t\t\tsocket: null\n\t\t}\n\t},\n\n\tcomponentDidMount() {\n\t\tconst socketUrl = window.location.protocol + \"//\" + window.location.host;\n\t\tlet socket = io(socketUrl)\n\t\t\t.on(\"connect\", () => {\n\t\t\t\tconsole.log(\"Connected\");\n\t\t\t\t// removeAuthWidget();\n\t\t\t\tsocket.on(\"reconnect\", () => {\n\t\t\t\t\t\tconsole.log(\"Reconnected\");\n\t\t\t\t\t\tthis.setState({ status: \"connected\" });\n\t\t\t\t\t})\n\t\t\t\t\t.on(\"disconnect\", () => {\n\t\t\t\t\t\tconsole.log(\"Disconnected\")\n\t\t\t\t\t});\n\t\t\t})\n\t\t\t.on(\"error\", error => {\n\t\t\t\tconsole.log(error);\n\t\t\t\tif (error === \"Authentication Failed\") {\n\t\t\t\t\tthis.setState({ status: \"authFailed\" });\n\t\t\t\t} else if (error === \"Gather Banned\") {\n\t\t\t\t\tthis.setState({ status: \"banned\" });\n\t\t\t\t}\n\t\t\t});\n\n\t\tthis.setState({ socket: socket });\n\t},\n\n\trender() {\n\t\tconst status = this.state.status;\n\t\tif (status === \"connected\") {\n\t\t\treturn <App socket={this.state.socket} />;\n\t\t} \n\n\t\tlet splash;\n\t\tif (status === \"authFailed\") {\n\t\t\tsplash = <AuthFailedSplash />\n\t\t} else if (status === \"banned\") {\n\t\t\tsplash = <BannedSplash />\n\t\t} else {\n\t\t\tsplash = <ConnectingSplash />\n\t\t}\n\n\t\treturn (\n\t\t\t<div>\n\t\t\t\t<div style=\"min-height: 750px;\">\n\t\t\t\t\t<div class=\"container-fluid\">\n\t\t\t\t\t\t{splash}\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t);\n\t}\n});\n\nconst AuthFailedSplash = React.createClass({\n\trender() {\n\t\treturn (\n\t\t\t<div class=\"row\" id=\"auth-required\">\n\t\t\t\t<div class=\"col-lg-6 col-lg-offset-3\">\n\t\t\t\t\t<div class=\"add-top jumbotron jumbo-auth text-center\">\n\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t<img src=\"/ensl_logo.png\" alt=\"ENSL Logo\" />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<h3>You need to be logged in to the ENSL website to access gathers</h3>\n\t\t\t\t\t\t<h3><small>If you are logged on, try visiting a few pages on ENSL.org so the server can update your cookies</small></h3>\n\t\t\t\t\t\t<h3><small>If this error persists please contact an admin to fix it</small></h3>\n\t\t\t\t\t\t<br />\n\t\t\t\t\t <p><a class=\"btn btn-primary btn-lg\" href=\"www.ensl.org\" role=\"button\">Go to website</a></p>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t);\n\t}\n});\n\nconst BannedSplash = React.createClass({\n\trender() {\n\t\treturn (\n\t\t\t<div className=\"row\">\n\t\t\t\t<div className=\"col-lg-6 col-lg-offset-3\">\n\t\t\t\t\t<div className=\"add-top jumbotron jumbo-auth text-center\">\n\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t<img src=\"/ensl_logo.png\" alt=\"ENSL Logo\" />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<h3>You're currently barred from joining gathers</h3>\n\t\t\t\t\t\t<h3><small>Either wait for the ban to expire or talk to an admin to get it lifted</small></h3>\n\t\t\t\t\t\t<br />\n\t\t\t\t\t <p><a className=\"btn btn-primary btn-lg\" href=\"http://www.ensl.org/bans\" role=\"button\">See the ban list</a></p>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t);\n\t}\n});\n\nconst ConnectingSplash = React.createClass({\n\trender() {\n\t\treturn (\n\t\t\t<div className=\"row\" id=\"authenticating\">\n\t\t\t\t<div className=\"col-lg-6 col-lg-offset-3\">\n\t\t\t\t\t<div className=\"add-top jumbotron jumbo-auth text-center\">\n\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t<img src=\"/ensl_logo.png\" className=\"jumbo-img\" alt=\"ENSL Logo\" />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<br />\n\t\t\t\t\t\t<h3>Authenticating your ENSL account</h3>\n\t\t\t\t\t\t<br />\n\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t<img src=\"/spinner.svg\" className=\"spinner\" alt=\"Loading\" />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t);\n\t}\n});\n\nconst App = React.createClass({\n\tgetInitialState() {\n\t\tlet updateTitle = true;\n\t\tlet showEventsPanel = true;\n\n\t\tif (storageAvailable('localStorage')) {\n\t\t\tif (localStorage.getItem(\"updateTitle\") !== null) {\n\t\t\t\tupdateTitle = JSON.parse(localStorage.getItem(\"updateTitle\"));\n\t\t\t}\n\t\t\tif (localStorage.getItem(\"showEventsPanel\") !== null) {\n\t\t\t\tshowEventsPanel = JSON.parse(localStorage.getItem(\"showEventsPanel\"));\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\tevents: [],\n\t\t\tupdateTitle: updateTitle,\n\t\t\tshowEventsPanel: showEventsPanel,\n\t\t\tsoundController: new SoundController()\n\t\t};\n\t},\n\n\tgetDefaultProps() {\n\t\treturn {\n\t\t\tgather: {\n\t\t\t\tgatherers: []\n\t\t\t},\n\t\t\tusers: [],\n\t\t\tmessages: [],\n\t\t\tmaps: [],\n\t\t\tuser: null,\n\t\t\tservers: [],\n\t\t\tarchive: [],\n\t\t\tsocket: null,\n\t\t\tsoundController: null\n\t\t};\n\t},\n\n\tupdateTitle() {\n\t\tlet gather = this.props.gather;\n\t\tif (gather && this.state.updateTitle) {\n\t\t\tdocument.title = `NSL Gathers (${gather.gatherers.length}/12)`;\n\t\t\treturn;\n\t\t}\n\t\tdocument.title = \"NSL Gathers\";\n\t},\n\n\ttoggleEventsPanel(event) {\n\t\tlet newState = event.target.checked;\n\t\tthis.setState({ showEventsPanel: newState });\n\t\tif (storageAvailable('localStorage')) {\n\t\t\tlocalStorage.setItem(\"showEventsPanel\", newState)\n\t\t}\n\t},\n\n\ttoggleUpdateTitle(event) {\n\t\tlet newState = event.target.checked;\n\t\tthis.setState({ updateTitle: newState });\n\t\tif (storageAvailable('localStorage')) {\n\t\t\tlocalStorage.setItem(\"updateTitle\", newState)\n\t\t}\n\t\tthis.updateTitle();\n\t},\n\n\tthisGatherer() {\n\t\tlet gather = this.props.gather;\n\t\tlet user = this.props.user;\n\t\tif (gather && user && gather.gatherers.length) {\n\t\t\treturn gather.gatherers\n\t\t\t\t.filter(gatherer => gatherer.id === user.id)\n\t\t\t\t.pop() || null;\n\t\t}\n\t\treturn null;\n\t},\n\n\tcomponentDidMount() {\n\t\tlet self = this;\n\t\tlet socket = this.props.socket;\n\t\tlet soundController = this.state.soundController;\n\n\t\tthis.updateTitle();\n\n\t\tsocket.on('stateChange', data => {\n\t\t\tlet state = data.state;\n\t\t\t\n\t\t\tif (state.from === 'gathering'\n\t\t\t\t\t&& state.to === 'election'\n\t\t\t\t\t&& this.thisGatherer()) {\n\t\t\t\tsoundController.playGatherMusic();\n\t\t\t}\n\n\t\t\tif (state.from === 'election'\n\t\t\t\t\t&& state.to === 'gathering') {\n\t\t\t\tsoundController.stop();\n\t\t\t}\n\t\t});\n\n\t\tsocket.on('event:append', data => {\n\t\t\tlet events = self.state.events;\n\t\t\tevents.unshift(data);\n\t\t\tself.setState({\n\t\t\t\tevents: events.slice(0, 20)\n\t\t\t});\n\t\t});\n\n\t\tsocket.on('users:update', \n\t\t\tdata => self.setProps({\n\t\t\t\tusers: data.users,\n\t\t\t\tuser: data.currentUser\n\t\t\t})\n\t\t);\n\n\t\tsocket.on(\"message:append\", data => {\n\t\t\tself.setProps({\n\t\t\t\tmessages: self.props.messages.concat(data.messages)\n\t\t\t\t\t.sort((a, b) => {\n\t\t\t\t\t\treturn new Date(a.createdAt) - new Date(b.createdAt);\n\t\t\t\t\t})\n\t\t\t});\n\t\t});\n\n\t\tsocket.on(\"message:refresh\", data => {\n\t\t\tself.setProps({\n\t\t\t\tmessages: data.messages\n\t\t\t});\n\t\t});\n\n\t\tsocket.on(\"gather:refresh\", (data) => {\n\t\t\tself.setProps({\n\t\t\t\tgather: data.gather,\n\t\t\t\tmaps: data.maps,\n\t\t\t\tservers: data.servers,\n\t\t\t\tpreviousGather: data.previousGather\n\t\t\t});\n\t\t\tthis.updateTitle();\n\t\t});\n\n\t\tsocket.on(\"gather:archive:refresh\", data => {\n\t\t\tself.setProps({\n\t\t\t\tarchive: data.archive,\n\t\t\t\tmaps: data.maps,\n\t\t\t\tservers: data.servers\n\t\t\t});\n\t\t});\n\n\t\tsocket.emit(\"users:refresh\");\n\t\tsocket.emit(\"message:refresh\");\n\t\tsocket.emit(\"gather:refresh\");\n\t},\n\n\trender() {\n\t\tlet eventsPanel;\n\t\tif (this.state.showEventsPanel) {\n\t\t\teventsPanel = <Events events={this.state.events} />;\n\t\t}\n\n\t\treturn <div id=\"wrapper\">\n\t\t\t<nav className=\"navbar navbar-default navbar-static-top\" \n\t\t\t\trole=\"navigation\" \n\t\t\t\tstyle={{marginBottom: \"0\"}}>\n\t\t\t\t<div className=\"navbar-header\">\n\t\t\t\t\t<a className=\"navbar-brand\" href=\"/\">NSL Gathers <small><i>Alpha</i></small></a>\n\t\t\t\t</div>\n\t\t\t <ul className=\"nav navbar-top-links navbar-right\" id=\"currentuser\">\n\t\t\t \t<CurrentUser user={this.props.user} />\n\t\t\t </ul>\n\t\t\t <ul className=\"nav navbar-top-links navbar-right\" id=\"soundcontroller\">\n\t\t\t \t<SoundPanel soundController={this.state.soundController} />\n\t\t\t </ul>\n\t\t\t <TeamSpeakButton />\n\t\t\t <ul className=\"nav navbar-top-links navbar-right\">\n\t\t\t\t <li className=\"dropdown\">\n\t\t\t\t\t\t<a className=\"dropdown-toggle\" data-toggle=\"dropdown\" href=\"#\">\n\t\t\t\t\t\t\tInfo <i className=\"fa fa-caret-down\"></i>\n\t\t\t\t\t\t</a>\n\t\t\t\t\t\t<ul className=\"dropdown-menu\">\n\t\t\t\t\t\t\t<li>\n\t\t\t\t\t\t\t\t<a href=\"https://github.com/cblanc/sws_gathers\" target=\"_blank\">\n\t\t\t\t\t\t\t\t\t<i className=\"fa fa-github\"> </i> Github\n\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t<li>\n\t\t\t\t\t\t\t\t<a href=\"http://steamcommunity.com/id/nslgathers\" target=\"_blank\">\n\t\t\t\t\t\t\t\t\t<i className=\"fa fa-external-link\"> </i> Steam Bot\n\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t<li>\n\t\t\t\t\t\t\t\t<a href=\"http://www.ensl.org/articles/464\" target=\"_blank\">\n\t\t\t\t\t\t\t\t\t<i className=\"fa fa-external-link\"> </i> Gather Rules\n\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t<li>\n\t\t\t\t\t\t\t\t<a href=\"/messages\" target=\"_blank\">\n\t\t\t\t\t\t\t\t\t<i className=\"fa fa-external-link\"> </i> Message Archive\n\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t</ul>\n\t\t\t\t\t</li>\n\t\t\t </ul>\n\t\t\t</nav>\n\t\t\t<AdminPanel />\n\t\t\t<SettingsPanel \n\t\t\t\ttoggleEventsPanel={this.toggleEventsPanel}\n\t\t\t\tshowEventsPanel={this.state.showEventsPanel}\n\t\t\t\ttoggleUpdateTitle={this.toggleUpdateTitle}\n\t\t\t\tupdateTitle={this.state.updateTitle} />\n\t\t\t<TeamSpeakModal />\n\t\t\t<ProfileModal user={this.props.user} />\n\t\t\t<div style={{minHeight: \"750px\"}}>\n\t\t\t\t<div className=\"container-fluid\">\n\t\t\t\t\t<div className=\"row\">\n\t\t\t\t\t\t<div className=\"col-md-2 hidden-xs\">\n\t\t\t\t\t\t\t<ul className=\"nav\" id=\"side-menu\">\n\t\t\t\t\t\t\t\t<UserMenu users={this.props.users} user={this.props.user} />\n\t\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div className=\"col-md-4\" id=\"chatroom\">\n\t\t\t\t\t\t\t<Chatroom \n\t\t\t\t\t\t\t\tmessages={this.props.messages} \n\t\t\t\t\t\t\t\tuser={this.props.user} />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div className=\"col-md-6\" id=\"gathers\">\n\t\t\t\t\t\t\t<Gather \n\t\t\t\t\t\t\t\tgather={this.props.gather}\n\t\t\t\t\t\t\t\tthisGatherer={this.thisGatherer()}\n\t\t\t\t\t\t\t\tuser={this.props.user} \n\t\t\t\t\t\t\t\tsoundController={this.state.soundController}\n\t\t\t\t\t\t\t\tmaps={this.props.maps}\n\t\t\t\t\t\t\t\tservers={this.props.servers}\n\t\t\t\t\t\t\t\tpreviousGather={this.props.previousGather}/>\n\t\t\t\t\t\t\t<hr />\n\t\t\t\t\t\t\t<ArchivedGathers archive={this.props.archive}\n\t\t\t\t\t\t\t\tmaps={this.props.maps}\n\t\t\t\t\t\t\t\tservers={this.props.servers} />\n\t\t\t\t\t\t\t<hr />\n\t\t\t\t\t\t\t{eventsPanel}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t}\n});\n\nmodule.exports = SplashScreen;","const React = require(\"react\");\nconst ReactEmoji = require(\"react-emoji\");\nconst ReactAutolink = require(\"ReactAutolink\");\nconst MessageBrowser = React.createClass({\n\tgetInitialState() {\n\t\treturn {\n\t\t\tbrowserState: \"\",\n\t\t\tmessages: [],\n\t\t\tpage: 0,\n\t\t\tlimit: 250,\n\t\t\tsearch: \"\"\n\t\t}\n\t},\n\n\thandleNextPage(e) {\n\t\te.preventDefault();\n\t\tconst page = this.state.page;\n\t\tthis.setState({ page: page + 1 });\n\t\tthis.loadMessages();\n\t},\n\n\thandlePreviousPage(e) {\n\t\te.preventDefault();\n\t\tconst page = this.state.page;\n\t\tif (page < 1) return;\n\t\tthis.setState({ page: page - 1 });\n\t\tthis.loadMessages();\n\t},\n\n\tpageHandlers() {\n\t\tlet previous;\n\t\tif (this.state.page > 0) {\n\t\t\tprevious = (\n\t\t\t\t<a className=\"btn btn-xs btn-primary add-right\"\n\t\t\t\t\tonClick={this.handlePreviousPage}>Prev</a>\n\t\t\t);\n\t\t}\n\t\tlet next;\n\t\tif (this.state.messages.length === this.state.limit) {\n\t\t\tnext = (\n\t\t\t\t<a className=\"btn btn-xs btn-primary\" \n\t\t\t\t\tonClick={this.handleNextPage}>Next</a>\n\t\t\t);\n\t\t}\n\t\treturn (\n\t\t\t<div>\n\t\t\t\t{previous}\n\t\t\t\t<span className=\"add-right\">\n\t\t\t\t\t{this.state.page}\n\t\t\t\t</span>\n\t\t\t\t{next}\n\t\t\t</div>\n\t\t);\n\t},\n\n\tloadMessages() {\n\t\tconst limit = this.state.limit;\n\t\tconst page = this.state.page;\n\t\tlet data = {\n\t\t\tlimit: limit,\n\t\t\tpage: page\n\t\t};\n\n\t\tif (this.state.search.length) {\n\t\t\tdata.query = this.state.search;\n\t\t}\n\n\t\tthis.setState({ browserState: \"Retrieving messages\"});\n\t\t$.ajax({\n\t\t\turl: \"/api/messages\",\n\t\t\tdata: data\n\t\t})\n\t\t.done(data => {\n\t\t\tthis.setState({\n\t\t\t\tmessages: data.messages,\n\t\t\t\tbrowserState: \"\"\n\t\t\t});\n\t\t})\n\t\t.fail(error => {\n\t\t\tconsole.error(error);\n\t\t\tthis.setState({\n\t\t\t\tbrowserState: `Unable to retrieve messages.`\n\t\t\t});\n\t\t})\n\t},\n\n\tcomponentDidMount() {\n\t\tthis.loadMessages();\n\t},\n\n\tupdateLimit(e) {\n\t\tlet newLimit = parseInt(e.target.value, 10);\n\t\tif (isNaN(newLimit) || newLimit > 250) newLimit = 250;\n\t\tthis.setState({ limit: newLimit });\n\t},\n\n\tupdateSearch(e) {\n\t\tthis.setState({ search: e.target.value });\n\t},\n\n\trender() {\n\t\tlet browserState;\n\t\tif (this.state.browserState.length) {\n\t\t\tbrowserState = (\n\t\t\t\t<div className=\"col-xs-7\">\n\t\t\t\t\t<div className=\"well\">{this.state.browserState}</div>\n\t\t\t\t</div>\n\t\t\t);\n\t\t}\n\t\tconst messages = this.state.messages.map(message => {\n\t\t\treturn (\n\t\t\t\t<tr key={message._id}>\n\t\t\t\t\t<td className=\"col-xs-2\">{(new Date(message.createdAt)).toString()}</td>\n\t\t\t\t\t<td className=\"col-xs-3\">{message.author.username}</td>\n\t\t\t\t\t<td className=\"col-xs-5\">{message.content}</td>\n\t\t\t\t\t<td className=\"col-xs-2\">{message._id}</td>\n\t\t\t\t</tr>\n\t\t\t);\n\t\t});\n\t\treturn (\n\t\t\t<div className=\"row\">\n\t\t\t\t<div className=\"col-xs-5\">\n\t\t\t\t\t<div className=\"form-horizontal\">\n\t\t\t\t\t <div className=\"form-group\">\n\t\t\t\t\t <label className=\"col-sm-3 control-label\">Max Results</label>\n\t\t\t\t\t <div className=\"col-sm-9\">\n\t\t\t\t\t <input type=\"number\" className=\"form-control\" \n\t\t\t\t\t \tonChange={this.updateLimit}\n\t\t\t\t\t \tvalue={this.state.limit}></input>\n\t\t\t\t\t </div>\n\t\t\t\t\t </div>\n\t\t\t\t\t <div className=\"form-group\">\n\t\t\t\t\t <label className=\"col-sm-3 control-label\">Search Filter</label>\n\t\t\t\t\t <div className=\"col-sm-9\">\n\t\t\t\t\t <input type=\"text\" className=\"form-control\" \n\t\t\t\t\t \tonChange={this.updateSearch}\n\t\t\t\t\t \tvalue={this.state.search}></input>\n\t\t\t\t\t </div>\n\t\t\t\t\t </div>\n\t\t\t\t\t <div className=\"form-group\">\n\t\t\t\t\t \t<div className=\"col-sm-offset-3 col-sm-9\">\n\t\t\t\t\t\t \t<button \n\t\t\t\t\t\t\t\t\tclassName=\"btn btn-primary\"\n\t\t\t\t\t\t\t\t\tonClick={this.loadMessages}>Search</button>\n\t\t\t\t\t \t</div>\n\t\t\t\t\t </div>\n\t\t\t\t\t <div className=\"row\">\n\t\t\t\t\t\t <div className=\"col-sm-offset-3 col-sm-9\">\n\t\t\t\t\t\t \t<p>Page Control</p>\n\t\t\t\t\t\t \t{this.pageHandlers()}\n\t\t\t\t\t \t</div>\n\t\t\t\t \t</div>\n\t\t\t\t </div>\n\t\t\t\t</div>\n\t\t\t\t{browserState}\n\t\t\t\t<div className=\"col-xs-12\">\n\t\t\t\t\t<table className=\"table\">\n\t\t\t\t\t\t<thead>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<th>Date</th>\n\t\t\t\t\t\t\t\t<th>Author</th>\n\t\t\t\t\t\t\t\t<th>Message</th>\n\t\t\t\t\t\t\t\t<th>ID</th>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t</thead>\n\t\t\t\t\t\t<tbody>\n\t\t\t\t\t\t\t{messages}\n\t\t\t\t\t\t</tbody>\n\t\t\t\t\t</table>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t);\n\t}\n});\n\nvar Chatroom = React.createClass({\n\tgetInitialState() {\n\t\treturn {\n\t\t\tautoScroll: true\n\t\t};\n\t},\n\n\tcomponentDidMount() {\n\t\tlet self = this;\n\n\t\tthis.scrollListener = _.debounce((event) => {\n\t\t\tself.temporarilyDisableAutoScroll(event);\n\t\t}, 300, {\n\t\t leading: false,\n\t\t trailing: true\n\t\t});\n\n\t\tlet node = React.findDOMNode(this.refs.messageContainer);\n\t\tnode.addEventListener('scroll', this.scrollListener);\n\n\t\tthis.scrollToBottom();\n\t},\n\n\tcomponentWillUnmount() {\n\t\tnode.removeEventListener('scroll', this.scrollListener);\n\t\tclearTimeout(this.disableScrollTimer);\n\t},\n\n\tloadMoreMessages() {\n\t\tvar earliestMessage = this.props.messages[0];\n\t\tif (earliestMessage === undefined) return;\n\t\tsocket.emit(\"message:refresh\", {\n\t\t\tbefore: earliestMessage.createdAt\n\t\t});\n\t},\n\n\tsendMessage(message) {\n\t\tsocket.emit(\"newMessage\", {message: message});\n\t},\n\n\tclearAutoScrollTimeout() {\n\t\tif (this.disableScrollTimer) clearTimeout(this.disableScrollTimer);\n\t},\n\n\ttemporarilyDisableAutoScroll(event) {\n\t\tlet self = this;\n\t\tlet node = event.target;\n\t\tif (node) {\n\t\t\tif (node.scrollHeight - node.scrollTop === node.clientHeight) {\n\t\t\t\tthis.setState({ autoScroll: true });\n\t\t\t\tthis.clearAutoScrollTimeout();\n\t\t\t}\n\t\t\tif (node.scrollHeight - node.scrollTop - node.clientHeight < 50) return;\n\t\t}\n\t\tthis.setState({ autoScroll: false });\n\t\tthis.clearAutoScrollTimeout();\n\t\tthis.disableScrollTimer = setTimeout(() => {\n\t\t\tself.setState({\n\t\t\t\tautoScroll: true\n\t\t\t})\n\t\t}, 10000);\n\t},\n\n\tcomponentDidUpdate() {\n\t\tthis.scrollToBottom();\n\t},\n\n\tscrollToBottom() {\n\t\tif (!this.state.autoScroll) return;\n\t\tlet node = React.findDOMNode(this.refs.messageContainer);\n\t node.scrollTop = node.scrollHeight;\n\t},\n\n\trender() {\n\t\tlet messages = this.props.messages.map(message => {\n\t\t\tif (message) {\n\t\t\t\treturn <ChatMessage message={message} \n\t\t\t\t\t\t\t\t\tkey={message._id}\n\t\t\t\t\t\t\t\t\tid={message._id}\n\t\t\t\t\t\t\t\t\tuser={this.props.user} />\n\t\t\t}\n\t\t});\n\t\treturn (\n\t\t\t<div className=\"panel panel-primary chatbox\">\n\t\t\t\t<div className=\"panel-heading\">Gather Chat</div>\n\t\t\t\t<div className=\"panel-body\">\n\t\t\t\t\t<ul className=\"chat\" id=\"chatmessages\" ref=\"messageContainer\">\n\t\t\t\t\t\t<li className=\"text-center\">\n\t\t\t\t\t\t\t<a href=\"#\"\n\t\t\t\t\t\t\t\tonClick={this.loadMoreMessages}\n\t\t\t\t\t\t\t\tclassName=\"btn btn-primary btn-xs\">\n\t\t\t\t\t\t\t\tLoad more messages\n\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t</li>\n\t\t\t\t\t\t{messages}\n\t\t\t\t\t</ul>\n\t\t\t\t</div>\n\t\t\t\t<div className=\"panel-footer\">\n\t\t\t\t\t<MessageBar />\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t);\n\t}\n});\n\nvar imgurRegex = /^(https?:\\/\\/i\\.imgur\\.com\\/\\S*\\.(jpg|png))$/i;\n\nvar ChatMessage = React.createClass({\n\tmixins: [\n ReactAutolink,\n ReactEmoji\n ],\n\n getInitialState() {\n \treturn {\n \t\tcreatedAt: \"\"\n \t}\n },\n\n updateCreatedAt() {\n \tlet self = this;\n \tif (this.props.message.createdAt) {\n \t\tself.setState({\n \t\t\tcreatedAt: $.timeago(self.props.message.createdAt)\n \t\t})\n \t}\n },\n\n componentWillMount() {\n\t\tthis.updateCreatedAt();\n },\n\n\tcomponentDidMount() {\n\t\tthis.interval = setInterval(this.updateCreatedAt, 60000);\n\t},\n\n\tcomponentWillUnmount: function () {\n\t\tclearInterval(this.interval);\n\t},\n\n\tmessageContent: function () {\n\t\tlet self = this;\n\t\tlet message = self.props.message.content\n\t\tif (message.match(imgurRegex)) {\n\t\t\treturn (\n\t\t\t\t<div className=\"imgur-container\">\n\t\t\t\t\t<a href={message} target=\"_blank\">\n\t\t\t\t\t\t<img className=\"imgur-chat\" src={message} />\n\t\t\t\t\t</a>\n\t\t\t\t</div>\n\t\t\t);\n\t\t}\n\n\t\treturn self.autolink(message, { \n\t\t\ttarget: \"_blank\", \n\t\t\trel: \"nofollow\" \n\t\t}).map((elem) => {\n\t\t\tif (_.isString(elem)) {\n\t\t\t\treturn self.emojify(elem);\n\t\t\t} else {\n\t\t\t\treturn elem;\n\t\t\t}\n\t\t});\n\t},\n\n\trender() {\n\t\tlet deleteButton;\n\t\tlet user = this.props.user;\n\t\tif (user && user.admin) {\n\t\t\tdeleteButton = <DeleteMessageButton messageId={this.props.message._id} />;\n\t\t}\n\t\treturn (\n\t\t\t<li className=\"left clearfix\">\n\t\t\t\t<span className=\"chat-img pull-left\">\n\t\t\t\t\t\t<img \n\t\t\t\t\t\t\tsrc={this.props.message.author.avatar} \n\t\t\t\t\t\t\talt=\"User Avatar\" \n\t\t\t\t\t\t\theight=\"40\"\n\t\t\t\t\t\t\twidth=\"40\"\n\t\t\t\t\t\t\tclassName=\"img-circle\" />\n\t\t\t\t</span>\n\t\t\t\t<div className=\"chat-body clearfix\">\n\t\t\t\t\t<div className=\"header\">\n\t\t\t\t\t\t<strong className=\"primary-font\">\n\t\t\t\t\t\t\t{this.props.message.author.username}\n\t\t\t\t\t\t\t</strong>\n\t\t\t\t\t\t<small className=\"pull-right text-muted\">\n\t\t\t\t\t\t\t{deleteButton}\n\t\t\t\t\t\t\t<span className=\"hidden-xs\">\n\t\t\t\t\t\t\t\t<i className=\"fa fa-clock-o fa-fw\"></i> \n\t\t\t\t\t\t\t\t{this.state.createdAt}\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</small>\n\t\t\t\t\t</div>\n\t\t\t\t\t<p className=\"wordwrap\">{this.messageContent()}</p>\n\t\t\t\t</div>\n\t\t\t</li>\n\t\t);\n\t}\n});\n\nvar DeleteMessageButton = React.createClass({\n\thandleClick (e) {\n\t\te.preventDefault();\n\t\tsocket.emit(\"message:delete\", {\n\t\t\tid: this.props.messageId\n\t\t});\n\t},\n\n\trender() {\n\t\treturn (\n\t\t\t<a href=\"#\" onClick={this.handleClick}>\n\t\t\t\t<i className=\"fa fa-trash-o\"></i>\n\t\t\t</a>\n\t\t);\n\t}\n})\n\nvar MessageBar = React.createClass({\n\tsendMessage(content) {\n\t\tsocket.emit(\"message:new\", {\n\t\t\tcontent: content\n\t\t});\n\t},\n\n\tgetInitialState() {\n\t\treturn {\n\t\t\tstatusMessage: null\n\t\t};\n\t},\n\n\tcheckInputLength() {\n\t\tconst input = React.findDOMNode(this.refs.content).value;\n\t\tconst currentStatusMessage = this.state.statusMessage;\n\t\tif (input.length > 256) {\n\t\t\treturn this.setState({\n\t\t\t\tstatusMessage: \"Maximum of 256 characters will be saved\"\n\t\t\t})\n\t\t}\n\t\tif (currentStatusMessage !== null) {\n\t\t\tthis.setState({\n\t\t\t\tstatusMessage: null\n\t\t\t});\n\t\t}\n\t},\n\n\thandleInputChange() {\n\t\t// Noop, later assigned as debounced method in componentWillMount\n\t},\n\n\thandleSubmit(e) {\n\t\te.preventDefault();\n\t\tlet content = React.findDOMNode(this.refs.content).value.trim();\n\t\tif (!content) return;\n\t\tReact.findDOMNode(this.refs.content).value = '';\n\t\tthis.sendMessage(content);\n\t\treturn;\n\t},\n\n\tcomponentWillMount() {\n\t\tthis.handleInputChange = _.debounce(this.checkInputLength, {\n\t\t\tleading: false,\n\t\t\ttrailing: true\n\t\t});\n\t},\n\n\trender() {\n\t\tlet statusMessage;\n\t\tif (this.state.statusMessage !== null) {\n\t\t\tstatusMessage = <div className=\"input-group\">\n\t\t\t\t<small>{this.state.statusMessage}</small>\n\t\t\t</div>;\n\t\t}\n\t\treturn (\n\t\t\t<form onSubmit={this.handleSubmit} autoComplete=\"off\">\n\t\t\t\t<div className=\"input-group\">\n\t\t\t\t\t<input \n\t\t\t\t\t\tid=\"btn-input\" \n\t\t\t\t\t\ttype=\"text\" \n\t\t\t\t\t\tclassName=\"form-control\" \n\t\t\t\t\t\tref=\"content\"\n\t\t\t\t\t\tonChange={this.handleInputChange}\n\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t\tplaceholder=\"Be polite please...\" />\n\t\t\t\t\t<span className=\"input-group-btn\">\n\t\t\t\t\t\t<input \n\t\t\t\t\t\t\ttype=\"submit\" \n\t\t\t\t\t\t\tclassName=\"btn btn-primary\" \n\t\t\t\t\t\t\tid=\"btn-chat\" \n\t\t\t\t\t\t\tvalue=\"Send\" />\n\t\t\t\t\t</span>\n\t\t\t\t</div>\n\t\t\t\t{statusMessage}\n\t\t\t</form>\n\t\t);\n\t}\n});\n","const React = require(\"react\");\n\nconst SettingsPanel = React.createClass({\n\trender() {\n\t\treturn (\n\t\t\t<div className=\"modal fade\" id=\"settingsmodal\">\n\t\t\t\t<div className=\"modal-dialog\">\n\t\t\t\t\t<div className=\"modal-content\">\n\t\t\t\t\t\t<div className=\"modal-header\">\n\t\t\t\t\t\t\t<button type=\"button\" className=\"close\" data-dismiss=\"modal\" \n\t\t\t\t\t\t\t\taria-label=\"Close\">\n\t\t\t\t\t\t\t\t\t<span aria-hidden=\"true\">×</span>\n\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t<h4 className=\"modal-title\">Settings</h4>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div className=\"modal-body\">\n\t\t\t\t\t\t\t<div className=\"checkbox\">\n\t\t\t\t\t\t\t\t<label className=\"checkbox-inline\">\n\t\t\t\t\t\t\t\t\t<input type=\"checkbox\" \n\t\t\t\t\t\t\t\t\t\tonChange={this.props.toggleUpdateTitle}\n\t\t\t\t\t\t\t\t\t\tchecked={this.props.updateTitle}/> Update Gather Status in Title (Cabooble Mode) - May require refresh\n\t\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t\t</div>\n\t\t </div>\n\t\t <div className=\"modal-body\">\n\t\t\t\t\t\t\t<div className=\"checkbox\">\n\t\t\t\t\t\t\t\t<label className=\"checkbox-inline\">\n\t\t\t\t\t\t\t\t\t<input type=\"checkbox\" \n\t\t\t\t\t\t\t\t\t\tonChange={this.props.toggleEventsPanel}\n\t\t\t\t\t\t\t\t\t\tchecked={this.props.showEventsPanel}/> Show events panel\n\t\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t\t</div>\n\t\t </div>\n\t\t\t\t\t\t<div className=\"modal-footer\">\n\t\t\t\t\t\t\t<button type=\"button\" className=\"btn btn-default\" \n\t\t\t\t\t\t\t\tdata-dismiss=\"modal\">Close</button>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t);\n\t}\n});\n","const React = require(\"react\");\n\nvar SnowMachineMenu = React.createClass({\n\tgetInitialState() {\n\t\treturn {\n\t\t\tsnowMachine: null\n\t\t}\n\t},\n\n\tcomponentDidMount() {\n\t\tconst snowMachine = new SnowMachine();\n\t\tsnowMachine.start();\n\t\tthis.setState({ snowMachine: snowMachine });\n\t},\n\n\ttoggle() {\n\t\tconst snowMachine = this.state.snowMachine;\n\t\tif (snowMachine.timer) {\n\t\t\tsnowMachine.stop();\n\t\t} else {\n\t\t\tsnowMachine.start();\n\t\t}\n\t},\n\n\trender() {\n\t\treturn (\n\t\t\t<ul className=\"nav navbar-top-links navbar-right\">\n\t\t\t <li>\n\t\t\t\t\t<a href=\"#\" onClick={this.toggle}>\n\t\t\t\t\t\tSnow\n\t\t\t\t\t</a>\n\t\t\t\t</li>\n\t\t </ul>\n\t );\n\t}\n});\n","const Howl = require(\"howl\");\nconst React = require(\"react\");\nconst helper = require(\"javascripts/helper\");\nconst storageAvailable = helper.storageAvailable;\n\nclass SoundController {\n\tconstructor () {\n\t\tif (Howl === undefined) {\n\t\t\tthrow new Error(\"Howl.js required to created sound controller\");\n\t\t}\n\n\t\tthis.MINIMUM_PLAY_INTERVAL = 20000;\n\n\t\tthis.playGatherMusic = _.throttle(() => {\n\t\t\tthis.gather.music.play();\n\t\t}, this.MINIMUM_PLAY_INTERVAL);\n\n\t\tthis.isMuted = Howler._muted;\n\t\t\n\t\tlet gatherMusic;\n\t\tif (storageAvailable(\"localStorage\")) {\n\t\t\tlet volume = localStorage.getItem(\"gatherVolume\");\n\t\t\tif (volume !== undefined) Howler.volume(volume);\n\t\t\tgatherMusic = localStorage.getItem(\"gatherMusic\");\n\t\t}\n\n\t\tthis.tunes = {\n\t\t\t\"classic\": {\n\t\t\t\tdescription: \"Gathers Classic\",\n\t\t\t\turl: 'http://www.ensl.org/files/audio/gather-1.mp3'\n\t\t\t},\n\t\t\t\"nights\": {\n\t\t\t\tdescription: \"Nights\",\n\t\t\t\turl: 'http://www.ensl.org/files/audio/nights.mp3'\n\t\t\t},\n\t\t\t\"robby\": {\n\t\t\t\tdescription: \"Robby\",\n\t\t\t\turl: 'http://www.ensl.org/files/audio/robby.mp3'\n\t\t\t},\n\t\t\t\"america\": {\n\t\t\t\tdescription: \"Infamous\",\n\t\t\t\turl: 'http://www.ensl.org/files/audio/america.mp3'\n\t\t\t},\n\t\t\t\"prommah\": {\n\t\t\t\tdescription: \"Prommah\",\n\t\t\t\turl: 'http://www.ensl.org/files/audio/prommah.mp3'\n\t\t\t},\n\t\t\t\"turts\": {\n\t\t\t\tdescription: \"Gorges Rock your Ass\",\n\t\t\t\turl: 'http://www.ensl.org/files/audio/turts.mp3'\n\t\t\t},\n\t\t\t\"skyice\": {\n\t\t\t\tdescription: \"Skyice\",\n\t\t\t\turl: 'http://www.ensl.org/files/audio/skyice.mp3'\n\t\t\t},\n\t\t\t\"justwannahavefun\": {\n\t\t\t\tdescription: \"Gorges just want to have fun\",\n\t\t\t\turl: 'http://www.ensl.org/files/audio/justwannahavefun.mp3'\n\t\t\t},\n\t\t\t\"eyeofthegorgie\": {\n\t\t\t\tdescription: \"Eye of the Gorgie\",\n\t\t\t\turl: 'http://www.ensl.org/files/audio/eyeofthegorgie.mp3'\n\t\t\t},\n\t\t\t\"boondock\": {\n\t\t\t\tdescription: \"Boondock Marines\",\n\t\t\t\turl: 'http://www.ensl.org/files/audio/boondock.mp3'\n\t\t\t},\n\t\t\t\"preclassic\": {\n\t\t\t\tdescription: \"Old Gathers Classic\",\n\t\t\t\turl: 'http://www.ensl.org/files/audio/gather-5.mp3'\n\t\t\t}\n\t\t}\n\n\t\tthis.setupGatherMusic(gatherMusic);\n\t}\n\n\tmute() {\n\t\tthis.isMuted = true;\n\t\treturn Howler.mute();\n\t}\n\n\tunMute() {\n\t\tthis.isMuted = false;\n\t\treturn Howler.unmute();\n\t}\n\n\tgetVolume() {\n\t\treturn Howler.volume();\n\t}\n\n\tsetVolume(val) {\n\t\tif (val === undefined || \n\t\t\t\ttypeof val !== 'number' || \n\t\t\t\tMath.abs(val) > 1) return;\n\t\tif (storageAvailable(\"localStorage\")) {\n\t\t\tlocalStorage.setItem(\"gatherVolume\", val);\n\t\t}\n\t\treturn Howler.volume(val);\n\t}\n\n\tplay(music) {\n\t\tif (this.gather && this.gather.music) return this.gather.music.play();\n\t}\n\n\tstop(music) {\n\t\tif (this.gather && this.gather.music) return this.gather.music.stop();\n\t}\n\n\tdefaultGatherMusic() {\n\t\treturn \"classic\";\n\t}\n\n\tsetupGatherMusic (musicName) {\n\t\tlet self = this;\n\t\tlet gatherMusic = self.tunes[musicName];\n\n\t\tif (!gatherMusic) {\n\t\t\tmusicName = this.defaultGatherMusic();\n\t\t\tgatherMusic = self.tunes[musicName]; \n\t\t}\n\n\t\tif (self.gather && self.gather.name === musicName) return;\n\n\t\t// Stop if already playing\n\t\tif (self.gather && self.gather.music) {\n\t\t\tself.gather.music.stop();\n\t\t}\n\n\t\tlet tune = self.tunes[musicName];\n\t\tself.gather = {\n\t\t\tname: musicName,\n\t\t\tdescription: tune.description,\n\t\t\turl: tune.url,\n\t\t\tmusic: new Howl({\n\t\t\t\turls: [tune.url]\n\t\t\t})\n\t\t};\n\t}\n}\n\nvar MusicSelector = React.createClass({\n\tgetInitialState() {\n\t\treturn {\n\t\t\tmusic: this.selectedMusic()\n\t\t}\n\t},\n\n\tselectedMusic() {\n\t\tif (storageAvailable(\"localStorage\")) {\n\t\t\treturn localStorage.getItem(\"gatherMusic\") \n\t\t\t\t|| this.props.soundController.defaultGatherMusic();\n\t\t} else {\n\t\t\treturn this.props.soundController.defaultGatherMusic(); \n\t\t}\n\t},\n\n\tsetMusic(event) {\n\t\tlet name = event.target.value;\n\t\tlet soundController = this.props.soundController;\n\t\tlet selectedTune = soundController.tunes[name];\n\t\tif (selectedTune === undefined) return;\n\t\tthis.setState({ music: name });\n\t\tsoundController.setupGatherMusic(name);\n\t\tif (storageAvailable(\"localStorage\")) {\n\t\t\tlocalStorage.setItem(\"gatherMusic\", name);\n\t\t}\n\t},\n\n\trender() {\n\t\tlet soundController = this.props.soundController;\n\t\tlet tunes = [];\n\t\tfor (var attr in soundController.tunes) {\n\t\t\tlet o = soundController.tunes[attr];\n\t\t\to.id = attr;\n\t\t\ttunes.push(o);\n\t\t}\n\t\tlet options = tunes.map(tune => {\n\t\t\treturn <option key={tune.id} value={tune.id}>{tune.description}</option>;\n\t\t});\n\t\treturn (\n\t\t\t<div className=\"form-group music-select\">\n\t\t\t\t<label>Music</label>\n\t\t\t\t<select\n\t\t\t\t\tclassName=\"form-control\"\n\t\t\t\t\tdefaultValue={this.state.music}\n\t\t\t\t\tonChange={this.setMusic}\n\t\t\t\t\tvalue={this.state.music}>\n\t\t\t\t\t{options}\n\t\t\t\t</select>\n\t\t\t</div>\n\t\t);\n\t}\n})\n\nvar SoundPanel = React.createClass({\n\tcomponentDidMount() {\n\t\tlet soundController = this.props.soundController;\n\t\tlet scale = 10;\n\n\t\t$('a#sound-dropdown').on('click', function (event) {\n\t\t\t$(this).parent().toggleClass('open');\n\t\t});\n\n\t\t$(\"#volume-slide\").slider({\n\t\t\tmin: 0,\n\t\t\tmax: scale,\n\t\t\tstep: 1\n\t\t}).on(\"slideStop\", ({value}) => {\n\t\t\tsoundController.setVolume(value / scale);\n\t\t}).slider('setValue', soundController.getVolume() * scale);\n\t},\n\n\tmute() {\n\t\tthis.props.soundController.mute();\n\t\tthis.forceUpdate();\n\t},\n\n\tunMute() {\n\t\tthis.props.soundController.unMute();\n\t\tthis.forceUpdate();\n\t},\n\n\tplay() {\n\t\tthis.props.soundController.play();\n\t},\n\n\tstop() {\n\t\tthis.props.soundController.stop();\n\t},\n\n\trender() {\n\t\tlet soundController = this.props.soundController;\n\t\tlet mutedIcon, mutedButton;\n\t\tif (soundController.isMuted) {\n\t\t\tmutedIcon = <i className=\"fa fa-volume-off fa-fw\"></i>;\n\t\t\tmutedButton = <li>\n\t\t\t\t<a href=\"#\" onClick={this.unMute}>\n\t\t\t\t\t{mutedIcon} Muted\n\t\t\t\t</a>\n\t\t\t</li>;\n\t\t} else {\n\t\t\tmutedIcon = <i className=\"fa fa-volume-up fa-fw\"></i>;\n\t\t\tmutedButton = <li>\n\t\t\t\t<a href=\"#\" onClick={this.mute}>\n\t\t\t\t\t{mutedIcon} Unmuted\n\t\t\t\t</a>\n\t\t\t</li>;\n\t\t}\n\t\treturn <ul className=\"nav navbar-top-links navbar-right\">\n\t\t <li className=\"dropdown\">\n\t\t\t\t<a className=\"dropdown-toggle\" href=\"#\" id=\"sound-dropdown\">\n\t\t\t\t\tSound {mutedIcon} <i className=\"fa fa-caret-down\"></i>\n\t\t\t\t</a>\n\t\t\t\t<ul className=\"dropdown-menu\" id=\"sound-dropdown\">\n\t\t\t\t\t{mutedButton}\n\t\t\t\t\t<li>\n\t\t\t\t\t\t<a href='#' onClick={this.play}>\n\t\t\t\t\t\t\t<i className=\"fa fa-play\"></i> Play\n\t\t\t\t\t\t</a>\n\t\t\t\t\t</li>\n\t\t\t\t\t<li>\n\t\t\t\t\t\t<a href='#' onClick={this.stop}>\n\t\t\t\t\t\t\t<i className=\"fa fa-stop\"></i> Stop\n\t\t\t\t\t\t</a>\n\t\t\t\t\t</li>\n\t\t\t\t\t<hr />\n\t\t\t\t\t<li>\n\t\t\t\t\t\t<div className=\"volume-slide\">\n\t\t\t\t\t\t\t<label>Volume</label>\n\t\t\t\t\t\t\t<div id=\"volume-slide\"></div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</li>\n\t\t\t\t\t<li>\n\t\t\t\t\t\t<MusicSelector soundController={soundController} />\n\t\t\t\t\t</li>\n\t\t\t\t</ul>\n\t\t\t</li>\n\t </ul>;\n\t}\n});\n","const React = require(\"react\");\nconst helper = require(\"javascripts/helper\");\nconst enslUrl = helper.enslUrl;\nconst hiveUrl = helper.hiveUrl;\nconst modalId = helper.modalId;\n\nconst UserLogin = React.createClass({\n\tauthorizeId(id) {\n\t\tsocket.emit(\"users:authorize\", {\n\t\t\tid: parseInt(id, 10)\n\t\t});\n\t},\n\n\thandleSubmit(e) {\n\t\te.preventDefault();\n\t\tlet id = React.findDOMNode(this.refs.authorize_id).value.trim();\n\t\tif (!id) return;\n\t\tReact.findDOMNode(this.refs.authorize_id).value = '';\n\t\tthis.authorizeId(id);\n\t},\n\n\trender() {\n\t\treturn (\n\t\t\t<form onSubmit={this.handleSubmit} >\n\t\t\t\t<div className=\"input-group signin\">\n\t\t\t\t\t<input \n\t\t\t\t\t\tid=\"btn-input\" \n\t\t\t\t\t\ttype=\"text\" \n\t\t\t\t\t\tclassName=\"form-control\" \n\t\t\t\t\t\tref=\"authorize_id\"\n\t\t\t\t\t\tplaceholder=\"Change user\" />\n\t\t\t\t\t<span className=\"input-group-btn\">\n\t\t\t\t\t\t<input \n\t\t\t\t\t\t\ttype=\"submit\" \n\t\t\t\t\t\t\tclassName=\"btn btn-primary\" \n\t\t\t\t\t\t\tid=\"btn-chat\" \n\t\t\t\t\t\t\tvalue=\"Assume ID\" />\n\t\t\t\t\t</span>\n\t\t\t\t</div>\n\t\t\t</form>\n\t\t);\n\t}\n});\n\nconst DisconnectUserButton = React.createClass({\n\tgetDefaultProps() {\n\t\treturn {\n\t\t\tid: null\n\t\t};\n\t},\n\n\tdisconnectUser() {\n\t\tsocket.emit(\"users:disconnect\", {\n\t\t\tid: this.props.id\n\t\t});\n\t},\n\t\n\trender() {\n\t\treturn <button\n\t\t\tclassName=\"btn btn-danger\"\n\t\t\tonClick={this.disconnectUser}>\n\t\t\tDisconnect User</button>\n\t}\n});\n\nconst UserModal = React.createClass({\n\trender() {\n\t\tconst currentUser = this.props.currentUser;\n\t\tconst user = this.props.user;\n\t\tlet hiveStats;\n\t\tif (user.hive.id) {\n\t\t\thiveStats = [\n\t\t\t<tr><td><strong>Hive Stats</strong></td><td></td></tr>,\n\t\t\t<tr>\n\t\t\t\t<td>ELO</td>\n\t\t\t\t<td>{user.hive.skill}</td>\n\t\t\t</tr>,\n\t\t\t<tr>\n\t\t\t\t<td>Hours Played</td>\n\t\t\t\t<td>{Math.round(user.hive.playTime / 3600)}</td>\n\t\t\t</tr>,\n\t\t\t<tr>\n\t\t\t\t<td>Wins</td>\n\t\t\t\t<td>{user.hive.wins}</td>\n\t\t\t</tr>,\n\t\t\t<tr>\n\t\t\t\t<td>Losses</td>\n\t\t\t\t<td>{user.hive.loses}</td>\n\t\t\t</tr>,\n\t\t\t<tr>\n\t\t\t\t<td>Kills (/min)</td>\n\t\t\t\t<td>{user.hive.kills} ({_.round(user.hive.kills / (user.hive.playTime / 60), 1)})</td>\n\t\t\t</tr>,\n\t\t\t<tr>\n\t\t\t\t<td>Assists (/min)</td>\n\t\t\t\t<td>{user.hive.assists} ({_.round(user.hive.assists / (user.hive.playTime / 60), 1)})</td>\n\t\t\t</tr>,\n\t\t\t<tr>\n\t\t\t\t<td>Deaths (/min)</td>\n\t\t\t\t<td>{user.hive.deaths} ({_.round(user.hive.deaths / (user.hive.playTime / 60), 1)})</td>\n\t\t\t</tr>\n\t\t\t]\n\t\t}\n\t\tlet adminOptions;\n\t\tif (currentUser.admin) {\n\t\t\tadminOptions = <DisconnectUserButton id={user.id} />;\n\t\t}\n\t\treturn (\n\t\t\t<div className=\"modal fade\" id={modalId(user)}>\n\t\t\t\t<div className=\"modal-dialog\">\n\t\t\t\t\t<div className=\"modal-content\">\n\t\t\t\t\t\t<div className=\"modal-header\">\n\t\t\t\t\t\t\t<button type=\"button\" className=\"close\" data-dismiss=\"modal\" \n\t\t\t\t\t\t\t\taria-label=\"Close\">\n\t\t\t\t\t\t\t\t\t<span aria-hidden=\"true\">×</span>\n\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t<h4 className=\"modal-title\">\n\t\t\t\t\t\t\t\t<img src=\"blank.gif\" \n\t\t\t\t\t\t\t\t\tclassName={\"flag flag-\" + ((user.country === null) ? \"eu\" : \n\t\t\t\t\t\t\t\t\t\tuser.country.toLowerCase()) } \n\t\t\t\t\t\t\t\t\talt={user.country} /> \n\t\t\t\t\t\t\t\t{user.username}\n\t\t\t\t\t\t\t</h4>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div className=\"modal-body\">\n\t\t\t\t\t\t\t<div className=\"text-center\">\n\t\t\t\t\t\t\t\t<img \n\t\t\t\t\t\t\t\tsrc={user.avatar} \n\t\t\t\t\t\t\t\talt=\"User Avatar\" />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<table className=\"table\">\n\t\t\t\t\t\t\t\t<tbody>\n\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t<td>Lifeforms</td>\n\t\t\t\t\t\t\t\t\t\t<td><LifeformIcons gatherer={{user: user}} /></td>\n\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t<td>Links</td>\n\t\t\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t\t\t<a href={enslUrl(user)} \n\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"btn btn-xs btn-primary\"\n\t\t\t\t\t\t\t\t\t\t\t\ttarget=\"_blank\">ENSL Profile</a> \n\t\t\t\t\t\t\t\t\t\t\t<a href={hiveUrl({user: user})} \n\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"btn btn-xs btn-primary\"\n\t\t\t\t\t\t\t\t\t\t\t\ttarget=\"_blank\">Hive Profile</a>\n\t\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t{hiveStats}\n\t\t\t\t\t\t\t\t</tbody>\n\t\t\t\t\t\t\t</table>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div className=\"modal-footer\">\n\t\t\t\t\t\t\t{adminOptions}\n\t\t\t\t\t\t\t<button type=\"button\" \n\t\t\t\t\t\t\t\tclassName=\"btn btn-default\" \n\t\t\t\t\t\t\t\tdata-dismiss=\"modal\">Close</button>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t);\n\t}\n})\n\nconst UserItem = React.createClass({\n\trender() {\n\t\tconst user = this.props.user;\n\t\tconst currentUser = this.props.currentUser;\n\t\treturn (\n\t\t\t<li className=\"list-group-item\">\n\t\t\t\t<a href=\"#\" data-toggle=\"modal\" \n\t\t\t\tdata-target={`#${modalId(user)}`}>{user.username}</a>\n\t\t\t\t<UserModal user={user} currentUser={currentUser} />\n\t\t\t</li>\n\t\t);\n\t}\n});\n\nconst UserMenu = React.createClass({\n\trender() {\n\t\tconst users = this.props.users\n\t\t.sort((a, b) => (a.username.toLowerCase() > b.username.toLowerCase()) ? 1 : -1)\n\t\t.map(user => {\n\t\t\treturn <UserItem user={user} key={user.id} \n\t\t\t\tcurrentUser={this.props.user} />\n\t\t});\n\t\treturn (\n\t\t\t<div>\n\t\t\t\t<div className=\"panel panel-primary add-bottom\">\n\t\t\t\t\t<div className=\"panel-heading\">\n\t\t\t\t\t\t<i className=\"fa fa-users fa-fw\"></i> Online\n\t\t\t\t\t\t<span className=\"badge pull-right\">{this.props.users.length}</span>\n\t\t\t\t\t</div>\n\t\t\t\t\t<ul className=\"list-group\" id=\"users-list\">\n\t\t\t\t\t\t{users}\n\t\t\t\t\t</ul>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t);\n\t}\n});\n\nconst AdminPanel = React.createClass({\n\thandleGatherReset() {\n\t\tsocket.emit(\"gather:reset\");\n\t},\n\n\trender() {\n\t\treturn (\n\t\t\t<div className=\"modal fade\" id=\"adminmodal\">\n\t\t\t\t<div className=\"modal-dialog\">\n\t\t\t\t\t<div className=\"modal-content\">\n\t\t\t\t\t\t<div className=\"modal-header\">\n\t\t\t\t\t\t\t<button type=\"button\" className=\"close\" data-dismiss=\"modal\" \n\t\t\t\t\t\t\t\taria-label=\"Close\">\n\t\t\t\t\t\t\t\t\t<span aria-hidden=\"true\">×</span>\n\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t<h4 className=\"modal-title\">Administration Panel</h4>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div className=\"modal-body\" id=\"admin-menu\">\n\t\t\t\t\t\t\t<h5>Swap Into a Different Account (Only works for admins)</h5>\n\t\t\t\t\t\t\t<UserLogin />\n\t\t\t\t\t\t\t<h5>Gather Options</h5>\n\t\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\tclassName=\"btn btn-danger max-width\"\n\t\t\t\t\t\t\t\t\tonClick={this.handleGatherReset}>\n\t\t\t\t\t\t\t\t\tReset Gather</button>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div className=\"modal-footer\">\n\t\t\t\t\t\t\t<button type=\"button\" className=\"btn btn-default\" \n\t\t\t\t\t\t\t\tdata-dismiss=\"modal\">Close</button>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t);\n\t}\n});\n\nconst ProfileModal = React.createClass({\n\thandleUserUpdate(e) {\n\t\te.preventDefault();\n\t\tlet abilities = {\n\t\t\tskulk: React.findDOMNode(this.refs.skulk).checked,\n\t\t\tlerk: React.findDOMNode(this.refs.lerk).checked,\n\t\t\tgorge: React.findDOMNode(this.refs.gorge).checked,\n\t\t\tfade: React.findDOMNode(this.refs.fade).checked,\n\t\t\tonos: React.findDOMNode(this.refs.onos).checked,\n\t\t\tcommander: React.findDOMNode(this.refs.commander).checked\n\t\t};\n\t\tlet skill = React.findDOMNode(this.refs.playerskill).value;\n\t\tsocket.emit(\"users:update:profile\", {\n\t\t\tid: this.props.user.id,\n\t\t\tprofile: {\n\t\t\t\tabilities: abilities,\n\t\t\t\tskill: skill\n\t\t\t}\n\t\t});\n\t},\n\n\trender() {\n\t\tif (!this.props.user) return false;\n\t\tlet abilities = this.props.user.profile.abilities;\n\t\tlet abilitiesForm = [];\n\t\tfor (let lifeform in abilities) {\n\t\t\tabilitiesForm.push(\n\t\t\t\t<div key={lifeform} className=\"checkbox\">\n\t\t\t\t\t<label className=\"checkbox-inline\">\n\t\t\t\t\t\t<input type=\"checkbox\" \n\t\t\t\t\t\t\tref={lifeform}\n\t\t\t\t\t\t\tdefaultChecked={abilities[lifeform]}/> {_.capitalize(lifeform)}\n\t\t\t\t\t</label>\n\t\t\t\t</div>\n\t\t\t);\n\t\t}\n\n\t\tlet skillLevel = this.props.user.profile.skill;\n\t\tlet skillLevels = _.uniq([\"Low Skill\", \"Medium Skill\", \"High Skill\", skillLevel])\n\t\t\t.filter(skill => { return typeof skill === 'string' })\n\t\t\t.map(skill => { return <option key={skill}>{skill}</option>});\n\n\t\treturn (\n\t\t\t<div className=\"modal fade\" id=\"profilemodal\">\n\t\t\t\t<div className=\"modal-dialog\">\n\t\t\t\t\t<div className=\"modal-content\">\n\t\t\t\t\t\t<div className=\"modal-header\">\n\t\t\t\t\t\t\t<button type=\"button\" className=\"close\" data-dismiss=\"modal\" \n\t\t\t\t\t\t\t\taria-label=\"Close\">\n\t\t\t\t\t\t\t\t<span aria-hidden=\"true\">×</span>\n\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t<h4 className=\"modal-title\">Profile</h4>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div className=\"modal-body\" id=\"profile-panel\">\n\t\t\t\t\t\t\t<form>\n\t\t\t\t\t\t\t\t<div className=\"form-group\">\n\t\t\t\t\t\t\t\t\t<label>Player Skill</label><br />\n\t\t\t\t\t\t\t\t\t<select \n\t\t\t\t\t\t\t\t\t\tdefaultValue={skillLevel}\n\t\t\t\t\t\t\t\t\t\tclassName=\"form-control\" \n\t\t\t\t\t\t\t\t\t\tref=\"playerskill\">\n\t\t\t\t\t\t\t\t\t\t{skillLevels}\n\t\t\t\t\t\t\t\t\t</select>\n\t\t\t\t\t\t\t\t\t<p className=\"add-top\"><small>\n\t\t\t\t\t\t\t\t\t\tTry to give an accurate representation of your skill to raise \n\t\t\t\t\t\t\t\t\t\t\tthe quality of your gathers\n\t\t\t\t\t\t\t\t\t</small></p>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<hr />\n\t\t\t\t\t\t\t\t<div className=\"form-group\">\n\t\t\t\t\t\t\t\t\t<label>Preferred Lifeforms</label><br />\n\t\t\t\t\t\t\t\t\t{abilitiesForm}\n\t\t\t\t\t\t\t\t\t<p><small>\n\t\t\t\t\t\t\t\t\t\tSpecify which lifeforms you'd like to play in the gather\n\t\t\t\t\t\t\t\t\t</small></p>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<hr />\n\t\t\t\t\t\t\t\t<p className=\"small\">\n\t\t\t\t\t\t\t\t\tYou will need to rejoin the gather to see your updated profile\n\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t\t<div className=\"form-group\">\n\t\t\t\t\t\t\t\t\t<button \n\t\t\t\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\t\t\t\tclassName=\"btn btn-primary\"\n\t\t\t\t\t\t\t\t\t\tdata-dismiss=\"modal\"\n\t\t\t\t\t\t\t\t\t\tonClick={this.handleUserUpdate}>\n\t\t\t\t\t\t\t\t\t\tUpdate & Close</button>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</form>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t);\n\t}\n});\n\nconst CurrentUser = React.createClass({\n\trender() {\n\t\tif (this.props.user) {\n\t\t\tlet adminOptions;\n\t\t\tif (this.props.user.admin || this.props.user.moderator) {\n\t\t\t\tadminOptions = (\n\t\t\t\t\t<li>\n\t\t\t\t\t\t<a href=\"#\" data-toggle=\"modal\" data-target=\"#adminmodal\">\n\t\t\t\t\t\t\t<i className=\"fa fa-magic fa-fw\"></i> Administration\n\t\t\t\t\t\t</a>\n\t\t\t\t\t</li>\n\t\t\t\t)\n\t\t\t}\n\t\t\treturn (\n\t\t\t\t<li className=\"dropdown\">\n\t\t\t\t\t<a className=\"dropdown-toggle\" data-toggle=\"dropdown\" href=\"#\">\n\t\t\t\t\t\t{this.props.user.username} <img src={this.props.user.avatar}\n\t\t\t\t\t\talt=\"User Avatar\" \n\t\t\t\t\t\theight=\"20\"\n\t\t\t\t\t\twidth=\"20\" /> <i className=\"fa fa-caret-down\"></i>\n\t\t\t\t\t</a>\n\t\t\t\t\t<ul className=\"dropdown-menu dropdown-user\">\n\t\t\t\t\t\t<li>\n\t\t\t\t\t\t\t<a data-toggle=\"modal\" \n\t\t\t\t\t\t\t\tdata-target=\"#profilemodal\" \n\t\t\t\t\t\t\t\thref=\"#\"><i className=\"fa fa-user fa-fw\"></i> Profile</a>\n\t\t\t\t\t\t</li>\n\t\t\t\t\t\t<li>\n\t\t\t\t\t\t\t<a data-toggle=\"modal\" \n\t\t\t\t\t\t\t\tdata-target=\"#settingsmodal\" \n\t\t\t\t\t\t\t\thref=\"#\"><i className=\"fa fa-gear fa-fw\"></i> Settings</a>\n\t\t\t\t\t\t</li>\n\t\t\t\t\t\t{adminOptions}\n\t\t\t\t\t</ul>\n\t\t\t\t</li>\n\t\t\t);\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}\n});\n\nvar AssumeUserIdButton = React.createClass({\n\tassumeId(e) {\n\t\te.preventDefault();\n\t\tif (this.props.gatherer) {\n\t\t\tsocket.emit(\"users:authorize\", {\n\t\t\t\tid: this.props.gatherer.id\n\t\t\t});\n\t\t\t// Refresh Gather list\n\t\t\tsetTimeout(() => {\n\t\t\t\tsocket.emit(\"gather:refresh\");\n\t\t\t}, 5000);\n\t\t}\n\t},\n\n\trender() {\n\t\tlet currentUser = this.props.currentUser;\n\t\tlet gatherer = this.props.gatherer;\n\t\tif (currentUser && gatherer) {\n\t\t\treturn <button\n\t\t\t\tclassName=\"btn btn-xs btn-danger\" \n\t\t\t\tonClick={this.assumeId}>Assume User ID</button>\n\t\t}\n\t}\n});\n","// Accepts an array of IDs voted\n// 1. Creates an array of tally objects, \n//\t\twith ID as prop and vote count as val { 12: 0 }\n// 2. Increments ID vote tally for every vote\n// 3. Sorts \n\nconst rankVotes = exports.rankVotes = function (votes, candidates) {\n\tvar initial = candidates.reduce(function (acc, candidate) {\n\t\tacc[candidate.id] = 0;\n\t\treturn acc;\n\t}, {});\n\n\tvar scores = votes.reduce(function (acc, id) {\n\t\tif (acc[id] !== undefined) {\n\t\t\tacc[id]++;\n\t\t}\n\t\treturn acc;\n\t}, initial);\n\n\tvar rank = [];\n\n\tfor (var id in scores) {\n\t\tif (scores.hasOwnProperty(id)) {\n\t\t\trank.push({\n\t\t\t\tid: parseInt(id, 10),\n\t\t\t\tcount: scores[id]\n\t\t\t});\n\t\t}\n\t}\n\n\treturn rank.sort(function (a, b) {\n\t\tif (b.count === a.count) {\n\t\t\treturn b.id - a.id;\n\t\t} else {\n\t\t\treturn b.count - a.count;\n\t\t}\n\t}).map(function (tally) {\n\t\treturn tally.id\n\t}).map(function (id) {\n\t\treturn candidates.reduce(function (acc, candidate) {\n\t\t\tif (candidate.id === id) return candidate;\n\t\t\treturn acc;\n\t\t});\n\t});\n};\n\nconst enslUrl = exports.enslUrl = (gatherer) => {\n\treturn `http://www.ensl.org/users/${gatherer.id}`\n};\n\nconst hiveUrl = exports.hiveUrl = (gatherer) => {\n\tconst hiveId = gatherer.user.hive.id;\n\tif (hiveId) {\n\t\treturn `http://hive.naturalselection2.com/profile/${hiveId}`;\n\t} else {\n\t\treturn null;\n\t}\n};\n\nconst modalId = exports.modalId = (user) => {\n\treturn `user-modal-${user.id}`;\n};\n\nconst storageAvailable = exports.storageAvailable = (type) => {\n\ttry {\n\t\tvar storage = window[type],\n\t\t\tx = '__storage_test__';\n\t\tstorage.setItem(x, x);\n\t\tstorage.removeItem(x);\n\t\treturn true;\n\t}\n\tcatch(e) {\n\t\treturn false;\n\t}\n};\n"]} |