plugins:[
new webpack.DefinePlugin({
GLOBAL_VARIABLE: JSON.stringify('value')
}),
]
validateField(e){//функция-валидация relatedTarget: button.clear-field
if(e.relatedTarget.classList.contains("clear-field"))return;
this.hideHint(); //прячем окно с подсказкой
let value = this.state.value;//e.target.value;
if(value === ''){
this.props.fieldIsValid('email',null);
return;
}
let regExp = new RegExp('^[a-zA-Zа-яА-Я0-9-_\.@]{3,30}$');
if(!regExp.test(value)){ //проверка на соответствие регэкспу
this.setState({isValid:false});
this.props.fieldIsValid('email',false);
}
else{
this.setState({isValid:true});
this.props.fieldIsValid('email',value);
}
this.checkAvailability();
}
render() {
return (
<div className="form-group">
<label>
{animateDynamicLabel(this.state.value, 'E-mail')}
<input
onChange={this.setValue.bind(this)}
onFocus={this.setHint.bind(this)}
onBlur={this.validateField.bind(this)}
value={this.state.value}
className={"form-control " + ( (this.state.isValid === false) ? 'hasErrors' : '') }
type="text"
placeholder="Адрес E-mail"
/>
<ClearField render={this.state.value && this.state.focus} clearField={this.clearField.bind(this)}/>
{this.showError()}
</label>
</div>
)
}
}
export default EmailInput;
function handler(event){
var scrollTo,
scrollDistance = 80,
delta;
if (event.type == 'mousewheel') {
delta = event.originalEvent.wheelDelta / 100;
} else if (event.type == 'DOMMouseScroll') {
delta = - event.originalEvent.detail / 3;
}
scrollTo = latestKnownScrollY - delta * scrollDistance;
if (scrollTo) {
event.preventDefault();
event.stopPropagation();
$('body,html').stop().animate( {
scrollTop : scrollTo
} , 500);
}
}
$(window).on("mousewheel DOMMouseScroll" , handler() )
$(window).off("mousewheel DOMMouseScroll" , handler() )
path=/;
, благодаря которому кука работает на всем сайте.document.cookie = "source=yaDirect;expires="+ date.toUTCString() + ";path=/;";