lightspeeddevelopment/lsx-health-plan

View on GitHub
assets/js/lsx-health-plan-admin.min.js

Summary

Maintainability
A
0 mins
Test Coverage
var LSX_HP_ADMIN=Object.create(null);!function(n,t,e){"use strict";LSX_HP_ADMIN.document=n(e),LSX_HP_ADMIN.init=function(){LSX_HP_ADMIN.changeName(),LSX_HP_ADMIN.singleExerciseRemoveClass(),LSX_HP_ADMIN.calculateBMI(),LSX_HP_ADMIN.setListLayout(),LSX_HP_ADMIN.initIsotope(),LSX_HP_ADMIN.removeOriginalTeamTabs(),LSX_HP_ADMIN.progressBar()},LSX_HP_ADMIN.changeName=function(){n(".wpua-edit .button").last().attr("value","Update Profile Image")},LSX_HP_ADMIN.singleExerciseRemoveClass=function(){n("body.single-exercise").removeClass("using-gutenberg")},LSX_HP_ADMIN.calculateBMI=function(){n(".woocommerce-MyAccount-content .my-stats-wrap .calculate-bmi .btn").on("click",function(t){t.preventDefault();var e=n(".woocommerce-MyAccount-content .my-stats-wrap #weight_field .input-text").val(),s=n(".woocommerce-MyAccount-content .my-stats-wrap #height_field .input-text").val()/100,i="";if(1<e&&1<s){var o=(e/(s*s)).toFixed(1);i=o<18.5?o+" - Underweight":o<25?o+" - Normal weight":o<30?o+" - Pre-obesity":o<35?o+" - Obesity class I":o<40?o+" - Obesity class II":o+" - Obesity class III",n(".woocommerce-MyAccount-content .my-stats-wrap .description .bmi-title").append('<p class="btn border-btn bmi-total">BMI: '+i+"</p>")}})},LSX_HP_ADMIN.setListLayout=function(){n(".set-box .set-list .workout-list").each(function(){3<n(this).children().length&&n(this).addClass("longer-list")})},LSX_HP_ADMIN.progressBar=function(){n(".progress progress").each(function(){var t=n(this).val();t<50&&n(this).addClass("less-progress"),50<=t&&n(this).addClass("half-progress"),100==t&&n(this).addClass("completed-progress")})},LSX_HP_ADMIN.removeOriginalTeamTabs=function(){n(".single-team .entry-tabs:not(.hp-entry-tabs)").remove(),n(".single-team .entry-tabs.hp-entry-tabs .lsx-sharing-wrapper").remove()},LSX_HP_ADMIN.initIsotope=function(){if(n("body").first().hasClass("archive")&&n.isFunction(n.fn.isotope)){var s=n(".lsx-plan-row");s.isotope({itemSelector:".lsx-plan-column",layoutMode:"fitRows"});var i=n(".lsx-type-nav-filter");i.find("a").click(function(){var t=n(this);if(t.parent().hasClass("active"))return!1;i.find(".active").removeClass("active"),t.parent().addClass("active");var e=n(this).attr("data-filter");return s.isotope({filter:e}),!1}),setTimeout(function(){s.isotope()},300),n(e).on("lazybeforeunveil",function(){setTimeout(function(){s.isotope()},300)}),n(t).load(function(){s.isotope()})}},LSX_HP_ADMIN.document.ready(function(){LSX_HP_ADMIN.init()})}(jQuery,window,document);