<commit_before>
var React = require('react');
var cx = require('classnames');

/**
	LayoutFixHeader
		http://www.getmdl.io/components/index.html#loading-section
	Props
		Spinner,ProgressBar,
		indeterminate,
		singleColor,
*/
module.exports = React.createClass({

	propTypes: {
		Spinner : React.PropTypes.bool,
		ProgressBar : React.PropTypes.bool,
		indeterminate : React.PropTypes.bool,
		singleColor : React.PropTypes.bool,
		percentage : React.PropTypes.number,
	},

getDefaultProps: function() {
	return {
			Spinner: true,
			indeterminate: true,
			ProgressBar: false,
			singleColor: false,
			percentage:0,
	};
},

	componentWillMount: function() {
		componentHandler.upgradeDom();
	},

	componentDidMount: function() {
		if(this.props.ProgressBar && !this.props.indeterminate){
			//console.log("set progress")
			var self = this;
			self.refs.loader.getDOMNode().addEventListener('mdl-componentupgraded', function() {
    		this.MaterialProgress.setProgress(self.props.percentage);
  		});
		}
	},

	render: function() {
		var classes = {
				container : {},
			};

		if(this.props.Spinner) {
			classes.container['mdl-spinner'] = true;
			classes.container['mdl-js-spinner'] = true;
			classes.container['is-active'] = true;
		}

		if(this.props.ProgressBar) {
			classes.container['mdl-progress'] = true;
			classes.container['mdl-js-progress'] = true;
		}

		if(this.props.indeterminate) {
			classes.container['mdl-progress__indeterminate'] = true;
		}

		if(this.props.singleColor) {
			classes.container['mdl-spinner--single-color'] = true;
		}

		return (
			<div ref="loader" className={cx(classes.container)} ></div>
		);
	},

});<commit_msg>修改loading: 1.縮排美化 2.去掉classes物件 3.componentHandler.upgradeDom() 改放在cdm<commit_after>
var React = require('react');
var cx = require('classnames');

/**
	Loading
		http://www.getmdl.io/components/index.html#loading-section
	Props
		Spinner,ProgressBar,
		indeterminate,
		singleColor,
*/
module.exports = React.createClass({

	propTypes: {
		Spinner : React.PropTypes.bool,
		ProgressBar : React.PropTypes.bool,
		indeterminate : React.PropTypes.bool,
		singleColor : React.PropTypes.bool,
		percentage : React.PropTypes.number,
	},

	getDefaultProps: function() {
	return {
			Spinner: true,
			indeterminate: true,
			ProgressBar: false,
			singleColor: false,
			percentage:0,
	};
},

	componentDidMount: function() {
		if(this.props.ProgressBar && !this.props.indeterminate){
			//console.log("set progress")
			var self = this;
			self.refs.loader.getDOMNode().addEventListener('mdl-componentupgraded', function() {
				this.MaterialProgress.setProgress(self.props.percentage);
			});
		}
		componentHandler.upgradeDom();
	},

	render: function() {
		var container =  {}

		if(this.props.Spinner) {
			container['mdl-spinner'] = true;
			container['mdl-js-spinner'] = true;
			container['is-active'] = true;
		}

		if(this.props.ProgressBar) {
			container['mdl-progress'] = true;
			container['mdl-js-progress'] = true;
		}

		if(this.props.indeterminate) {
			container['mdl-progress__indeterminate'] = true;
		}

		if(this.props.singleColor) {
			container['mdl-spinner--single-color'] = true;
		}

		return (
			<div ref="loader" className={cx(container)} ></div>
		);
	},

});
{'fraction_non_alphanumeric': 0.15701970443349753, 'fraction_numerical': 0.001539408866995074, 'mean_word_length': 4.013888888888889, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2844760', 'n_tokens_mistral': 1266, 'n_tokens_neox': 1113, 'n_words': 163}