How to use id.replace method in Cypress

Best JavaScript code snippet using cypress

ninja-forms-admin.js

Source:ninja-forms-admin.js Github

copy

Full Screen

...190 start: function(e, ui){191 var wp_editor_count = $(ui.item).find(".wp-editor-wrap").length;192 if(wp_editor_count > 0){193 $(ui.item).find(".wp-editor-wrap").each(function(){194 var ed_id = this.id.replace("wp-", "");195 ed_id = ed_id.replace("-wrap", "");196 tinyMCE.execCommand( 'mceRemoveControl', false, ed_id );197 });198 }199 },200 stop: function(e,ui) {201 /*202 if( $(ui.item).prop("tagName") == "A" ){203 //alert( $.data( document.body, 'test' ) );204 var el = $( "li.ninja-forms-no-nest:last" ).clone();205 $(ui.item).replaceWith(el);206 }207 */208 var wp_editor_count = $(ui.item).find(".wp-editor-wrap").length;209 if(wp_editor_count > 0){210 $(ui.item).find(".wp-editor-wrap").each(function(){211 var ed_id = this.id.replace("wp-", "");212 ed_id = ed_id.replace("-wrap", "");213 tinyMCE.execCommand( 'mceAddControl', true, ed_id );214 });215 }216 $(this).sortable("refresh");217 }218 }); 219 220 //Save the sortable list as an array when the save button is pressed221 $(".ninja-forms-save-data").click(function(event){222 //event.preventDefault();223 var order = $("#ninja_forms_field_list").sortable("toArray");224 $("#ninja_forms_field_order").val(order);225 });226 //Add New Field227 $(".ninja-forms-new-field").click(function(event){228 event.preventDefault();229 var limit = this.name.replace('_', '');230 var type = this.id;231 var form_id = $("#_form_id").val();232 if(limit != ''){233 var current_count = $("." + type + "-li").length;234 }else{235 var current_count = '';236 }237 if((limit != '' && current_count < limit) || limit == '' || current_count == '' || current_count == 0){238 239 $.post( ajaxurl, { type: type, form_id: form_id, action:"ninja_forms_new_field"}, ninja_forms_new_field_response );240 }else{241 $(this).addClass('disabled');242 }243 });244 //Listen to the Field Label and change the LI title and update select lists on KeyUp245 $(document).on( 'keyup', '.ninja-forms-field-label', function(){246 var field_id = this.id.replace("ninja_forms_field_", "");247 field_id = field_id.replace("_label", "");248 249 var label = this.value;250 label = ninja_forms_escape_html( label );251 if ( $.trim( label ) == '' ){252 label = $(this).parent().parent().parent().prev().find('.item-type:first').prop("innerHTML");253 }254 $("#ninja_forms_field_" + field_id + "_title").prop("innerHTML", label);255 if ( label.length > 15 ) {256 label = label.substring(0, 15); 257 label += '...';258 } 259 $(".ninja-forms-field-conditional-cr-field option[value='" + field_id + "']").each(function(){260 $(this).text(field_id + ' - ' + label);261 });262 $(".ninja-forms-calc-select option[value='" + field_id +"']").each(function(){263 $(this).text(field_id + ' - ' + label);264 });265 });266 //Show / Hide Help Textarea267 $(document).on( 'change', '.ninja-forms-show-help', function( event ){268 var field_id = this.id.replace("ninja_forms_field_", "");269 field_id = field_id.replace("_show_help", "");270 if(this.checked){271 $("#ninja_forms_field_" + field_id + "_help_span").show();272 }else{273 $("#ninja_forms_field_" + field_id + "_help_span").hide();274 }275 });276 277 // Delete Form JS278 $(".ninja-forms-delete-form").click(function(event){279 event.preventDefault();280 var form_id = this.id.replace('ninja_forms_delete_form_', '');281 var answer = confirm('Really delete this form? (Irreversible)');282 if(answer){283 $.post(ajaxurl, { form_id: form_id, action:"ninja_forms_delete_form"}, function(response){284 $("#ninja_forms_form_" + form_id + "_tr").css("background-color", "#FF0000").fadeOut('slow', function(){285 $(this).remove();286 });287 });288 }289 });290 291 //Remove Field292 $(document).on( 'click', '.ninja-forms-field-remove', function(event){293 event.preventDefault();294 var field_id = this.id.replace("ninja_forms_field_", "");295 field_id = field_id.replace("_remove", "");296 var answer = confirm("Remove this field? It will be removed even if you do not save.");297 if(answer){298 $.post(ajaxurl, { field_id: field_id, action:"ninja_forms_remove_field"}, function(){299 $("#ninja_forms_field_" + field_id).remove();300 $(document).trigger('removeField', [ field_id ]);301 $(".ninja-forms-field-conditional-cr-field").each(function(){302 $(this).children('option').each(function(){303 if(this.value == field_id){304 $(this).remove();305 }306 });307 });308 });309 }310 });311 //Delete individual submissions312 $(".ninja-forms-delete-sub").click(function(event){313 event.preventDefault();314 var sub_id = this.id.replace("ninja_forms_sub_", "");315 var answer = confirm("Permenantly delete this item?");316 if(answer){317 $.post(ajaxurl, { sub_id: sub_id, action:"ninja_forms_delete_sub"}, function(response){318 $("#ninja_forms_sub_" + sub_id + "_tr").css("background-color", "#FF0000").fadeOut('slow', function(){319 $(this).remove();320 });321 });322 }323 });324 /* * * End General JS * * */325 326 /* * * Field Specific JS * * * /327 328 /* Textbox Field JS */329 330 // Default Value331 $(document).on( 'change', '.ninja-forms-_text-default-value', function(){332 var id = this.id.replace('default_value_', '');333 if(this.value == '_custom'){334 $("#ninja_forms_field_" + id + "_default_value").val('');335 $("#default_value_label_" + id).show();336 $("#ninja_forms_field_" + id + "_default_value").focus();337 }else{338 $("#default_value_label_" + id).hide();339 $("#ninja_forms_field_" + id + "_default_value").val(this.value);340 }341 342 if(this.value != ''){343 $("#ninja_forms_field_" + id + "_datepicker").prop('checked', false);344 if(this.value != '_user_email'){345 $("#ninja_forms_field_" + id + "_email").prop("checked", false);346 $("#ninja_forms_field_" + id + "_send_email").prop("checked", false); 347 }348 }349 });350 351 // Input Mask352 $(document).on( 'change', '.ninja-forms-_text-mask', function(){353 var id = this.id.replace('mask_', '');354 if(this.value == '_custom'){355 $("#ninja_forms_field_" + id + "_mask").val(''); 356 $("#mask_label_" + id).show();357 $("#ninja_forms_field_" + id + "_mask").focus();358 }else{359 $("#mask_label_" + id).hide();360 $("#ninja_forms_field_" + id + "_mask").val(this.value);361 }362 363 if(this.value != ''){364 $("#ninja_forms_field_" + id + "_datepicker").prop('checked', false);365 $("#ninja_forms_field_" + id + "_email").prop("checked", false);366 $("#ninja_forms_field_" + id + "_send_email").prop("checked", false);367 }368 });369 //Input Mask Help370 $(document).on( 'click', '.ninja-forms-mask-help', function(event){371 event.preventDefault();372 if( !$("#tab-panel-mask_help").is(":visible") ){373 $("#tab-link-mask_help").find("a").click();374 $("#contextual-help-link").click().focus(); 375 }376 });377 378 // Datepicker379 $(document).on( 'change', '.ninja-forms-_text-datepicker', function(){380 var id = this.id.replace("ninja_forms_field_", "");381 id = id.replace("_datepicker", "");382 if(this.checked == true){383 //$("#ninja_forms_field_" + id + "_default_value").val("");384 $("#ninja_forms_field_" + id + "_mask").val("");385 $("#default_value_" + id).val("");386 $("#default_value_label_" + id).hide();387 $("#mask_" + id).val("");388 $("#mask_label_" + id).hide();389 $("#ninja_forms_field_" + id + "_email").prop("checked", false);390 $("#ninja_forms_field_" + id + "_send_email").prop("checked", false);391 $("#ninja_forms_field_" + id + "_from_email").prop("checked", false);392 }393 }); 394 395 // Email396 $(document).on( 'change', '.ninja-forms-_text-email', function(){397 var id = this.id.replace("ninja_forms_field_", "");398 id = id.replace("_email", "");399 if(this.checked == true){400 if( $("#ninja_forms_field_" + id + "_default_value").val() != '_user_email' ){401 $("#ninja_forms_field_" + id + "_default_value").val("");402 $("#default_value_" + id).val("");403 $("#default_value_label_" + id).hide();404 }405 $("#ninja_forms_field_" + id + "_mask").val("");406 $("#mask_" + id).val("");407 $("#mask_label_" + id).hide();408 $("#ninja_forms_field_" + id + "_datepicker").prop("checked", false);409 }else{410 $("#ninja_forms_field_" + id + "_send_email").prop("checked", false);411 $("#ninja_forms_field_" + id + "_from_email").prop("checked", false);412 }413 });414 // Send Email415 $(document).on( 'change', '.ninja-forms-_text-send_email', function(){416 var id = this.id.replace("ninja_forms_field_", "");417 id = id.replace("_send_email", "");418 if(this.checked == true){419 $("#ninja_forms_field_" + id + "_email").prop("checked", true);420 if( $("#ninja_forms_field_" + id + "_default_value").val() != '_user_email' ){421 $("#ninja_forms_field_" + id + "_default_value").val("");422 $("#default_value_" + id).val("");423 $("#default_value_label_" + id).hide(); 424 }425 $("#ninja_forms_field_" + id + "_mask").val("");426 $("#mask_" + id).val("");427 $("#mask_label_" + id).hide();428 $("#ninja_forms_field_" + id + "_datepicker").prop("checked", false);429 }430 });431 // From Email432 $(document).on( 'change', '.ninja-forms-_text-from_email', function(){433 var id = this.id.replace("ninja_forms_field_", "");434 id = id.replace("_from_email", "");435 if(this.checked == true){436 $("#ninja_forms_field_" + id + "_email").prop("checked", true);437 if( $("#ninja_forms_field_" + id + "_default_value").val() != '_user_email' ){438 $("#ninja_forms_field_" + id + "_default_value").val("");439 $("#default_value_" + id).val("");440 $("#default_value_label_" + id).hide(); 441 }442 $("#ninja_forms_field_" + id + "_mask").val("");443 $("#mask_" + id).val("");444 $("#mask_label_" + id).hide();445 $("#ninja_forms_field_" + id + "_datepicker").prop("checked", false);446 }447 }); 448 /* List Field JS */449 //Collapse List Options.450 $(document).on( 'click', '.ninja-forms-field-collapse-options', function(e){451 e.preventDefault();452 var field_id = this.id.replace("ninja_forms_field_", "");453 field_id = field_id.replace("_collapse_options", "");454 $("#ninja_forms_field_" + field_id + "_list_span").slideToggle(function(){455 /*456 if($("#ninja_forms_field_" + field_id + "_list_span").css("display") != 'none'){457 var label = "Collapse Options";458 }else{459 var label = "Expand Options";460 }461 $("#ninja_forms_field_" + field_id + "_collapse_options").prop("innerHTML", label);462 */463 });464 });465 466 //Listen to the "List Type" Select box and show the multi-size input box if "Multi-Select" is selected.467 $(document).on( 'change', '.ninja-forms-_list-list_type', function(){468 var field_id = this.id.replace("ninja_forms_field_", "");469 field_id = field_id.replace("_list_type", "");470 if(this.value == 'multi'){471 $("#ninja_forms_field_" + field_id+ "_multi_size_p").show();472 }else{473 $("#ninja_forms_field_" + field_id+ "_multi_size_p").hide(); 474 }475 if(this.value == 'radio' || this.value == 'checkbox'){476 $("#ninja_forms_field_" + field_id + "_label_pos").val('left');477 $("#ninja_forms_field_" + field_id + "_label_pos option[value='inside']").attr('disabled', true);478 }else{479 $("#ninja_forms_field_" + field_id + "_label_pos option[value='inside']").attr('disabled', false);480 }481 });482 483 //Make List Options sortable484 485 $(".ninja-forms-field-list-options").sortable({486 helper: 'clone',487 handle: '.ninja-forms-drag',488 items: 'div',489 placeholder: "ui-state-highlight",490 });491 492 // Listen to the Show list values checkboxes and show or hide those if necessary.493 $(document).on( 'change', '.ninja-forms-field-list-show-value', function(e){494 var field_id = this.id.replace("ninja_forms_field_", "");495 field_id = field_id.replace("_list_show_value", "");496 if(this.checked){497 $(".ninja-forms-field-" + field_id + "-list-option-value").show();498 }else{499 $(".ninja-forms-field-" + field_id + "-list-option-value").hide();500 }501 });502 //Add New List Option503 $(document).on( 'click', '.ninja-forms-field-add-list-option', function(event){504 event.preventDefault();505 var field_id = this.id.replace("ninja_forms_field_", "");506 field_id = field_id.replace("_list_add_option", "");507 var x = $(".ninja-forms-field-" + field_id + "-list-option").length;508 var hidden_value = $("#ninja_forms_field_" + field_id + "_list_show_value").prop("checked");509 510 if(hidden_value){511 hidden_value = 1;512 }else{513 hidden_value = 0;514 }515 516 $.post(ajaxurl, { field_id: field_id, x: x, hidden_value: hidden_value, action:"ninja_forms_add_list_option"}, function(response){517 $("#ninja_forms_field_" + field_id + "_list_options").append(response);518 $("#ninja_forms_field_" + field_id + "_list_option_" + x).fadeIn();519 $(".ninja-forms-field-conditional-value-list").each(function(){520 $(this).append("<option value='' title='" + x + "'></option>");521 });522 $("[name='ninja_forms_field_" + field_id + "\\[list\\]\\[options\\]\\[" + x + "\\]\\[label\\]']").focus();523 });524 });525 526 //Remove List Option527 $(document).on( 'click', '.ninja-forms-field-remove-list-option', function(event){528 event.preventDefault();529 var field_id = this.id.replace("ninja_forms_field_", "");530 field_id = field_id.replace("_list_remove_option", "");531 var x = $(this).parent().prop("id");532 x = x.replace("ninja_forms_field_" + field_id + "_list_option_", "");533 534 $(this).parent().parent().parent().parent().parent().fadeOut(300, function(){ 535 $(this).remove(); 536 });537 538 $(".ninja-forms-field-conditional-value-list").each(function(){539 $(this).children('option').each(function(){540 if(this.title == x){541 $(this).remove();542 }543 });544 });545 });546 //Listen to the option labels and values; if the enter key is pressed, add a new option.547 $(document).on( 'keydown', '.ninja-forms-field-list-option-label', function(event){548 if( event.keyCode == 13 ){549 var add_id = this.id.replace("option_label", "add_option");550 $("#" + add_id).click();551 return false;552 }553 }); 554 $(document).on( 'keydown', '.ninja-forms-field-list-option-value', function(event){555 if( event.keyCode == 13 ){556 var add_id = this.id.replace("option_value", "add_option");557 $("#" + add_id).click();558 return false;559 }560 }); 561 $(document).on( 'keydown', '.ninja-forms-field-list-option-calc', function(event){562 if( event.keyCode == 13 ){563 var add_id = this.id.replace("option_calc", "add_option");564 $("#" + add_id).click();565 return false;566 }567 });568 569 //Listen to List Option Labels and Values and change existing criteron option selects570 $(document).on( 'keyup', '.ninja-forms-field-list-option-label', function(){ 571 var field_id = this.id.replace("ninja_forms_field_", "");572 field_id = field_id.replace("_list_option_label", "");573 var label = this.value;574 var x = $(this).parent().prop("id").replace("ninja_forms_field_" + field_id + "_list_option_", "");575 var list_show_value = $("#ninja_forms_field_" + field_id + "_list_show_value").prop("checked");576 577 $(".ninja-forms-field-conditional-cr-field").each(function(){578 if(this.value == field_id){579 $(this).nextElementInDom('.ninja-forms-field-conditional-cr-value-list').each(function(){580 $(this).children('option').each(function(){581 if(this.title == x){582 this.text = label;583 if(!list_show_value){584 this.value = label;585 }586 }587 });588 });589 }590 });591 592 $(".ninja-forms-field-" + field_id + "-conditional-value").children('option').each(function(){593 if(this.title == x){594 this.text = label;595 if(!list_show_value){596 this.value = label;597 }598 }599 });600 }); 601 602 $(document).on( 'keyup', '.ninja-forms-field-list-option-value', function(){ 603 var field_id = this.id.replace("ninja_forms_field_", "");604 field_id = field_id.replace("_list_option_value", "");605 var value = this.value;606 var x = $(this).parent().parent().prop("id").replace("ninja_forms_field_" + field_id + "_list_option_", "");607 $(".ninja-forms-field-conditional-cr-field").each(function(){608 if(this.value == field_id){609 $(this).nextElementInDom('.ninja-forms-field-conditional-cr-value-list').each(function(){610 $(this).children('option').each(function(){611 if(this.title == x){612 this.value = value;613 }614 });615 });616 }617 }); 618 619 $(".ninja-forms-field-" + field_id + "-conditional-value").children('option').each(function(){620 if(this.title == x){621 this.value = value;622 }623 });624 625 });626 $(document).on( 'change', '.ninja-forms-hidden-default-value', function(){627 var field_id = $(this).attr("rel");628 if( this.value == 'custom' ){629 $("#ninja_forms_field_" + field_id + "_default_value").val("");630 $("#default_value_label_" + field_id).show();631 $("#ninja_forms_field_" + field_id + "_default_value").focus();632 }else{633 $("#ninja_forms_field_" + field_id + "_default_value").val(this.value);634 $("#default_value_label_" + field_id).hide();635 }636 });637 // Close the import popup when "cancel" is clicked.638 $(".cancel-list-import").click(function(e){639 e.preventDefault();640 tb_remove();641 });642 // Handle the importing of textarea data when the user clicks: "done"643 $(".save-list-import").click(function(e){644 e.preventDefault();645 var options = $(this).parent().find("textarea").val();646 var field_id = $(this).attr("rel");647 $.post(ajaxurl, { options: options, field_id: field_id, action:"ninja_forms_import_list_options"}, function(response){648 $("#ninja_forms_field_" + field_id + "_list_options").append( response );649 tb_remove();650 });651 });652 /* Password Field JS */653 $(document).on( 'change', '.ninja-forms-_profile_pass-reg_password', function(){654 if( this.checked ){655 $(".reg-password").parent().parent().show();656 }else{657 $(".reg-password").parent().parent().hide();658 }659 });660 /* Calculation Field JS */661 $(document).on( 'click', '.ninja-forms-field-add-calc', function(e){662 e.preventDefault();663 var field_id = $(this).attr("rel");664 var spinner = $(this).next(".spinner");665 $(spinner).show();666 var x = $("#ninja_forms_field_" + field_id + "_calc").find(".ninja-forms-calc-row:last").attr("rel");667 if ( isNaN( x ) ) {668 x = 0;669 } else {670 x = parseInt(x);671 x = x + 1; 672 }673 $.post(ajaxurl, { field_id: field_id, x: x, action:"ninja_forms_add_calc_row"}, function(response){674 $("#ninja_forms_field_" + field_id + "_calc").append(response);675 $(spinner).hide();676 });677 });678 $(document).on( 'click', '.ninja-forms-field-remove-calc', function(e){679 e.preventDefault();680 var field_id = $(this).attr("rel");681 var x = $(this).attr("name");682 $("#ninja_forms_field_" + field_id + "_calc_row_" + x).hide( function(){683 $("#ninja_forms_field_" + field_id + "_calc_row_" + x).remove();684 });685 });686 // Listen to the calculation field "name" element and update the calculation select lists with the new values.687 $(document).on( 'keyup', '.ninja-forms-calc-name', function(){688 var field_id = $(this).prop("id");689 field_id = field_id.replace("ninja_forms_field_", "");690 field_id = field_id.replace("_calc_name", "");691 var label = this.value;692 label = ninja_forms_escape_html( label );693 if ( $.trim( label ) == '' ){694 label = 'calc_name';695 }696 // Set the LI label to this new text.697 $(this).parent().parent().parent().prev().find('.ninja-forms-field-title').html(label);698 });699 // Register a function to be called whenever a new field is added to the form.700 $(document).bind('addField', function(event, response){701 // Add this new calc field to all of our calculation selects702 $(".ninja-forms-calc-select").each(function(){703 $(this).append('<option value="' + response.new_id + '">' + response.new_id + ' - ' + response.new_type + '</option>');704 });705 });706 // Register a function to be called whenever a field is removed from the form.707 $(document).bind('removeField', function(event, field_id){708 $(".ninja-forms-calc-select option[value='" + field_id + "']").remove();709 });710 // Listen to the calculation display type select and show or hide the appropriate options.711 $(document).on( 'change', '.ninja-forms-calc-display', function(e){712 var field_id = this.id.replace("ninja_forms_field_", "");713 field_id = field_id.replace("_calc_display_type", "");714 // Show the extra settings if the "none" option isn't selected.715 if(this.value == 'html'){716 $("#ninja_forms_field_" + field_id + "_clac_text_display").hide();717 $("#ninja_forms_field_" + field_id + "_clac_html_display").show();718 $("#ninja_forms_field_" + field_id + "_clac_extra_display").show();719 $("#ninja_forms_field_" + field_id + "_label").val('');720 }else if(this.value == 'text'){721 $("#ninja_forms_field_" + field_id + "_clac_text_display").show();722 $("#ninja_forms_field_" + field_id + "_clac_html_display").hide();723 $("#ninja_forms_field_" + field_id + "_clac_extra_display").show();724 }else{725 $("#ninja_forms_field_" + field_id + "_clac_text_display").hide();726 $("#ninja_forms_field_" + field_id + "_clac_html_display").hide();727 $("#ninja_forms_field_" + field_id + "_clac_extra_display").hide();728 $("#ninja_forms_field_" + field_id + "_label").val('');729 }730 });731 // Listen to the calculation advanced equations checkbox and show the advanced calculations box if it is checked.732 $(document).on( 'change', '.ninja-forms-calc-method', function(e){733 if(this.value == 'auto'){734 // Hide both advanced options735 $(this).parent().parent().parent().find(".ninja-forms-calculations").hide();736 $(this).parent().parent().parent().find(".ninja-forms-eq").hide();737 }else if(this.value == 'fields'){738 $(this).parent().parent().parent().find(".ninja-forms-calculations").show();739 $(this).parent().parent().parent().find(".ninja-forms-eq").hide(); 740 }else{741 $(this).parent().parent().parent().find(".ninja-forms-calculations").hide();742 $(this).parent().parent().parent().find(".ninja-forms-eq").show(); 743 }744 });745 /* * * End Field Specific JS * * */746 747 /* * * Favorite Fields JS * * */748 749 //Add Field to the User's Favorites List750 $(document).on( 'click', '.ninja-forms-field-add-fav', function(event){751 event.preventDefault();752 var field_id = this.id.replace("ninja_forms_field_", "");753 field_id = field_id.replace("_fav", "");754 var field_data = new Object();755 var this_id = this.id;756 $("[name*='ninja_forms_field_" + field_id + "']").each(function(){757 tmp = this.name.replace("ninja_forms_field_" + field_id + "[", "");758 tmp = tmp.replace("]", "");759 if(this.type == 'checkbox'){760 if(this.checked){761 field_data['"' + tmp + '"']= this.value;762 }763 }else{764 field_data['"' + tmp + '"']= this.value; 765 }766 })767 768 var fav_name = prompt("What would you like to name this favorite?", "");769 if(fav_name.length >= 1){770 $.post(ajaxurl, { fav_name: fav_name, field_data: field_data, field_id: field_id, action:"ninja_forms_add_fav"}, function(response){771 //document.write(response);772 $("#ninja_forms_field_" + field_id + "_fav").removeClass("ninja-forms-field-add-fav");773 $("#ninja_forms_field_" + field_id + "_fav").addClass("ninja-forms-field-remove-fav");774 $("#ninja_forms_sidebar_fav_fields").append(response.link_html);775 $("#ninja_forms_field_" + field_id + "_title").nextElementInDom('.item-type:first').prop("innerHTML", response.fav_name);776 $("#ninja_forms_field_" + field_id + "_fav_id").val(response.fav_id);777 });778 }else{779 var answer = confirm('You must supply a name for this favorite.');780 if(answer){781 $("#" + this_id).click();782 }783 }784 });785 786 //Remove a field from the user's favorites list787 $(document).on( 'click', '.ninja-forms-field-remove-fav', function(event){788 event.preventDefault();789 var field_id = this.id.replace("ninja_forms_field_", "");790 field_id = field_id.replace("_fav", "");791 $.post(ajaxurl, { field_id: field_id, action:"ninja_forms_remove_fav"}, function(response){792 $("#ninja_forms_insert_fav_field_" + response.fav_id + "_p").remove();793 $(".ninja-forms-field-fav-id").each(function(){794 if(this.value == response.fav_id){795 var remove_id = this.id.replace("ninja_forms_field_", "");796 remove_id = remove_id.replace("_fav_id", "");797 $("#ninja_forms_field_" + remove_id + "_fav").removeClass("ninja-forms-field-remove-fav"); 798 $("#ninja_forms_field_" + remove_id + "_fav").addClass("ninja-forms-field-add-fav");799 $("#ninja_forms_field_" + remove_id + "_title").nextElementInDom('.item-type:first').prop("innerHTML", response.type_name);800 }801 });802 });803 }); 804 805 //Insert a Favorite Field806 $(document).on( 'click', '.ninja-forms-insert-fav-field', function(event){807 event.preventDefault();808 var fav_id = this.id.replace("ninja_forms_insert_fav_field_", "");809 var form_id = $("#_form_id").val();810 $.post(ajaxurl, {fav_id: fav_id, form_id: form_id, action:"ninja_forms_insert_fav"}, ninja_forms_new_field_response)811 });812 813 /* * * End Favorite Fields JS * * */814 815 /* * * Defined Fields JS * * */816 817 //Add Field to the Defined Fields List818 $(document).on( 'click', '.ninja-forms-field-add-def', function(event){819 event.preventDefault();820 var field_id = this.id.replace("ninja_forms_field_", "");821 field_id = field_id.replace("_def", "");822 var field_data = new Object();823 var this_id = this.id;824 $("[name*='ninja_forms_field_" + field_id + "']").each(function(){825 tmp = this.name.replace("ninja_forms_field_" + field_id + "[", "");826 tmp = tmp.replace("]", "");827 if(this.type == 'checkbox'){828 if(this.checked){829 field_data['"' + tmp + '"']= this.value;830 }831 }else{832 field_data['"' + tmp + '"']= this.value; 833 }834 })835 836 var def_name = prompt("What would you like to name this Defined FIeld?", "");837 if(def_name.length >= 1){838 $.post(ajaxurl, { def_name: def_name, field_data: field_data, field_id: field_id, action:"ninja_forms_add_def"}, function(response){839 $("#ninja_forms_sidebar_def_fields").append(response.link_html);840 $("#ninja_forms_field_" + field_id + "_title").nextElementInDom('.item-type:first').prop("innerHTML", response.def_name);841 $("#ninja_forms_field_" + field_id + "_def_id").val(response.def_id);842 });843 }else{844 var answer = confirm('You must supply a name for this Defined Field.');845 if(answer){846 $("#" + this_id).click();847 }848 }849 });850 851 //Remove a field from the defined fields list852 $(document).on( 'click', '.ninja-forms-field-remove-def', function(event){853 event.preventDefault();854 var field_id = this.id.replace("ninja_forms_field_", "");855 field_id = field_id.replace("_def", "");856 $.post(ajaxurl, { field_id: field_id, action:"ninja_forms_remove_def"}, function(response){857 $("#ninja_forms_insert_def_field_" + response.def_id + "_p").remove();858 });859 });860 861 862 //Insert a Defined Field863 $(document).on( 'click', '.ninja-forms-insert-def-field', function(event){864 event.preventDefault();865 var limit = this.name.replace('_', '');866 var def_id = this.id.replace("ninja_forms_insert_def_field_", "");867 var form_id = $("#_form_id").val();868 var type = this.rel;869 if(limit != ''){870 var current_count = $("." + type + "-li").length;871 }else{872 var current_count = '';873 }874 if((limit != '' && current_count < limit) || limit == '' || current_count == '' || current_count == 0){875 $.post(ajaxurl, {def_id: def_id, form_id: form_id, action:"ninja_forms_insert_def"}, ninja_forms_new_field_response);876 }877 });878 879 /* * * End Defined Fields JS * * */880 881 /* * * Begin Form Settings JS * * */882 883 $(".ninja-forms-add-mailto").click(function(event){884 event.preventDefault();885 var id = this.id.replace("ninja_forms_add_mailto_", "");886 if($(".ninja-forms-mailto-address").length > 0){887 var count = $(".ninja-forms-mailto-address:last").parent().prop("id");888 count = count.replace("ninja_forms_mailto_", "");889 count = count.replace("_span", "");890 count++; 891 }else{892 var count = 0;893 }894 var html = '<span id="ninja_forms_mailto_' + count + '_span"><a href="#" id="" class="ninja-forms-remove-mailto">X</a> <input type="text" name="admin_mailto[]" id="" value="" class="ninja-forms-mailto-address"></span>';895 $("#ninja_forms_mailto").append(html);896 $(".ninja-forms-mailto-address:last").focus();897 });898 899 $(document).on( 'click', '.ninja-forms-remove-mailto', function(event){...

Full Screen

Full Screen

licenses-newlicense.js

Source:licenses-newlicense.js Github

copy

Full Screen

1// JavaScript Document2/*----3 fn_movealllistitems()4 Function to be used for drag the items from one box to another5----*/6function fn_movealllistitems(leftlist,rightlist,id,courseid)7{ 8 if(id == 0)9 {10 $("div[id^="+leftlist+"_]").each(function()11 {12 if(!$(this).hasClass('dim')){13 var clas = $(this).attr('class');14 var temp = $(this).attr('id').replace(leftlist,rightlist);15 16 $(this).attr('id',temp);17 $('#'+rightlist).append($(this));18 19 if($(this).attr('class') == 'draglinkleft') {20 $(this).removeClass("draglinkleft draglinkright");21 $(this).addClass("draglinkright");22 } else {23 $(this).removeClass("draglinkleft draglinkright");24 $(this).addClass("draglinkleft");25 }26 }27 });28 }29 else30 {31 var clas=$('#'+leftlist+'_'+courseid).attr('class');32 33 if(clas=="draglinkleft")34 {35 36 $('#'+rightlist).append($('#'+leftlist+' #'+leftlist+'_'+courseid));37 $('#'+leftlist+'_'+courseid).removeClass('draglinkleft').addClass('draglinkright');38 var temp = $('#'+leftlist+'_'+courseid).attr('id').replace(leftlist,rightlist); 39 var ids='id';40 $('#'+leftlist+'_'+courseid).attr(ids,temp);41 }42 else 43 {44 45 $('#'+leftlist).append($('#'+rightlist+' #'+rightlist+'_'+courseid));46 $('#'+rightlist+'_'+courseid).removeClass('draglinkright').addClass('draglinkleft');47 var temp = $('#'+rightlist+'_'+courseid).attr('id').replace(rightlist,leftlist); 48 var ids='id';49 $('#'+rightlist+'_'+courseid).attr(ids,temp);50 } 51 }52 if($('#hidlicense').val()!='0'){53 if(id == 0) {54 if(rightlist=="list4"){55 56 var addall = 1;57 fn_load_modulesave($('#hidlicense').val(),id,addall);58 }59 else if(rightlist=="list3"){ 60 var remall = 0;61 fn_load_modulesave($('#hidlicense').val(),id,remall); }62 }63 else { 64 if(rightlist=="list4" && clas=="draglinkleft" ){65 var addall = 5;66 fn_load_modulesave($('#hidlicense').val(),courseid,addall);67 }68 else if(rightlist=="list4" && clas!="draglinkleft"){69 70var addall = 3;71 fn_load_modulesave($('#hidlicense').val(),courseid,addall);72}73 74 }75 76 }77 if(leftlist=="list3" ||rightlist=="list4" && leftlist=="list4" || rightlist=="list3" )78 {79 var list3 = [];80 $("div[id^=list3_]").each(function(){81 list3.push($(this).attr('id').replace('list3_',''));82 });83 $('#leftmoddiv').html(list3.length);84 var list4 = [];85 $("div[id^=list4_]").each(function(){86 list4.push($(this).attr('id').replace('list4_',''));87 });88 $('#rightmoddiv').html(list4.length);89 fn_load_product($('#hidlicense').val(),'content'); //load product details list90 fn_load_assessment($('#hidlicense').val()); //load assessment details list91 92 }93 94 if(leftlist=="list11" ||rightlist=="list12" && leftlist=="list12" || rightlist=="list11" )95 {96 var list11 = [];97 $("div[id^=list11_]").each(function(){98 list11.push($(this).attr('id').replace('list11_',''));99 });100 $('#leftquests').html(list11.length);101 var list12 = [];102 $("div[id^=list12_]").each(function(){103 list12.push($(this).attr('id').replace('list12_',''));104 });105 $('#rightquests').html(list12.length);106 107 fn_load_product($('#hidlicense').val(),'content'); //load product details list108 fn_load_assessment($('#hidlicense').val()); //load assessment details list109 }110 111 if(leftlist=="list13" ||rightlist=="list14" && leftlist=="list14" || rightlist=="list13" )112 {113 var list13 = [];114 $("div[id^=list13_]").each(function(){115 list13.push($(this).attr('id').replace('list13_',''));116 });117 $('#leftexpeditions').html(list13.length);118 var list14 = [];119 $("div[id^=list14_]").each(function(){120 list14.push($(this).attr('id').replace('list14_',''));121 });122 $('#rightexpeditions').html(list14.length);123 124 fn_load_product($('#hidlicense').val(),'content'); // load product details list125 fn_load_assessment($('#hidlicense').val()); //load assessment details list126 }127 128 if(leftlist=="list9" ||rightlist=="list10" && leftlist=="list10" || rightlist=="list9" )129 {130 var list9 = [];131 $("div[id^=list9_]").each(function(){132 list9.push($(this).attr('id').replace('list9_',''));133 });134 $('#leftassessments').html(list9.length);135 var list10 = [];136 $("div[id^=list10_]").each(function(){137 list10.push($(this).attr('id').replace('list10_',''));138 });139 $('#rightassessments').html(list10.length);140 } 141 142 if(leftlist=="list5" || leftlist=="list6" && rightlist=="list6" || rightlist=="list5" )143 {144 var list5 = [];145 $("div[id^=list5_]").each(function(){146 list5.push($(this).attr('id').replace('list5_',''));147 });148 $('#leftunits').html(list5.length);149 var list6 = [];150 $("div[id^=list6_]").each(function(){151 list6.push($(this).attr('id').replace('list6_',''));152 });153 $('#rightunits').html(list6.length);154 155 fn_load_lessons($('#hidlicense').val());156 }157 158 if(leftlist=="list7" || leftlist=="list8" && rightlist=="list8" || rightlist=="list7" )159 {160 var list7 = [];161 $("div[id^=list7_]").each(function(){162 list7.push($(this).attr('id').replace('list7_',''));163 });164 $('#leftipls').html(list7.length);165 var list8 = [];166 $("div[id^=list8_]").each(function(){167 list8.push($(this).attr('id').replace('list8_',''));168 });169 $('#rightipls').html(list8.length);170 171 fn_load_product($('#hidlicense').val(),'content'); // load product details list172 fn_load_assessment($('#hidlicense').val()); //load product details list173 174 }175 176 if(leftlist=="list15" || leftlist=="list16" && rightlist=="list16" || rightlist=="list15" )177 {178 var list15 = [];179 $("div[id^=list15_]").each(function(){180 list15.push($(this).attr('id').replace('list15_',''));181 });182 $('#leftcourses').html(list15.length);183 var list16 = [];184 $("div[id^=list16_]").each(function(){185 list16.push($(this).attr('id').replace('list16_',''));186 });187 $('#rightcourses').html(list16.length);188 189 fn_load_pdlessons($('#hidlicense').val());190 }191 192 if(leftlist=="list23" || leftlist=="list24" && rightlist=="list24" || rightlist=="list23" )193 {194 var list23 = [];195 $("div[id^=list23_]").each(function(){196 list23.push($(this).attr('id').replace('list23_',''));197 });198 $('#leftpdlessons').html(list23.length);199 var list24 = [];200 $("div[id^=list24_]").each(function(){201 list24.push($(this).attr('id').replace('list24_',''));202 });203 $('#rightpdlessons').html(list24.length);204 205 fn_load_product($('#hidlicense').val(),'content'); // load product details list206 fn_load_assessment($('#hidlicense').val()); //load assessment details list207 }208 209 if(leftlist=="list25" || leftlist=="list26" && rightlist=="list26" || rightlist=="list25" )210 {211 var list25 = [];212 $("div[id^=list25_]").each(function(){213 list25.push($(this).attr('id').replace('list25_',''));214 });215 $('#leftmission').html(list25.length);216 217 var list26 = [];218 $("div[id^=list26_]").each(function(){219 list26.push($(this).attr('id').replace('list26_',''));220 });221 $('#rightmission').html(list26.length);222 223 fn_load_product($('#hidlicense').val(),'content'); // load product details list224 fn_load_assessment($('#hidlicense').val()); //load assessment details list225 }226 227 if(leftlist=="list31" || leftlist=="list32" && rightlist=="list32" || rightlist=="list31" )228 {229 var list31 = [];230 $("div[id^=list31_]").each(function(){231 list31.push($(this).attr('id').replace('list31_',''));232 });233 $('#leftnondigi').html(list31.length);234 235 var list32 = [];236 $("div[id^=list32_]").each(function(){237 list32.push($(this).attr('id').replace('list32_',''));238 });239 $('#rightnondigi').html(list32.length);240 241 fn_load_product($('#hidlicense').val(),'content'); // load product details list242 243 }244 245 if(leftlist=="list27" || leftlist=="list28" && rightlist=="list28" || rightlist=="list27" )246 {247 var list27 = [];248 $("div[id^=list27_]").each(function(){249 list27.push($(this).attr('id').replace('list27_',''));250 });251 $('#lefsosdocs').html(list27.length);252 253 var list28 = [];254 $("div[id^=list28_]").each(function(){255 list28.push($(this).attr('id').replace('list28_',''));256 });257 $('#rightsosdocs').html(list28.length);258 }259 260 261 if(leftlist=="list17" || leftlist=="list18" && rightlist=="list18" || rightlist=="list17" )262 {263 var list17 = [];264 $("div[id^=list17_]").each(function(){265 list17.push($(this).attr('id').replace('list17_',''));266 });267 $('#leftsosunits').html(list17.length);268 var list18 = [];269 $("div[id^=list18_]").each(function(){270 list18.push($(this).attr('id').replace('list18_',''));271 });272 $('#rightsosunits').html(list18.length);273 274 fn_load_phases($('#hidlicense').val());275 fn_load_product($('#hidlicense').val(),'content'); // load product details list276 }277 278 if(leftlist=="list19" || leftlist=="list20" && rightlist=="list20" || rightlist=="list19" )279 {280 var list19 = [];281 $("div[id^=list19_]").each(function(){282 list19.push($(this).attr('id').replace('list19_',''));283 });284 $('#leftsosphases').html(list19.length);285 var list20 = [];286 $("div[id^=list20_]").each(function(){287 list20.push($(this).attr('id').replace('list20_',''));288 });289 $('#rightsosphases').html(list20.length);290 291 fn_load_video($('#hidlicense').val());292 }293 294 if(leftlist=="list21" || leftlist=="list22" && rightlist=="list22" || rightlist=="list21" )295 {296 var list21 = [];297 $("div[id^=list21_]").each(function(){298 list21.push($(this).attr('id').replace('list21_',''));299 });300 $('#leftsosvideos').html(list21.length);301 var list22 = [];302 $("div[id^=list22_]").each(function(){303 list22.push($(this).attr('id').replace('list22_',''));304 });305 $('#rightsosvideos').html(list22.length);306 }307 308 /*** pimproduct start line ***/309 310 if(leftlist=="list29" || leftlist=="list30" && rightlist=="list30" || rightlist=="list29" )311 {312 var list29 = [];313 $("div[id^=list29_]").each(function(){314 list29.push($(this).attr('id').replace('list29_',''));315 });316 $('#leftproduct').html(list29.length);317 var list30 = [];318 $("div[id^=list30_]").each(function(){319 list30.push($(this).attr('id').replace('list30_',''));320 });321 $('#rightproduct').html(list30.length);322 323}324 /*** pimproduct end lime ***/325}326/*----327 fn_createlicense()328 Function to be used for get the license details and send to license ajax page for save and edit329----*/330function fn_createlicense(id)331{332 var list4 = []; //module id333 var list6 = []; //unit id334 var list8 = []; //ipl id335 var list10 = []; //assessmentid 336 var list12 = []; //Questid 337 var list14 = []; //expdetion / destination id338 var list16= []; //courses339 var list18= []; //units340 var list20= []; //phases341 var list22= []; //videos342 var list24= []; //pd lessons343 var list26= []; //Missions344 var list28= []; //documents345 var list30= []; //Product346 var list32= []; //Nondigitalcontent347 var extids = [];348 349 $("div[id^=list4_]").each(function()350 {351 list4.push($(this).attr('name').replace('list4_',''));352 }); 353 354 $("div[id^=list6_]").each(function()355 {356 list6.push($(this).attr('id').replace('list6_',''));357 }); 358 359 $("div[id^=list10_]").each(function()360 {361 list10.push($(this).attr('id').replace('list10_',''));362 }); 363 364 $("div[id^=list8_]").each(function()365 {366 list8.push($(this).attr('name').replace('list8_',''));367 });368 369 $("div[id^=list12_]").each(function()370 {371 list12.push($(this).attr('name').replace('list12_',''));372 });373 374 $("div[id^=list14_]").each(function()375 {376 list14.push($(this).attr('name').replace('list14_',''));377 });378 379 $("div[id^=list16_]").each(function()380 {381 list16.push($(this).attr('id').replace('list16_',''));382 });383 384 $("div[id^=list24_]").each(function()385 {386 list24.push($(this).attr('name').replace('list24_',''));387 });388 //pd389 390 //SOS391 $("div[id^=list18_]").each(function()392 {393 list18.push($(this).attr('id').replace('list18_',''));394 });395 396 $("div[id^=list20_]").each(function()397 {398 list20.push($(this).attr('name').replace('list20_',''));399 });400 401 $("div[id^=list22_]").each(function()402 {403 list22.push($(this).attr('name').replace('list22_',''));404 });405 406 $("div[id^=list26_]").each(function()407 {408 list26.push($(this).attr('name').replace('list26_',''));409 });410 411 $("div[id^=list32_]").each(function()412 {413 list32.push($(this).attr('id').replace('list32_',''));414 });415 416 $("div[id^=list28_]").each(function()417 {418 list28.push($(this).attr('name').replace('list28_',''));419 });420 //sim product421 $("div[id^=list30_]").each(function()422 {423 list30.push($(this).attr('name').replace('list30_',''));424 });425 426 $("input[id^=exid_]").each(function()427 {428 extids.push($(this).val());429 });430 431 var dataparam = "oper=savelicense"+"&licennsename="+$('#licennsename').val()+"&duration="+$('#duration').val()+"&amount="+$('#amount').val()+"&sales="+$('#sales').val()+"&month="+$('#hidmonth').val()+"&licensetype="+$('#hidlicensetype').val()+"&id="+id+"&list4="+list4+"&list6="+list6+"&list8="+list8+"&list12="+list12+"&list14="+list14+"&tags="+$('#form_tags_license').val()+"&extids="+extids+"&list16="+list16+"&list24="+list24+"&list26="+list26+"&list18="+list18+"&list20="+list20+"&list22="+list22+"&contenttype="+$('#contenttype').val()+"&list28="+list28+"&list10="+list10+"&list30="+list30+"&list32="+list32;432 if($("#createlicense").validate().form())433 {434 435 if(id!=0 && id!=undefined){436 actionmsg = "Updating";437 alertmsg = " License has been updated successfully"; 438 }439 else {440 actionmsg = "Saving";441 alertmsg = "License has been created successfully"; 442 } 443 444 $.ajax({445 type: 'post',446 url: "licenses/newlicense/licenses-newlicense-newlicenseajax.php",447 data: dataparam,448 beforeSend: function(){449 showloadingalert(actionmsg+", please wait."); 450 },451 success: function (data) { 452 if(trim(data)=="success")453 {454 $('.lb-content').html(alertmsg);455 setTimeout('closeloadingalert()',1000);456 setTimeout('removesections("#home");',500);457 setTimeout('showpages("licenses","licenses/licenses.php");',500);458 }459 else if(trim(data)=="fail")460 {461 $('.lb-content').html("Incorrect Data");462 setTimeout('closeloadingalert()',1000);463 } 464 },465 });466 467 }468}469/*----470 fn_load_lessons()471 Function to be used for load the lesson 472----*/473function fn_load_lessons(id)474{475 var list6= [];476 $("div[id^=list6_]").each(function() //get unit ids477 {478 list6.push($(this).attr('id').replace('list6_',''));479 }); 480 var dataparam = "oper=loadlessons"+"&unitids="+list6+"&id="+id; 481 $.ajax({482 type: 'post',483 url: "licenses/newlicense/licenses-newlicense-newlicenseajax.php",484 data: dataparam,485 success: function (data) { 486 $('#Ipls').html(data) 487 },488 }); 489}490/*----491 fn_load_phases()492 Function to be used for load the phases493----*/494function fn_load_phases(id)495{496 var list18= [];497 $("div[id^=list18_]").each(function() //get sosunit ids498 {499 list18.push($(this).attr('id').replace('list18_',''));500 }); 501 var dataparam = "oper=loadphases"+"&unitids="+list18+"&id="+id; 502 $.ajax({503 type: 'post',504 url: "licenses/newlicense/licenses-newlicense-newlicenseajax.php",505 data: dataparam,506 success: function (data) { 507 $('#phases').html(data) 508 },509 }); 510}511/*----512 fn_load_videos()513 Function to be used for load the phases514----*/515function fn_load_video(id)516{517 var list18= [];518 $("div[id^=list18_]").each(function() //get sosunit ids519 {520 list18.push($(this).attr('id').replace('list18_',''));521 }); 522 523 var list20= [];524 $("div[id^=list20_]").each(function() //get sosunit ids525 {526 list20.push($(this).attr('id').replace('list20_',''));527 }); 528 var dataparam = "oper=loadvideo"+"&unitids="+list18+"&phaseids="+list20+"&id="+id; 529 $.ajax({530 type: 'post',531 url: "licenses/newlicense/licenses-newlicense-newlicenseajax.php",532 data: dataparam,533 success: function (data) { 534 $('#video').html(data) 535 fn_load_document(id);536 },537 }); 538}539/*----540 fn_load_document()541 Function to be used for load the document542----*/543function fn_load_document(id)544{545 var list18= [];546 $("div[id^=list18_]").each(function() //get sosunit ids547 {548 list18.push($(this).attr('id').replace('list18_',''));549 }); 550 551 var list20= [];552 $("div[id^=list20_]").each(function() //get sosphase ids553 {554 list20.push($(this).attr('id').replace('list20_',''));555 }); 556 var dataparam = "oper=loaddocument"+"&unitids="+list18+"&phaseids="+list20+"&id="+id; 557 $.ajax({558 type: 'post',559 url: "licenses/newlicense/licenses-newlicense-newlicenseajax.php",560 data: dataparam,561 success: function (data) { 562 $('#document').html(data) 563 },564 }); 565}566/*----567 fn_load_lessons()568 Function to be used for load the lesson 569----*/570function fn_load_pdlessons(id)571{572 var list16= [];573 $("div[id^=list16_]").each(function() //get unit ids574 {575 list16.push($(this).attr('id').replace('list16_',''));576 }); 577 var dataparam = "oper=loadpdlessons"+"&courseids="+list16+"&id="+id; 578 $.ajax({579 type: 'post',580 url: "licenses/newlicense/licenses-newlicense-newlicenseajax.php",581 data: dataparam,582 success: function (data) { 583 $('#pdlessons').html(data) 584 },585 }); 586}587/*----588 fn_load_product()589 Function to be used for load the product 590----*/591function fn_load_product(id,type)592{593 var list6= []; // get unit ids594 $("div[id^=list6_]").each(function()595 {596 list6.push($(this).attr('id').replace('list6_',''));597 }); 598 599 var list8= []; // get ipl ids600 $("div[id^=list8_]").each(function() 601 {602 list8.push($(this).attr('id').replace('list8_',''));603 }); 604 605 var list4= []; // get module id606 $("div[id^=list4_]").each(function() 607 {608 list4.push($(this).attr('id').replace('list4_',''));609 });610 611 var list12= []; // get Quest id612 $("div[id^=list12_]").each(function() 613 {614 list12.push($(this).attr('id').replace('list12_',''));615 });616 617 var list14= []; // get expedition id618 $("div[id^=list14_]").each(function() 619 {620 list14.push($(this).attr('id').replace('list14_',''));621 });622 623 var list16= []; // get course id624 $("div[id^=list16_]").each(function()625 {626 list16.push($(this).attr('id').replace('list16_',''));627 });628 629 var list24= []; // get PD id630 $("div[id^=list24_]").each(function() 631 {632 list24.push($(this).attr('id').replace('list24_',''));633 });634 635 var list26= []; // get Mission id636 $("div[id^=list26_]").each(function() 637 {638 list26.push($(this).attr('id').replace('list26_',''));639 });640 641 var list32= []; // get Non digital id642 $("div[id^=list32_]").each(function() 643 {644 list32.push($(this).attr('id').replace('list32_',''));645 });646 647 var dataparam = "oper=loadproduct"+"&unitids="+list6+"&iplids="+list8+"&maduleids="+list4+"&expids="+list14+"&questids="+list12+"&pdids="+list24+"&missionids="+list26+"&courseids="+list16+"&id="+id+"&nondigitalcontentids="+list32; 648 //alert(dataparam);649 $.ajax({650 type: 'post',651 url: "licenses/newlicense/licenses-newlicense-newlicenseajax.php",652 data: dataparam,653 success: function (data) { 654 655 if(type=='content')656 {657 var list29= []; // get PD id658 $("div[id^=list29_]").each(function() //get unit ids659 {660 list29.push($(this).attr('id').replace('list29_',''));661 });662 }663 664 $('#product').html(data)665 if(type=='edit')666 {667 var list29= []; // get product left id668 $("div[id^=list29_]").each(function() //get product left ids669 {670 list29.push($(this).attr('id').replace('list29_',''));671 });672 }673 674 fn_movealllistitems('list29','list30',0,0); // Move right side675 676 var left ='';677 for(var i=0; i<list29.length; i++)678 {679 var leftside = list29[i];680 var res = leftside.split(",");681 if(left=='')682 {683 var left1=res[0];684 }685 else686 {687 var left1=left1+","+res[0];688 }689 if(id!=0)690 {691 fn_movealllistitems('list29','list30',1,left1); // Move left side692 }693 }694 695 },696 }); 697}698/*----699 fn_load_assessment()700 Function to be used for load the assessment701----*/702function fn_load_assessment(id)703{704 705 var list8= []; // get ipl ids706 $("div[id^=list8_]").each(function() 707 {708 list8.push($(this).attr('id').replace('list8_',''));709 }); 710 711 var list4= []; // get module id712 $("div[id^=list4_]").each(function() 713 {714 list4.push($(this).attr('id').replace('list4_',''));715 });716 717 var list12= []; // get Quest id718 $("div[id^=list12_]").each(function() 719 {720 list12.push($(this).attr('id').replace('list12_',''));721 });722 723 var list14= []; // get expedition id724 $("div[id^=list14_]").each(function() 725 {726 list14.push($(this).attr('id').replace('list14_',''));727 });728 729 730 var list24= []; // get PD id731 $("div[id^=list24_]").each(function() 732 {733 list24.push($(this).attr('id').replace('list24_',''));734 });735 736 var list26= []; // get Mission id737 $("div[id^=list26_]").each(function() 738 {739 list26.push($(this).attr('id').replace('list26_',''));740 });741 742 743 var dataparam = "oper=loadassessment"+"&iplids="+list8+"&maduleids="+list4+"&expids="+list14+"&questids="+list12+"&pdids="+list24+"&missionids="+list26+"&id="+id; 744 //alert(dataparam);745 $.ajax({746 type: 'post',747 url: "licenses/newlicense/licenses-newlicense-newlicenseajax.php",748 data: dataparam,749 success: function (data) { 750 751 $('#assessment').html(data);752 753 },754 }); 755}756/*----757 fn_deletelicense()758 Function to be used for delete the license 759----*/760function fn_deletelicense(id)761{ 762 $.Zebra_Dialog('Are you sure you want to delete?',763 {764 'type': 'confirmation',765 'buttons': [766 {caption: 'No', callback: function() { }},767 {caption: 'Yes', callback: function() { 768 actionmsg = "Deleting";769 alertmsg = "License has been deleted successfully"; 770 alertmsg1 = "License cannot be deleted. Districts or schools are using this license"; 771 var dataparam = "oper=deletelicense&id="+id; 772 $.ajax({773 type: 'post',774 url: "licenses/newlicense/licenses-newlicense-newlicenseajax.php",775 data: dataparam,776 beforeSend: function(){777 showloadingalert(actionmsg+", please wait."); 778 },779 success: function (data) {780 if(data=="success")781 {782 $('.lb-content').html(alertmsg); 783 setTimeout('closeloadingalert()',1000);784 setTimeout('removesections("#home");',500);785 setTimeout('showpages("licenses","licenses/licenses.php")',500);786 }787 else if(data=="exists")788 {789 closeloadingalert();790 $.Zebra_Dialog(alertmsg1, { 'type': 'information', 'buttons': false, 'auto_close': 2000 });791 }792 else793 {794 $('.lb-content').html("Deleting this license has been failed");795 setTimeout('closeloadingalert()',2000);796 } 797 },798 }); 799 }800 }]801 }); 802}803/*----804 fn_updatelicense()805 Function to be used for update the license details for distict,school and individual806----*/807function fn_updatelicense(id,type,hidlicenseid){ 808 var ddllicense = '';809 var numusers ='';810 var startdate ='';811 var enddate ='';812 var renewal ='';813 var graceipl='';814 var gracemod='';815 var error=0; 816 var counterror=0;817 var rcount = ''; 818 $("div[id^='lic']").each(function() {819 var flag=0; 820 if($(this).attr('id')!='licenselist'){821 var i = $(this).attr('id').substring(3);822 823 if($('#checkbox'+i).is(':checked')){824 flag=1;825 }826 if($('#iplcount'+i).is(':visible')){827 if($('#iplcount'+i).val()==0 || $('#iplcount'+i).val()==''){828 error=1;829 }830 }831 if($('#modcount'+i).is(':visible')){832 if($('#modcount'+i).val()==0 || $('#modcount'+i).val()==''){833 error=1;834 }835 }836 if($('#noofusers' + i).val()==0 || $('#noofusers' + i).val()==''){837 error=1;838 }839 if($('#sdate' + i).val()==0 || $('#sdate' + i).val()==''){840 error=1;841 }842 if($('#errorcount'+i).val()==1){843 counterror=1;844 }845 renewal+=flag+'~';846 ddllicense+=$('#ddllic' + i).val()+'~';847 numusers+=$('#noofusers' + i).val()+'~'; 848 startdate+=$('#sdate' + i).val()+'~'; 849 enddate+=$('#edate' + i).val()+'~'; 850 graceipl+=$('#iplcount' + i).val()+'~'; 851 gracemod+=$('#modcount' + i).val()+'~'; 852 rcount+=$('#renewalcount_' + i).val()+'~'; 853 }854 }); 855 if(error==0 && counterror==0){856 var dataparam = "oper=updatelicense&ddllicense="+ddllicense+"&numusers="+numusers+"&startdate="+startdate+"&enddate="+enddate+"&graceipl="+graceipl+"&gracemod="+gracemod+"&renewal="+renewal+"&id="+id+"&type="+type+"&distid="+$('#hiddistid').val()+"&rcount="+rcount;857 $.ajax({858 type: 'post',859 url: "licenses/newlicense/licenses-newlicense-newlicenseajax.php",860 data: dataparam,861 beforeSend: function(){862 showloadingalert("Updating please wait."); 863 },864 success:function(data) {865 $('.lb-content').html("License has been updated successfully"); 866 setTimeout('closeloadingalert()',1000);867 removesections("#licenses-newlicense-actions");868 showpageswithpostmethod("licenses-newlicense-viewlicenseholders","licenses/newlicense/licenses-newlicense-viewlicenseholders.php","id="+hidlicenseid); 869 }870 871 });872 }873 else{874 if(error==1){875 $.Zebra_Dialog("Please fill all the information about licenses.", { 'type': 'information', 'buttons': false, 'auto_close': 2000 });876 return false;877 }878 else if(counterror==1){879 $.Zebra_Dialog("Seats exceeds available student seats.", { 'type': 'information', 'buttons': false, 'auto_close': 2000 });880 return false;881 }882 }883 884}885function fn_loadextendcontent(licenseid,flag)886{887 var list4 = []; //module/mathmodule id/quest id888 889 $("div[id^=list4_]").each(function()890 {891 list4.push($(this).attr('name').replace('list4_',''));892 }); 893 $("div[id^=list12_]").each(function()894 {895 list4.push($(this).attr('name').replace('list12_',''));896 });897 $("div[id^=list14_]").each(function()898 {899 list4.push($(this).attr('name').replace('list14_',''));900 });901 902 $("div[id^=list26_]").each(function()903 {904 list4.push($(this).attr('name').replace('list26_',''));905 });906 if(list4=='' && flag!=1){907 $.Zebra_Dialog("Please select any Module/Mathmodule/Quest/Exppedition.", { 'type': 'information', 'buttons': false, 'auto_close': 2000 });908 return false;909 }910 var dataparam = "oper=loadextendcontent&licenseid="+licenseid+"&list4="+list4; 911 $.ajax({912 type: 'post',913 url: "licenses/newlicense/licenses-newlicense-newlicenseajax.php",914 data: dataparam,915 beforeSend: function(){ 916 },917 success:function(data) {918 $('#extendcontent').html(data);919 }920 921 }); 922}923/*----924 fn_load_modulesave()925 Function to be used for load the modules to save 926----*/927function fn_load_modulesave(licenseid,id,movemods)928{929 var list4= [];930 if(movemods == 1) {931 $("div[id^=list4_]").each(function() //get unit ids932 {933 list4.push($(this).attr('name').replace('list4_',''));934 });935var chkid = id;936 }937 else if(movemods == 0)938 {939 $("div[id^=list3_]").each(function() //get unit ids940 {941 list4.push($(this).attr('name').replace('list3_',''));942 });943 var chkid = id;944 }945 else if(movemods == 5) {946 list4 = id;947 var chkid = 1;948 }949 else if(movemods == 3) {950 list4 = id;951 var chkid = 1;952 }953 954 var dataparam = "oper=loadmodulesave"+"&list4="+list4+"&licenseid="+licenseid+"&chkid="+chkid+"&movemods="+movemods; 955 $.ajax({956 type: 'post',957 url: "licenses/newlicense/licenses-newlicense-newlicenseajax.php",958 data: dataparam,959 beforeSend: function(){960 showloadingalert("Updating please wait."); 961 },962 success: function (data) {963 setTimeout('closeloadingalert()',1000); 964 },965 }); ...

Full Screen

Full Screen

HostAccessRulesTable.js

Source:HostAccessRulesTable.js Github

copy

Full Screen

...7 for (c=0;c<elems.length;c++) {8 if (elems[c].getAttribute("type")=='checkbox' && elems[c].getAttribute("column")=='read') {9 elems[c].checked = item.checked;10 if (!elems[c].checked) {11 getElementById(elems[c].id.replace("Read","Write"),tbl).checked = item.checked;12 if (this.className=="HostAccessRulesTable") {13 getElementById(elems[c].id.replace("Read","SMB"),tbl).checked = item.checked;14 getElementById(elems[c].id.replace("Read","NFS"),tbl).checked = item.checked;15 getElementById(elems[c].id.replace("Read","AFP"),tbl).checked = item.checked;16 }17 }18 if (this.className=="HostAccessRulesTable" && elems[c].checked && !getElementById(elems[c].id.replace("Read","SMB"),tbl).checked && !getElementById(elems[c].id.replace("Read","NFS"),tbl).checked && !getElementById(elems[c].id.replace("Read","AFP"),tbl).checked) {19 getElementById(elems[c].id.replace("Read","SMB"),tbl).checked = item.checked;20 getElementById(elems[c].id.replace("Read","NFS"),tbl).checked = item.checked; 21 getElementById(elems[c].id.replace("Read","AFP"),tbl).checked = item.checked; 22 }23 }24 }25 this.checkAllChecked(item);26 var ev = new Array;27 ev["target"] = this.opener_item;28 this.opener_object.onChange(ev);29 },30 checkAllWrite: function(event) {31 var item = eventTarget(event);32 var elems = $I(this.node.id+"_table").getElementsByTagName('input');33 var c=0;34 for (c=0;c<elems.length;c++) {35 if (elems[c].getAttribute("type")=='checkbox' && elems[c].getAttribute("column")=='write') {36 elems[c].checked = item.checked;37 if (this.className=="HostAccessRulesTable" && !document.getElementById(elems[c].id.replace("Write","Read")).checked) {38 document.getElementById(elems[c].id.replace("Write","SMB")).checked = elems[c].checked; 39 document.getElementById(elems[c].id.replace("Write","NFS")).checked = elems[c].checked; 40 document.getElementById(elems[c].id.replace("Write","AFP")).checked = elems[c].checked; 41 }42 }43 if (elems[c].checked) {44 document.getElementById(elems[c].id.replace("Write","Read")).checked = elems[c].checked;45 }46 }47 this.checkAllChecked(item);48 var ev = new Array;49 ev["target"] = this.opener_item;50 this.opener_object.onChange(ev);51 },52 checkAllSMB: function(event) {53 var item = eventTarget(event); 54 var elems = $I(this.node.id+"_table").getElementsByTagName('input');55 var c=0;56 for (c=0;c<elems.length;c++) {57 if (elems[c].getAttribute("type")=='checkbox' && elems[c].getAttribute("column")=='SMB') {58 elems[c].checked = item.checked;59 var ev = new Array;60 ev["target"] = elems[c];61 this.checkSMB(ev);62 }63 }64 this.checkAllChecked(item);65 var ev = new Array;66 ev["target"] = this.opener_item;67 this.opener_object.onChange(ev);68 },69 checkAllNFS: function(event) {70 var item = eventTarget(event);71 var elems = $I(this.node.id+"_table").getElementsByTagName('input');72 var c=0;73 for (c=0;c<elems.length;c++) {74 if (elems[c].getAttribute("type")=='checkbox' && elems[c].getAttribute("column")=='NFS') {75 elems[c].checked = item.checked;76 var ev = new Array;77 ev["target"] = elems[c];78 this.checkNFS(ev);79 }80 }81 this.checkAllChecked(item);82 var ev = new Array;83 ev["target"] = this.opener_item;84 this.opener_object.onChange(ev);85 },86 checkAllAFP: function(event) {87 var item = eventTarget(event);88 var elems = $I(this.node.id+"_table").getElementsByTagName('input');89 var c=0;90 for (c=0;c<elems.length;c++) {91 if (elems[c].getAttribute("type")=='checkbox' && elems[c].getAttribute("column")=='AFP') {92 elems[c].checked = item.checked;93 var ev = new Array;94 ev["target"] = elems[c];95 this.checkAFP(ev);96 }97 }98 this.checkAllChecked(item);99 var ev = new Array;100 ev["target"] = this.opener_item;101 this.opener_object.onChange(ev);102 },103 104 checkRead: function(event) {105 var target = eventTarget(event);106 if (!target.checked) {107 getElementById(target.id.replace("Read","Write"),this.node).checked = target.checked;108 if (this.className=="HostAccessRulesTable") {109 getElementById(target.id.replace("Read","SMB"),this.node).checked = target.checked;110 getElementById(target.id.replace("Read","NFS"),this.node).checked = target.checked;111 getElementById(target.id.replace("Read","AFP"),this.node).checked = target.checked;112 }113 }114 if (target.checked) {115 if (this.className=="HostAccessRulesTable" && !getElementById(target.id.replace("Read","SMB"),this.node).checked && !getElementById(target.id.replace("Read","NFS"),this.node).checked && !getElementById(target.id.replace("Read","AFP"),this.node).checked) {116 getElementById(target.id.replace("Read","SMB"),this.node).checked = target.checked;117 getElementById(target.id.replace("Read","NFS"),this.node).checked = target.checked; 118 getElementById(target.id.replace("Read","AFP"),this.node).checked = target.checked; 119 }120 }121 this.checkAllChecked(target);122 var ev = new Array;123 ev["target"] = this.opener_item;124 this.opener_object.onChange(ev);125 },126 checkWrite: function(event) {127 target = eventTarget(event);128 if (target.checked) {129 document.getElementById(target.id.replace("Write","Read")).checked = target.checked;130 if (this.className=="HostAccessRulesTable" && !document.getElementById(target.id.replace("Write","SMB")).checked && !document.getElementById(target.id.replace("Write","NFS")).checked && !document.getElementById(target.id.replace("Write","AFP")).checked) {131 document.getElementById(target.id.replace("Write","SMB")).checked = target.checked;132 document.getElementById(target.id.replace("Write","NFS")).checked = target.checked; 133 document.getElementById(target.id.replace("Write","AFP")).checked = target.checked; 134 }135 }136 this.checkAllChecked(target);137 var ev = new Array;138 ev["target"] = this.opener_item;139 this.opener_object.onChange(ev);140 },141 checkSMB: function(event) {142 var target = eventTarget(event);143 if (!target.checked) {144 if (!document.getElementById(target.id.replace("SMB","NFS")).checked && !document.getElementById(target.id.replace("SMB","AFP")).checked) {145 document.getElementById(target.id.replace("SMB","Read")).checked = target.checked;146 document.getElementById(target.id.replace("SMB","Write")).checked = target.checked; 147 }148 }149 if (target.checked) {150 if (!document.getElementById(target.id.replace("SMB","Read")).checked && !document.getElementById(target.id.replace("SMB","NFS")).checked && !document.getElementById(target.id.replace("SMB","AFP")).checked) {151 document.getElementById(target.id.replace("SMB","Read")).checked = target.checked;152 }153 }154 this.checkAllChecked(target);155 var ev = new Array;156 ev["target"] = this.opener_item;157 this.opener_object.onChange(ev);158 },159 checkNFS: function(event) {160 var target = eventTarget(event);161 if (!target.checked) {162 if (!document.getElementById(target.id.replace("NFS","SMB")).checked && !document.getElementById(target.id.replace("NFS","AFP")).checked) {163 document.getElementById(target.id.replace("NFS","Read")).checked = target.checked;164 document.getElementById(target.id.replace("NFS","Write")).checked = target.checked; 165 }166 }167 if (target.checked) {168 if (!document.getElementById(target.id.replace("NFS","Read")).checked && !document.getElementById(target.id.replace("NFS","SMB")).checked && !document.getElementById(target.id.replace("NFS","AFP")).checked) {169 document.getElementById(target.id.replace("NFS","Read")).checked = target.checked;170 }171 }172 this.checkAllChecked(target);173 var ev = new Array;174 ev["target"] = this.opener_item;175 this.opener_object.onChange(ev);176 },177 checkAFP: function(event) {178 target = eventTarget(event);179 if (!target.checked) {180 if (!document.getElementById(target.id.replace("AFP","SMB")).checked && !document.getElementById(target.id.replace("AFP","NFS")).checked) {181 document.getElementById(target.id.replace("AFP","Read")).checked = target.checked;182 document.getElementById(target.id.replace("AFP","Write")).checked = target.checked; 183 }184 }185 if (target.checked) {186 if (!document.getElementById(target.id.replace("AFP","Read")).checked && !document.getElementById(target.id.replace("AFP","SMB")).checked && !document.getElementById(target.id.replace("AFP","NFS")).checked) {187 document.getElementById(target.id.replace("AFP","Read")).checked = target.checked;188 document.getElementById(target.id.replace("AFP","Write")).checked = target.checked;189 }190 }191 this.checkAllChecked(target);192 var ev = new Array;193 ev["target"] = this.opener_item;194 this.opener_object.onChange(ev);195 },196 197 checkChecked: function(column) {198 var elems = $I(this.node.id+"_table").getElementsByTagName('input');199 var all_checked = true;200 var c=0;201 for (c=0;c<elems.length;c++) {202 if (elems[c].getAttribute("type")=='checkbox' && elems[c].getAttribute("column")==column) { 203 if (!elems[c].checked) {204 all_checked=false;205 return all_checked;206 }207 }208 }209 return all_checked;210 },211 212 checkAllChecked: function() {213 var id=this.object_id;214 getElementById(id+"_checkAllRead",this.node).checked = this.checkChecked("read");215 getElementById(id+"_checkAllWrite",this.node).checked = this.checkChecked("write");216 if (this.className=="HostAccessRulesTable") {217 getElementById(id+"_checkAllSMB",this.node).checked = this.checkChecked("SMB");218 getElementById(id+"_checkAllNFS",this.node).checked = this.checkChecked("NFS");219 getElementById(id+"_checkAllAFP",this.node).checked = this.checkChecked("AFP");220 }221 },222 getChecked: function() {223 var res = new Array;224 var elems = $I(this.node.id+"_table").getElementsByTagName('input');225 var c=0;226 for (c=0;c<elems.length;c++) {227 var smb='';var nfs='';var afp='';228 var readonly="";229 if (elems[c].getAttribute("type")=='checkbox' && elems[c].getAttribute("column")=='read') {230 if (elems[c].checked) {231 if (document.getElementById(elems[c].id.replace("Read","Write")).checked)232 readonly = "no";233 else234 readonly = "yes";235 if (this.className=="HostAccessRulesTable") {236 if (document.getElementById(elems[c].id.replace("Read","SMB")).checked)237 smb = "smb";238 else239 smb = ""; 240 if (document.getElementById(elems[c].id.replace("Read","NFS")).checked)241 nfs = "nfs";242 else243 nfs = ""; 244 if (document.getElementById(elems[c].id.replace("Read","AFP")).checked)245 afp = "afp";246 else247 afp = ""; 248 res[res.length] = elems[c].getAttribute("share")+"~"+elems[c].getAttribute("path")+"~"+readonly+"~"+smb+"~"+nfs+"~"+afp;249 } else {250 res[res.length] = elems[c].getAttribute("share")+"~"+elems[c].getAttribute("path")+"~"+readonly; 251 }252 }253 }254 }255 return res.join("|");256 }...

Full Screen

Full Screen

shortcuts-landing-page.js

Source:shortcuts-landing-page.js Github

copy

Full Screen

1(function ($) {2 window.BaseUrl = window.BaseUrl || '';3 $.SalesPortal = $.SalesPortal || {};4 $.SalesPortal.ShortcutsLandingPage = function () {5 let pageData = undefined;6 let updateSizeDelegates = [];7 this.init = function (data) {8 pageData = data;9 $.SalesPortal.Content.fillContent({10 content: pageData.content,11 headerOptions: pageData.options.headerOptions,12 actions: pageData.actions,13 navigationPanel: pageData.navigationPanel,14 fixedPanels: pageData.fixedPanels,15 resizeCallback: updateContentSize,16 loadCallback: function () {17 new $.SalesPortal.ShortcutsSearchBar({18 shortcutData: pageData.options19 });20 let initMarkupBlocks = function (markupObject) {21 $.SalesPortal.ShortcutsManager.assignShortcutItemHandlers(markupObject);22 $.each(markupObject.find('.shortcut-library-link'), function (key, value) {23 let libraryLinkBlock = $(value);24 if ($.SalesPortal.Content.isMobileDevice())25 {26 libraryLinkBlock.hammer().on('hold', function (event) {27 let linkId = $(this).find('.service-data .library-link-id').text();28 $.SalesPortal.LinkManager.requestLinkContextMenu(linkId, false, false, event.gesture.center.pageX, event.gesture.center.pageY);29 event.gesture.stopPropagation();30 event.gesture.preventDefault();31 });32 }33 else34 {35 libraryLinkBlock.off('contextmenu').on('contextmenu', function (event) {36 let linkId = $(this).find('.service-data .library-link-id').text();37 $.SalesPortal.LinkManager.requestLinkContextMenu(linkId, false, false, event.clientX, event.clientY);38 return false;39 });40 }41 if (libraryLinkBlock.hasClass('draggable'))42 libraryLinkBlock.off('dragstart').on('dragstart', function (e) {43 let urlHeader = $(this).data("url-header");44 let url = $(this).data('url');45 if (url !== '')46 e.originalEvent.dataTransfer.setData(urlHeader, url);47 });48 });49 $.each(markupObject.find('.horizontal-feed'), function (key, value) {50 let linkFeed = $(value);51 let feedId = linkFeed.prop('id').replace('horizontal-feed-', '');52 let querySettingsEncoded = linkFeed.find('>.service-data .encoded-object .query-settings').text();53 let querySettings = querySettingsEncoded !== undefined && querySettingsEncoded.length ? $.parseJSON(querySettingsEncoded) : undefined;54 let viewSettingsEncoded = linkFeed.find('>.service-data .encoded-object .view-settings').text();55 let viewSettings = viewSettingsEncoded !== undefined && viewSettingsEncoded.length ? $.parseJSON(viewSettingsEncoded) : undefined;56 new $.SalesPortal.LandingPage.HorizontalFeed({57 containerId: feedId,58 querySettings: querySettings,59 viewSettings: viewSettings60 }).init();61 });62 $.each(markupObject.find('.vertical-feed'), function (key, value) {63 let linkFeed = $(value);64 let feedId = linkFeed.prop('id').replace('vertical-feed-', '');65 let querySettingsEncoded = linkFeed.find('>.service-data .encoded-object .query-settings').text();66 let querySettings = querySettingsEncoded !== undefined && querySettingsEncoded.length ? $.parseJSON(querySettingsEncoded) : undefined;67 let viewSettingsEncoded = linkFeed.find('>.service-data .encoded-object .view-settings').text();68 let viewSettings = viewSettingsEncoded !== undefined && viewSettingsEncoded.length ? $.parseJSON(viewSettingsEncoded) : undefined;69 new $.SalesPortal.LandingPage.VerticalFeed({70 containerId: feedId,71 querySettings: querySettings,72 viewSettings: viewSettings73 }).init();74 });75 $.each(markupObject.find('.scroll-stripe'), function (key, value) {76 let stripeBlock = $(value);77 let arrowSize = 42;78 if (stripeBlock.hasClass('scrolltab-medium'))79 arrowSize = 62;80 else if (stripeBlock.hasClass('scrolltab-large'))81 arrowSize = 82;82 stripeBlock.scrollTabs({83 left_arrow_size: arrowSize,84 right_arrow_size: arrowSize85 });86 $.SalesPortal.ShortcutsManager.assignShortcutItemHandlers(stripeBlock);87 });88 $.each(markupObject.find('.landing-page-button-group'), function (key, value) {89 let buttonGroupBlock = $(value);90 $.SalesPortal.ShortcutsManager.assignShortcutItemHandlers(buttonGroupBlock);91 });92 $.each(markupObject.find('.masonry-container'), function (key, value) {93 let masonryBlock = $(value);94 let masonryId = masonryBlock.prop('id').replace('masonry-container-', '');95 let querySettingsEncoded = masonryBlock.find('>.service-data .encoded-object .query-settings').text();96 let querySettings = querySettingsEncoded !== undefined && querySettingsEncoded.length ? $.parseJSON(querySettingsEncoded) : undefined;97 let viewSettingsEncoded = masonryBlock.find('>.service-data .encoded-object .view-settings').text();98 let viewSettings = viewSettingsEncoded !== undefined && viewSettingsEncoded.length ? $.parseJSON(viewSettingsEncoded) : undefined;99 let masonryProcessor = new $.SalesPortal.LandingPage.Masonry({100 containerId: masonryId,101 parentShortcutId: pageData.options.linkId,102 querySettings: querySettings,103 viewSettings: viewSettings104 });105 masonryProcessor.init();106 updateSizeDelegates.push(function () {107 masonryProcessor.updateContentSize();108 });109 });110 $.each(markupObject.find('.toggle-panel'), function (key, value) {111 let togglePanelBlock = $(value);112 let togglePanelId = togglePanelBlock.prop('id').replace('toggle-panel-', '');113 new $.SalesPortal.LandingPage.TogglePanel({114 containerId: togglePanelId,115 parentShortcutId: pageData.options.linkId,116 }).init();117 });118 $.each(markupObject.find('.menu-stripe'), function (key, value) {119 let menuStripeBlock = $(value);120 let menuStripeId = menuStripeBlock.prop('id').replace('menu-stripe-', '');121 new $.SalesPortal.LandingPage.MenuStripe({122 containerId: menuStripeId123 }).init();124 });125 $.each(markupObject.find('.landing-page-video-group'), function (key, value) {126 let videoGroupBlock = $(value);127 let videoGroupId = videoGroupBlock.prop('id').replace('video-group-', '');128 new $.SalesPortal.LandingPage.VideoGroup({129 containerId: videoGroupId130 }).init();131 });132 $.each(markupObject.find('.drop-folder-container'), function (key, value) {133 let dropFolderBlock = $(value);134 let dropFolderContainerId = dropFolderBlock.prop('id').replace('drop-folder-container-', '');135 new $.SalesPortal.LandingPage.DropFolder({136 containerId: dropFolderContainerId137 }).init();138 });139 $.each(markupObject.find('.landing-page-calendar'), function (key, value) {140 let calendarBlock = $(value);141 let calendarContainerId = calendarBlock.prop('id').replace('calendar-', '');142 let calendarProcessor = new $.SalesPortal.LandingPage.Calendar({143 containerId: calendarContainerId,144 parentShortcutId: pageData.options.linkId,145 });146 updateSizeDelegates.push(function () {147 calendarProcessor.init();148 });149 });150 $.each(markupObject.find('.library-block'), function (key, value) {151 let libraryBlock = $(value);152 let libraryBlockId = libraryBlock.prop('id').replace('library-block-', '');153 new $.SalesPortal.LandingPage.Wallbin.LibraryBlock({154 containerId: libraryBlockId155 }).init();156 });157 $.each(markupObject.find('.library-page-bundle-block'), function (key, value) {158 let libraryPageBundleBlock = $(value);159 let libraryPageBundleBlockId = libraryPageBundleBlock.prop('id').replace('library-page-bundle-block-', '');160 new $.SalesPortal.LandingPage.Wallbin.LibraryPageBundleBlock({161 containerId: libraryPageBundleBlockId162 }).init();163 });164 $.each(markupObject.find('.library-page-block'), function (key, value) {165 let libraryPageBlock = $(value);166 let libraryPageBlockId = libraryPageBlock.prop('id').replace('library-page-block-', '');167 new $.SalesPortal.LandingPage.Wallbin.LibraryPageBlock({168 containerId: libraryPageBlockId169 }).init();170 });171 $.each(markupObject.find('.library-window-block'), function (key, value) {172 let libraryWindowBlock = $(value);173 let libraryWindowBlockId = libraryWindowBlock.prop('id').replace('library-window-block-', '');174 new $.SalesPortal.LandingPage.Wallbin.LibraryWindowBlock({175 containerId: libraryWindowBlockId176 }).init();177 });178 $.each(markupObject.find('.search-results-block'), function (key, value) {179 let searchResultsBlock = $(value);180 let searchResultsBlockId = searchResultsBlock.prop('id').replace('search-results-block-', '');181 let searchResultsBlockManager = new $.SalesPortal.LandingPage.SearchResultsBlock({182 containerId: searchResultsBlockId183 });184 searchResultsBlockManager.init();185 updateSizeDelegates.push(function () {186 searchResultsBlockManager.updateContentSize();187 });188 });189 markupObject.find('[data-bs-hover-animate]')190 .mouseenter(function () {191 let elem = $(this);192 elem.addClass('animated ' + elem.attr('data-bs-hover-animate'))193 })194 .mouseleave(function () {195 let elem = $(this);196 elem.removeClass('animated ' + elem.attr('data-bs-hover-animate'))197 });198 markupObject.find('.landing-carousel.carousel-slide-show').carousel();199 markupObject.find('.tooltipster-target').tooltipster();200 };201 let pageContent = $.SalesPortal.Content.getContentObject();202 let landingPage = pageContent.find('.landing-page-markup');203 initMarkupBlocks(landingPage);204 let fixedPanels = $.SalesPortal.Content.getFixedPanels();205 initMarkupBlocks(fixedPanels);206 updateSizeDelegates.push(function () {207 let content = $.SalesPortal.Content.getContentObject();208 let shortcutsPage = content.find('.shortcuts-page-content');209 let height = content.outerHeight(true) - content.find('.shortcuts-search-bar-container').outerHeight(true) - 20;210 shortcutsPage.css({211 'height': height + 'px'212 });213 });214 initActionButtons();215 $(window).off('resize.landing-page').on('resize.landing-page', updateContentSize);216 updateContentSize();217 if (data.autoLoadModalContentCallback !== undefined)218 data.autoLoadModalContentCallback();219 }220 });221 };222 let initActionButtons = function () {223 let shortcutActionsContainer = $('#shortcut-action-container');224 shortcutActionsContainer.find('.hide-search, .show-search').addClass('hidden-xs');225 };226 let updateContentSize = function () {227 $.SalesPortal.ShortcutsManager.updateContentSize();228 $.each(updateSizeDelegates, function (i, val) {229 val();230 });231 };232 };...

Full Screen

Full Screen

userReg.js

Source:userReg.js Github

copy

Full Screen

...17}18function checkUserCode(txtid) {19 var userCode = $.trim($(txtid).val());20 if (userCode == "") {21 $(txtid.id.replace("txt", "#lbl")).text("请输入会员编号!");22 $(txtid.id.replace("txt", "#lbl")).css({ display: "block" });23 $(txtid.id.replace("txt", "#img")).css({ display: "none" });24 return false;25 }26 var reg = /^[0-9]{6}$/;27// var reg = /^[a-zA-Z|0-9]{6,10}$/;28 if (!reg.test(userCode)) {29 $(txtid.id.replace("txt", "#lbl")).text("会员编号必须由6到10位数字或字母组成!");30 $(txtid.id.replace("txt", "#lbl")).css({ display: "block" });31 $(txtid.id.replace("txt", "#img")).css({ display: "none" });32 return false;33 }34 var isValiable = Web.UserReg.chenkUserCode(userCode).value.trim();35 if (isValiable == "false") {36 $(txtid.id.replace("txt", "#lbl")).text("该会员编号已存在!");37 $(txtid.id.replace("txt", "#lbl")).css({ display: "block" });38 $(txtid.id.replace("txt", "#img")).css({ display: "none" });39 return false;40 }41 $(txtid.id.replace("txt", "#lbl")).css({ display: "none" });42 $(txtid.id.replace("txt", "#img")).css({ display: "" });43}44function checkRecommendCode(txtid) {45 var recommendCode = $.trim($(txtid).val());46 if (recommendCode == "") {47 $(txtid.id.replace("txt", "#lbl")).text("请输入推荐会员编号!");48 $(txtid.id.replace("txt", "#lbl")).css({ display: "block" });49 $(txtid.id.replace("txt", "#img")).css({ display: "none" });50 return false;51 }52 var isValiable = Web.UserReg.checkRecommendCode(recommendCode).value.trim();53 if (isValiable == "false") {54 $(txtid.id.replace("txt", "#lbl")).text("推荐会员编号不可用!");55 $(txtid.id.replace("txt", "#lbl")).css({ display: "block" });56 $(txtid.id.replace("txt", "#img")).css({ display: "none" });57 return false;58 }59 $(txtid.id.replace("txt", "#lbl")).css({ display: "none" });60 $(txtid.id.replace("txt", "#img")).css({ display: "" });61}62function checkParentCode(txtid) {63 var parentCode = $.trim($(txtid).val());64 if (parentCode == "") {65 $(txtid.id.replace("txt", "#lbl")).text("请输入接点会员编号!");66 $(txtid.id.replace("txt", "#lbl")).css({ display: "block" });67 $(txtid.id.replace("txt", "#img")).css({ display: "none" });68 return false;69 }70 var isValiable = Web.UserReg.checkParentCode(parentCode).value.trim();71 if (isValiable == "false") {72 $(txtid.id.replace("txt", "#lbl")).text("接点会员编号不可用!");73 $(txtid.id.replace("txt", "#lbl")).css({ display: "block" });74 $(txtid.id.replace("txt", "#img")).css({ display: "none" });75 return false;76 }77 if (isValiable == "full") {78 $(txtid.id.replace("txt", "#lbl")).text("接点会员脚下无空位!");79 $(txtid.id.replace("txt", "#lbl")).css({ display: "block" });80 $(txtid.id.replace("txt", "#img")).css({ display: "none" });81 return false;82 }83 if (isValiable == "onlyleft") {84 $(txtid.id.replace("txt", "#lbl")).text("接点会员脚下无空位!");85 $(txtid.id.replace("txt", "#lbl")).css({ display: "block" });86 $(txtid.id.replace("txt", "#img")).css({ display: "none" });87 return false;88 }89 $(txtid.id.replace("txt", "#lbl")).css({ display: "none" });90 $(txtid.id.replace("txt", "#img")).css({ display: "" });91}92function checkAgentCode(txtid) {93 var agentCode = $.trim($(txtid).val());94 if (agentCode == "") {95 $(txtid.id.replace("txt", "#lbl")).text("请输入服务中心编号!");96 $(txtid.id.replace("txt", "#lbl")).css({ display: "block" });97 $(txtid.id.replace("txt", "#img")).css({ display: "none" });98 return false;99 }100 var isValiable = Web.UserReg.checkAgentCode(agentCode).value.trim();101 if (isValiable == "false") {102 $(txtid.id.replace("txt", "#lbl")).text("服务中心编号不可用!");103 $(txtid.id.replace("txt", "#lbl")).css({ display: "block" });104 $(txtid.id.replace("txt", "#img")).css({ display: "none" });105 return false;106 }107 $(txtid.id.replace("txt", "#lbl")).css({ display: "none" });108 $(txtid.id.replace("txt", "#img")).css({ display: "" });109}110function checkPassword(txtid, level) {111 var reg = /^[a-zA-Z0-9]{3,8}$/;112 var text = $.trim($(txtid).val());113 if (text == "") {114 if (level == 1) {115 $(txtid.id.replace("txt", "#lbl")).text("请输入登录密码!");116 }117 if (level == 2) {118 $(txtid.id.replace("txt", "#lbl")).text("请输入二级密码!");119 }120 if (level == 3) {121 $(txtid.id.replace("txt", "#lbl")).text("请输入三级密码!");122 }123 $(txtid.id.replace("txt", "#lbl")).css({ display: "block" });124 $(txtid.id.replace("txt", "#img")).css({ display: "none" });125 return false;126 }127 if (!reg.test(text)) {128 $(txtid.id.replace("txt", "#lbl")).text("密码必须由3位到8位数字或字母组成!");129 $(txtid.id.replace("txt", "#lbl")).css({ display: "block" });130 $(txtid.id.replace("txt", "#img")).css({ display: "none" });131 return false;132 }133 $(txtid.id.replace("txt", "#lbl")).css({ display: "none" });134 $(txtid.id.replace("txt", "#img")).css({ display: "" });135}136function checkConfirmPassword(txtid, contxtid) {137 var text = $.trim($(txtid).val());138 var context = $.trim($(contxtid).val());139 if (text == "") {140 $(txtid.id.replace("txt", "#lbl")).text("请输入确认密码!");141 $(txtid.id.replace("txt", "#lbl")).css({ display: "block" });142 $(txtid.id.replace("txt", "#img")).css({ display: "none" });143 return false;144 }145 if (text != context) {146 $(txtid.id.replace("txt", "#lbl")).text("两次输入的密码不一致!");147 $(txtid.id.replace("txt", "#lbl")).css({ display: "block" });148 $(txtid.id.replace("txt", "#img")).css({ display: "none" });149 return false;150 }151 $(txtid.id.replace("txt", "#lbl")).css({ display: "none" });152 $(txtid.id.replace("txt", "#img")).css({ display: "" });153}154function checkIdenCode(txtid) {155 var reg = /(^\d{15}$)|(^\d{17}([0-9]|X)$)/;156 var text = $.trim($(txtid).val());157 if (text == "") {158 $(txtid.id.replace("txt", "#lbl")).text("请输入身份证号!");159 $(txtid.id.replace("txt", "#lbl")).css({ display: "block" });160 $(txtid.id.replace("txt", "#img")).css({ display: "none" });161 return false;162 }163 if (!reg.test(text)) {164 $(txtid.id.replace("txt", "#lbl")).text("身份证号格式不正确!");165 $(txtid.id.replace("txt", "#lbl")).css({ display: "block" });166 $(txtid.id.replace("txt", "#img")).css({ display: "none" });167 return false;168 }169 var isValiable = Web.UserReg.checkIdenCode(text).value.trim();170 if (isValiable == "false") {171 $(txtid.id.replace("txt", "#lbl")).text("您的身份证号已经被占用!");172 $(txtid.id.replace("txt", "#lbl")).css({ display: "block" });173 $(txtid.id.replace("txt", "#img")).css({ display: "none" });174 return false;175 }176 $(txtid.id.replace("txt", "#lbl")).css({ display: "none" });177 $(txtid.id.replace("txt", "#img")).css({ display: "" });178}179function checkBank() {180 var seleText = $.trim($('#ddlsele_province option:selected').text());181 if (seleText == "请选择") {182 $("#lbl_bankBranch").css({ display: "block" });183 $("#img_bankBranch").css({ display: "none" });184 return false;185 }186 var text = $.trim($("#txt_bankBranch").val());187 if (text == "") {188 $("#lbl_bankBranch").css({ display: "block" });189 $("#img_bankBranch").css({ display: "none" });190 return false;191 }192 $("#lbl_bankBranch").css({ display: "none" });193 $("#img_bankBranch").css({ display: "" });194}195function checkEmpty(txtid) {196 var text = $.trim($(txtid).val());197 if (text == "") {198 $(txtid.id.replace("txt", "#lbl")).css({ display: "block" });199 $(txtid.id.replace("txt", "#img")).css({ display: "none" });200 return false;201 }202 $(txtid.id.replace("txt", "#lbl")).css({ display: "none" });203 $(txtid.id.replace("txt", "#img")).css({ display: "" });204}205function CheckContent() {206 var aer = $('#city').find("select").eq(2).val();207 if (aer == "请选择") {208 document.getElementById("img_bankBranch").style.display = "none";209 document.getElementById("lbl_bankBranch").style.display = "block";210 return false;211 }212 document.getElementById("img_bankBranch").style.display = "none";213 document.getElementById("lbl_bankBranch").style.display = "";...

Full Screen

Full Screen

form.js

Source:form.js Github

copy

Full Screen

...72 //////////////73 setTimeout( function(){74 $ES('.lof-onoff').each( function( item ){75 76 if( $defined($ES( "."+item.id.replace("params",'group-') )) ) { 77 if( item.checked ){78 //$ES( "."+item.id.replace("params",'group-') ).setStyle("display","");79 // $E( 'tr.'+item.id.replace("params",'group-')).setStyle("display",'');80 item.value=1;81 } else {82 if( $ES( "."+item.id.replace("params",'group-') ).length > 0 ){83 $ES( "."+item.id.replace("params",'group-') ).setStyle("display","none");84 $E( 'tr.'+item.id.replace("params",'group-')).setStyle("display",'');85 item.value=0;86 }87 }88 } 89 });90 setTimeout( function(){91 $E('.jpane-slider ').setStyle( 'height', $E('.paramlist').offsetHeight );92 }, 300 );93 }, 200 );94 9596 $ES('.lof-onoff').addEvent('click', function(item,idx){97 // alert(this.getParent('tr') )98 if( !this.checked ){ // alert( );99 this.value=0;100 $ES( "."+this.id.replace("params",'group-') ).setStyle("display","none");101 $E( 'tr.'+this.id.replace("params",'group-')).setStyle("display",'');102 }else {103 $ES( "."+this.id.replace("params",'group-') ).setStyle("display","");104 $E( 'tr.'+this.id.replace("params",'group-')).setStyle("display",'');105 this.value=1;106 }107 setTimeout( function(){ $E('.jpane-slider ').setStyle( 'height', $E('.paramlist').offsetHeight );}, 300 );108 } );109 110} else {111 var controls=['group','enable_caption'];112 controls.each( function(_group){ 113 $$('#params'+_group).addEvent('change',function(){114 $$('.lof-group').hide(); 115 $$('.lof-'+this.value).show();116 (function(){117 var height = ($$('#menu-pane .jpane-slider')[0].getElement('.panelform-legacy').getHeight() );118 $$('#menu-pane .jpane-slider')[0].setStyle('height', height ) ; ...

Full Screen

Full Screen

mediaUpload.js

Source:mediaUpload.js Github

copy

Full Screen

1MediaUploader = {2 registerAjaxUploadListener : function (uploadBtnId, caller) {3 new AjaxUpload(uploadBtnId, {4 action: '?c=media&m=upload',5 responseType: 'json',6 data : {7 },8 onSubmit : function(file, ext){9 /* Setting data */10 this.setData({11 'file': file12 });1314 },15 onComplete : function(file, response){16 var statusStage = $('#'+ uploadBtnId.replace("avatarMedia","mediaStatus"));17 if (response.error_code == 1) {18 //statusStage.html('上传失败');19 alert(response.error_message);20 } else {21 switch (caller) {22 case 'audio':23 var formatStage = $('#'+ uploadBtnId.replace("avatarMedia","audioFormat"));24 var sizeStage = $('#'+ uploadBtnId.replace("avatarMedia","audioSize"));25 var bitrateStage = $('#'+ uploadBtnId.replace("avatarMedia","audioBitrate"));26 var operationStage = $('#'+ uploadBtnId.replace("avatarMedia","audioOperation"));27 var serializedStage = $('#'+ uploadBtnId.replace("avatarMedia","audioSerialized"));28 var checkStage = $('#'+ uploadBtnId.replace("avatarMedia","audioCheckStatus"));29 formatStage.val(response.data[0].sf_file_extension);30 sizeStage.val(response.data[0].sf_file_size);31 bitrateStage.val(response.data[0].sf_file_bitrate);32 checkStage.val(mediaCheckStatus[response.data[0].sf_check_status])33 operationStage.html('<a href="'+response.data[0].sf_file_link+'" target="_blank">试听</a>');34 serializedStage.val(response.data[0].json);35 $('#'+uploadBtnId).attr("disabled","disabled");36 break;37 case 'mtv' :38 var serializedStage = $('#'+ uploadBtnId.replace("avatarMedia","mvSerialized"));39 var operationStage = $('#'+ uploadBtnId.replace("avatarMedia","mvOperation"));40 operationStage.html('<a href="'+response.data[0].sf_file_link+'" target="_blank">查看</a>');41 serializedStage.val(response.data[0].serialized);42 serializedStage.removeAttr("title");43 break;44 }45 statusStage.html('<span class="red">上传成功</span>');46 $('#'+uploadBtnId).attr("disabled","disabled");47 }48 },49 onchange:function(file){5051 }52 });53 } ...

Full Screen

Full Screen

edit.js

Source:edit.js Github

copy

Full Screen

1function valueEditLinkClick(event) {2 var element = event.element();3 id = element.id.replace('ValueEditLink','');4 $$('.' + id + 'Value').each(function(e) {e.hide();});5 $$('.' + id + 'ValueEdit').each(function(e) {e.show();});6 if (id.startsWith('Avatar')) {7 id = id.replace('Avatar','');8 editLinkAvatar(id); 9 } else if (id.startsWith('Product')) {10 id = id.replace('Product','');11 editLinkProduct(id); 12 } else if (id.startsWith('LinkedPerson')) {13 id = id.replace('LinkedPerson','');14 editLinkLinkedPerson(id);15 }16 return false;17}18function valueEditCancelLinkClick(event) {19 var element = event.element();20 id = element.id.replace('ValueEditCancelLink','');21 $$('.' + id + 'Value').each(function(e) {e.show();});22 $$('.' + id + 'ValueEdit').each(function(e) {e.hide();});23 return false;24}25function valueEditSubmitClick(event) {26 var element = event.element();27 id = element.id.replace('ValueEditSubmit','');28 if (id.startsWith('Avatar')) {29 id = id.replace('Avatar','');30 editAvatar(id); 31 } else if (id.startsWith('Product')) {32 id = id.replace('Product','');33 editProduct(id); 34 } else if (id.startsWith('LinkedPerson')) {35 id = id.replace('LinkedPerson','');36 editLinkedPerson(id);37 }38 39}40document.observe("dom:loaded", function() {41 links = $$('a');42 $$('a').each(function(a) {43 if (a.id.endsWith('ValueEditLink')) {44 $(a.id).observe('click', valueEditLinkClick);45 } else if (a.id.endsWith('ValueEditCancelLink')) {46 $(a.id).observe('click', valueEditCancelLinkClick);47 } 48 });49 ...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1Cypress.Commands.add('replace', { prevSubject: 'element' }, (subject, id, content) => {2 cy.get(subject)3 .then(el => {4 el[0].innerHTML = el[0].innerHTML.replace(id, content)5 })6 return cy.wrap(subject)7})8Cypress.Commands.add('replace', { prevSubject: 'element' }, (subject, id, content) => {9 cy.get(subject)10 .then(el => {11 el[0].innerHTML = el[0].innerHTML.replace(id, content)12 })13 return cy.wrap(subject)14})15Cypress.Commands.add('replace', { prevSubject: 'element' }, (subject, id, content) => {16 cy.get(subject)17 .then(el => {18 el[0].innerHTML = el[0].innerHTML.replace(id, content)19 })20 return cy.wrap(subject)21})22Cypress.Commands.add('replace', { prevSubject: 'element' }, (subject, id, content) => {23 cy.get(subject)24 .then(el => {25 el[0].innerHTML = el[0].innerHTML.replace(id, content)26 })27 return cy.wrap(subject)28})29Cypress.Commands.add('replace', { prevSubject: 'element' }, (subject, id, content) => {30 cy.get(subject)31 .then(el => {32 el[0].innerHTML = el[0].innerHTML.replace(id, content)33 })34 return cy.wrap(subject)35})36Cypress.Commands.add('replace', { prevSubject: 'element' }, (subject, id, content) => {37 cy.get(subject)38 .then(el => {39 el[0].innerHTML = el[0].innerHTML.replace(id, content)40 })41 return cy.wrap(subject)42})43Cypress.Commands.add('replace', { prevSubject: 'element' }, (subject, id, content) => {44 cy.get(subject)45 .then(el => {46 el[0].innerHTML = el[0].innerHTML.replace(id, content)47 })48 return cy.wrap(subject)49})

Full Screen

Using AI Code Generation

copy

Full Screen

1cy.get('div').then(($div) => {2 const id = $div.attr('id')3 cy.get(`#${id.replace('my', '')}`).click()4 })5cy.get('div').then(($div) => {6 const id = $div.attr('id')7 cy.get(`#${id.substring(2)}`).click()8 })9cy.get('div').then(($div) => {10 const id = $div.attr('id')11 cy.get(`#${id.split('my')[1]}`).click()12 })13cy.get('div').then(($div) => {14 const id = $div.attr('id')15 cy.get(`#${id.slice(2)}`).click()16 })17cy.get('div').then(($div) => {18 const id = $div.attr('id')19 cy.get(`#${id.substr(2)}`).click()20 })21cy.get('div').then(($div) => {22 const id = $div.attr('id')23 cy.get(`#${id.match(/my(.*)/)[1]}`).click()24 })25cy.get('div').then(($div) => {26 const id = $div.attr('id')27 cy.get(`#${id.replace('my', '')}`).click()28 })29cy.get('div').then(($div) => {30 const id = $div.attr('id')31 cy.get(`#${id.replace('my', '')}`).click()32 })33cy.get('div').then(($div) => {34 const id = $div.attr('id')35 cy.get(`#${id.replace('my', '')}`).click()36 })37cy.get('div').then(($div) => {38 const id = $div.attr('id')39 cy.get(`#${id.replace('my', '')}`).click()40 })41cy.get('div').then(($div) => {42 const id = $div.attr('id')43 cy.get(`#${id

Full Screen

Cypress Tutorial

Cypress is a renowned Javascript-based open-source, easy-to-use end-to-end testing framework primarily used for testing web applications. Cypress is a relatively new player in the automation testing space and has been gaining much traction lately, as evidenced by the number of Forks (2.7K) and Stars (42.1K) for the project. LambdaTest’s Cypress Tutorial covers step-by-step guides that will help you learn from the basics till you run automation tests on LambdaTest.

Chapters:

  1. What is Cypress? -
  2. Why Cypress? - Learn why Cypress might be a good choice for testing your web applications.
  3. Features of Cypress Testing - Learn about features that make Cypress a powerful and flexible tool for testing web applications.
  4. Cypress Drawbacks - Although Cypress has many strengths, it has a few limitations that you should be aware of.
  5. Cypress Architecture - Learn more about Cypress architecture and how it is designed to be run directly in the browser, i.e., it does not have any additional servers.
  6. Browsers Supported by Cypress - Cypress is built on top of the Electron browser, supporting all modern web browsers. Learn browsers that support Cypress.
  7. Selenium vs Cypress: A Detailed Comparison - Compare and explore some key differences in terms of their design and features.
  8. Cypress Learning: Best Practices - Take a deep dive into some of the best practices you should use to avoid anti-patterns in your automation tests.
  9. How To Run Cypress Tests on LambdaTest? - Set up a LambdaTest account, and now you are all set to learn how to run Cypress tests.

Certification

You can elevate your expertise with end-to-end testing using the Cypress automation framework and stay one step ahead in your career by earning a Cypress certification. Check out our Cypress 101 Certification.

YouTube

Watch this 3 hours of complete tutorial to learn the basics of Cypress and various Cypress commands with the Cypress testing at LambdaTest.

Run Cypress automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful