Advertisement
Guest User

Untitled

a guest
Sep 30th, 2013
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if ( typeof(alert_message_phone) == 'undefined' ) { var alert_message_phone = 'Please enter a valid phone number. Most US/Canada and International formats accepted.'; }
  2. jQuery(document).ready(function (a) {
  3.   a("#sendmail").attr('disabled', false);
  4.   a(".wp2pgpmail").each(function () {
  5.     a(this).validate({
  6.       rules: {
  7.        "wp2pgpmail-secret": {
  8.           required: true,
  9.           digits: true,
  10.           maxlength: 2
  11.         }
  12.       },
  13.       errorPlacement: function (a, b) {
  14.         if (b.is(":radio") || b.is(":checkbox")) {
  15.           a.appendTo(b.parent().parent())
  16.         } else {
  17.           a.insertAfter(b)
  18.         }
  19.       },
  20.       submitHandler: function(form) {
  21.         var message = '';
  22.         var label = '';
  23.  
  24.         for(i=0; i<form.elements.length; i++){
  25.           champ = form.elements[i];
  26.           label = form.elements[i].name;
  27.           if (typeof label != "undefined"
  28.                 && label != ""
  29.                 && label != 'form_id'
  30.                 && label != '_wpnonce'
  31.                 && label != 'wp2pgpmail-secret'
  32.                 && label != 'wp2pgpmail-spam'
  33.                 && label != 'wp2pgpmail-submit'
  34.                 // Insert Email and Name field names here:
  35.                 && label != 'wp2pgpmail-email-10'
  36.                 && label != 'wp2pgpmail-name-11'
  37.                 && (
  38.                   champ.type == 'text'
  39.                   || champ.type == 'textarea'
  40.                   || (
  41.                     champ.type == 'checkbox'
  42.                     && champ.checked == true
  43.                   )
  44.                   || champ.type == 'select-one'  
  45.                   || (
  46.                     champ.type == 'radio'
  47.                     && champ.checked == true
  48.                     )
  49.                   )
  50.                 ) {
  51.             message += champ.value + "\r\n";
  52.             champ.value = '-- encrypted data --';
  53.             if ( champ.value != '-- encrypted data --' ) {
  54.               champ.options[0] = new Option("-- encrypted data --", "-- encrypted data --", false, false);
  55.               champ.value = '-- encrypted data --';
  56.             }
  57.           }
  58.         }
  59.         message += "\r\n[" + form._ip.value + "]\r\n";
  60.         form._message.value = message;
  61.         if ( encrypt() ) {
  62.           form.submit();
  63.         }
  64.       }
  65.     })
  66.   });
  67.   a.validator.addMethod("phone", function (a, b) {
  68.     a = a.replace(/[\+\s\(\)\.\-\ ]/g, "");
  69.     return this.optional(b) || a.length > 9 && a.match(/^((\+)?[1-9]{1,2})?([-\s\.])?((\(\d{1,4}\))|\d{1,4})(([-\s\.])?[0-9]{1,12}){1,2}$/)
  70.   }, alert_message_phone);
  71.   a(".wp2pgpmail-date-picker").datepicker({
  72.     minDate: "-70y",
  73.     changeMonth: true,
  74.     changeYear: true,
  75.     maxDate: "+10Y +1M +10D",
  76.     yearRange: "c-100:c+20",
  77.     firstDay: 1
  78.   });
  79. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement