| 1 |
var fields = { |
| 2 |
'Default - Name (Heading)': { 'show_rows' : [ |
| 3 |
'.row-field-title', |
| 4 |
'.row-description', |
| 5 |
], |
| 6 |
'properties': { |
| 7 |
'meta_name_value' : '' |
| 8 |
} |
| 9 |
}, |
| 10 |
|
| 11 |
'Default - Contact Info (Heading)': { 'show_rows' : [ |
| 12 |
'.row-field-title', |
| 13 |
'.row-description', |
| 14 |
], |
| 15 |
'properties': { |
| 16 |
'meta_name_value' : '' |
| 17 |
} |
| 18 |
}, |
| 19 |
|
| 20 |
'Default - About Yourself (Heading)': { 'show_rows' : [ |
| 21 |
'.row-field-title', |
| 22 |
'.row-description', |
| 23 |
], |
| 24 |
'properties': { |
| 25 |
'meta_name_value' : '' |
| 26 |
} |
| 27 |
}, |
| 28 |
|
| 29 |
'Default - Username': { 'show_rows' : [ |
| 30 |
'.row-field-title', |
| 31 |
'.row-description', |
| 32 |
'.row-default-value', |
| 33 |
'.row-required' |
| 34 |
], |
| 35 |
'properties': { |
| 36 |
'meta_name_value' : '' |
| 37 |
}, |
| 38 |
'required' : [ |
| 39 |
true |
| 40 |
] |
| 41 |
}, |
| 42 |
|
| 43 |
'Default - First Name': { 'show_rows' : [ |
| 44 |
'.row-field-title', |
| 45 |
'.row-meta-name', |
| 46 |
'.row-description', |
| 47 |
'.row-default-value', |
| 48 |
'.row-required' |
| 49 |
], |
| 50 |
'properties': { |
| 51 |
'meta_name_value' : 'first_name' |
| 52 |
} |
| 53 |
}, |
| 54 |
|
| 55 |
'Default - Last Name': { 'show_rows' : [ |
| 56 |
'.row-field-title', |
| 57 |
'.row-meta-name', |
| 58 |
'.row-description', |
| 59 |
'.row-default-value', |
| 60 |
'.row-required' |
| 61 |
], |
| 62 |
'properties': { |
| 63 |
'meta_name_value' : 'last_name' |
| 64 |
} |
| 65 |
}, |
| 66 |
|
| 67 |
'Default - Nickname': { 'show_rows' : [ |
| 68 |
'.row-field-title', |
| 69 |
'.row-meta-name', |
| 70 |
'.row-description', |
| 71 |
'.row-default-value', |
| 72 |
'.row-required' |
| 73 |
], |
| 74 |
'properties': { |
| 75 |
'meta_name_value' : 'nickname' |
| 76 |
}, |
| 77 |
'required' : [ |
| 78 |
true |
| 79 |
] |
| 80 |
}, |
| 81 |
|
| 82 |
'Default - E-mail': { 'show_rows' : [ |
| 83 |
'.row-field-title', |
| 84 |
'.row-description', |
| 85 |
'.row-default-value', |
| 86 |
'.row-required' |
| 87 |
], |
| 88 |
'properties': { |
| 89 |
'meta_name_value' : '' |
| 90 |
}, |
| 91 |
'required' : [ |
| 92 |
true |
| 93 |
] |
| 94 |
}, |
| 95 |
|
| 96 |
'Default - Website': { 'show_rows' : [ |
| 97 |
'.row-field-title', |
| 98 |
'.row-description', |
| 99 |
'.row-default-value', |
| 100 |
'.row-required' |
| 101 |
], |
| 102 |
'properties': { |
| 103 |
'meta_name_value' : '' |
| 104 |
} |
| 105 |
}, |
| 106 |
|
| 107 |
'Default - AIM': { 'show_rows' : [ |
| 108 |
'.row-field-title', |
| 109 |
'.row-meta-name', |
| 110 |
'.row-description', |
| 111 |
'.row-default-value', |
| 112 |
'.row-required' |
| 113 |
], |
| 114 |
'properties': { |
| 115 |
'meta_name_value' : 'aim' |
| 116 |
} |
| 117 |
}, |
| 118 |
|
| 119 |
'Default - Yahoo IM': { 'show_rows' : [ |
| 120 |
'.row-field-title', |
| 121 |
'.row-meta-name', |
| 122 |
'.row-description', |
| 123 |
'.row-default-value', |
| 124 |
'.row-required' |
| 125 |
], |
| 126 |
'properties': { |
| 127 |
'meta_name_value' : 'yim' |
| 128 |
} |
| 129 |
}, |
| 130 |
|
| 131 |
'Default - Jabber / Google Talk': { 'show_rows' : [ |
| 132 |
'.row-field-title', |
| 133 |
'.row-meta-name', |
| 134 |
'.row-description', |
| 135 |
'.row-default-value', |
| 136 |
'.row-required' |
| 137 |
], |
| 138 |
'properties': { |
| 139 |
'meta_name_value' : 'jabber' |
| 140 |
} |
| 141 |
}, |
| 142 |
|
| 143 |
'Default - Password': { 'show_rows' : [ |
| 144 |
'.row-field-title', |
| 145 |
'.row-description', |
| 146 |
'.row-required', |
| 147 |
'.row-ask-current-password' |
| 148 |
], |
| 149 |
'properties': { |
| 150 |
'meta_name_value' : '' |
| 151 |
}, |
| 152 |
'required' : [ |
| 153 |
true |
| 154 |
] |
| 155 |
}, |
| 156 |
|
| 157 |
'Default - Repeat Password': { 'show_rows' : [ |
| 158 |
'.row-field-title', |
| 159 |
'.row-description', |
| 160 |
'.row-required' |
| 161 |
], |
| 162 |
'properties': { |
| 163 |
'meta_name_value' : '' |
| 164 |
}, |
| 165 |
'required' : [ |
| 166 |
true |
| 167 |
] |
| 168 |
}, |
| 169 |
|
| 170 |
'Default - Biographical Info': { 'show_rows' : [ |
| 171 |
'.row-field-title', |
| 172 |
'.row-meta-name', |
| 173 |
'.row-description', |
| 174 |
'.row-row-count', |
| 175 |
'.row-default-content', |
| 176 |
'.row-required' |
| 177 |
], |
| 178 |
'properties': { |
| 179 |
'meta_name_value' : 'description' |
| 180 |
} |
| 181 |
}, |
| 182 |
|
| 183 |
'Default - Display name publicly as': { 'show_rows' : [ |
| 184 |
'.row-field-title', |
| 185 |
'.row-description', |
| 186 |
'.row-default-value', |
| 187 |
'.row-required' |
| 188 |
], |
| 189 |
'properties': { |
| 190 |
'meta_name_value' : '' |
| 191 |
} |
| 192 |
}, |
| 193 |
|
| 194 |
'Default - Blog Details': { 'show_rows' : [ |
| 195 |
'.row-field-title', |
| 196 |
'.row-description' |
| 197 |
], |
| 198 |
'properties': { |
| 199 |
'meta_name_value' : '' |
| 200 |
} |
| 201 |
}, |
| 202 |
|
| 203 |
'GDPR Checkbox': { 'show_rows' : [ |
| 204 |
'.row-field-title', |
| 205 |
'.row-meta-name', |
| 206 |
'.row-description', |
| 207 |
'.row-required', |
| 208 |
'.row-overwrite-existing' |
| 209 |
], |
| 210 |
'properties': { |
| 211 |
'meta_name_value' : 'user_consent_gdpr', |
| 212 |
'field_title' : wppb_fields_strings.gdpr_title, |
| 213 |
'description' : wppb_fields_strings.gdpr_description |
| 214 |
}, |
| 215 |
'required' : [ |
| 216 |
true |
| 217 |
] |
| 218 |
}, |
| 219 |
'GDPR Delete Button': { 'show_rows' : [ |
| 220 |
'.row-field-title', |
| 221 |
'.row-description', |
| 222 |
], |
| 223 |
'properties': { |
| 224 |
'meta_name_value' : '' |
| 225 |
} |
| 226 |
}, |
| 227 |
|
| 228 |
'Heading': { 'show_rows' : [ |
| 229 |
'.row-field-title', |
| 230 |
'.row-description', |
| 231 |
'.row-heading-tag' |
| 232 |
], |
| 233 |
'properties': { |
| 234 |
'meta_name_value' : '' |
| 235 |
} |
| 236 |
}, |
| 237 |
|
| 238 |
'Input': { 'show_rows' : [ |
| 239 |
'.row-field-title', |
| 240 |
'.row-meta-name', |
| 241 |
'.row-description', |
| 242 |
'.row-default-value', |
| 243 |
'.row-required', |
| 244 |
'.row-overwrite-existing' |
| 245 |
] |
| 246 |
}, |
| 247 |
|
| 248 |
'Email': { 'show_rows' : [ |
| 249 |
'.row-field-title', |
| 250 |
'.row-meta-name', |
| 251 |
'.row-description', |
| 252 |
'.row-default-value', |
| 253 |
'.row-required', |
| 254 |
'.row-overwrite-existing' |
| 255 |
] |
| 256 |
}, |
| 257 |
'Email Confirmation': { 'show_rows' : [ |
| 258 |
'.row-field-title', |
| 259 |
'.row-field', |
| 260 |
'.row-description', |
| 261 |
'.row-required' |
| 262 |
], |
| 263 |
'required' : [ |
| 264 |
true |
| 265 |
], |
| 266 |
'properties': { |
| 267 |
'meta_name_value' : '' |
| 268 |
} |
| 269 |
}, |
| 270 |
'URL': { 'show_rows' : [ |
| 271 |
'.row-field-title', |
| 272 |
'.row-meta-name', |
| 273 |
'.row-description', |
| 274 |
'.row-default-value', |
| 275 |
'.row-required', |
| 276 |
'.row-overwrite-existing' |
| 277 |
] |
| 278 |
}, |
| 279 |
|
| 280 |
'Number': { 'show_rows' : [ |
| 281 |
'.row-field-title', |
| 282 |
'.row-meta-name', |
| 283 |
'.row-description', |
| 284 |
'.row-default-value', |
| 285 |
'.row-min-number-value', |
| 286 |
'.row-max-number-value', |
| 287 |
'.row-number-step-value', |
| 288 |
'.row-required', |
| 289 |
'.row-overwrite-existing' |
| 290 |
] |
| 291 |
}, |
| 292 |
'Input (Hidden)': { 'show_rows' : [ |
| 293 |
'.row-field-title', |
| 294 |
'.row-meta-name', |
| 295 |
'.row-description', |
| 296 |
'.row-default-value', |
| 297 |
'.row-overwrite-existing' |
| 298 |
] |
| 299 |
}, |
| 300 |
'International Telephone Input': { 'show_rows' : [ |
| 301 |
'.row-field-title', |
| 302 |
'.row-meta-name', |
| 303 |
'.row-description', |
| 304 |
'.row-default-value', |
| 305 |
'.row-initial-country', |
| 306 |
'.row-preferred-countries', |
| 307 |
'.row-excluded-countries', |
| 308 |
'.row-national-mode', |
| 309 |
'.row-hide-flags', |
| 310 |
'.row-overwrite-existing', |
| 311 |
'.row-required' |
| 312 |
] |
| 313 |
}, |
| 314 |
'Language': { 'show_rows' : [ |
| 315 |
'.row-field-title', |
| 316 |
'.row-meta-name', |
| 317 |
'.row-description', |
| 318 |
'.row-default-value', |
| 319 |
'.row-overwrite-existing' |
| 320 |
] |
| 321 |
}, |
| 322 |
|
| 323 |
'Textarea': { 'show_rows' : [ |
| 324 |
'.row-field-title', |
| 325 |
'.row-meta-name', |
| 326 |
'.row-description', |
| 327 |
'.row-default-content', |
| 328 |
'.row-required', |
| 329 |
'.row-row-count', |
| 330 |
'.row-overwrite-existing' |
| 331 |
] |
| 332 |
}, |
| 333 |
'WYSIWYG': { 'show_rows' : [ |
| 334 |
'.row-field-title', |
| 335 |
'.row-meta-name', |
| 336 |
'.row-description', |
| 337 |
'.row-default-content', |
| 338 |
'.row-required', |
| 339 |
'.row-overwrite-existing' |
| 340 |
] |
| 341 |
}, |
| 342 |
'Phone': { 'show_rows' : [ |
| 343 |
'.row-field-title', |
| 344 |
'.row-meta-name', |
| 345 |
'.row-description', |
| 346 |
'.row-phone-format', |
| 347 |
'.row-required', |
| 348 |
'.row-overwrite-existing' |
| 349 |
] |
| 350 |
}, |
| 351 |
'Select': { 'show_rows' : [ |
| 352 |
'.row-field-title', |
| 353 |
'.row-meta-name', |
| 354 |
'.row-description', |
| 355 |
'.row-default-option', |
| 356 |
'.row-required', |
| 357 |
'.row-overwrite-existing', |
| 358 |
'.row-options', |
| 359 |
'.row-labels' |
| 360 |
] |
| 361 |
}, |
| 362 |
'Select (Multiple)': { 'show_rows' : [ |
| 363 |
'.row-field-title', |
| 364 |
'.row-meta-name', |
| 365 |
'.row-description', |
| 366 |
'.row-default-options', |
| 367 |
'.row-required', |
| 368 |
'.row-overwrite-existing', |
| 369 |
'.row-options', |
| 370 |
'.row-labels' |
| 371 |
] |
| 372 |
}, |
| 373 |
|
| 374 |
'Select (Country)': { 'show_rows' : [ |
| 375 |
'.row-field-title', |
| 376 |
'.row-meta-name', |
| 377 |
'.row-description', |
| 378 |
'.row-default-option-country', |
| 379 |
'.row-required', |
| 380 |
'.row-overwrite-existing' |
| 381 |
] |
| 382 |
}, |
| 383 |
|
| 384 |
'Select (Currency)': { 'show_rows' : [ |
| 385 |
'.row-field-title', |
| 386 |
'.row-meta-name', |
| 387 |
'.row-description', |
| 388 |
'.row-show-currency-symbol', |
| 389 |
'.row-default-option-currency', |
| 390 |
'.row-required', |
| 391 |
'.row-overwrite-existing' |
| 392 |
] |
| 393 |
}, |
| 394 |
|
| 395 |
'Select (Timezone)': { 'show_rows' : [ |
| 396 |
'.row-field-title', |
| 397 |
'.row-meta-name', |
| 398 |
'.row-description', |
| 399 |
'.row-default-option-timezone', |
| 400 |
'.row-required', |
| 401 |
'.row-overwrite-existing' |
| 402 |
] |
| 403 |
}, |
| 404 |
'Select (CPT)': { 'show_rows' : [ |
| 405 |
'.row-field-title', |
| 406 |
'.row-meta-name', |
| 407 |
'.row-description', |
| 408 |
'.row-default-option', |
| 409 |
'.row-cpt', |
| 410 |
'.row-required', |
| 411 |
'.row-overwrite-existing' |
| 412 |
] |
| 413 |
}, |
| 414 |
'Select (Taxonomy)': { 'show_rows' : [ |
| 415 |
'.row-field-title', |
| 416 |
'.row-meta-name', |
| 417 |
'.row-description', |
| 418 |
'.row-default-option', |
| 419 |
'.row-taxonomy', |
| 420 |
'.row-required', |
| 421 |
'.row-overwrite-existing' |
| 422 |
] |
| 423 |
}, |
| 424 |
"Select2": { 'show_rows' : [ |
| 425 |
'.row-field-title', |
| 426 |
'.row-meta-name', |
| 427 |
'.row-description', |
| 428 |
'.row-default-option', |
| 429 |
'.row-required', |
| 430 |
'.row-overwrite-existing', |
| 431 |
'.row-options', |
| 432 |
'.row-labels', |
| 433 |
'.row-visibility', |
| 434 |
'.row-user-role-visibility', |
| 435 |
'.row-location-visibility' |
| 436 |
] |
| 437 |
}, |
| 438 |
"Select2 (Multiple)": { 'show_rows' : [ |
| 439 |
'.row-field-title', |
| 440 |
'.row-meta-name', |
| 441 |
'.row-description', |
| 442 |
'.row-default-options', |
| 443 |
'.row-required', |
| 444 |
'.row-overwrite-existing', |
| 445 |
'.row-options', |
| 446 |
'.row-labels', |
| 447 |
'.row-select2-multiple-limit', |
| 448 |
'.row-select2-multiple-tags', |
| 449 |
'.row-visibility', |
| 450 |
'.row-user-role-visibility', |
| 451 |
'.row-location-visibility' |
| 452 |
] |
| 453 |
}, |
| 454 |
'Honeypot': { 'show_rows' : [ |
| 455 |
'.row-field-title' |
| 456 |
], |
| 457 |
'properties': { |
| 458 |
'meta_name_value' : 'honeypot', |
| 459 |
'field_title' : wppb_fields_strings.honeypot_title |
| 460 |
} |
| 461 |
}, |
| 462 |
'Checkbox': { 'show_rows' : [ |
| 463 |
'.row-field-title', |
| 464 |
'.row-meta-name', |
| 465 |
'.row-description', |
| 466 |
'.row-default-options', |
| 467 |
'.row-required', |
| 468 |
'.row-overwrite-existing', |
| 469 |
'.row-options', |
| 470 |
'.row-labels' |
| 471 |
] |
| 472 |
}, |
| 473 |
|
| 474 |
'Checkbox (Terms and Conditions)': { 'show_rows' : [ |
| 475 |
'.row-field-title', |
| 476 |
'.row-meta-name', |
| 477 |
'.row-description', |
| 478 |
'.row-required', |
| 479 |
'.row-overwrite-existing' |
| 480 |
], |
| 481 |
'required' : [ |
| 482 |
true |
| 483 |
] |
| 484 |
}, |
| 485 |
|
| 486 |
'Radio': { 'show_rows' : [ |
| 487 |
'.row-field-title', |
| 488 |
'.row-meta-name', |
| 489 |
'.row-description', |
| 490 |
'.row-default-option', |
| 491 |
'.row-required', |
| 492 |
'.row-overwrite-existing', |
| 493 |
'.row-options', |
| 494 |
'.row-labels' |
| 495 |
] |
| 496 |
}, |
| 497 |
|
| 498 |
'Upload': { 'show_rows' : [ |
| 499 |
'.row-field-title', |
| 500 |
'.row-meta-name', |
| 501 |
'.row-description', |
| 502 |
'.row-simple-upload', |
| 503 |
'.row-allowed-extensions', |
| 504 |
'.row-required', |
| 505 |
'.row-overwrite-existing', |
| 506 |
'.row-allowed-upload-extensions', |
| 507 |
'.row-max-file-size' |
| 508 |
] |
| 509 |
}, |
| 510 |
|
| 511 |
'Avatar': { 'show_rows' : [ |
| 512 |
'.row-field-title', |
| 513 |
'.row-meta-name', |
| 514 |
'.row-description', |
| 515 |
'.row-simple-upload', |
| 516 |
'.row-allowed-image-extensions', |
| 517 |
'.row-avatar-size', |
| 518 |
'.row-max-file-size', |
| 519 |
'.row-required', |
| 520 |
'.row-overwrite-existing' |
| 521 |
] |
| 522 |
}, |
| 523 |
|
| 524 |
'Datepicker': { 'show_rows' : [ |
| 525 |
'.row-field-title', |
| 526 |
'.row-meta-name', |
| 527 |
'.row-description', |
| 528 |
'.row-default-value', |
| 529 |
'.row-required', |
| 530 |
'.row-date-format', |
| 531 |
'.row-overwrite-existing' |
| 532 |
] |
| 533 |
}, |
| 534 |
|
| 535 |
|
| 536 |
'Timepicker': { 'show_rows' : [ |
| 537 |
'.row-field-title', |
| 538 |
'.row-meta-name', |
| 539 |
'.row-description', |
| 540 |
'.row-required', |
| 541 |
'.row-time-format', |
| 542 |
'.row-overwrite-existing' |
| 543 |
] |
| 544 |
}, |
| 545 |
|
| 546 |
'Colorpicker': { 'show_rows' : [ |
| 547 |
'.row-field-title', |
| 548 |
'.row-meta-name', |
| 549 |
'.row-description', |
| 550 |
'.row-required', |
| 551 |
'.row-overwrite-existing' |
| 552 |
] |
| 553 |
}, |
| 554 |
|
| 555 |
|
| 556 |
'Validation': { 'show_rows' : [ |
| 557 |
'.row-field-title', |
| 558 |
'.row-meta-name', |
| 559 |
'.row-description', |
| 560 |
'.row-validation-possible-values', |
| 561 |
'.row-custom-error-message', |
| 562 |
'.row-required' |
| 563 |
], |
| 564 |
'required' : [ |
| 565 |
true |
| 566 |
] |
| 567 |
}, |
| 568 |
|
| 569 |
'reCAPTCHA': { 'show_rows' : [ |
| 570 |
'.row-field-title', |
| 571 |
'.row-description', |
| 572 |
'.row-recaptcha-type', |
| 573 |
'.row-public-key', |
| 574 |
'.row-private-key', |
| 575 |
'.row-captcha-pb-forms', |
| 576 |
'.row-captcha-wp-forms', |
| 577 |
'.row-required' |
| 578 |
], |
| 579 |
'required' : [ |
| 580 |
true |
| 581 |
], |
| 582 |
'properties': { |
| 583 |
'meta_name_value' : '' |
| 584 |
} |
| 585 |
}, |
| 586 |
|
| 587 |
'Turnstile': { 'show_rows' : [ |
| 588 |
'.row-field-title', |
| 589 |
'.row-description', |
| 590 |
'.row-theme', |
| 591 |
'.row-turnstile-site-key', |
| 592 |
'.row-turnstile-secret-key', |
| 593 |
'.row-turnstile-pb-forms', |
| 594 |
'.row-turnstile-wp-forms', |
| 595 |
'.row-required' |
| 596 |
], |
| 597 |
'required' : [ |
| 598 |
true |
| 599 |
], |
| 600 |
'properties': { |
| 601 |
'meta_name_value' : '' |
| 602 |
} |
| 603 |
}, |
| 604 |
|
| 605 |
'Select (User Role)': { 'show_rows' : [ |
| 606 |
'.row-field-title', |
| 607 |
'.row-description', |
| 608 |
'.row-user-roles', |
| 609 |
'.row-user-roles-on-edit-profile', |
| 610 |
'.row-required' |
| 611 |
], |
| 612 |
'properties': { |
| 613 |
'meta_name_value' : '' |
| 614 |
} |
| 615 |
}, |
| 616 |
|
| 617 |
'Map': { 'show_rows' : [ |
| 618 |
'.row-field-title', |
| 619 |
'.row-meta-name', |
| 620 |
'.row-description', |
| 621 |
'.row-map-api-key', |
| 622 |
'.row-map-default-lat', |
| 623 |
'.row-map-default-lng', |
| 624 |
'.row-map-default-zoom', |
| 625 |
'.row-map-height', |
| 626 |
'.row-map-pins-load-type', |
| 627 |
'.row-map-pagination-number', |
| 628 |
'.row-map-bubble-fields', |
| 629 |
'.row-required', |
| 630 |
'.row-overwrite-existing' |
| 631 |
], |
| 632 |
'properties': { |
| 633 |
'meta_name_value' : 'map' |
| 634 |
} |
| 635 |
}, |
| 636 |
|
| 637 |
'Additional Map': { 'show_rows' : [ |
| 638 |
'.row-field-title', |
| 639 |
'.row-meta-name', |
| 640 |
'.row-description', |
| 641 |
'.row-map-default-lat', |
| 642 |
'.row-map-default-lng', |
| 643 |
'.row-map-default-zoom', |
| 644 |
'.row-map-height', |
| 645 |
'.row-required', |
| 646 |
'.row-overwrite-existing' |
| 647 |
] |
| 648 |
}, |
| 649 |
|
| 650 |
'HTML': { 'show_rows' : [ |
| 651 |
'.row-field-title', |
| 652 |
'.row-description', |
| 653 |
'.row-html-content' |
| 654 |
], |
| 655 |
'properties': { |
| 656 |
'meta_name_value' : '' |
| 657 |
} |
| 658 |
} |
| 659 |
} |
| 660 |
var fields_to_show = [ |
| 661 |
'.row-field-title', |
| 662 |
'.row-field', |
| 663 |
'.row-meta-name', |
| 664 |
'.row-required' |
| 665 |
] |
| 666 |
|
| 667 |
function wppb_hide_properties_for_already_added_fields( container_name ){ |
| 668 |
|
| 669 |
jQuery( container_name + ' tr:not(.update_container_wppb_manage_fields)' ).each(function() { |
| 670 |
|
| 671 |
field = jQuery('.row-field pre', this).text(); |
| 672 |
|
| 673 |
jQuery( 'li', this ).each(function() { |
| 674 |
var class_name = ''; |
| 675 |
|
| 676 |
class_name = jQuery(this).attr('class'); |
| 677 |
jQuery(this).hide(); |
| 678 |
|
| 679 |
if ( ( field in fields ) ){ |
| 680 |
var to_show = fields[field]['show_rows']; |
| 681 |
for (var key in to_show) { |
| 682 |
if ('.'+class_name == fields_to_show[key]){ |
| 683 |
jQuery(this).show(); |
| 684 |
} |
| 685 |
} |
| 686 |
} |
| 687 |
|
| 688 |
}); |
| 689 |
}); |
| 690 |
|
| 691 |
/* hide the delete button for username,password and email fields */ |
| 692 |
jQuery( container_name + ' ' + '.element_type_default-e-mail .mbdelete,' + ' ' + container_name + ' ' + '.element_type_default-password .mbdelete,' + ' ' + container_name + ' ' + '.element_type_default-username .mbdelete' ).hide(); // PB specific line |
| 693 |
} |
| 694 |
|
| 695 |
|
| 696 |
|
| 697 |
function wppb_hide_all ( container_name ){ |
| 698 |
jQuery( container_name + ' ' + '.mb-list-entry-fields > li' ).each(function() { |
| 699 |
if ( !( ( jQuery(this).hasClass('row-field') ) || ( jQuery(this).children().hasClass('button-primary') ) ) || jQuery(this).hasClass('row-rpf-button') ){ |
| 700 |
jQuery(this).hide(); |
| 701 |
} |
| 702 |
}); |
| 703 |
|
| 704 |
jQuery( container_name + ' ' + '.mb-list-entry-fields .button-primary' ).attr( 'disabled', true ); |
| 705 |
|
| 706 |
jQuery( container_name + ' ' + '.element_type_default-e-mail .mbdelete,' + ' ' + container_name + ' ' + '.element_type_default-password .mbdelete,' + ' ' + container_name + ' ' + '.element_type_default-username .mbdelete' ).hide(); // PB specific line |
| 707 |
jQuery( container_name + ' ' + '.element_type_default-e-mail #field' + ', ' + container_name + ' ' + '.element_type_default-password #field' + ', ' + container_name + ' ' + '.element_type_default-username #field' + ', ' + container_name + ' ' + '.element_type_default-e-mail #required' + ', ' + container_name + ' ' + '.element_type_default-password #required,' + container_name + ' ' + '.element_type_default-username #required,' + container_name + ' ' + '.element_type_checkbox-terms-and-conditions #required,' + container_name + ' ' + '.element_type_recaptcha #required,' + container_name + ' ' + '.element_type_turnstile #required,' + container_name + ' ' + '.element_type_woocommerce-customer-billing-address #field, ' + container_name + ' ' + '.element_type_woocommerce-customer-shipping-address #field').attr( 'disabled', true ); // PB specific line |
| 708 |
|
| 709 |
} |
| 710 |
|
| 711 |
|
| 712 |
function wppb_disable_add_entry_button( container_name ){ |
| 713 |
jQuery( container_name + ' ' + '.mb-list-entry-fields .button-primary' ).each( function(){ |
| 714 |
|
| 715 |
//jQuery(this).data('myclick', this.onclick ); |
| 716 |
this.onclick = function(event) { |
| 717 |
if ( jQuery(this).attr( 'disabled' ) ) { |
| 718 |
return false; |
| 719 |
} |
| 720 |
/* changed this in version 2.5.0 because the commented line generated stack exceeded error when multiple fields were opened with edit */ |
| 721 |
if ( typeof( event.currentTarget ) == 'undefined' ){ |
| 722 |
// Repeater field triggered the click event of the "Add Field" / "Save changes" buttons, so the onclick attribute is in the target, not currentTarget |
| 723 |
eval(event.target.getAttribute('onclick')); |
| 724 |
}else { |
| 725 |
// normal Manage Fields Add Field button press |
| 726 |
eval(event.currentTarget.getAttribute('onclick')); |
| 727 |
} |
| 728 |
|
| 729 |
//jQuery(this).data('myclick').call(this, event || window.event); |
| 730 |
}; |
| 731 |
}); |
| 732 |
|
| 733 |
} |
| 734 |
|
| 735 |
|
| 736 |
function wppb_edit_form_properties( container_name, element_id ){ |
| 737 |
wppb_hide_all ( container_name ); |
| 738 |
wppb_disable_add_entry_button ( container_name ); |
| 739 |
|
| 740 |
field = jQuery( container_name + ' #' + element_id + ' ' + '#field' ).val(); |
| 741 |
|
| 742 |
if ( ( field in fields ) ){ |
| 743 |
var to_show = fields[ field.trim() ]['show_rows']; |
| 744 |
for (var key in to_show) |
| 745 |
jQuery( container_name + ' #' + element_id + ' ' + to_show[key] ).show(); |
| 746 |
|
| 747 |
var properties = fields[ field.trim() ]['properties']; |
| 748 |
if( typeof properties !== 'undefined' && properties ) { |
| 749 |
for( var key in properties ) { |
| 750 |
if( typeof properties['meta_name_value'] !== 'undefined' ) { |
| 751 |
jQuery( container_name + ' ' + '#meta-name').attr( 'readonly', true ); |
| 752 |
} |
| 753 |
} |
| 754 |
} |
| 755 |
|
| 756 |
jQuery( container_name + ' ' + '.mb-list-entry-fields .button-primary' ).removeAttr( 'disabled' ); |
| 757 |
|
| 758 |
//Handle user role sorting |
| 759 |
wppb_handle_user_role_field( container_name ); |
| 760 |
} |
| 761 |
} |
| 762 |
|
| 763 |
|
| 764 |
function wppb_display_needed_fields( index, container_name, current_field_select ){ |
| 765 |
|
| 766 |
var show_rows = fields[index.trim()]['show_rows']; |
| 767 |
for (var key in show_rows) { |
| 768 |
jQuery( show_rows[key], jQuery( current_field_select ).parents( '.mb-list-entry-fields' ) ).show(); |
| 769 |
} |
| 770 |
|
| 771 |
var properties = fields[index.trim()]['properties']; |
| 772 |
if ( ( ( typeof properties !== 'undefined' ) && ( properties ) ) ) { //the extra (second) condition is a particular case since only the username is defined in our global array that has no meta-name |
| 773 |
for (var key in properties) { |
| 774 |
if ( ( typeof properties['meta_name_value'] !== 'undefined' ) ){ |
| 775 |
jQuery( container_name + ' ' + '#meta-name' ).val( properties['meta_name_value'] ); |
| 776 |
jQuery( container_name + ' ' + '#meta-name' ).attr( 'readonly', true ); |
| 777 |
} |
| 778 |
if ( ( typeof properties['field_title'] !== 'undefined' ) ){ |
| 779 |
jQuery( container_name + ' ' + '#field-title' ).val( properties['field_title'] ); |
| 780 |
} |
| 781 |
if ( ( typeof properties['description'] !== 'undefined' ) ){ |
| 782 |
jQuery( container_name + ' ' + '#description' ).val( properties['description'] ); |
| 783 |
} |
| 784 |
} |
| 785 |
|
| 786 |
}else{ |
| 787 |
/* meta value when editing a field shouldn't change so we take it from the current entered value which is displayed above the edit form */ |
| 788 |
if( jQuery( current_field_select).parents('.update_container_wppb_manage_fields').length != 0 ){ |
| 789 |
meta_value = jQuery( '.row-meta-name pre', jQuery( current_field_select).parents( '.update_container_wppb_manage_fields' ).prev() ).text(); |
| 790 |
} |
| 791 |
/* for the add form it should change */ |
| 792 |
else{ |
| 793 |
|
| 794 |
// Repeater fields have different meta name prefixes, stored in the GET parameter 'wppb_field_metaname_prefix'. |
| 795 |
var get_parameter_prefix = wppb_get_parameter_by_name( 'wppb_field_metaname_prefix' ); |
| 796 |
var field_metaname_prefix = ( get_parameter_prefix == null ) ? 'custom_field' : get_parameter_prefix; |
| 797 |
|
| 798 |
numbers = new Array(); |
| 799 |
jQuery( '#container_wppb_manage_fields .row-meta-name pre').each(function(){ |
| 800 |
meta_name = jQuery(this).text(); |
| 801 |
if( meta_name.indexOf( field_metaname_prefix ) !== -1 ){ |
| 802 |
var meta_name = meta_name.replace(field_metaname_prefix, '' ); |
| 803 |
/* we should have an underscore present in custom_field_# so remove it */ |
| 804 |
meta_name = meta_name.replace('_', '' ); |
| 805 |
|
| 806 |
if( isNaN( meta_name ) ){ |
| 807 |
meta_name = Math.floor((Math.random() * 200) + 100); |
| 808 |
} |
| 809 |
numbers.push( parseInt(meta_name) ); |
| 810 |
} |
| 811 |
|
| 812 |
}); |
| 813 |
if( numbers.length > 0 ){ |
| 814 |
numbers.sort( function(a, b){return a-b} ); |
| 815 |
numbers.reverse(); |
| 816 |
meta_number = parseInt(numbers[0])+1; |
| 817 |
} |
| 818 |
else |
| 819 |
meta_number = 1; |
| 820 |
|
| 821 |
meta_value = field_metaname_prefix + '_' + meta_number; |
| 822 |
} |
| 823 |
|
| 824 |
jQuery( container_name + ' ' + '#meta-name' ).val( meta_value ); |
| 825 |
jQuery( container_name + ' ' + '#meta-name' ).attr( 'readonly', false ); |
| 826 |
} |
| 827 |
|
| 828 |
//Handle user role sorting |
| 829 |
wppb_handle_user_role_field( container_name ); |
| 830 |
|
| 831 |
var set_required = fields[index.trim()]['required']; |
| 832 |
if ( ( typeof set_required !== 'undefined' ) && ( set_required ) ){ |
| 833 |
jQuery( container_name + ' ' + '#required' ).val( 'Yes' ); |
| 834 |
jQuery( container_name + ' ' + '#required' ).attr( 'disabled', true ); |
| 835 |
|
| 836 |
}else{ |
| 837 |
jQuery( container_name + ' ' + '#required' ).val( 'No' ); |
| 838 |
jQuery( container_name + ' ' + '#required' ).attr( 'disabled', false ); |
| 839 |
} |
| 840 |
|
| 841 |
jQuery( container_name + ' ' + '.mb-list-entry-fields .button-primary' ).removeAttr( 'disabled' ); |
| 842 |
} |
| 843 |
|
| 844 |
|
| 845 |
function wppb_get_parameter_by_name(name, url) { |
| 846 |
if (!url) url = window.location.href; |
| 847 |
name = name.replace(/[\[\]]/g, "\\$&"); |
| 848 |
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"), |
| 849 |
results = regex.exec(url); |
| 850 |
if (!results) return null; |
| 851 |
if (!results[2]) return null; |
| 852 |
return decodeURIComponent(results[2].replace(/\+/g, " ")); |
| 853 |
} |
| 854 |
|
| 855 |
/* |
| 856 |
* Function that handles the sorting of the user roles from the Select (User Role) |
| 857 |
* extra field |
| 858 |
* |
| 859 |
*/ |
| 860 |
function wppb_handle_user_role_field( container_name ) { |
| 861 |
|
| 862 |
jQuery( container_name + ' ' + '.row-user-roles .wck-checkboxes').sortable({ |
| 863 |
|
| 864 |
//Assign a custom handle for the drag and drop |
| 865 |
handle: '.sortable-handle', |
| 866 |
|
| 867 |
create: function( event, ui ) { |
| 868 |
|
| 869 |
//Add the custom handle for drag and drop |
| 870 |
jQuery(this).find('div').each( function() { |
| 871 |
jQuery(this).prepend('<span class="sortable-handle"></span>'); |
| 872 |
}); |
| 873 |
|
| 874 |
$sortOrderInput = jQuery(this).parents('.row-user-roles').siblings('.row-user-roles-sort-order').find('input[type=text]'); |
| 875 |
|
| 876 |
if( $sortOrderInput.val() == '' ) { |
| 877 |
jQuery(this).find('input[type=checkbox]').each( function() { |
| 878 |
$sortOrderInput.val( $sortOrderInput.val() + ', ' + jQuery(this).val() ); |
| 879 |
}); |
| 880 |
} else { |
| 881 |
sortOrderElements = $sortOrderInput.val().split(', '); |
| 882 |
sortOrderElements.shift(); |
| 883 |
|
| 884 |
for( var i=0; i < sortOrderElements.length; i++ ) { |
| 885 |
jQuery( container_name + ' ' + '.row-user-roles .wck-checkboxes').append( jQuery( container_name + ' ' + '.row-user-roles .wck-checkboxes input[value="' + sortOrderElements[i] + '"]').parent().parent().get(0) ); |
| 886 |
} |
| 887 |
} |
| 888 |
}, |
| 889 |
|
| 890 |
update: function( event, ui ) { |
| 891 |
$sortOrderInput = ui.item.parents('.row-user-roles').siblings('.row-user-roles-sort-order').find('input[type=text]'); |
| 892 |
$sortOrderInput.val(''); |
| 893 |
|
| 894 |
ui.item.parent().find('input[type=checkbox]').each( function() { |
| 895 |
$sortOrderInput.val( $sortOrderInput.val() + ', ' + jQuery(this).val() ); |
| 896 |
}); |
| 897 |
} |
| 898 |
}); |
| 899 |
} |
| 900 |
|
| 901 |
function wppb_initialize_live_select( container_name ){ |
| 902 |
wppb_hide_all( container_name ); |
| 903 |
jQuery(document).on( 'change', container_name + ' ' + '.mb-list-entry-fields #field', function () { |
| 904 |
field = jQuery(this).val(); |
| 905 |
|
| 906 |
if ( field != ''){ |
| 907 |
wppb_hide_all( container_name ); |
| 908 |
wppb_display_needed_fields( field, container_name, this ); |
| 909 |
}else{ |
| 910 |
wppb_hide_all( container_name ); |
| 911 |
} |
| 912 |
}); |
| 913 |
|
| 914 |
// Show the score threshold field only when reCAPTCHA v3 is selected |
| 915 |
jQuery( document ).on( 'change', container_name + ' ' + '.mb-list-entry-fields #recaptcha-type', function () { |
| 916 |
if ( jQuery( this ).val() === 'v3' ){ |
| 917 |
jQuery( container_name + ' ' + '.row-score-threshold' ).show() |
| 918 |
} else { |
| 919 |
jQuery( container_name + ' ' + '.row-score-threshold' ).hide() |
| 920 |
} |
| 921 |
} ); |
| 922 |
} |
| 923 |
|
| 924 |
|
| 925 |
function wppb_enable_select2(container_name){ |
| 926 |
// Select2 initialization on manage fields. |
| 927 |
|
| 928 |
wppbSelect2.call( jQuery( container_name + ' #field'), { |
| 929 |
placeholder: 'Select an option', |
| 930 |
allowClear: true |
| 931 |
}); |
| 932 |
|
| 933 |
var $eventSelect = jQuery( container_name + ' #field'); |
| 934 |
$eventSelect.on("select2:open", function (e) { |
| 935 |
jQuery('#wppb_select2_overlay').fadeIn('100') |
| 936 |
}); |
| 937 |
$eventSelect.on("select2:close", function (e) { |
| 938 |
jQuery('#wppb_select2_overlay').hide(); |
| 939 |
}); |
| 940 |
} |
| 941 |
|
| 942 |
|
| 943 |
jQuery(function(){ |
| 944 |
wppb_initialize_live_select ( '#wppb_manage_fields' ); |
| 945 |
wppb_initialize_live_select ( '#container_wppb_manage_fields' ); |
| 946 |
|
| 947 |
wppb_hide_properties_for_already_added_fields( '#container_wppb_manage_fields' ); |
| 948 |
wppb_disable_add_entry_button ( '#wppb_manage_fields' ); |
| 949 |
|
| 950 |
var overlay = jQuery('<div id="wppb_select2_overlay"> </div>') |
| 951 |
overlay.appendTo(document.body) |
| 952 |
|
| 953 |
wppb_enable_select2('#wppb_manage_fields'); |
| 954 |
|
| 955 |
// Show the score threshold field only when reCAPTCHA v3 is selected |
| 956 |
jQuery('html').on('wpbFormMetaLoaded', function(e, elem) { |
| 957 |
jQuery('.row-score-threshold input').each(function() { |
| 958 |
if ( jQuery(this).closest('.mb-list-entry-fields').find(".row-recaptcha-type :selected").val() === 'v3' ){ |
| 959 |
jQuery(this).closest('.row-score-threshold').show(); |
| 960 |
} else { |
| 961 |
jQuery(this).closest('.row-score-threshold').hide(); |
| 962 |
} |
| 963 |
}); |
| 964 |
}); |
| 965 |
}); |
| 966 |
|
| 967 |
// Custom functionality for sorting options (see the Map POIs attributes). |
| 968 |
(function ($) { |
| 969 |
window.SortSelCheck = { |
| 970 |
// Initiate the events and triggers. |
| 971 |
init: function () { |
| 972 |
SortSelCheck.assess(); |
| 973 |
SortSelCheck.listen(); |
| 974 |
}, |
| 975 |
|
| 976 |
// Listen for events. |
| 977 |
listen: function () { |
| 978 |
// Listen for the new element setup and trigger the expected custom event. |
| 979 |
$('.wck-add-form').on('change', function() { |
| 980 |
SortSelCheck.assess('wck-add-form'); |
| 981 |
}); |
| 982 |
}, |
| 983 |
|
| 984 |
// Assess the potential elements and configure these when possible. |
| 985 |
assess: function (elem) { |
| 986 |
var $elem = $('.wppb_sortable_checkboxes_wrap'); |
| 987 |
// console.log('assess triggerer ' + elem, $elem); |
| 988 |
$elem.each(function() { |
| 989 |
$rows = SortSelCheck.remake($(this)); |
| 990 |
SortSelCheck.attach($(this), $rows); |
| 991 |
}); |
| 992 |
}, |
| 993 |
|
| 994 |
// Configure the elements that form the sortable checkboxes options. |
| 995 |
remake: function ($field) { |
| 996 |
var $rows = $field.children('.wck-checkboxes'); |
| 997 |
if (!$rows.length) { |
| 998 |
$field.prepend('<div class="wck-checkboxes cozmoslabs-checkbox-list"> </div>'); |
| 999 |
var $rows = $field.children('.wck-checkboxes'); |
| 1000 |
} |
| 1001 |
if ($rows.length) { |
| 1002 |
SortSelCheck.sortable($rows); |
| 1003 |
} |
| 1004 |
return $rows; |
| 1005 |
}, |
| 1006 |
|
| 1007 |
// Attach the custom dropdown options as sortable checkboxes options. |
| 1008 |
attach: function ($field, $rows) { |
| 1009 |
var $ddwn = $field.children('.wppb_selector_for_sortable_checkbox'); |
| 1010 |
if ($ddwn.length) { |
| 1011 |
$ddwn.on('change', function() { |
| 1012 |
var val = $(this).val(); |
| 1013 |
if ('' !== val) { |
| 1014 |
$rows.append('<div class="cozmoslabs-chckbox-container"><input type="checkbox" name="' + $(this).data('list') + '" id="' + $(this).data('list') + '_' + val + '" value="' + val + '" checked="checked" class="mb-checkbox mb-field"><label for="' + $(this).data('list') + '_' + val + '">' + $(this).children('option').filter(':selected').text() + '</label></div>'); |
| 1015 |
$(this).children('option').filter(':selected').remove(); |
| 1016 |
SortSelCheck.sortable($rows); |
| 1017 |
} |
| 1018 |
}); |
| 1019 |
} |
| 1020 |
}, |
| 1021 |
|
| 1022 |
// Make sortable items from the list. |
| 1023 |
sortable: function ($list) { |
| 1024 |
var $items = $list.children('div'); |
| 1025 |
$items.addClass('wppb_manage_fields_sortables'); |
| 1026 |
$items.remove('em'); |
| 1027 |
$items.prepend('<em class="dashicons dashicons-menu"></em> '); |
| 1028 |
$list.sortable({ |
| 1029 |
items: '> div', |
| 1030 |
classes: {'ui-sortable': 'highlight'} |
| 1031 |
}); |
| 1032 |
}, |
| 1033 |
|
| 1034 |
}; |
| 1035 |
|
| 1036 |
$(document).ready(function () { |
| 1037 |
// Initialize the custom functionality. |
| 1038 |
SortSelCheck.init('init'); |
| 1039 |
|
| 1040 |
// Bind the event to the custom functionality. |
| 1041 |
$('html').on('wpbFormMetaLoaded', function(e, elem) { |
| 1042 |
SortSelCheck.assess(elem); |
| 1043 |
}); |
| 1044 |
}); |
| 1045 |
|
| 1046 |
})(jQuery); |
| 1047 |
|