// https://github.com/twbs/bootstrap-sass/blob/3.3-stable/assets/stylesheets/bootstrap/mixins/_gradients.scss#L17-L27
// Vertical gradient, from top to bottom
//
// Creates two color stops, start and end, by specifying a color and position for each color stop.
// Color stops are not available in IE9 and below.
@mixin gradient-vertical($start-color: #555, $end-color: #333, $start-percent: 0%, $end-percent: 100%) {
background-image: -webkit-linear-gradient(top, $start-color $start-percent, $end-color $end-percent); // Safari 5.1-6, Chrome 10+
background-image: -o-linear-gradient(top, $start-color $start-percent, $end-color $end-percent); // Opera 12
background-image: linear-gradient(to bottom, $start-color $start-percent, $end-color $end-percent); // Standard, IE10, Firefox 16+, Opera 12.10+, Safari 7+, Chrome 26+
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#{ie-hex-str($start-color)}', endColorstr='#{ie-hex-str($end-color)}', GradientType=0); // IE9 and down
}
/**
* Crawler simulation module
* @author Hai Zheng
*/
class CrawlerSimulate extends React.Component {
constructor(props) {
super(props);
this.state = {
list: props.list,
};
this.handleInputChange = this.handleInputChange.bind(this);
this.delRow = this.delRow.bind(this);
this.addNew = this.addNew.bind(this);
}
handleInputChange(e, index) {
const target = e.target;
const value = target.type === 'checkbox' ? target.checked : target.value;
const list = this.state.list;
list[index][target.dataset.type] = value;
this.setState({
list: list,
});
}
delRow(index) {
const data = this.state.list;
data.splice(index, 1);
this.setState({ list: data });
}
addNew() {
const list = this.state.list;
list.push({ name: '', vals: '' });
this.setState({ list: list });
}
render() {
return (