ma.Fb=function(){this.$facebookLogin=$("#facebook-login"),$facebookLogin.on("click",this.onClick)},ma.Fb.prototype.onClick=function(t){t.preventDefault(),console.log("yup")},ma=ma||{},$.ajaxSetup({type:"post",dataType:"json",error:function(t,o,a){console.log(t,o,a)}}),$(document).ready(function(){}),ma.modalWorkout=function(t,o){this.updating=!1,this.shapes=o,this.$modal=$("#modalWorkout"),this.$workout=null,this.$updating=this.$modal.find(".updating"),$(t).on("click",this,this.onClick),this.$modal.find("button.update-all").on("click",this,this.onUpdateAll)},ma.modalWorkout.prototype.onClick=function(t){t.data.$workout=$(this)},ma.modalWorkout.prototype.onUpdateAll=function(t){$shapeCursor=t.data.$modal.find(".shape-slider .shape-cursor"),$completeCursor=t.data.$modal.find(".complete-slider .complete-cursor");var o,a,e=$completeCursor[0].style.width;parseInt(e)||(completevalue=100);for(o in t.data.shapes)$shapeCursor.hasClass(t.data.shapes[o])&&(a=o);a||(a=100),$.ajax({url:ma.url+"workouts/ajaxAll",data:{id:t.data.$workout.data("id"),shape:a,complete:e},success:function(o){o.success&&t.data.updateAdjustments(!1,o.success)}})},ma.modalWorkout.prototype.updateAdjustments=function(t,o){var a,e,s,d,u=this;return this.updating=t,$updateText=$(this.$modal).find(".adjustment .updating"),t?$updateText.fadeIn("fast"):$updateText.fadeOut("fast"),o&&($(this.$workout).find(".workout-footer .adjustment").addClass("show-adjust"),$complete=$(this.$workout).find(".workout-footer .adjustment .complete"),$shape=$(this.$workout).find(".workout-footer .adjustment .shape"),o.complete||0===o.complete?($complete.text(o.complete+"% Complete"),$complete.data("complete",o.complete)):($complete.text("100% Complete"),$complete.data("complete","100")),o.shape||0===o.shape?($shape.removeClass().addClass("shape "+this.shapes[o.shape]),$shape.data("shape",o.shape)):($shape.removeClass().addClass("shape top-shape"),$shape.data("shape",100)),o.workouts.adjustment&&o.workouts.adjustment.forEach(function(t,o,a){t.adjustment&&$(".workout[data-id="+t.id+"]").find(".workout-body .value").text(u.format(t))}),o.workouts.scheda.hide&&($(".workout").removeClass("scheda-hide"),o.workouts.scheda.hide.forEach(function(t,o,a){$(".workout[data-id="+t.Workout.id+"]").addClass("scheda-hide")})),o.workouts.scheda.as&&o.workouts.scheda.as.forEach(function(t,o,a){$(".workout[data-id="+t.Workout.id+"]").find(".workout-body .zone").text(t.Zone.name)})),this.updating},ma.modalWorkout.prototype.format=function(t){var o,a,e;return 1===parseInt(t.sport_id,10)?" "+t.adjustment:(e=parseInt(t.adjustment,10),o=Math.floor(e/60),a=e-60*o,o<10&&(o="0"+o),a<10&&(a="0"+a),e=" "+o+":"+a+" ")};