componentWillMount() { var {router} = this.context, routeData, bodyTopPos; routeData = getRouteData(router); //window.console.log(routeData.name, AppRoutes.NINETIES_IMG_INDEX); //if (routeData.name === AppRoutes.NINETIES_IMG) { // if (this.props.ninetiesImgSelection === undefined) { // //window.console.log(4); // } //} if (routeData.name === AppRoutes.NINETIES_IMG_INDEX) { //window.console.log(8); this.setState({ indexPage: true }); } if (routeData.name === AppRoutes.APP && routeData.id === undefined && this.props.ninetiesImgSelection.unique_id !== undefined) { router.transitionTo(AppRoutes.NINETIES_IMG, {id: this.props.ninetiesImgSelection.unique_id}); } bodyTopPos = document.body.scrollTop * -1; if (bodyTopPos < 0) { DomUtils.changeStyle(document.body, 'top', bodyTopPos); } DomUtils.addClass(document.body, NinetiesImgBox.DISABLE_BODY_SCROLL_CLASS); }
componentWillUnmount() { var topStyle = DomUtils.getStyle(document.body, 'top', true) * -1; DomUtils.unsetStyle(document.body, 'top', true); DomUtils.removeClass(document.body, NinetiesImgBox.DISABLE_BODY_SCROLL_CLASS); if (topStyle > 0) { window.scrollTo(0, topStyle); } }
clickOutside = (event) => { var box = React.findDOMNode(this.refs.ninetiesBox); if (DomUtils.clickOutside(event, box) === true) { this.goBackToHomepage(); } };