Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(function(){
- // vac slider
- $(".listVac .title").click(function(){
- if($(this).parent().hasClass("show")) $(this).parent().removeClass("show");
- else $(this).parent().addClass("show");
- return false;
- });
- });
- // input helper microplugin
- (function($){
- $.fn.ihelper = function(opts) {
- return this.each(function() {
- var $this = $(this);
- $this.focus(function() {
- if(!$this.val() || $this.val() == $this.attr('data-placeholder')) {
- $this.val('');
- $this.removeClass('with_placeholder');
- }
- }).blur(function() {
- if((!$this.val() || $this.val() == $this.attr('data-placeholder'))) {
- $this.val($this.attr('data-placeholder'));
- $this.addClass('with_placeholder');
- }
- }).blur();
- });
- };
- })(jQuery);
- $(function(){
- // input helper
- $('input[data-placeholder], textarea[data-placeholder]').ihelper();
- // hide errors on input focus
- $('.x-can_error').bind('focus blur', function() {
- $(this).removeClass('x-can_error');
- $(this).closest('.form_row').find('.error_message').html('');
- });
- });
- function validateEmail(email) {
- var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
- if(reg.test(email) == false)
- return false
- return true
- }
- function validateURL(url) {
- var urlregex = new RegExp("^(http|https|ftp)\://([a-zA-Z0-9\.\-]+(\:[a-zA-Z0-9\.&%\$\-]+)*@)*((25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])|([a-zA-Z0-9\-]+\.)*[a-zA-Z0-9\-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(\:[0-9]+)*(/($|[a-zA-Z0-9\.\,\?\'\\\+&%\$#\=~_\-]+))*$");
- return urlregex.test(url);
- }
- function checkVacancyRequestForm(form){
- if(!$(form.name).val() || $(form.name).val() == $(form.name).attr('data-placeholder')){
- $(form.name).prev().removeClass('hidden');
- $(form.name).addClass('x-can_error').focus()
- return false
- } else {
- $(form.name).prev().addClass('hidden')
- $(form.name).removeClass('x-can_error')
- }
- if(!$(form.phone).val() || $(form.phone).val() == $(form.phone).attr('data-placeholder')){
- $(form.phone).prev().removeClass('hidden');
- $(form.phone).addClass('x-can_error').focus()
- return false
- } else {
- $(form.phone).prev().addClass('hidden')
- $(form.phone).removeClass('x-can_error')
- }
- if(!$(form.email).val() || $(form.email).val() == $(form.email).attr('data-placeholder') || !validateEmail($(form.email).val())){
- $(form.email).prev().removeClass('hidden');
- $(form.email).addClass('x-can_error').focus()
- return false
- } else {
- $(form.email).prev().addClass('hidden')
- $(form.email).removeClass('x-can_error')
- }
- /*
- if(!$(form.resume_href).val() || $(form.resume_href).val() == $(form.resume_href).attr('data-placeholder') || !validateURL($(form.resume_href).val())){
- $(form.resume_href).prev().removeClass('hidden');
- $(form.resume_href).addClass('x-can_error').focus()
- return false
- } else {
- $(form.resume_href).prev().addClass('hidden')
- $(form.resume_href).removeClass('x-can_error')
- }
- */
- if(!$(form.about).val() || $(form.about).val() == $(form.about).attr('data-placeholder')){
- $(form.about).prev().removeClass('hidden');
- $(form.about).addClass('x-can_error').focus()
- return false
- } else {
- $(form.about).prev().addClass('hidden')
- $(form.about).removeClass('x-can_error')
- }
- return true
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement