1function pm_change_search_field(a) 2{ 3 var group = a; 4 var data ={'action':'pm_advance_search_get_search_fields_by_gid', 'gid' : group, 'match_fields': ' '}; 5 jQuery.post(pm_ajax_object.ajax_url, data, function (response){ 6 if(response){ 7 jQuery('#advance_seach_ul').empty(); 8 jQuery('#advance_seach_ul').append(response); 9 pm_advance_user_search(''); 10 if ( typeof pg_refresh_search_field == 'function' ) { 11 pg_refresh_search_field(); 12 } 13 14 }else{ 15 //console.log("err"); 16 } 17 18 }); 19} 20function pm_remove_attachment(obj,key,value) 21{ 22 jQuery('#pm-edit-group-popup, .pm-popup-mask, .pg-blog-dialog-mask').toggle(); 23 ( function($) { 24 $( "#pg-remove-attachment-dialog" ).dialog({ 25 resizable: false, 26 height: "auto", 27 width: 400, 28 modal: true, 29 buttons: { 30 "Yes": function() { 31 32 var data = { 33 'action': 'pm_remove_attachment', 34 'key': key, 35 'value':value 36 }; 37 $.post(pm_ajax_object.ajax_url, data, function(response) { 38 if(response) 39 { 40 $(obj).parent('a').parent('span.pm_frontend_attachment').remove(); 41 } 42 }); 43 44 $( this ).dialog( "close" ); 45 }, 46 "No": function() { 47 $( this ).dialog( "close" ); 48 } 49 } 50 }); 51 } )(jQuery); 52} 53 54function pm_expand_all_conent() 55{ 56 jQuery("#pm-accordion .pm-accordian-content").show(); 57} 58 59function pm_collapse_all_conent() 60{ 61 jQuery("#pm-accordion .pm-accordian-content").hide(); 62} 63 64function pm_show_hide(obj,primary,secondary,trinary) 65{ 66 a = jQuery(obj).is(':checked'); 67 if (a == true) 68 { 69 jQuery('#'+primary).show(500); 70 if(secondary!='') 71 { 72 jQuery('#'+secondary).hide(500); 73 } 74 if(trinary!='') 75 { 76 jQuery('#'+trinary).hide(500); 77 } 78 } 79 else 80 { 81 jQuery('#'+primary).hide(500); 82 if(secondary!='') 83 { 84 jQuery('#'+secondary).show(500); 85 } 86 if(trinary!='') 87 { 88 jQuery('#'+trinary).show(500); 89 } 90 } 91 92} 93 94function pm_add_repeat(obj) 95{ 96 a= jQuery(obj).parent('a').parent('div.pm_repeat').clone(); 97 jQuery(a).children('input').val(''); 98 jQuery(obj).parent('a').parent('div.pm_repeat').parent('div.pm-field-input').append(a); 99} 100 101function pm_remove_repeat(obj) 102{ 103 jQuery(obj).parent('a').parent('div.pm_repeat').remove(); 104} 105 106function validate_phone_number2(number) 107{ 108 var isnumber = jQuery.isNumeric(number); 109 var regex = /^(\+\d{1,2}\s)?\(?\d{3}\)?[\s.-]\d{3}[\s.-]\d{4}$/; 110 var phone_num = number.replace(/[^\d]/g, ''); 111 if ( number != "") 112 { 113// if(isnumber == false ) 114// return false; 115 116 if(phone_num.length <10 || phone_num.length > 13) 117 return false; 118 119// if(!regex.test(number)) 120// return false; 121 122 return true; 123 }else 124 { 125 return true; 126 } 127 128 129} 130 131function validate_phone_number(number) { 132 if(number!=""){ 133 var phone_num = number.replace(/[^\d]/g, ''); 134 var a = number; 135 var phone_num = number.replace(/[^\d]/g, ''); 136 var filter = /^((\+[1-9]{1,4}[ \-]*)|(\([0-9]{2,3}\)[ \-]*)|([0-9]{2,4})[ \-]*)*?[0-9]{3,4}?[ \-]*[0-9]{3,4}?$/; 137 if (filter.test(a)&&(phone_num.length >=10 && phone_num.length <= 13)) { 138 //console.log(phone_num); 139 return true; 140 } 141 else { 142 return false; 143 } 144 }else{ 145 return true; 146 } 147} 148 149function validateMobileNumber(number) { 150 if (number != "") { 151 const regex = /^\+?(\d{1,4})?[-.\s]?((\d{10,15})|(\d{6,9}))$/; 152 return regex.test(number); 153 } 154 else 155 { 156 return true; 157 } 158} 159 160function validate_facebook_url(val) 161{ 162 if (val != "") { 163 if (/(?:https?:\/\/)?(?:www\.)?facebook\.com\/(?:(?:\w)*#!\/)?(?:pages\/)?(?:[\w\-]*\/)*?(\/)?([\w\-\.]*)/i.test(val)) 164 { 165 return true; 166 } else 167 { 168 return false; 169 } 170 } else { 171 return true; 172 } 173 174} 175 176function validate_twitter_url(val) 177{ 178 if (val != '') { 179 if (/(ftp|http|https):\/\/?((www|\w\w)\.)?twitter.com(\w+:{0,1}\w*@)?(\S+)(:([0-9])+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/i.test(val)) { 180 return true; 181 } else { 182 return false;
183 } 184 } else { 185 return true; 186 } 187} 188 189function validate_google_url(val) 190{ 191 if (val != '') { 192 if (/((http:\/\/(plus\.google\.com\/.*|www\.google\.com\/profiles\/.*|google\.com\/profiles\/.*))|(https:\/\/(plus\.google\.com\/.*)))/i.test(val)) { 193 return true; 194 } else { 195 return false; 196 } 197 198 } else { 199 return true; 200 } 201} 202 203function validate_linked_in_url(val) 204{ 205 if (val != '') { 206 if (/(ftp|http|https):\/\/?((www|\w\w)\.)?linkedin.com(\w+:{0,1}\w*@)?(\S+)(:([0-9])+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/i.test(val)) { 207 return true; 208 } else { 209 return false; 210 } 211 } else { 212 return true; 213 } 214} 215 216function validate_youtube_url(val) 217{ 218 if (val != '') { 219 if (/(ftp|http|https):\/\/?((www|\w\w)\.)?youtube.com(\w+:{0,1}\w*@)?(\S+)(:([0-9])+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/i.test(val)) { 220 return true; 221 } else { 222 return false; 223 } 224 225 } else { 226 return true; 227 } 228} 229 230function validate_soundcloud_url(val) 231{ 232 if (val != '') { 233 if (/(ftp|http|https):\/\/?((www|\w\w)\.)?soundcloud.com(\w+:{0,1}\w*@)?(\S+)(:([0-9])+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/i.test(val)) { 234 return true; 235 } else { 236 return false; 237 } 238 239 } else { 240 return true; 241 } 242} 243 244function validate_mixcloud_url(val) 245{ 246 if (val != '') { 247 if (/(ftp|http|https):\/\/?((www|\w\w)\.)?mixcloud.com(\w+:{0,1}\w*@)?(\S+)(:([0-9])+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/i.test(val)) { 248 return true; 249 } else { 250 return false; 251 } 252 253 } else { 254 return true; 255 } 256} 257 258function validate_instagram_url(val) 259{ 260 if (val != '') { 261 var regex = /(?:(?:http|https):\/\/)?(?:www.)?(?:instagram.com|instagr.am)\/([A-Za-z0-9-_]+)/; 262 if (val.match(regex)) { 263 return true; 264 } else { 265 return false; 266 } 267 } else { 268 return true; 269 } 270} 271 272function profile_magic_frontend_validation(form) 273{ 274 275 var email_val = ""; 276 var formid = form.id; 277 var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/; 278 jQuery('.errortext').html(''); 279 jQuery('.errortext').hide(); 280 jQuery('.all_errors').html(''); 281 jQuery('.warning').removeClass('warning'); 282 jQuery('.pg-form-validation-error').removeClass('pg-form-validation-error'); 283 284 jQuery('#'+formid+' .pm_email').each(function (index, element) { 285 var email = jQuery(this).children('input').val(); 286 var isemail = regex.test(email); 287 if (isemail == false && email != "") { 288 jQuery(this).children('input').addClass('warning'); 289 jQuery(this).children('.errortext').html(pm_error_object.valid_email); 290 jQuery(this).children('.errortext').show(); 291 } 292 }); 293 294 jQuery('#'+formid+' .pm_number').each(function (index, element) { 295 var number = jQuery(this).children('input').val(); 296 var isnumber = jQuery.isNumeric(number); 297 if (isnumber == false && number != "") { 298 jQuery(this).children('input').addClass('warning'); 299 jQuery(this).children('.errortext').html(pm_error_object.valid_number); 300 jQuery(this).children('.errortext').show(); 301 } 302 }); 303 304 305 jQuery('#'+formid+' .pm_phone_number').each(function (index, element) { 306 var number = jQuery(this).children('input').val(); 307 if (!validate_phone_number(number)) { 308 jQuery(this).children('input').addClass('warning'); 309 jQuery(this).children('.errortext').html(pm_error_object.valid_phone_number); 310 jQuery(this).children('.errortext').show(); 311 } 312 }); 313 314 jQuery('#'+formid+' .pm_mobile_number').each(function (index, element) { 315 var number = jQuery(this).children('input').val(); 316 if (!validateMobileNumber(number)) { 317 jQuery(this).children('input').addClass('warning'); 318 jQuery(this).children('.errortext').html(pm_error_object.valid_mobile_number); 319 jQuery(this).children('.errortext').show(); 320 } 321 }); 322 323 jQuery('#'+formid+' .pm_facebook_url').each(function (index, element) { 324 var number = jQuery(this).children('input').val(); 325 if (!validate_facebook_url(number)) { 326 jQuery(this).children('input').addClass('warning'); 327 jQuery(this).children('.errortext').html(pm_error_object.valid_facebook_url); 328 jQuery(this).children('.errortext').show(); 329 } 330 }); 331 332 jQuery('#'+formid+' .pm_twitter_url').each(function (index, element) { 333 var number = jQuery(this).children('input').val(); 334 if (!validate_twitter_url(number)) { 335 jQuery(this).children('input').addClass('warning'); 336 jQuery(this).children('.errortext').html(pm_error_object.valid_twitter_url); 337 jQuery(this).children('.errortext').show(); 338 } 339 }); 340 341 342 jQuery('#'+formid+' .pm_google_url').each(function (index, element) { 343 var number = jQuery(this).children('input').val(); 344 if (!validate_google_url(number)) { 345 jQuery(this).children('input').addClass('warning'); 346 jQuery(this).children('.errortext').html(pm_error_object.valid_google_url); 347 jQuery(this).children('.errortext').show(); 348 } 349 }); 350 351 352 jQuery('#'+formid+' .pm_linked_in_url').each(function (index, element) { 353 var number = jQuery(this).children('input').val(); 354 if (!validate_linked_in_url(number)) { 355 jQuery(this).children('input').addClass('warning'); 356 jQuery(this).children('.errortext').html(pm_error_object.valid_linked_in_url); 357 jQuery(this).children('.errortext').show(); 358 } 359 }); 360 361 362 jQuery('#'+formid+' .pm_youtube_url').each(function (index, element) { 363 var number = jQuery(this).children('input').val(); 364 if (!validate_youtube_url(number)) { 365 jQuery(this).children('input').addClass('warning'); 366 jQuery(this).children('.errortext').html(pm_error_object.valid_youtube_url); 367 jQuery(this).children('.errortext').show(); 368 } 369 }); 370 371 jQuery('#'+formid+' .pm_mixcloud_url').each(function (index, element) { 372 var number = jQuery(this).children('input').val(); 373 if (!validate_mixcloud_url(number)) { 374 jQuery(this).children('input').addClass('warning'); 375 jQuery(this).children('.errortext').html(pm_error_object.valid_mixcloud_url); 376 jQuery(this).children('.errortext').show(); 377 } 378 }); 379 380 jQuery('#'+formid+' .pm_soundcloud_url').each(function (index, element) { 381 var number = jQuery(this).children('input').val(); 382 if (!validate_soundcloud_url(number)) { 383 jQuery(this).children('input').addClass('warning'); 384 jQuery(this).children('.errortext').html(pm_error_object.valid_soundcloud_url); 385 jQuery(this).children('.errortext').show(); 386 } 387 }); 388 389 390 jQuery('#'+formid+' .pm_instagram_url').each(function (index, element) { 391 var number = jQuery(this).children('input').val(); 392 if (!validate_instagram_url(number)) { 393 jQuery(this).children('input').addClass('warning'); 394 jQuery(this).children('.errortext').html(pm_error_object.valid_instagram_url); 395 jQuery(this).children('.errortext').show(); 396 } 397 }); 398 399 jQuery('#'+formid+' .pm_datepicker').each(function (index, element) { 400 var date = jQuery(this).children('input').val(); 401 var pattern = /^([0-9]{4})-([0-9]{2})-([0-9]{2})$/; 402 if(pm_fields_object.dateformat == 'dd-mm-yy'){ 403 pattern = /^([0-9]{2})-([0-9]{2})-([0-9]{4})$/; 404 } 405 else if(pm_fields_object.dateformat =='yy-mm-dd'){ 406 pattern = /^([0-9]{4})-([0-9]{2})-([0-9]{2})$/; 407 } 408 else if(pm_fields_object.dateformat =='mm-dd-yy'){ 409 pattern = /^([0-9]{2})-([0-9]{2})-([0-9]{4})$/; 410 } 411 else if(pm_fields_object.dateformat == 'dd.mm.yy'){ 412 pattern = /^([0-9]{2}).([0-9]{2}).([0-9]{4})$/; 413 } 414 else if(pm_fields_object.dateformat =='yy.mm.dd'){ 415 pattern = /^([0-9]{4}).([0-9]{2}).([0-9]{2})$/; 416 } 417 else if(pm_fields_object.dateformat =='mm.dd.yy'){ 418 pattern = /^([0-9]{2}).([0-9]{2}).([0-9]{4})$/; 419 } 420 else if(pm_fields_object.dateformat =='yy/mm/dd'){ 421 pattern = /^([0-9]{4})\/([0-9]{2})\/([0-9]{2})$/; 422 } 423 else if(pm_fields_object.dateformat =='mm/dd/yy'){ 424 pattern = /^([0-9]{2})\/([0-9]{2})\/([0-9]{4})$/; 425 }else if(pm_fields_object.dateformat =='dd/mm/yy'){ 426 pattern = /^([0-9]{2})\/([0-9]{2})\/([0-9]{4})$/; 427 } 428 if (date != "" && !pattern.test(date)) { 429 jQuery(this).children('input').addClass('warning'); 430 jQuery(this).children('.errortext').html(pm_error_object.valid_date); 431 jQuery(this).children('.errortext').show(); 432 } 433 434 }); 435 436 jQuery('#'+formid+' .pm_required').each(function (index, element) { 437 var value = jQuery(this).children('input').val(); 438 var value = jQuery.trim(value); 439 if (value == "") { 440 jQuery(this).children('input').addClass('warning'); 441 jQuery(this).children('.errortext').html(pm_error_object.required_field); 442 jQuery(this).children('.errortext').show(); 443 } 444 }); 445 446 jQuery('#'+formid+' .pm_select_required').each(function (index, element) { 447 var value = jQuery(this).children('select').val(); 448 var value = jQuery.trim(value); 449 if (value == "") { 450 jQuery(this).children('select').addClass('warning'); 451 jQuery(this).children('.errortext').html(pm_error_object.required_field); 452 jQuery(this).children('.errortext').show(); 453 } 454 }); 455 456 jQuery('#'+formid+' .pm_rich_editor_required').each(function (index, element) { 457 458 }); 459 460 jQuery('#'+formid+' .pm_textarearequired').each(function (index, element) { 461 var value = jQuery(this).children('textarea').val(); 462 var value = jQuery.trim(value); 463 if (value == "") { 464 jQuery(this).children('textarea').addClass('warning'); 465 jQuery(this).children('.errortext').html(pm_error_object.required_field); 466 jQuery(this).children('.errortext').show(); 467 } 468 }); 469 470 jQuery('#'+formid+' .pm_checkboxrequired').each(function (index, element) { 471 var checkboxlenght = jQuery(this).children('.pmradio').children('.pm-radio-option').children('input[type="checkbox"]:checked'); 472 var atLeastOneIsChecked = checkboxlenght.length > 0; 473 if (atLeastOneIsChecked == true) { 474 }else{ 475 //jQuery(this).children('textarea').addClass('warning'); 476 jQuery(this).children('.errortext').html(pm_error_object.required_field); 477 jQuery(this).children('.errortext').show(); 478 } 479 }); 480 481 jQuery('#'+formid+' .pm_radiorequired').each(function (index, element) { 482 var checkboxlenght = jQuery(this).children('.pmradio').children('.pm-radio-option').children('input[type="radio"]:checked'); 483 var atLeastOneIsChecked = checkboxlenght.length > 0; 484 if (atLeastOneIsChecked == true) { 485 }else{ 486 //jQuery(this).children('textarea').addClass('warning'); 487 jQuery(this).children('.errortext').html(pm_error_object.required_field); 488 jQuery(this).children('.errortext').show(); 489 } 490 }); 491 492 jQuery('#'+formid+' .pm_fileinput .pm_repeat').each(function (index, element) { 493 var val = jQuery(this).children('input').val().toLowerCase(); 494 var allowextensions = jQuery(this).children('input').attr('data-filter-placeholder'); 495 if(allowextensions=='') 496 { 497 allowextensions = pm_error_object.allow_file_ext; 498 } 499 500 allowextensions = allowextensions.toLowerCase(); 501 var regex = new RegExp("(.*?)\.(" + allowextensions + ")$"); 502 if(!(regex.test(val)) && val!="") { 503 504 jQuery(this).children('input').addClass('warning'); 505 jQuery(this).children('.errortext').html(pm_error_object.file_type); 506 jQuery(this).children('.errortext').show(); 507 } 508 }); 509 510 jQuery('#'+formid+' .pm_repeat_required .pm_repeat').each(function (index, element) { 511 var value = jQuery(this).children('input').val(); 512 var value = jQuery.trim(value); 513 if (value == "") { 514 jQuery(this).children('input').addClass('warning'); 515 jQuery(this).children('.errortext').html(pm_error_object.required_field); 516 jQuery(this).children('.errortext').show(); 517 } 518 }); 519 520 jQuery('#'+formid+' .pm_user_pass').each(function (index, element) { 521 var password = jQuery(this).children('input').val(); 522 var passwordlength = password.length; 523 if(password !="") 524 { 525 if(passwordlength < 7) 526 { 527 jQuery(this).children('input').addClass('warning'); 528 jQuery(this).children('.errortext').html(pm_error_object.short_password); 529 jQuery(this).children('.errortext').show(); 530 } 531 } 532 }); 533 534 jQuery('#'+formid+' .pm_confirm_pass').each(function (index, element) { 535 var confirm_pass = jQuery(this).children('input').val(); 536 var password = password = jQuery('#'+formid+' .pm_user_pass').children('input').val(); 537 if(password != confirm_pass) 538 { 539 jQuery(this).children('input').addClass('warning'); 540 jQuery(this).children('.errortext').html(pm_error_object.pass_not_match); 541 jQuery(this).children('.errortext').show(); 542 } 543 }); 544 545 jQuery('#'+formid+' .pm_recaptcha').each(function (index, element) { 546 var response = grecaptcha.getResponse(); 547 //recaptcha failed validation 548 if (response.length == 0) { 549 jQuery(this).children('.errortext').html(pm_error_object.required_field); 550 jQuery(this).children('.errortext').show(); 551 } 552 }); 553 554 var b = ''; 555 jQuery('#'+formid+' .errortext').each(function () { 556 var a = jQuery(this).html(); 557 if(a!=='') 558 { 559 jQuery(this).addClass('pg-form-validation-error'); 560 } 561 b = a + b; 562 }); 563
564 if (jQuery('#'+formid+' .usernameerror').length > 0) 565 { 566 c = jQuery('#'+formid+' .usernameerror').html(); 567 if(c!=='') 568 { 569 jQuery('#'+formid+' .usernameerror').addClass('pg-form-validation-error'); 570 } 571 b = c + b; 572 } 573 else 574 { 575 c = ''; 576 } 577 578 if (jQuery('#'+formid+' .useremailerror').length > 0) 579 { 580 d = jQuery('.useremailerror').html(); 581 if(d!=='') 582 { 583 jQuery('#'+formid+' .useremailerror').addClass('pg-form-validation-error'); 584 } 585 b = c + b; 586 b = d + b; 587 } 588 jQuery('#'+formid+' .all_errors').html(b); 589 var error = jQuery('#'+formid+' .all_errors').html(); 590 if (error == '') { 591 return true; 592 } else { 593 jQuery('html, body').animate({ 594 scrollTop: jQuery('#'+formid+' .pg-form-validation-error').first().offset().top-40 595 }, 500); 596 jQuery('.pg-edit-group-popup-loader').remove(); 597 jQuery('input[type=submit][name=reg_form_submit]').removeClass('pg-stripe-submit-disabled'); 598 return false; 599 } 600} 601 602function profile_magic_frontend_validation_edit_profile(form) 603{ 604 605 var email_val = ""; 606 var formid = form.id; 607 var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/; 608 jQuery('.errortext').html(''); 609 jQuery('.errortext').hide(); 610 jQuery('.all_errors').html(''); 611 jQuery('.warning').removeClass('warning'); 612 613 jQuery('#'+formid+' .pm_email').each(function (index, element) { 614 var email = jQuery(this).children('input').val(); 615 var isemail = regex.test(email); 616 if (isemail == false && email != "") { 617 jQuery(this).children('input').addClass('warning'); 618 jQuery(this).children('.errortext').html(pm_error_object.valid_email); 619 jQuery(this).children('.errortext').show(); 620 } 621 }); 622 623 jQuery('#'+formid+' .pm_number').each(function (index, element) { 624 var number = jQuery(this).children('input').val(); 625 var isnumber = jQuery.isNumeric(number); 626 if (isnumber == false && number != "") { 627 jQuery(this).children('input').addClass('warning'); 628 jQuery(this).children('.errortext').html(pm_error_object.valid_number); 629 jQuery(this).children('.errortext').show(); 630 } 631 }); 632 633 634 jQuery('#'+formid+' .pm_phone_number').each(function (index, element) { 635 var number = jQuery(this).children('input').val(); 636 if (!validate_phone_number(number)) { 637 jQuery(this).children('input').addClass('warning'); 638 jQuery(this).children('.errortext').html(pm_error_object.valid_phone_number); 639 jQuery(this).children('.errortext').show(); 640 } 641 }); 642 643 jQuery('#'+formid+' .pm_mobile_number').each(function (index, element) { 644 var number = jQuery(this).children('input').val(); 645 if (!validateMobileNumber(number)) { 646 jQuery(this).children('input').addClass('warning'); 647 jQuery(this).children('.errortext').html(pm_error_object.valid_mobile_number); 648 jQuery(this).children('.errortext').show(); 649 } 650 }); 651 652 jQuery('#'+formid+' .pm_facebook_url').each(function (index, element) { 653 var number = jQuery(this).children('input').val(); 654 if (!validate_facebook_url(number)) { 655 jQuery(this).children('input').addClass('warning'); 656 jQuery(this).children('.errortext').html(pm_error_object.valid_facebook_url); 657 jQuery(this).children('.errortext').show(); 658 } 659 }); 660 661 jQuery('#'+formid+' .pm_twitter_url').each(function (index, element) { 662 var number = jQuery(this).children('input').val(); 663 if (!validate_twitter_url(number)) { 664 jQuery(this).children('input').addClass('warning'); 665 jQuery(this).children('.errortext').html(pm_error_object.valid_twitter_url); 666 jQuery(this).children('.errortext').show(); 667 } 668 }); 669 670 671 jQuery('#'+formid+' .pm_google_url').each(function (index, element) { 672 var number = jQuery(this).children('input').val(); 673 if (!validate_google_url(number)) { 674 jQuery(this).children('input').addClass('warning'); 675 jQuery(this).children('.errortext').html(pm_error_object.valid_google_url); 676 jQuery(this).children('.errortext').show(); 677 } 678 }); 679 680 681 jQuery('#'+formid+' .pm_linked_in_url').each(function (index, element) { 682 var number = jQuery(this).children('input').val(); 683 if (!validate_linked_in_url(number)) { 684 jQuery(this).children('input').addClass('warning'); 685 jQuery(this).children('.errortext').html(pm_error_object.valid_linked_in_url); 686 jQuery(this).children('.errortext').show(); 687 } 688 }); 689 690 691 jQuery('#'+formid+' .pm_youtube_url').each(function (index, element) { 692 var number = jQuery(this).children('input').val(); 693 if (!validate_youtube_url(number)) { 694 jQuery(this).children('input').addClass('warning'); 695 jQuery(this).children('.errortext').html(pm_error_object.valid_youtube_url); 696 jQuery(this).children('.errortext').show(); 697 } 698 }); 699 700 jQuery('#'+formid+' .pm_mixcloud_url').each(function (index, element) { 701 var number = jQuery(this).children('input').val(); 702 if (!validate_mixcloud_url(number)) { 703 jQuery(this).children('input').addClass('warning'); 704 jQuery(this).children('.errortext').html(pm_error_object.valid_mixcloud_url); 705 jQuery(this).children('.errortext').show(); 706 } 707 }); 708 709 jQuery('#'+formid+' .pm_soundcloud_url').each(function (index, element) { 710 var number = jQuery(this).children('input').val(); 711 if (!validate_soundcloud_url(number)) { 712 jQuery(this).children('input').addClass('warning'); 713 jQuery(this).children('.errortext').html(pm_error_object.valid_soundcloud_url); 714 jQuery(this).children('.errortext').show(); 715 } 716 }); 717 718 719 jQuery('#'+formid+' .pm_instagram_url').each(function (index, element) { 720 var number = jQuery(this).children('input').val(); 721 if (!validate_instagram_url(number)) { 722 jQuery(this).children('input').addClass('warning'); 723 jQuery(this).children('.errortext').html(pm_error_object.valid_instagram_url); 724 jQuery(this).children('.errortext').show(); 725 } 726 }); 727 728 jQuery('#'+formid+' .pm_datepicker').each(function (index, element) { 729 var date = jQuery(this).children('input').val(); 730 var pattern = /^([0-9]{4})-([0-9]{2})-([0-9]{2})$/; 731 if(pm_fields_object.dateformat == 'dd-mm-yy'){ 732 pattern = /^([0-9]{2})-([0-9]{2})-([0-9]{4})$/; 733 } 734 else if(pm_fields_object.dateformat =='yy-mm-dd'){ 735 pattern = /^([0-9]{4})-([0-9]{2})-([0-9]{2})$/; 736 } 737 else if(pm_fields_object.dateformat =='mm-dd-yy'){ 738 pattern = /^([0-9]{2})-([0-9]{2})-([0-9]{4})$/; 739 } 740 else if(pm_fields_object.dateformat == 'dd.mm.yy'){ 741 pattern = /^([0-9]{2}).([0-9]{2}).([0-9]{4})$/; 742 } 743 else if(pm_fields_object.dateformat =='yy.mm.dd'){ 744 pattern = /^([0-9]{4}).([0-9]{2}).([0-9]{2})$/; 745 } 746 else if(pm_fields_object.dateformat =='mm.dd.yy'){ 747 pattern = /^([0-9]{2}).([0-9]{2}).([0-9]{4})$/; 748 } 749 else if(pm_fields_object.dateformat =='yy/mm/dd'){ 750 pattern = /^([0-9]{4})\/([0-9]{2})\/([0-9]{2})$/; 751 } 752 else if(pm_fields_object.dateformat =='mm/dd/yy'){ 753 pattern = /^([0-9]{2})\/([0-9]{2})\/([0-9]{4})$/; 754 }else if(pm_fields_object.dateformat =='dd/mm/yy'){ 755 pattern = /^([0-9]{2})\/([0-9]{2})\/([0-9]{4})$/; 756 } 757 if (date != "" && !pattern.test(date)) { 758 jQuery(this).children('input').addClass('warning'); 759 jQuery(this).children('.errortext').html(pm_error_object.valid_date); 760 jQuery(this).children('.errortext').show(); 761 } 762 763 }); 764 765 jQuery('#'+formid+' .pm_required').each(function (index, element) { 766 var value = jQuery(this).children('input').val(); 767 var value = jQuery.trim(value); 768 if (value == "") { 769 jQuery(this).children('input').addClass('warning'); 770 jQuery(this).children('.errortext').html(pm_error_object.required_field); 771 jQuery(this).children('.errortext').show(); 772 } 773 }); 774 775 jQuery('#'+formid+' .pm_select_required').each(function (index, element) { 776 var value = jQuery(this).children('select').val(); 777 var value = jQuery.trim(value); 778 if (value == "") { 779 jQuery(this).children('select').addClass('warning'); 780 jQuery(this).children('.errortext').html(pm_error_object.required_field); 781 jQuery(this).children('.errortext').show(); 782 } 783 }); 784 785 jQuery('#'+formid+' .pm_rich_editor_required').each(function (index, element) { 786 787 }); 788 789 jQuery('#'+formid+' .pm_textarearequired').each(function (index, element) { 790 var value = jQuery(this).children('textarea').val(); 791 var value = jQuery.trim(value); 792 if (value == "") { 793 jQuery(this).children('textarea').addClass('warning'); 794 jQuery(this).children('.errortext').html(pm_error_object.required_field); 795 jQuery(this).children('.errortext').show(); 796 } 797 }); 798 799 jQuery('#'+formid+' .pm_checkboxrequired').each(function (index, element) { 800 var checkboxlenght = jQuery(this).children('.pmradio').children('.pm-radio-option').children('input[type="checkbox"]:checked'); 801 var atLeastOneIsChecked = checkboxlenght.length > 0; 802 if (atLeastOneIsChecked == true) { 803 }else{ 804 //jQuery(this).children('textarea').addClass('warning'); 805 jQuery(this).children('.errortext').html(pm_error_object.required_field); 806 jQuery(this).children('.errortext').show(); 807 } 808 }); 809 810 jQuery('#'+formid+' .pm_radiorequired').each(function (index, element) { 811 var checkboxlenght = jQuery(this).children('.pmradio').children('.pm-radio-option').children('input[type="radio"]:checked'); 812 var atLeastOneIsChecked = checkboxlenght.length > 0; 813 if (atLeastOneIsChecked == true) { 814 }else{ 815 //jQuery(this).children('textarea').addClass('warning'); 816 jQuery(this).children('.errortext').html(pm_error_object.required_field); 817 jQuery(this).children('.errortext').show(); 818 } 819 }); 820 821 jQuery('#'+formid+' .pm_fileinput .pm_repeat').each(function (index, element) { 822 var val = jQuery(this).children('input').val().toLowerCase(); 823 var allowextensions = jQuery(this).children('input').attr('data-filter-placeholder'); 824 if(allowextensions=='') 825 { 826 allowextensions = pm_error_object.allow_file_ext; 827 } 828 829 allowextensions = allowextensions.toLowerCase(); 830 var regex = new RegExp("(.*?)\.(" + allowextensions + ")$"); 831 if(!(regex.test(val)) && val!="") { 832 833 jQuery(this).children('input').addClass('warning'); 834 jQuery(this).children('.errortext').html(pm_error_object.file_type); 835 jQuery(this).children('.errortext').show(); 836 } 837 }); 838 839 jQuery('#'+formid+' .pm_repeat_required .pm_repeat').each(function (index, element) { 840 var value = jQuery(this).children('input').val(); 841 var value = jQuery.trim(value); 842 if (value == "") { 843 jQuery(this).children('input').addClass('warning'); 844 jQuery(this).children('.errortext').html(pm_error_object.required_field); 845 jQuery(this).children('.errortext').show(); 846 } 847 }); 848 849 jQuery('#'+formid+' .pm_user_pass').each(function (index, element) { 850 var password = jQuery(this).children('input').val(); 851 var passwordlength = password.length; 852 if(password !="") 853 { 854 if(passwordlength < 7) 855 { 856 jQuery(this).children('input').addClass('warning'); 857 jQuery(this).children('.errortext').html(pm_error_object.short_password); 858 jQuery(this).children('.errortext').show(); 859 } 860 } 861 }); 862 863 jQuery('#'+formid+' .pm_confirm_pass').each(function (index, element) { 864 var confirm_pass = jQuery(this).children('input').val(); 865 var password = password = jQuery('#'+formid+' .pm_user_pass').children('input').val(); 866 if(password != confirm_pass) 867 { 868 jQuery(this).children('input').addClass('warning'); 869 jQuery(this).children('.errortext').html(pm_error_object.pass_not_match); 870 jQuery(this).children('.errortext').show(); 871 } 872 }); 873 874 jQuery('#'+formid+' .pm_recaptcha').each(function (index, element) { 875 var response = grecaptcha.getResponse(); 876 //recaptcha failed validation 877 if (response.length == 0) { 878 jQuery(this).children('.errortext').html(pm_error_object.required_field); 879 jQuery(this).children('.errortext').show(); 880 } 881 }); 882 883 var b = ''; 884 jQuery('#'+formid+' .errortext').each(function () { 885 var a = jQuery(this).html(); 886 b = a + b; 887 }); 888
889 if (jQuery('#'+formid+' .usernameerror').length > 0) 890 { 891 c = jQuery('.usernameerror').html(); 892 b = c + b; 893 } 894 895 if (jQuery('#'+formid+' .useremailerror').length > 0) 896 { 897 d = jQuery('.useremailerror').html(); 898 b = d + b; 899 } 900 jQuery('#'+formid+' .all_errors').html(b); 901 var error = jQuery('#'+formid+' .all_errors').html(); 902 if (error == '') { 903 return true; 904 } else { 905 pm_expand_all_conent(); 906 jQuery(window).scrollTop( jQuery(".warning:first").offset().top); 907 console.log(jQuery(".warning:first").offset().top); 908 return false; 909 } 910} 911 912function pm_frontend_check_username(formid) 913{ 914 jQuery('.pm_user_name').each(function (index, element) { 915 var field = this; 916 var username = jQuery(this).children('input').val(); 917 var data = { 918 'action': 'pm_check_user_exist', 919 'nonce': pm_ajax_object.nonce, 920 'type': 'validateUserName', 921 'userdata' : username 922 }; 923 // We can also pass the url value separately from ajaxurl for front end AJAX implementations 924 jQuery.post(pm_ajax_object.ajax_url, data, function(response) { 925 if(response=="true") 926 { 927 jQuery(field).children('input').addClass('warning'); 928 jQuery(field).children('.usernameerror').html(pm_error_object.user_exist); 929 jQuery(field).children('.usernameerror').show(); 930 } 931 else 932 { 933 jQuery(field).children('input').removeClass('warning'); 934 jQuery(field).children('.usernameerror').html(''); 935 jQuery(field).children('.usernameerror').hide(); 936 } 937 938 }); 939 }); 940} 941 942function pm_frontend_check_useremail(previous) 943{ 944 jQuery('.pm_user_email').each(function (index, element) { 945 var field = this; 946 var username = jQuery(this).children('input').val(); 947 var data = { 948 'action': 'pm_check_user_exist', 949 'nonce': pm_ajax_object.nonce, 950 'type': 'validateUserEmail', 951 'userdata' : username, 952 'previous_data':previous 953 }; 954 // We can also pass the url value separately from ajaxurl for front end AJAX implementations 955 jQuery.post(pm_ajax_object.ajax_url, data, function(response) { 956 if(response=="true") 957 { 958 jQuery(field).children('input').addClass('warning'); 959 jQuery(field).children('.useremailerror').html(pm_error_object.email_exist); 960 jQuery(field).children('.useremailerror').show(); 961 } 962 else 963 { 964 jQuery(field).children('input').removeClass('warning'); 965 jQuery(field).children('.useremailerror').html(''); 966 jQuery(field).children('.useremailerror').hide(); 967 } 968 }); 969 }); 970} 971 972function pm_frontend_change_password(form) 973{ 974 var pass1 = jQuery(form).children('.pmrow').children('.pm-col').children('.pm-field-input').children('#pass1').val(); 975 var pass2 = jQuery(form).children('.pmrow').children('.pm-col').children('.pm-field-input').children('#pass2').val(); 976 var userid = jQuery(form).children('#user_id').val(); 977 jQuery('#pm_reset_passerror').removeClass('pm_password_error'); 978 jQuery('#pm_reset_passerror').removeClass('pm_password_success'); 979 var data = {'action': 'pm_change_frontend_user_pass','pass1': pass1,'pass2' : pass2, 'nonce': pm_ajax_object.nonce}; 980 // We can also pass the url value separately from ajaxurl for front end AJAX implementations 981 jQuery.post(pm_ajax_object.ajax_url, data, function(response) { 982 if(response==true) 983 { 984 jQuery('#pm_reset_passerror').addClass('pm_password_success'); 985 jQuery('#pm_reset_passerror').html(pm_error_object.password_change_successfully); 986 jQuery('#pm_reset_passerror').show(); 987 window.location = pm_error_object.login_url; 988 } 989 else 990 { 991 992 jQuery('#pm_reset_passerror').addClass('pm_password_error'); 993 jQuery('#pm_reset_passerror').html(response); 994 jQuery('#pm_reset_passerror').show(); 995 } 996 }); 997 return false;
998} 999 1000var searchRequest = null; 1001function pm_advance_user_search(pagenum) 1002{ 1003 1004 1005 var form = jQuery("#pm-advance-search-form"); 1006 jQuery("#pm_result_pane").html('<div class="pm-loader"></div>'); 1007 var pmDomColor = jQuery(".pmagic").find("a").css('color'); 1008 jQuery(".pm-loader").css('border-top-color', pmDomColor); 1009 1010 1011 if (jQuery('#advance_seach_ul li').length === 0){ 1012 jQuery('#pm-advance-search-form #advance_search_pane #advance_seach_ul').addClass("pg-advance-search-hide"); 1013 }else{ 1014 jQuery('#pm-advance-search-form #advance_search_pane #advance_seach_ul').removeClass("pg-advance-search-hide"); 1015 } 1016 1017 1018 1019 if(pagenum!== '') 1020 { 1021 if(pagenum=='Reset') 1022 { 1023 form.trigger('reset'); 1024 jQuery('#advance_search_pane').hide(200); 1025 jQuery('#pagenum').attr("value",1); 1026 jQuery('input[type=checkbox]').attr("checked",false); 1027 pm_change_search_field(''); 1028 } 1029 else 1030 { 1031 jQuery('#pagenum').attr("value",pagenum); 1032 } 1033 1034 } 1035 else 1036 { 1037 jQuery('#pagenum').attr("value",1); 1038 } 1039 var form_values = form.serializeArray(); 1040 1041 var data = {'nonce': pm_ajax_object.nonce}; 1042 1043 //creating data in object format and array for multiple checkbox 1044 jQuery.each(form_values, function () { 1045 if (data[this.name] !== undefined) { 1046 if (!data[this.name].push) { 1047 data[this.name] = [data[this.name]]; 1048 } 1049 data[this.name].push(this.value); 1050 } else { 1051 data[this.name] = this.value; 1052 } 1053 }); 1054 //console.log(data); 1055 1056 if(searchRequest != null) 1057 searchRequest.abort(); 1058 //ajax call start 1059 searchRequest = jQuery.post(pm_ajax_object.ajax_url, data, function (resp) 1060 { 1061 1062 if (resp) 1063 { 1064 jQuery("#pm_result_pane").html(resp); 1065 1066 var pmDomColor = jQuery(".pmagic").find("a").css('color'); 1067 jQuery(".pm-color").css('color', pmDomColor); 1068 jQuery( ".page-numbers.current" ).css('background', pmDomColor); 1069 } 1070 else 1071 { 1072 //console.log("err"); 1073 } 1074 1075 }); 1076 //ajax call ends here 1077 1078 1079 1080 1081} 1082 1083function profile_magic_send_email(userid) 1084{ 1085 var data = {'action': 'pm_send_change_pass_email','userid': userid}; 1086 // We can also pass the url value separately from ajaxurl for front end AJAX implementations 1087 jQuery.post(pm_ajax_object.ajax_url, data, function(response) { 1088 1089 }); 1090 return false; 1091} 1092 1093function profile_magic_multistep_form_validation(form) 1094{ 1095 1096 var email_val = ""; 1097 var formid = form.attr('id'); 1098 var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/; 1099 jQuery('.errortext').html(''); 1100 jQuery('.errortext').hide(); 1101 jQuery('.all_errors').html(''); 1102 jQuery('.warning').removeClass('warning'); 1103jQuery('#'+formid+' .pm_email').each(function (index, element) { 1104 var email = jQuery(this).children('input').val(); 1105 var isemail = regex.test(email); 1106 if (isemail == false && email != "") { 1107 jQuery(this).children('input').addClass('warning'); 1108 jQuery(this).children('.errortext').html(pm_error_object.valid_email); 1109 jQuery(this).children('.errortext').show(); 1110 } 1111 }); 1112 1113 jQuery('#'+formid+' .pm_number').each(function (index, element) { 1114 var number = jQuery(this).children('input').val(); 1115 var isnumber = jQuery.isNumeric(number); 1116 if (isnumber == false && number != "") { 1117 jQuery(this).children('input').addClass('warning'); 1118 jQuery(this).children('.errortext').html(pm_error_object.valid_number); 1119 jQuery(this).children('.errortext').show(); 1120 } 1121 }); 1122 1123 jQuery('#'+formid+' .pm_phone_number').each(function (index, element) { 1124 var number = jQuery(this).children('input').val(); 1125 if (!validate_phone_number(number)) { 1126 jQuery(this).children('input').addClass('warning'); 1127 jQuery(this).children('.errortext').html(pm_error_object.valid_phone_number); 1128 jQuery(this).children('.errortext').show(); 1129 } 1130 }); 1131 1132 jQuery('#'+formid+' .pm_mobile_number').each(function (index, element) { 1133 var number = jQuery(this).children('input').val(); 1134 if (!validateMobileNumber(number)) { 1135 jQuery(this).children('input').addClass('warning'); 1136 jQuery(this).children('.errortext').html(pm_error_object.valid_mobile_number); 1137 jQuery(this).children('.errortext').show(); 1138 } 1139 }); 1140 1141 jQuery('#'+formid+' .pm_facebook_url').each(function (index, element) { 1142 var number = jQuery(this).children('input').val(); 1143 if (!validate_facebook_url(number)) { 1144 jQuery(this).children('input').addClass('warning'); 1145 jQuery(this).children('.errortext').html(pm_error_object.valid_facebook_url); 1146 jQuery(this).children('.errortext').show(); 1147 } 1148 }); 1149 1150 jQuery('#'+formid+' .pm_twitter_url').each(function (index, element) { 1151 var number = jQuery(this).children('input').val(); 1152 if (!validate_twitter_url(number)) { 1153 jQuery(this).children('input').addClass('warning'); 1154 jQuery(this).children('.errortext').html(pm_error_object.valid_twitter_url); 1155 jQuery(this).children('.errortext').show(); 1156 } 1157 }); 1158 1159 1160 jQuery('#'+formid+' .pm_google_url').each(function (index, element) { 1161 var number = jQuery(this).children('input').val(); 1162 if (!validate_google_url(number)) { 1163 jQuery(this).children('input').addClass('warning'); 1164 jQuery(this).children('.errortext').html(pm_error_object.valid_google_url); 1165 jQuery(this).children('.errortext').show(); 1166 } 1167 }); 1168 1169 1170 jQuery('#'+formid+' .pm_linked_in_url').each(function (index, element) { 1171 var number = jQuery(this).children('input').val(); 1172 if (!validate_linked_in_url(number)) { 1173 jQuery(this).children('input').addClass('warning'); 1174 jQuery(this).children('.errortext').html(pm_error_object.valid_linked_in_url); 1175 jQuery(this).children('.errortext').show(); 1176 } 1177 }); 1178 1179 1180 jQuery('#'+formid+' .pm_youtube_url').each(function (index, element) { 1181 var number = jQuery(this).children('input').val(); 1182 if (!validate_youtube_url(number)) { 1183 jQuery(this).children('input').addClass('warning'); 1184 jQuery(this).children('.errortext').html(pm_error_object.valid_youtube_url); 1185 jQuery(this).children('.errortext').show(); 1186 } 1187 }); 1188 1189 jQuery('#'+formid+' .pm_mixcloud_url').each(function (index, element) { 1190 var number = jQuery(this).children('input').val(); 1191 if (!validate_mixcloud_url(number)) { 1192 jQuery(this).children('input').addClass('warning'); 1193 jQuery(this).children('.errortext').html(pm_error_object.valid_mixcloud_url); 1194 jQuery(this).children('.errortext').show(); 1195 } 1196 }); 1197 1198 jQuery('#'+formid+' .pm_soundcloud_url').each(function (index, element) { 1199 var number = jQuery(this).children('input').val(); 1200 if (!validate_soundcloud_url(number)) { 1201 jQuery(this).children('input').addClass('warning'); 1202 jQuery(this).children('.errortext').html(pm_error_object.valid_soundcloud_url); 1203 jQuery(this).children('.errortext').show(); 1204 } 1205 }); 1206 1207 jQuery('#'+formid+' .pm_instagram_url').each(function (index, element) { 1208 var number = jQuery(this).children('input').val(); 1209 if (!validate_instagram_url(number)) { 1210 jQuery(this).children('input').addClass('warning'); 1211 jQuery(this).children('.errortext').html(pm_error_object.valid_instagram_url); 1212 jQuery(this).children('.errortext').show(); 1213 } 1214 }); 1215 1216 jQuery('#'+formid+' .pm_datepicker').each(function (index, element) { 1217 var date = jQuery(this).children('input').val(); 1218 var pattern = /^([0-9]{4})-([0-9]{2})-([0-9]{2})$/; 1219 if(pm_fields_object.dateformat == 'dd-mm-yy'){ 1220 pattern = /^([0-9]{2})-([0-9]{2})-([0-9]{4})$/; 1221 } 1222 else if(pm_fields_object.dateformat =='yy-mm-dd'){ 1223 pattern = /^([0-9]{4})-([0-9]{2})-([0-9]{2})$/; 1224 } 1225 else if(pm_fields_object.dateformat =='mm-dd-yy'){ 1226 pattern = /^([0-9]{2})-([0-9]{2})-([0-9]{4})$/; 1227 } 1228 else if(pm_fields_object.dateformat == 'dd.mm.yy'){ 1229 pattern = /^([0-9]{2}).([0-9]{2}).([0-9]{4})$/; 1230 } 1231 else if(pm_fields_object.dateformat =='yy.mm.dd'){ 1232 pattern = /^([0-9]{4}).([0-9]{2}).([0-9]{2})$/; 1233 } 1234 else if(pm_fields_object.dateformat =='mm.dd.yy'){ 1235 pattern = /^([0-9]{2}).([0-9]{2}).([0-9]{4})$/; 1236 } 1237 else if(pm_fields_object.dateformat =='yy/mm/dd'){ 1238 pattern = /^([0-9]{4})\/([0-9]{2})\/([0-9]{2})$/; 1239 } 1240 else if(pm_fields_object.dateformat =='mm/dd/yy'){ 1241 pattern = /^([0-9]{2})\/([0-9]{2})\/([0-9]{4})$/; 1242 }else if(pm_fields_object.dateformat =='dd/mm/yy'){ 1243 pattern = /^([0-9]{2})\/([0-9]{2})\/([0-9]{4})$/; 1244 } 1245 if (date != "" && !pattern.test(date)) { 1246 jQuery(this).children('input').addClass('warning'); 1247 jQuery(this).children('.errortext').html(pm_error_object.valid_date); 1248 jQuery(this).children('.errortext').show(); 1249 } 1250 }); 1251 1252 jQuery('#'+formid+' .pm_required').each(function (index, element) { 1253 var value = jQuery(this).children('input').val(); 1254 var value = jQuery.trim(value); 1255 if (value == "") { 1256 jQuery(this).children('input').addClass('warning'); 1257 jQuery(this).children('.errortext').html(pm_error_object.required_field); 1258 jQuery(this).children('.errortext').show(); 1259 } 1260 }); 1261 1262 jQuery('#'+formid+' .pm_select_required').each(function (index, element) { 1263 var value = jQuery(this).children('select').val(); 1264 var value = jQuery.trim(value); 1265 if (value == "") { 1266 jQuery(this).children('select').addClass('warning'); 1267 jQuery(this).children('.errortext').html(pm_error_object.required_field); 1268 jQuery(this).children('.errortext').show(); 1269 } 1270 }); 1271 1272 jQuery('#'+formid+' .pm_textarearequired').each(function (index, element) { 1273 var value = jQuery(this).children('textarea').val(); 1274 var value = jQuery.trim(value); 1275 if (value == "") { 1276 jQuery(this).children('textarea').addClass('warning'); 1277 jQuery(this).children('.errortext').html(pm_error_object.required_field); 1278 jQuery(this).children('.errortext').show(); 1279 } 1280 }); 1281 1282 jQuery('#'+formid+' .pm_checkboxrequired').each(function (index, element) { 1283 var checkboxlenght = jQuery(this).children('.pmradio').children('.pm-radio-option').children('input[type="checkbox"]:checked'); 1284 var atLeastOneIsChecked = checkboxlenght.length > 0; 1285 if (atLeastOneIsChecked == true) { 1286 }else{ 1287 //jQuery(this).children('textarea').addClass('warning'); 1288 jQuery(this).children('.errortext').html(pm_error_object.required_field); 1289 jQuery(this).children('.errortext').show(); 1290 } 1291 }); 1292 1293 jQuery('#'+formid+' .pm_radiorequired').each(function (index, element) { 1294 var checkboxlenght = jQuery(this).children('.pmradio').children('.pm-radio-option').children('input[type="radio"]:checked'); 1295 var atLeastOneIsChecked = checkboxlenght.length > 0; 1296 if (atLeastOneIsChecked == true) { 1297 }else{ 1298 //jQuery(this).children('textarea').addClass('warning'); 1299 jQuery(this).children('.errortext').html(pm_error_object.required_field); 1300 jQuery(this).children('.errortext').show(); 1301 } 1302 }); 1303 1304 jQuery('#'+formid+' .pm_fileinput .pm_repeat').each(function (index, element) { 1305 var val = jQuery(this).children('input').val().toLowerCase(); 1306 var allowextensions = jQuery(this).children('input').attr('data-filter-placeholder'); 1307 if(allowextensions=='') 1308 { 1309 allowextensions = pm_error_object.allow_file_ext; 1310 } 1311 1312 allowextensions = allowextensions.toLowerCase(); 1313 var regex = new RegExp("(.*?)\.(" + allowextensions + ")$"); 1314 if(!(regex.test(val)) && val!="") { 1315 1316 jQuery(this).children('input').addClass('warning'); 1317 jQuery(this).children('.errortext').html(pm_error_object.file_type); 1318 jQuery(this).children('.errortext').show(); 1319 } 1320 }); 1321 1322 jQuery('#'+formid+' .pm_repeat_required .pm_repeat').each(function (index, element) { 1323 var value = jQuery(this).children('input').val(); 1324 var value = jQuery.trim(value); 1325 if (value == "") { 1326 jQuery(this).children('input').addClass('warning'); 1327 jQuery(this).children('.errortext').html(pm_error_object.required_field); 1328 jQuery(this).children('.errortext').show(); 1329 } 1330 }); 1331 1332 jQuery('#'+formid+' .pm_user_pass').each(function (index, element) { 1333 var password = jQuery(this).children('input').val(); 1334 var passwordlength = password.length; 1335 if(password !="") 1336 { 1337 if(passwordlength < 7) 1338 { 1339 jQuery(this).children('input').addClass('warning'); 1340 jQuery(this).children('.errortext').html(pm_error_object.short_password); 1341 jQuery(this).children('.errortext').show(); 1342 } 1343 } 1344 }); 1345 1346 jQuery('#'+formid+' .pm_confirm_pass').each(function (index, element) { 1347 var confirm_pass = jQuery(this).children('input').val(); 1348 var password = password = jQuery('#'+formid+' .pm_user_pass').children('input').val(); 1349 if(password != confirm_pass) 1350 { 1351 jQuery(this).children('input').addClass('warning'); 1352 jQuery(this).children('.errortext').html(pm_error_object.pass_not_match); 1353 jQuery(this).children('.errortext').show(); 1354 } 1355 }); 1356 1357 jQuery('#'+formid+' .pm_recaptcha').each(function (index, element) { 1358 var response = grecaptcha.getResponse(); 1359 //recaptcha failed validation 1360 if (response.length == 0) { 1361 jQuery(this).children('.errortext').html(pm_error_object.required_field); 1362 jQuery(this).children('.errortext').show(); 1363 } 1364 }); 1365 1366 var all_errors = ''; 1367 jQuery('#'+formid+' .errortext').each(function () { 1368 var a = jQuery(this).html(); 1369 all_errors = a + all_errors; 1370 }); 1371 if (jQuery('#'+formid+' .usernameerror').length > 0) 1372 { 1373 c = jQuery('.usernameerror').html(); 1374 if(jQuery.trim(c)!='') 1375 jQuery('.pm_user_name').children('input').addClass('warning'); 1376 all_errors = c + all_errors; 1377 } 1378 1379 if (jQuery('#'+formid+' .useremailerror').length > 0) 1380 { 1381 d = jQuery('.useremailerror').html(); 1382 if(jQuery.trim(d)!='') 1383 jQuery('.pm_user_email').children('input').addClass('warning'); 1384 all_errors = d + all_errors; 1385 } 1386 jQuery('#'+formid+' .all_errors').html(all_errors); 1387 var error = jQuery('#'+formid+' .all_errors').html(); 1388 if (error == '') { 1389 return true; 1390 } else { 1391 return false;
1392 } 1393} 1394 1395function openParentTab() 1396{ 1397 locationHash = location.hash.substring( 1 ); 1398 //console.log(locationHash); 1399 // Check if we have an location Hash 1400 if (locationHash) { 1401 // Check if the location hash exsist. 1402 var hash = jQuery('#'+locationHash); 1403 if (hash.length) { 1404 var t = hash; 1405 jQuery('li.pm-profile-tab a').removeClass('active'); 1406 jQuery(this).addClass('active'); 1407 jQuery('.pg-profile-tab-content').hide(); 1408 jQuery(t).find('.pm-section-content:first').show(); 1409 jQuery('li.hideshow ul').hide(); 1410 jQuery(t).fadeIn('slow'); 1411 return false; 1412 } 1413 } 1414} 1415 1416function generateTabs(tabs) { 1417 1418 html = ''; 1419 for (var i in tabs) { 1420 tab = tabs[i]; 1421 html = html + '<li class="multipage_tab"><a href="#" onclick="return jQuery(\'#multipage\').gotopage(' + tab.number + ');">' + tab.title + '</a></li>'; 1422 } 1423 jQuery('<ul class="multipage_tabs" id="multipage_tabs">'+html+'<div class="clearer"></div></ul>').insertBefore('#multipage'); 1424} 1425function setActiveTab(selector,page) { 1426 jQuery('#multipage_tabs li').each(function(index){ 1427 if ((index+1)==page) { 1428 jQuery(this).addClass('active'); 1429 } else { 1430 jQuery(this).removeClass('active'); 1431 } 1432 }); 1433} 1434 1435function transition(from,to) { 1436 jQuery(from).fadeOut('fast',function(){jQuery(to).fadeIn('fast');}); 1437 1438} 1439function textpages(obj,page,pages) { 1440 jQuery(obj).html(page + ' of ' + pages); 1441} 1442 1443function pm_user_image_validation(a) 1444{ 1445 var val = jQuery(a).children('.pm-user-image').val().toLowerCase(); 1446 if(val=='') 1447 { 1448 jQuery(a).children('pm-user-image').addClass('warning'); 1449 jQuery(a).children('.pm-popup-error').html(pm_error_object.required_field); 1450 jQuery(a).children('.pm-popup-error').show(); 1451 return false; 1452 } 1453 1454 var allowextensions = 'jpg|jpeg|png|gif'; 1455 if(allowextensions=='') 1456 { 1457 allowextensions = pm_error_object.allow_file_ext; 1458 } 1459 allowextensions = allowextensions.toLowerCase(); 1460 var regex = new RegExp("(.*?)\.(" + allowextensions + ")$"); 1461 if(!(regex.test(val)) && val!="") { 1462 jQuery(a).children('pm-user-image').addClass('warning'); 1463 jQuery(a).children('.pm-popup-error').html(pm_error_object.file_type); 1464 jQuery(a).children('.pm-popup-error').show(); 1465 return false; 1466 } 1467 else 1468 { 1469 jQuery(a).children('.pm-popup-error').html(''); 1470 jQuery(a).children('.pm-popup-error').hide(); 1471 return true; 1472 } 1473} 1474 1475 1476 1477 1478 1479//GUI Functions 1480function callPmPopup(dialog) { 1481 var pmId = dialog + "-dialog"; 1482 jQuery(pmId).siblings('.pm-popup-mask').show(); 1483 jQuery(pmId).show(); 1484 jQuery('.pm-popup-container').css("animation", "pm-popup-in 0.3s ease-out 1"); 1485} 1486 1487 1488 1489 1490function profile_magic_blogpost_validation() 1491{ 1492 jQuery('.errortext').html(''); 1493 jQuery('.errortext').hide(); 1494 jQuery('.all_errors').html(''); 1495 jQuery('.warning').removeClass('warning'); 1496 jQuery('#pm_add_blog_post .pm_required').each(function (index, element) { 1497 var value = jQuery(this).children('input').val(); 1498 var value = jQuery.trim(value); 1499 if (value == "") { 1500 jQuery(this).children('input').addClass('warning'); 1501 jQuery(this).children('.errortext').html(pm_error_object.required_field); 1502 jQuery(this).children('.errortext').show(); 1503 } 1504 }); 1505 1506 jQuery('#pm_add_blog_post .pm_fileinput .pm_repeat').each(function (index, element) { 1507 var val = jQuery(this).children('input').val().toLowerCase(); 1508 var allowextensions = 'jpg|jpeg|png|gif'; 1509 if(allowextensions=='') 1510 { 1511 allowextensions = pm_error_object.allow_file_ext; 1512 } 1513 1514 allowextensions = allowextensions.toLowerCase(); 1515 var regex = new RegExp("(.*?)\.(" + allowextensions + ")$"); 1516 if(!(regex.test(val)) && val!="") { 1517 1518 jQuery(this).children('input').addClass('warning'); 1519 jQuery(this).children('.errortext').html(pm_error_object.file_type); 1520 jQuery(this).children('.errortext').show(); 1521 } 1522 }); 1523 var all_errors = ''; 1524 jQuery('#pm_add_blog_post .errortext').each(function () { 1525 var a = jQuery(this).html(); 1526 all_errors = a + all_errors; 1527 }); 1528 jQuery('#pm_add_blog_post .all_errors').html(all_errors); 1529 var error = jQuery('#pm_add_blog_post .all_errors').html(); 1530 if (error == '') { 1531 1532 jQuery('input[name="pg_blog_submit"]').attr('disabled','disabled'); 1533 return true; 1534 } else { 1535 return false;
1536 } 1537} 1538 1539function load_more_pg_blogs(uid) 1540{ 1541 jQuery('.pm-load-more-blogs').hide(); 1542 jQuery('.pg-load-more-container .pm-loader').show(); 1543 var page = parseInt(jQuery('#pg_next_blog_page').val()); 1544 var nextpage = page +1; 1545 var data = {action: 'pm_load_pg_blogs', 'uid': uid,'page':page,'nonce': pm_ajax_object.nonce}; 1546 jQuery.post(pm_ajax_object.ajax_url, data, function (response) { 1547 if(response) 1548 { 1549 jQuery('.pg-load-more-container .pm-loader').hide(); 1550 jQuery('#pg_next_blog_page').val(nextpage); 1551 jQuery('#pg-blog-container').append(response); 1552 } 1553 }); 1554 1555} 1556 1557function load_more_user_blogs_shortcode_posts(authors,posttypes) 1558{ 1559 jQuery('.pm-load-more-blogs').hide(); 1560 jQuery('.pg-load-more-container .pm-loader').show(); 1561 var page = parseInt(jQuery('#pg_next_blog_page').val()); 1562 var nextpage = page +1; 1563 var data = {action: 'pm_load_user_blogs_shortcode_posts',authors: authors, posttypes:posttypes, page:page, 'nonce': pm_ajax_object.nonce}; 1564 jQuery.post(pm_ajax_object.ajax_url, data, function (response) { 1565 if(response) 1566 { 1567 jQuery('.pg-load-more-container .pm-loader').hide(); 1568 jQuery('#pg_next_blog_page').val(nextpage); 1569 jQuery('#pg-user-blog-container').append(response); 1570 } 1571 }); 1572 1573} 1574 1575 1576 1577function pm_delete_account_setting(form) 1578{ 1579 var formid = form.id; 1580 jQuery('#'+formid+' .errortext').html(''); 1581 jQuery('#'+formid+' .errortext').hide(); 1582 jQuery('#'+formid+' .all_errors').html(''); 1583 jQuery('#'+formid+' .warning').removeClass('warning'); 1584 jQuery('#'+formid+' .pm_required').each(function (index, element) { 1585 var value = jQuery(this).children('input').val(); 1586 var value = jQuery.trim(value); 1587 if (value == "") { 1588 jQuery(this).children('input').addClass('warning'); 1589 jQuery(this).children('.errortext').html(pm_error_object.required_field); 1590 jQuery(this).children('.errortext').show(); 1591 } 1592 }); 1593 var all_errors = ''; 1594 jQuery('#'+formid+' .errortext').each(function () { 1595 var a = jQuery(this).html(); 1596 all_errors = a + all_errors; 1597 }); 1598 1599 jQuery('#'+formid+' .all_errors').html(all_errors); 1600 var error = jQuery('#'+formid+' .all_errors').html(); 1601 if (error == '') 1602 { 1603 return true; 1604 } 1605 else 1606 { 1607 return false; 1608 } 1609 1610} 1611function pm_save_account_setting(form) 1612{ 1613 var email_val = ""; 1614 var formid = form.id; 1615 var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/; 1616 jQuery('#'+formid+' .errortext').html(''); 1617 jQuery('#'+formid+' .errortext').hide(); 1618 jQuery('#'+formid+' .all_errors').html(''); 1619 jQuery('#'+formid+' .warning').removeClass('warning'); 1620 jQuery('#'+formid+' .pm_required').each(function (index, element) { 1621 var value = jQuery(this).children('input').val(); 1622 var value = jQuery.trim(value); 1623 if (value == "") { 1624 jQuery(this).children('input').addClass('warning'); 1625 jQuery(this).children('.errortext').html(pm_error_object.required_field); 1626 jQuery(this).children('.errortext').show(); 1627 } 1628 }); 1629 1630 jQuery('#'+formid+' .pm_email').each(function (index, element) { 1631 var email = jQuery(this).children('input').val(); 1632 var isemail = regex.test(email); 1633 if (isemail == false && email != "") { 1634 jQuery(this).children('input').addClass('warning'); 1635 jQuery(this).children('.errortext').html(pm_error_object.valid_email); 1636 jQuery(this).children('.errortext').show(); 1637 } 1638 }); 1639 1640 var all_errors = ''; 1641 jQuery('#'+formid+' .errortext').each(function () { 1642 var a = jQuery(this).html(); 1643 all_errors = a + all_errors; 1644 }); 1645 1646 jQuery('#'+formid+' .all_errors').html(all_errors); 1647 var error = jQuery('#'+formid+' .all_errors').html(); 1648 if (error == '') 1649 { 1650 return true; 1651 } 1652 else 1653 { 1654 return false; 1655 } 1656 1657} 1658 1659(function PG_mobile_resposve ($) { 1660 var $window = $(window), 1661 $html = $('html'), 1662 $is_resize = 0; 1663 1664 1665 $window.resize(function resize() { 1666 if ($window.width() < 479) { 1667 if($is_resize==0) 1668 { 1669 show_pg_section_left_panel(); 1670 $is_resize = 1; 1671 } 1672 1673 return $html.addClass('pg-mobile-479'); 1674 } 1675 else 1676 { 1677 $('.pm-section-left-panel').show(); 1678 $('.pm-section-right-panel').show(); 1679 } 1680 1681 $html.removeClass('pg-mobile-479'); 1682 1683 if ($window.width() < 760) { 1684 return $html.addClass('pg-mobile-760'); 1685 1686 } 1687 1688 $html.removeClass('pg-mobile-760'); 1689 1690 1691 if ($window.width() < 979) { 1692 return $html.addClass('pg-mobile-979'); 1693 1694 } 1695 1696 $html.removeClass('pg-mobile-979'); 1697 1698 }).trigger('resize'); 1699})(jQuery); 1700 1701function show_pg_section_right_panel() 1702{ 1703 jQuery(".pg-mobile-479 .pm-section-right-panel").show(); 1704 jQuery(".pg-mobile-479 .pm-section-left-panel").hide(); 1705 jQuery(".pg-mobile-479 .pg-left-panel-icon").show(); 1706} 1707 1708function show_pg_section_left_panel() 1709{ 1710 jQuery(".pg-mobile-479 .pm-section-right-panel").hide(); 1711 jQuery(".pg-mobile-479 .pm-section-left-panel").show(); 1712 jQuery(".pg-mobile-479 .pg-left-panel-icon").hide(); 1713} 1714 1715function pg_remove_user_group(uid,gid) 1716{ 1717 var boxid = '#pg-user-group-box-'+gid; 1718 var data = {action:'pm_remove_user_group',uid:uid,gid:gid,'nonce': pm_ajax_object.nonce}; 1719 jQuery('#pg_edit_group_html_container').html('<div class="pg-edit-group-popup-loader"><div class="pm-loader"></div></div>'); 1720 var pmDomColor = jQuery(".pmagic").find("a").css('color'); 1721 jQuery(".pm-loader").css('border-top-color', pmDomColor); 1722 jQuery.post(pm_ajax_object.ajax_url, data, function (resp) 1723 { 1724 //window.location.reload(true); 1725 if(resp=='success') 1726 { 1727 1728 //jQuery(boxid).remove(); 1729 //jQuery('.pm-popup-mask, #pm-edit-group-popup, .pg-blog-dialog-mask').hide(); 1730 window.location.reload(true); 1731 1732 } 1733 }); 1734 1735} 1736 1737function pg_open_group_tab() 1738{ 1739 var child = jQuery('.pm-profile-tab ul li.pg-group-tab'); 1740var parent = jQuery('ul.pm-profile-tab-wrap'); 1741 1742 var i = 0; 1743 var tabindex=0; 1744 jQuery('ul.pm-profile-tab-wrap').children('li').each(function () { 1745 jQuery(this).find('a').removeClass("active"); 1746 var obj = jQuery(this).find('a[href="#pg-groups"]'); // "this" is the current element in the loop 1747 if(obj.length) 1748 { 1749 jQuery('.pg-profile-tab-content').css("display","none"); 1750 obj.addClass("active"); 1751 tabindex = i; 1752 } 1753 1754 i++; 1755 1756}); 1757 1758 jQuery('#pg-groups').css("display","block"); 1759}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.