// WINDOW-WIDE EVENTS // These must be handled carefully, because naively registering a // handler for each editor will cause the editors to never be // garbage collected. function forEachCodeMirror(f) { if (!document.body.getElementsByClassName) return; var byClass = document.body.getElementsByClassName("CodeMirror"); for (var i = 0; i < byClass.length; i++) { var cm = byClass[i].CodeMirror; if (cm) f(cm); } }
getCollectives(){ var player = document.getElementById('bt'+this.props.charId+"-"+this.props.gameId); var parentEl = player.parentElement; player = player.childNodes[0]; var collectives = parentEl.getElementsByClassName('collective'); Array.from(collectives).forEach(collective => { if(Util.rect2Rect(collective, player)){ var collectiveId = collective.getAttribute("data-key"); Store.removeCollective(this.props.gameId,collectiveId); } }); }
hide() { // A single SequenceView object is used for two phases (i.e before and after // register allocation), tracking the indexes lets the redundant hides and // shows be avoided when switching between the two. this.currentPhaseIndex = this.phaseSelect.selectedIndex; if (!this.phaseIndexes.has(this.currentPhaseIndex)) { this.isShown = false; this.container.removeChild(this.divNode); this.container.getElementsByClassName("graph-toolbox")[0].removeChild(this.toggleRangeViewEl); if (this.showRangeView) this.rangeView.hide(); } }
show() { this.currentPhaseIndex = this.phaseSelect.selectedIndex; if (!this.isShown) { this.isShown = true; this.phaseIndexes.add(this.currentPhaseIndex); this.container.appendChild(this.divNode); this.container.getElementsByClassName("graph-toolbox")[0].appendChild(this.toggleRangeViewEl); } if (this.showRangeView) this.rangeView.show(); }
getCollectives(){ var player = document.getElementById('bt'+this.props.gameId); var parentEl = player.parentElement; player = player.childNodes[0]; var collectives = parentEl.getElementsByClassName('collective'); Array.from(collectives).forEach(collective => { if(Util.rect2Rect(collective, player)){ var collectiveId = collective.getAttribute("data-key"); Store.removeCollective(this.props.gameId,collectiveId); } }); }
// WINDOW-WIDE EVENTS // These must be handled carefully, because naively registering a // handler for each editor will cause the editors to never be // garbage collected. function forEachCodeMirror(f) { if (!document.body.getElementsByClassName) return; var byClass = document.body.getElementsByClassName("CodeMirror"); for (var i = 0; i < byClass.length; i++) { var cm = byClass[i].CodeMirror; if (cm) f(cm); } }
// These must be handled carefully, because naively registering a // handler for each editor will cause the editors to never be // garbage collected. function forEachCodeMirror(f) { if (!document.body.getElementsByClassName) return let byClass = document.body.getElementsByClassName("CodeMirror") for (let i = 0; i < byClass.length; i++) { let cm = byClass[i].CodeMirror if (cm) f(cm) } }
// WINDOW-WIDE EVENTS // These must be handled carefully, because naively registering a // handler for each editor will cause the editors to never be // garbage collected. function forEachCodeMirror(f) { if (!document.body.getElementsByClassName) return; var byClass = document.body.getElementsByClassName("CodeMirror"); for (var i = 0; i < byClass.length; i++) { var cm = byClass[i].CodeMirror; if (cm) f(cm); } }
// WINDOW-WIDE EVENTS // These must be handled carefully, because naively registering a // handler for each editor will cause the editors to never be // garbage collected. function forEachCodeMirror(f) { if (!document.body.getElementsByClassName) return; var byClass = document.body.getElementsByClassName("CodeMirror"); for (var i = 0; i < byClass.length; i++) { var cm = byClass[i].CodeMirror; if (cm) f(cm); } }
// WINDOW-WIDE EVENTS // These must be handled carefully, because naively registering a // handler for each editor will cause the editors to never be // garbage collected. function forEachCodeMirror(f) { if (!document.body.getElementsByClassName) return; var byClass = document.body.getElementsByClassName("CodeMirror"); for (var i = 0; i < byClass.length; i++) { var cm = byClass[i].CodeMirror; if (cm) f(cm); } }
getCollectives(){ var player = document.getElementById('pl'+this.props.gameId); var parentEl = player.parentElement; player = player.childNodes[0]; var collectives = parentEl.getElementsByClassName('collective'); Array.from(collectives).forEach(collective => { if(Util.rect2Rect(collective, player)){ var collectiveId = collective.getAttribute("data-key"); Store.removeCollective(this.props.gameId,collectiveId); } }); }
// WINDOW-WIDE EVENTS // These must be handled carefully, because naively registering a // handler for each editor will cause the editors to never be // garbage collected. function forEachCodeMirror(f) { if (!document.body.getElementsByClassName) return; var byClass = document.body.getElementsByClassName("CodeMirror"); for (var i = 0; i < byClass.length; i++) { var cm = byClass[i].CodeMirror; if (cm) f(cm); } }
// WINDOW-WIDE EVENTS // These must be handled carefully, because naively registering a // handler for each editor will cause the editors to never be // garbage collected. function forEachCodeMirror(f) { if (!document.body.getElementsByClassName) return; var byClass = document.body.getElementsByClassName("CodeMirror"); for (var i = 0; i < byClass.length; i++) { var cm = byClass[i].CodeMirror; if (cm) f(cm); } }
// WINDOW-WIDE EVENTS // These must be handled carefully, because naively registering a // handler for each editor will cause the editors to never be // garbage collected. function forEachCodeMirror(f) { if (!document.body.getElementsByClassName) return; var byClass = document.body.getElementsByClassName("CodeMirror"); for (var i = 0; i < byClass.length; i++) { var cm = byClass[i].CodeMirror; if (cm) f(cm); } }
// WINDOW-WIDE EVENTS // These must be handled carefully, because naively registering a // handler for each editor will cause the editors to never be // garbage collected. function forEachCodeMirror(f) { if (!document.body.getElementsByClassName) return; var byClass = document.body.getElementsByClassName("CodeMirror"); for (var i = 0; i < byClass.length; i++) { var cm = byClass[i].CodeMirror; if (cm) f(cm); } }