Passed
Branch dev (a37336)
by Michael
14:56
created

form.bundle.min.js ➔ t   F

Complexity

Conditions 41

Size

Total Lines 1
Code Lines 1

Duplication

Lines 1
Ratio 100 %

Importance

Changes 0
Metric Value
eloc 1
dl 1
loc 1
rs 0
c 0
b 0
f 0
cc 41

How to fix   Complexity   

Complexity

Complex classes like form.bundle.min.js ➔ t often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.

Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.

1
/*! Admin Page Framework - Form Main 1.2.7 */
2
!function(o){function s(e){return void 0===e?-1:!0===e?1:!1!==e&&0!==e&&"number"==typeof e?e:-1}o.fn.incrementDigitByModel=function(e,i,t,a){return"string"!=typeof e?e:(a=a||"___i___",t=t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),a=new RegExp("^(.+?)("+a+")(.*?)$","g"),t=t.replace(a,"($1)(\\d+)($3.*?)"),a=new RegExp(t),e.replace(a,function(e,t,a,n){return i=void 0===i?a:i,t+(Number(i)+1)+n}))},o.fn.incrementAttributes=function(e,a,n,i){var r=o(this);o.each(e,function(e,t){r.incrementAttribute(t,a,n,i)})},o.fn.incrementAttribute=function(e,a,n,i){return this.attr(e,function(e,t){return o(this).incrementDigitByModel(t,a,n,i)})},o.fn.incrementIDAttribute=function(e,a){return this.attr(e,function(e,t){return i(e,t,1,a)})},o.fn.incrementNameAttribute=function(e,a){return this.attr(e,function(e,t){return r(e,t,1,a)})},o.fn.decrementIDAttribute=function(e,a){return this.attr(e,function(e,t){return i(e,t,-1,a)})},o.fn.decrementNameAttribute=function(e,a){return this.attr(e,function(e,t){return r(e,t,-1,a)})},o.fn.setIndexIDAttribute=function(e,a,n){return this.attr(e,function(e,t){return i(a,t,0,n)})},o.fn.setIndexNameAttribute=function(e,a,n){return this.attr(e,function(e,t){return r(a,t,0,n)})};var i=function(i,e,r,t){if(void 0===e)return e;var o=1,a=new RegExp("(.+?)__(\\d+)(?=([_-]|$))","g"),n=e.match(a);if(0===(n=null!==n&&n.hasOwnProperty("length")?n.length:0))return e;var d=(d=s(t))<0?n+1+d:d;return e.replace(a,function(e,t,a){if(o!==d)return o++,e;var n="";switch(r){case 1:n=t+"__"+(Number(a)+1);break;case-1:n=t+"__"+(Number(a)-1);break;default:n=t+"__"+i}return o++,n})},r=function(i,e,r,t){if(void 0===e)return e;var o=1,a=new RegExp("(.+?)\\[(\\d+)(?=\\])","g"),n=e.match(a);if(0===(n=null!==n&&n.hasOwnProperty("length")?n.length:0))return e;var d=(d=s(t))<0?n+1+d:d;return e.replace(a,function(e,t,a){if(o!==d)return o++,e;var n="";switch(r){case 1:n=t+"["+(Number(a)+1);break;case-1:n=t+"["+(Number(a)-1);break;default:n=t+"["+i}return o++,n})}}(jQuery),function(e){e.fn.selectAllAdminPageFrameworkCheckboxes=function(){jQuery(this).parent().find("input[type=checkbox]").prop("checked",!0).trigger("change")},e.fn.deselectAllAdminPageFrameworkCheckboxes=function(){jQuery(this).parent().find("input[type=checkbox]").prop("checked",!1).trigger("change")}}(jQuery),function(e){function t(){jQuery(".admin-page-framework-form-loading").remove(),jQuery(".admin-page-framework-form-js-on").hide().css("visibility","visible").fadeIn(200).removeClass(".admin-page-framework-form-js-on")}var a=window.onerror;window.onerror=function(){return t(),"function"==typeof(window.onerror=a)&&a()},jQuery(document).ready(function(){t()}),e(document).on("admin-page-framework_saved_widget",function(e,t){jQuery(".admin-page-framework-form-loading").remove()})}(jQuery),function(a){a.fn.aAdminPageFrameworkInputOptions={},a.fn.storeAdminPageFrameworkInputOptions=function(e,t){e=e.replace(/__\d+_/,"___"),a.fn.aAdminPageFrameworkInputOptions[e]=t},a.fn.getAdminPageFrameworkInputOptions=function(e){return e=e.replace(/__\d+_/,"___"),void 0===a.fn.aAdminPageFrameworkInputOptions[e]?null:a.fn.aAdminPageFrameworkInputOptions[e]}}(jQuery),function(l){l.fn.aAdminPageFrameworkAddRepeatableFieldCallbacks=[],l.fn.aAdminPageFrameworkRepeatFieldCallbacks=[],l.fn.aAdminPageFrameworkRemoveRepeatableFieldCallbacks=[],l.fn.aAdminPageFrameworkSortedFieldsCallbacks=[],l.fn.aAdminPageFrameworkStoppedSortingFieldsCallbacks=[],l.fn.aAdminPageFrameworkAddedWidgetCallbacks=[],l.fn.aAdminPageFrameworkStoppedSortingSectionsCallbacks=[],l(document).on("admin-page-framework_added_repeatable_field",function(e,n,i,r,o,d){var s=jQuery(e.target);l.each(l.fn.aAdminPageFrameworkAddRepeatableFieldCallbacks,function(e,t){var a=t[0];return 2<(t=t[1]).length&&-1===l.inArray(n,t)||"function"!=typeof a||(-1===l.inArray(n,["_nested","inline_mixed"])&&console.warn("Admin Page Framework ("+n+" field type): The `added_repeatable_field` callback argument for the `registerAdminPageFrameworkCallbacks` method is deprecated. Use `repeated_field` instead."),void a(s,n,i,r,o,d))})}),l(document).on("admin-page-framework_repeated_field",function(e,t,a){var n=jQuery(e.target),i=l(e.target).data("type"),r={};switch(r.call_type=t,r.field_type=i,r.model_element=a,r.added_element=n,t){case 1:r.incremented_from=Number(a.attr("data-largest_index")),r.index=r.incremented_from+1,r.id=a.attr("data-section_id_model"),r.name=a.attr("data-section_name_model"),r.flat_name=a.attr("data-flat_section_name_model"),r.address=a.attr("data-section_address_model");break;default:case 0:case 2:r.incremented_from=Number(a.attr("data-largest_index")-1),r.index=r.incremented_from+1,r.id=a.attr("data-field_tag_id_model"),r.name=a.attr("data-field_name_model"),r.flat_name=a.attr("data-field_name_flat_model"),r.address=a.attr("data-field_address_model")}l.each(l.fn.aAdminPageFrameworkRepeatFieldCallbacks,function(e,t){var a=t[0],t=t[1];return-1!==l.inArray(i,["_nested","inline_mixed"])||-1===l.inArray(i,t)||"function"!=typeof a||void a(n,r)})}),l(document).on("admin-page-framework_stopped_sorting_sections",function(e){var n=jQuery(e.target);l.each(l.fn.aAdminPageFrameworkStoppedSortingSectionsCallbacks,function(e,t){var a=t[0];if(t[1],"function"!=typeof a)return!0;a(n)})}),l.fn.callBackSortedFields=function(a,n,i){var r=this;l.fn.aAdminPageFrameworkSortedFieldsCallbacks.forEach(function(e){var t=e[0];if(2<(e=e[1]).length&&-1===l.inArray(a,e))return!0;"function"==typeof t&&t(r,a,n,i)})},l.fn.callBackStoppedSortingFields=function(a,n,i){var r=this;l.fn.aAdminPageFrameworkStoppedSortingFieldsCallbacks.forEach(function(e){var t=e[0];if(2<(e=e[1]).length&&-1===l.inArray(a,e))return!0;"function"==typeof t&&t(r,a,n,i)})},l(document).on("admin-page-framework_saved_widget",function(e,n){l.each(l.fn.aAdminPageFrameworkAddedWidgetCallbacks,function(e,t){var a=t[0];if(t[1],"function"!=typeof a)return!0;a(n)})}),l.fn.registerAdminPageFrameworkCallbacks=function(e,t){e=l.extend({added_repeatable_field:null,repeated_field:null,removed_repeatable_field:null,sorted_fields:null,stopped_sorting_fields:null,saved_widget:null,stopped_sorting_sections:null},e),(t=void 0===t?[]:t).push("_nested","inline_mixed"),l.fn.aAdminPageFrameworkAddRepeatableFieldCallbacks.push([e.added_repeatable_field,t]),l.fn.aAdminPageFrameworkRepeatFieldCallbacks.push([e.repeated_field,t]),l.fn.aAdminPageFrameworkRemoveRepeatableFieldCallbacks.push([e.removed_repeatable_field,t]),l.fn.aAdminPageFrameworkSortedFieldsCallbacks.push([e.sorted_fields,t]),l.fn.aAdminPageFrameworkStoppedSortingFieldsCallbacks.push([e.stopped_sorting_fields,t]),l.fn.aAdminPageFrameworkAddedWidgetCallbacks.push([e.saved_widget,t]),l.fn.aAdminPageFrameworkStoppedSortingSectionsCallbacks.push([e.stopped_sorting_sections,t])},l.fn.registerAPFCallback=function(e,t){l.fn.registerAdminPageFrameworkCallbacks(e,t)}}(jQuery),function(f){f(document).ready(function(){f(".admin-page-framework-fields.repeatable").each(function(){var e=f(this).siblings(".repeatable-field-buttons-model");if(!e.length)return!0;var t=e.data(),a=e.children(".admin-page-framework-repeatable-field-buttons").first(),n=f(a),i=f(a).clone();n.find(".repeatable-field-button").addClass("button-large"),i.find(".repeatable-field-button").addClass("button-small"),0<(a=(e=f(this).find("> .admin-page-framework-field.without-child-fields")).find(".repeatable-field-buttons")).length?a.replaceWith(i):e.find(".admin-page-framework-repeatable-field-buttons").length||e.prepend(i),f(this).find("> .admin-page-framework-field.with-child-fields").prepend(n),f(this).updateAdminPageFrameworkRepeatableFields(t)})});var m=AdminPageFrameworkScriptFormMain;f.fn.updateAdminPageFrameworkRepeatableFields=function(e){var t=this,a=t.find(".repeatable-field-add-button").first().data("id"),n=f("#"+a),e=f.extend({max:0,min:0,fadein:500,fadeout:500,disabled:!1,preserve_values:0},e);n.data("repeatable")||n.data("repeatable",e),(n=f(t).find(".admin-page-framework-repeatable-field-buttons").filter(function(){return f(this).closest(".admin-page-framework-fields").attr("id")===a})).attr("data-max",e.max),n.attr("data-min",e.min),n.attr("data-fadein",e.fadein),n.attr("data-fadeout",e.fadeout),n.attr("data-preserve_values",e.preserve_values),(n=f(t).find(".repeatable-field-add-button")).off("click"),n.on("click",function(){if(f(this).parent().data("disabled")){var e=f(this).parent().data("disabled");return tb_show(e.caption,f(this).attr("href")),!1}return f(this).addAdminPageFrameworkRepeatableField(),!1}),(t=f(t).find(".repeatable-field-remove-button")).off("click"),t.on("click",function(){return f(this).removeAdminPageFrameworkRepeatableField(),!1}),t=n.first().closest(".admin-page-framework-field").attr("id"),n=f("#"+a).find(".admin-page-framework-field").filter(function(){return f(this).closest(".admin-page-framework-fields").attr("id")===a}).length,0<e.min&&0<n&&0<e.min-n&&f("#"+t).addAdminPageFrameworkRepeatableField(t)},f.fn.addAdminPageFrameworkRepeatableField=function(e){void 0===e&&(e=f(this).closest(".admin-page-framework-field").attr("id"));var t=f("#"+e),a=t.clone(),n=t.closest(".admin-page-framework-fields"),i=n.attr("id"),r=n.data("repeatable"),o=(r=r||{max:(l=t.find(".admin-page-framework-repeatable-field-buttons").filter(function(){return f(this).closest(".admin-page-framework-fields").attr("id")===i}).first()).attr("data-max"),min:l.attr("data-min"),fadein:l.attr("data-fadein"),fadeout:l.attr("data-fadeout"),preserve_values:l.attr("data-preserve_values")}).fadein,d=r.fadeout,s=r.max,e=n.find(".admin-page-framework-field").filter(function(){return f(this).closest(".admin-page-framework-fields").attr("id")===i}),l=t.find(".admin-page-framework-repeatable-field-buttons").filter(function(){return f(this).closest(".admin-page-framework-fields").attr("id")===i});return 0!=s&&e.length>=s?(l=l.last(),s=f(this).formatPrintText(m.messages.cannotAddMore,s),s=f('<span class="repeatable-error repeatable-field-error" id="repeatable-error-'+i+'" >'+s+"</span>"),0<n.find("#repeatable-error-"+i).length?n.find("#repeatable-error-"+i).replaceWith(s):l.before(s),void s.delay(2e3).fadeOut(d)):(r.preserve_values||(a.find("input:not([type=radio], [type=checkbox], [type=submit], [type=hidden]),textarea").val(""),a.find("input[type=checkbox]").prop("checked",!1)),a.find(".repeatable-error").remove(),o?a.hide().insertAfter(t).delay(100).fadeIn(o):a.insertAfter(t),c(a,n),a.updateAdminPageFrameworkRepeatableFields(),t.find("input[type=radio][checked=checked]").prop("checked",!0).attr("checked","checked"),a.trigger("admin-page-framework_added_repeatable_field",[a.data("type"),a.attr("id"),0,0,0]),f(a).find(".admin-page-framework-field").addBack().trigger("admin-page-framework_repeated_field",[0,jQuery(a).closest(".admin-page-framework-fields")]),1<(t=n.find(".repeatable-field-remove-button").filter(function(){return f(this).closest(".admin-page-framework-fields").attr("id")===i})).length&&t.css("visibility","visible"),n.children(".admin-page-framework-field").children(".delimiter").show().last().hide(),a)};var c=function(e,t){var a=Number(t.attr("data-largest_index"));t.attr("data-largest_index",a+1);var n=t.attr("data-field_tag_id_model"),i=t.attr("data-field_name_model"),r=t.attr("data-field_name_flat_model"),t=t.attr("data-field_address_model");e.incrementAttribute("id",a,n),e.find("label").incrementAttribute("for",a,n),e.find("input,textarea,select,option").incrementAttribute("id",a,n),e.find("input,textarea,select").incrementAttribute("name",a,i),e.find("input[type=hidden].element-address").incrementAttributes(["name","value","data-field_address_model"],a,t),e.find("input[type=radio][data-id],input[type=checkbox][data-id],select[data-id]").incrementAttribute("data-id",a,n),e.find(".admin-page-framework-field,.admin-page-framework-fields,.admin-page-framework-fieldset").incrementAttributes(["id","data-field_tag_id_model","data-field_id"],a,n),e.find(".admin-page-framework-fields").incrementAttributes(["data-field_name_model"],a,i),e.find(".admin-page-framework-fields").incrementAttributes(["data-field_name_flat","data-field_name_flat_model"],a,r),e.find(".admin-page-framework-fields").incrementAttributes(["data-field_address","data-field_address_model"],a,t)};f.fn.removeAdminPageFrameworkRepeatableField=function(){var e=f(this).closest(".admin-page-framework-field"),t=f(this).closest(".admin-page-framework-fields"),a=t.attr("id"),n=t.data("repeatable"),i=n?n.min:0,r=t.find(".admin-page-framework-field").filter(function(){return f(this).closest(".admin-page-framework-fields").attr("id")===a}),o=500;if(0!=i&&r.length<=i){var d=e.find(".admin-page-framework-repeatable-field-buttons").filter(function(){return f(this).closest(".admin-page-framework-fields").attr("id")===a}).last(),r=f(this).formatPrintText(m.messages.cannotRemoveMore,i),i=f('<span class="repeatable-error repeatable-field-error" id="repeatable-error-'+a+'">'+r+"</span>");return 0<(r=t.find("#repeatable-error-"+a).filter(function(){return f(this).closest(".admin-page-framework-fields").attr("id")===a})).length?r.replaceWith(i):d.before(i),o=n?n.fadeout:500,void i.delay(2e3).fadeOut(o)}o=n?n.fadeout:500,e.fadeOut(o,function(){f(this).remove();var e=t.find(".repeatable-field-remove-button").filter(function(){return f(this).closest(".admin-page-framework-fields").attr("id")===a});1===e.length&&e.css("visibility","hidden")})}}(jQuery),function(c){c(document).ready(function(){c(".admin-page-framework-sections.repeatable-section").each(function(e){var t=(a=c(this).children(".repeatable-section-buttons-model").first()).data(),a=a.find(".admin-page-framework-repeatable-section-buttons").first().detach();c(this).find(".admin-page-framework-section-caption").each(function(){c(this).show();var e=c(a[0].outerHTML);0<c(this).children(".admin-page-framework-collapsible-section-title").children("fieldset").length&&e.addClass("section_title_field_sibling");var t=c(this).find(".admin-page-framework-collapsible-section-title");t.length?(e.find(".repeatable-section-button").removeClass("button-large"),t.append(e)):c(this).prepend(e)}),c(this).updateAdminPageFrameworkRepeatableSections(t)})});var p=AdminPageFrameworkScriptFormMain;c.fn.updateAdminPageFrameworkRepeatableSections=function(e){var t,a=this.find(".repeatable-section-add-button").first().closest(".admin-page-framework-sections").attr("id");c.fn.aAdminPageFrameworkRepeatableSectionsOptions||(c.fn.aAdminPageFrameworkRepeatableSectionsOptions=[]),c.fn.aAdminPageFrameworkRepeatableSectionsOptions.hasOwnProperty(a)||(c.fn.aAdminPageFrameworkRepeatableSectionsOptions[a]=c.extend({max:0,min:0,fadein:500,fadeout:500,disabled:0,preserve_values:0},e)),e=c.fn.aAdminPageFrameworkRepeatableSectionsOptions[a],c(this).find(".repeatable-section-add-button").on("click",function(){if(c(this).parent().data("disabled")){var e=c(this).parent().data("disabled");return tb_show(e.caption,c(this).attr("href")),!1}return c(this).addAdminPageFrameworkRepeatableSection(),!1}),c(this).find(".repeatable-section-remove-button").on("click",function(){return c(this).removeAdminPageFrameworkRepeatableSection(),!1}),t=this.find(".repeatable-section-add-button").first().closest(".admin-page-framework-section").attr("id"),a=jQuery("#"+a).find(".admin-page-framework-section").length,0<e.min&&0<a&&0<e.min-a&&c("#"+t).addAdminPageFrameworkRepeatableSection(t)},c.fn.addAdminPageFrameworkRepeatableSection=function(e){void 0===e&&(e=c(this).closest(".admin-page-framework-section").attr("id"));var t=c("#"+e),a=t.clone(),n=t.closest(".admin-page-framework-sections"),i=n.attr("id"),r=c(this).closest(".admin-page-framework-section-tabs-contents").children(".admin-page-framework-section-tabs").first(),o=n.attr("data-largest_index"),d=c.fn.aAdminPageFrameworkRepeatableSectionsOptions[i].fadein,s=c.fn.aAdminPageFrameworkRepeatableSectionsOptions[i].fadeout,l=c.fn.aAdminPageFrameworkRepeatableSectionsOptions[i].preserve_values;if(0!=(m=c.fn.aAdminPageFrameworkRepeatableSectionsOptions[i].max)&&n.find(".admin-page-framework-section").length>=m){var f=t.find(".admin-page-framework-repeatable-section-buttons").last(),m=c(this).formatPrintText(p.messages.cannotAddMoreSections,m),m=c('<span class="repeatable-section-error" id="repeatable-section-error-'+i+'">'+m+"</span>");return 0<n.find("#repeatable-section-error-"+i).length?n.find("#repeatable-section-error-"+i).replaceWith(m):f.before(m),void m.delay(2e3).fadeOut(s)}return l||a.find("input:not([type=radio], [type=checkbox], [type=submit], [type=hidden]),textarea").val(""),a.find(".repeatable-section-error").remove(),(s=a.find(".admin-page-framework-section-caption").first().attr("data-section_tab"))&&"_default"!==s||a.find(".admin-page-framework-section-title").not(".admin-page-framework-collapsible-section-title").hide(),"function"==typeof a.enableAdminPageFrameworkCollapsibleButton&&a.find(".admin-page-framework-collapsible-sections-title, .admin-page-framework-collapsible-section-title").enableAdminPageFrameworkCollapsibleButton(),a.hide().insertAfter(t),r.length&&!t.hasClass("is_subsection_collapsible")||a.delay(100).fadeIn(d),u(a,o,n),t.find("input[type=radio][checked=checked]").prop("checked",!0),c(a).find(".admin-page-framework-field").each(function(e){c(this).updateAdminPageFrameworkRepeatableFields(),c(this).trigger("admin-page-framework_added_repeatable_field",[c(this).data("type"),c(this).attr("id"),1,o,e]),c(this).trigger("admin-page-framework_repeated_field",[1,jQuery(a).closest(".admin-page-framework-sections")])}),a.updateAdminPageFrameworkRepeatableSections(),a.find(".admin-page-framework-fields.sortable").each(function(){c(this).enableAdminPageFrameworkSortableFields()}),0<r.length&&!t.hasClass("is_subsection_collapsible")&&((e=(t=r.find("#section_tab-"+e)).clone()).removeClass("active"),l||e.find("input:not([type=radio], [type=checkbox], [type=submit], [type=hidden]),textarea").val(""),e.hide().insertAfter(t).delay(10).fadeIn(d),u(e,o,n),r.closest(".admin-page-framework-section-tabs-contents").createTabs("refresh")),n.attr("data-largest_index",Number(o)+1),1<(n=n.find(".repeatable-section-remove-button")).length&&n.show(),a};var u=function(e,t,a){var n=a.attr("data-section_id_model"),i=a.attr("data-section_name_model"),a=a.attr("data-flat_section_name_model");c(e).incrementAttribute("id",t,n),c(e).find("tr.admin-page-framework-fieldrow, .admin-page-framework-fieldset, .admin-page-framework-fields, .admin-page-framework-field, table.form-table, input,textarea,select,option").incrementAttribute("id",t,n),c(e).find(".admin-page-framework-fields").incrementAttribute("data-field_tag_id_model",t,n),c(e).find(".admin-page-framework-fields").incrementAttributes(["data-field_name_model"],t,i),c(e).find(".admin-page-framework-fields").incrementAttributes(["data-field_name_flat","data-field_name_flat_model","data-field_address","data-field_address_model"],t,a),c(e).find("input[type=radio][data-id],input[type=checkbox][data-id],select[data-id]").incrementAttribute("data-id",t,n),c(e).find(".admin-page-framework-fieldset").incrementAttribute("data-field_id",t,n),c(e).find(".repeatable-field-add-button").incrementAttribute("data-id",t,n),c(e).find("label").incrementAttribute("for",t,n),c(e).find("input:not(.element-address),textarea,select").incrementAttribute("name",t,i),c(e).find("a.anchor").incrementAttribute("href",t,n),c(e).find("input[type=hidden].element-address").incrementAttributes(["name","value","data-field_address_model"],t,a)};c.fn.removeAdminPageFrameworkRepeatableSection=function(){var e=c(this).closest(".admin-page-framework-section"),t=e.attr("id"),a=c(this).closest(".admin-page-framework-sections"),n=a.attr("id"),i=c(this).closest(".admin-page-framework-section-tabs-contents").children(".admin-page-framework-section-tabs").first(),r=i.children(".admin-page-framework-section-tab"),o=(a.attr("data-largest_index"),c.fn.aAdminPageFrameworkRepeatableSectionsOptions[n].fadein,c.fn.aAdminPageFrameworkRepeatableSectionsOptions[n].fadeout),d=c.fn.aAdminPageFrameworkRepeatableSectionsOptions[n].min;if(0!=d&&a.find(".admin-page-framework-section").length<=d){var s=e.find(".admin-page-framework-repeatable-section-buttons").last(),l=c(this).formatPrintText(p.messages.cannotRemoveMoreSections,d),l=c('<span class="repeatable-section-error" id="repeatable-section-error-'+n+'">'+l+"</span>");return 0<a.find("#repeatable-section-error-"+n).length?a.find("#repeatable-section-error-"+n).replaceWith(l):s.before(l),void l.delay(2e3).fadeOut(o)}s=e.nextAll(),l=e.hasClass("is_subsection_collapsible"),e.fadeOut(o,function(){c(this).remove();var e=a.find(".repeatable-section-remove-button");1===e.length&&(e.css("display","none"),(e=a.find(".admin-page-framework-section-caption").first().attr("data-section_tab"))&&"_default"!==e||a.find(".admin-page-framework-section-title").first().show())}),s.each(function(e){}),0<i.length&&1<r.length&&!l&&(((t=i.find("#section_tab-"+t)).prev().length?t.prev():t.next()).addClass("active"),t.fadeOut(o,function(){c(this).delay(100).remove()}),i.closest(".admin-page-framework-section-tabs-contents").createTabs("refresh"))}}(jQuery),function(r){r(document).ready(function(){r(".admin-page-framework-section-tabs-contents").createTabs()}),r.fn.createTabs=function(e){var n="string"==typeof e&&"refresh"===e;"object"==typeof e&&r.extend({},e);var i=void 0!==window.location.hash?window.location.hash:"";this.children("ul").each(function(){var a=!1;r(this).children("li").each(function(e){var t=r(this).children("a").attr("href");if(""!==i&&t===i)return!(a=!0)}),r(this).children("li").each(function(e){var t=r(this).children("a").attr("href");""!==i&&t===i&&r(this).addClass("active"),n||a||(r(this).addClass("active"),a=!0),r(this).hasClass("active")?r(t).show():r(t).css("display","none"),r(this).addClass("nav-tab"),r(this).children("a").addClass("anchor"),r(this).off("click"),r(this).on("click",function(e){e.preventDefault(),r(this).siblings("li.active").removeClass("active"),r(this).addClass("active"),e=r(this).find("a").attr("href"),r(this).parent().parent().find(e).css("display","block").siblings(":not( ul )").css("display","none")})})})}}(jQuery),function(t){t(document).ready(function(){t(".admin-page-framework-fields.sortable").each(function(){t(this).enableAdminPageFrameworkSortableFields()})}),t.fn.enableAdminPageFrameworkSortableFields=function(e){(e=t("string"==typeof e?"#"+e+".sortable":this)).off("sortupdate"),e.off("sortstop"),(e=e.sortable({items:"> div:not( .disabled )"})).on("sortstop",function(){t(this).callBackStoppedSortingFields(t(this).data("type"),t(this).attr("id"),0)}),e.on("sortupdate",function(){t(this).callBackSortedFields(t(this).data("type"),t(this).attr("id"),0)})}}(jQuery),function(n){n(document).ready(function(){n(".admin-page-framework-sections.sortable-section").each(function(){n(this).enableAdminPageFrameworkSortableSections()})}),n.fn.enableAdminPageFrameworkSortableSections=function(e){var t=(a=n("string"==typeof e?"#"+e+".sortable-section":this)).hasClass("admin-page-framework-section-tabs-contents"),e=0<a.children(".admin-page-framework-section.is_subsection_collapsible").length,a=t?a.find("ul.admin-page-framework-section-tabs"):a;(a=t||e?a:a.parent()).off("sortupdate"),a.off("sortstop"),e=a.sortable({items:t?"> li:not( .disabled )":".admin-page-framework-section:not( .disabled, .admin-page-framework-collapsible-toggle-all-button-container )",handle:e&&".admin-page-framework-section-caption",stop:function(e,t){n(this).trigger("admin-page-framework_stopped_sorting_sections",[])}}),t||e.on("sortstop",function(){n(this).find("caption > .admin-page-framework-section-title:not(.admin-page-framework-collapsible-sections-title,.admin-page-framework-collapsible-section-title)").first().show(),n(this).find("caption > .admin-page-framework-section-title:not(.admin-page-framework-collapsible-sections-title,.admin-page-framework-collapsible-section-title)").not(":first").hide()})}}(jQuery),function(t){var a=9999;t.widget("admin-page-framework.pointerTooltip",t.wp.pointer,{reposition:function(){var e;this.options.disabled||(e=this._processPosition(this.options.position),this.pointer.css({top:0,left:0,zIndex:a++}),this.pointer.fadeIn(this.options.fadeIn),e=t.extend({of:this.element,collision:"fit none"},e),this.pointer.position(e),this.repoint())},_create:function(){this._super(),this.options.pointerHeight&&this.pointer.css({height:this.options.pointerHeight+"px"})},get:function(){return this.pointer}})}(jQuery),function(l){function i(e){r(this,e.data)}function r(e,t){var a=l("body"),n=t.width,o=void 0!==t.content?l(f(t.content)?t.content:"<span>"+t.content+"</span>"):l(e).find(".admin-page-framework-form-tooltip-content").clone(),i=l(e).offset().left+l(e).width()+n>a.offset().left+a.width();(a=l.extend(!0,{},t,{pointerWidth:n,pointerHeight:t.height,content:function(){return o.html()},position:{edge:i?"top":"left",align:i?"center":"left",within:i?a:l(e).closest(".admin-page-framework-field, .admin-page-framework-fieldrow, .admin-page-framework-section")},buttons:function(){},close:function(){}},t)).pointerClass+=i?" offscreen":"",i=["Tooltip",a],parseInt(AdminPageFrameworkScriptFormMain.debugMode)&&console.log("[APF]",...i),l(e).pointerTooltip(a).pointerTooltip("open");var r,d,s=e;t.autoClose?(d=o,l(r=s).add(".admin-page-framework-form-tooltip-balloon").on("mouseleave",function(e){var t=this,a=setTimeout(function(){l(r).pointerTooltip("close"),d.remove(),l(r).off("mouseleave"),l(t).off("mouseleave"),l(r).off("mouseenter"),l(t).off("mouseenter")},1e3);l(r).data("timeoutId",a)}),l(r).add(".admin-page-framework-form-tooltip-balloon").on("mouseenter",function(){clearTimeout(l(r).data("timeoutId"))})):setTimeout(function(){var a,n=s,i=o,r=t.pointerClass.split(" ")[0];(a=l("body").not("."+r)).on("click",":not(."+r+")",function e(t){l(this).closest("."+r).length||(a.off("click",e),l(n).pointerTooltip("close"),i.remove())})},200),setTimeout(function(){var a,n=s,i=o;(a=l("body")).on("touchstart",function e(t){a.off("touchstart",e),l(n).pointerTooltip("close"),i.remove()})},200)}function f(e){var t=document.createElement("div");t.innerHTML=e;for(var a=t.childNodes,n=a.length;n--;)if(1===a[n].nodeType)return 1}l(document).ready(function(){l(".admin-page-framework-form-tooltip").each(function(){l(this)["admin-page-framework-form-tooltip"]()})}),l.fn["admin-page-framework-form-tooltip"]=function(e){var t,a,n;t=this,a=e="string"==typeof e?{content:f(e)?e:"<span>"+e+"</span>"}:e,n=l(t),e=(e=l(t).attr("data-tooltip-content"))||void 0,a=void 0===a?{}:a,(a=l.extend({},{pointerClass:"admin-page-framework-form-tooltip-balloon",width:l(t).data("width")||a.width||340,height:l(t).data("height")||a.height,shown:!1,content:e,oneOff:!1,autoClose:!0,noArrow:!1},a)).pointerClass+=a.noArrow?" no-arrow":"",l(n).removeClass("no-js"),a.shown&&r(t,a),n=l(n),a.oneOff||n.on("mouseover touchend",a,i)}}(jQuery),function(e){e.expr.filters.offscreen=function(e){return(e=e.getBoundingClientRect()).x+e.width<0||e.y+e.height<0||e.x>window.innerWidth||e.y>window.innerHeight},e.fn.reverse=[].reverse,e.fn.formatPrintText=function(){var a=arguments;return a[0].replace(/{(\d+)}/g,function(e,t){return void 0!==a[parseInt(t)+1]?a[parseInt(t)+1]:e})},e.fn.compareVersionNumbers=function(e,t){var a=e.split("."),n=t.split(".");function i(e){for(var t=0;t<e.length;++t)if(!/^\d+$/.test(e[t]))return;return 1}if(!i(a)||!i(n))return NaN;for(var r=0;r<a.length;++r){if(n.length===r)return 1;if(a[r]!==n[r])return a[r]>n[r]?1:-1}return a.length!==n.length?-1:0}}(jQuery),function(d){d(document).ready(function(){d(document).ajaxComplete(function(e,t,a){var n,i,r={},o="string"==typeof a.data?a.data.split("&"):{};for(n in o)i=o[n].split("="),r[decodeURIComponent(i[0])]=decodeURIComponent(i[1]);r.action&&"save-widget"===r.action&&(a=d('input.widget-id[value="'+r["widget-id"]+'"]').parents(".widget"),d(a).find(".admin-page-framework-sectionset").length<=0||(t.responseText?d(document).trigger("admin-page-framework_saved_widget",a):wpWidgets.save(a,0,1,0)))})})}(jQuery);
1 ignored issue
show
Comprehensibility Best Practice introduced by
Are you sure this return statement is not missing an argument? If this is intended, consider adding an explicit undefined like return undefined;.
Loading history...
Bug introduced by
The variable AdminPageFrameworkScriptFormMain seems to be never declared. If this is a global, consider adding a /** global: AdminPageFrameworkScriptFormMain */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
Best Practice introduced by
Comparing 0 to s using the != operator is not safe. Consider using !== instead.
Loading history...
Comprehensibility Naming Best Practice introduced by
The variable i already seems to be declared on line 2. Consider using another variable name or omitting the var keyword.

This check looks for variables that are declared in multiple lines. There may be several reasons for this.

In the simplest case the variable name was reused by mistake. This may lead to very hard to locate bugs.

If you want to reuse a variable for another purpose, consider declaring it at or near the top of your function and just assigning to it subsequently so it is always declared.

Loading history...
Comprehensibility Naming Best Practice introduced by
The variable l already seems to be declared on line 2. Consider using another variable name or omitting the var keyword.

This check looks for variables that are declared in multiple lines. There may be several reasons for this.

In the simplest case the variable name was reused by mistake. This may lead to very hard to locate bugs.

If you want to reuse a variable for another purpose, consider declaring it at or near the top of your function and just assigning to it subsequently so it is always declared.

Loading history...
Comprehensibility Naming Best Practice introduced by
The variable r already seems to be declared on line 2. Consider using another variable name or omitting the var keyword.

This check looks for variables that are declared in multiple lines. There may be several reasons for this.

In the simplest case the variable name was reused by mistake. This may lead to very hard to locate bugs.

If you want to reuse a variable for another purpose, consider declaring it at or near the top of your function and just assigning to it subsequently so it is always declared.

Loading history...
Coding Style Comprehensibility introduced by
The default case is not the last statement in this switch statement. For the sake of readability, you might want to move it to the end of the statement.
Loading history...
Comprehensibility Naming Best Practice introduced by
The variable m already seems to be declared on line 2. Consider using another variable name or omitting the var keyword.

This check looks for variables that are declared in multiple lines. There may be several reasons for this.

In the simplest case the variable name was reused by mistake. This may lead to very hard to locate bugs.

If you want to reuse a variable for another purpose, consider declaring it at or near the top of your function and just assigning to it subsequently so it is always declared.

Loading history...
Coding Style introduced by
Consider using undefined instead of void(0). It is equivalent and more straightforward to read.
Loading history...
Comprehensibility introduced by
Usage of the sequence operator is discouraged, since it may lead to obfuscated code.

The sequence or comma operator allows the inclusion of multiple expressions where only is permitted. The result of the sequence is the value of the last expression.

This operator is most often used in for statements.

Used in another places it can make code hard to read, especially when people do not realize it even exists as a seperate operator.

This check looks for usage of the sequence operator in locations where it is not necessary and could be replaced by a series of expressions or statements.

var a,b,c;

a = 1, b = 1,  c= 3;

could just as well be written as:

var a,b,c;

a = 1;
b = 1;
c = 3;

To learn more about the sequence operator, please refer to the MDN.

Loading history...
Debugging Code introduced by
console.log looks like debug code. Are you sure you do not want to remove it?
Loading history...
Best Practice introduced by
Comparing 0 to i using the != operator is not safe. Consider using !== instead.
Loading history...
Best Practice introduced by
Comparing 0 to m = c.fn.aAdminPageFrame...leSectionsOptions.i.max using the != operator is not safe. Consider using !== instead.
Loading history...
Bug introduced by
The regular expression (.+?)\\[(\\d+)(?=\\]) seems to be invalid.
Loading history...
Unused Code introduced by
The parameter t is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
Coding Style Best Practice introduced by
Curly braces around statements make for more readable code and help prevent bugs when you add further statements.

Consider adding curly braces around all statements when they are executed conditionally. This is optional if there is only one statement, but leaving them out can lead to unexpected behaviour if another statement is added later.

Consider:

if (a > 0)
    b = 42;

If you or someone else later decides to put another statement in, only the first statement will be executed.

if (a > 0)
    console.log("a > 0");
    b = 42;

In this case the statement b = 42 will always be executed, while the logging statement will be executed conditionally.

if (a > 0) {
    console.log("a > 0");
    b = 42;
}

ensures that the proper code will be executed conditionally no matter how many statements are added or removed.

Loading history...
Unused Code introduced by
The assignment to variable e seems to be never used. Consider removing it.
Loading history...
Unused Code introduced by
The assignment to variable o seems to be never used. Consider removing it.
Loading history...
Complexity Best Practice introduced by
There is no return statement if "" !== i && t === i is false. Are you sure this is correct? If so, consider adding return; explicitly.

This check looks for functions where a return statement is found in some execution paths, but not in all.

Consider this little piece of code

function isBig(a) {
    if (a > 5000) {
        return "yes";
    }
}

console.log(isBig(5001)); //returns yes
console.log(isBig(42)); //returns undefined

The function isBig will only return a specific value when its parameter is bigger than 5000. In any other case, it will implicitly return undefined.

This behaviour may not be what you had intended. In any case, you can add a return undefined to the other execution path to make the return value explicit.

Loading history...
Unused Code introduced by
The parameter e is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
Bug introduced by
The variable wpWidgets seems to be never declared. If this is a global, consider adding a /** global: wpWidgets */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
Best Practice introduced by
Comparing 0 to d using the != operator is not safe. Consider using !== instead.
Loading history...
Best Practice introduced by
There is no return statement in this branch, but you do return something in other branches. Did you maybe miss it? If you do not want to return anything, consider adding return undefined; explicitly.
Loading history...
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...