Advertisement
Guest User

odnoklassniki-core.js

a guest
Feb 24th, 2020
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $(function(){
  2.     // vac slider
  3.     $(".listVac .title").click(function(){
  4.         if($(this).parent().hasClass("show")) $(this).parent().removeClass("show");
  5.             else $(this).parent().addClass("show");
  6.         return false;
  7.     });
  8. });
  9.  
  10. // input helper microplugin
  11. (function($){
  12.     $.fn.ihelper = function(opts) {
  13.         return this.each(function() {
  14.             var $this = $(this);
  15.             $this.focus(function() {
  16.                 if(!$this.val() || $this.val() == $this.attr('data-placeholder')) {
  17.                     $this.val('');
  18.                     $this.removeClass('with_placeholder');
  19.                 }
  20.             }).blur(function() {
  21.                 if((!$this.val() || $this.val() == $this.attr('data-placeholder'))) {
  22.                     $this.val($this.attr('data-placeholder'));
  23.                     $this.addClass('with_placeholder');
  24.                 }
  25.             }).blur();
  26.         });
  27.     };
  28. })(jQuery);
  29. $(function(){
  30.     // input helper
  31.     $('input[data-placeholder], textarea[data-placeholder]').ihelper();
  32.     // hide errors on input focus
  33.     $('.x-can_error').bind('focus blur', function() {
  34.         $(this).removeClass('x-can_error');
  35.         $(this).closest('.form_row').find('.error_message').html('');
  36.     });
  37. });
  38.  
  39. function validateEmail(email) {
  40.    var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
  41.    if(reg.test(email) == false)
  42.       return false
  43.    return true
  44. }
  45.  
  46.  function validateURL(url) {
  47.       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\.\,\?\'\\\+&%\$#\=~_\-]+))*$");
  48.       return urlregex.test(url);
  49.     }
  50.  
  51.  
  52.  
  53. function checkVacancyRequestForm(form){
  54.     if(!$(form.name).val() || $(form.name).val() == $(form.name).attr('data-placeholder')){
  55.         $(form.name).prev().removeClass('hidden');
  56.         $(form.name).addClass('x-can_error').focus()
  57.         return false
  58.     } else {
  59.         $(form.name).prev().addClass('hidden')
  60.         $(form.name).removeClass('x-can_error')
  61.     }
  62.     if(!$(form.phone).val() || $(form.phone).val() == $(form.phone).attr('data-placeholder')){
  63.         $(form.phone).prev().removeClass('hidden');
  64.         $(form.phone).addClass('x-can_error').focus()
  65.         return false
  66.     } else {
  67.         $(form.phone).prev().addClass('hidden')
  68.         $(form.phone).removeClass('x-can_error')
  69.     }
  70.     if(!$(form.email).val() || $(form.email).val() == $(form.email).attr('data-placeholder') || !validateEmail($(form.email).val())){
  71.         $(form.email).prev().removeClass('hidden');
  72.         $(form.email).addClass('x-can_error').focus()
  73.         return false
  74.     } else {
  75.         $(form.email).prev().addClass('hidden')
  76.         $(form.email).removeClass('x-can_error')
  77.     }
  78.     /*
  79.     if(!$(form.resume_href).val() || $(form.resume_href).val() == $(form.resume_href).attr('data-placeholder') || !validateURL($(form.resume_href).val())){
  80.         $(form.resume_href).prev().removeClass('hidden');
  81.         $(form.resume_href).addClass('x-can_error').focus()
  82.         return false
  83.     } else {
  84.         $(form.resume_href).prev().addClass('hidden')
  85.         $(form.resume_href).removeClass('x-can_error')
  86.     }
  87.     */
  88.     if(!$(form.about).val() || $(form.about).val() == $(form.about).attr('data-placeholder')){
  89.         $(form.about).prev().removeClass('hidden');
  90.         $(form.about).addClass('x-can_error').focus()
  91.         return false
  92.     } else {
  93.         $(form.about).prev().addClass('hidden')
  94.         $(form.about).removeClass('x-can_error')
  95.     }  
  96.     return true
  97. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement