Файл: zyro/js/main.js
Строк: 87
<?php
function wb_form_validateForm(formId, values, errors) {
var form = $("input[name='wb_form_id'][value='" + formId + "']").parent();
if (!form || form.length === 0 || !errors) return;
form.find("input[name],textarea[name]").css({backgroundColor: ""});
if (errors.required) {
for (var i = 0; i < errors.required.length; i++) {
var name = errors.required[i];
var elem = form.find("input[name='" + name + "'],textarea[name='" + name + "'],select[name='" + name + "']");
elem.css({backgroundColor: "#ff8c8c"});
}
}
if (Object.keys(errors).length) {
for (var k in values) {
var elem = form.find("input[name='" + k + "'],textarea[name='" + k + "'],select[name='" + k + "']");
elem.val(values[k]);
}
}
}
$(function() {
var comboBoxes = $('.wb-combobox-controll');
if (comboBoxes.length) {
comboBoxes.each(function() {
var thisCombo = $(this);
var clickFunc = function() {
var w = thisCombo.find('input').outerWidth();
var mw = (menu = thisCombo.find('.dropdown-menu')).width();
var ew = thisCombo.parent().outerWidth();
if (mw < ew) menu.width(ew);
menu.css({ marginLeft: (-w) + 'px' });
thisCombo.find('.btn-group').toggleClass('open');
};
$(this).find('input').bind('click', clickFunc);
$(this).find('.dropdown-toggle').bind('click', clickFunc);
});
$(document).bind('click', function(e) {
var t = $(e.target);
if (!t.is('.wb-combobox-controll')) {
t = t.parents('.wb-combobox-controll');
$.each($('.wb-combobox-controll'), function() {
if (t.get(0) !== $(this).get(0)) {
$(this).find('.btn-group').removeClass('open');
}
});
}
});
}
if (currLang) {
$('.lang-selector').each(function() {
var thisElem = $(this);
var type = thisElem.attr('data-type');
if (type == 'flags') {
thisElem.find('a[data-lang="' + currLang + '"]').addClass('active');
} else if (type == 'select') {
var actLi = thisElem.find('li[data-lang="' + currLang + '"]');
actLi.addClass('active');
thisElem.find('input').val(actLi.find('a').html());
}
});
}
});
?>