| 1 |
(function(){ |
| 2 |
//#region dev/js/addons/free/ma-progressbar.js |
| 3 |
/** |
| 4 |
* Start progressbar widget script |
| 5 |
*/ |
| 6 |
(function($, elementor) { |
| 7 |
"use strict"; |
| 8 |
/** |
| 9 |
* Animated progress bar helper |
| 10 |
* |
| 11 |
* @param {string} id - Progress bar ID |
| 12 |
* @param {string} type - Progress bar type (line, line-bubble, circle, fan) |
| 13 |
* @param {number} value - Progress value |
| 14 |
* @param {string} strokeColor - Stroke color |
| 15 |
* @param {string} trailColor - Trail color |
| 16 |
* @param {number} strokeWidth - Stroke width |
| 17 |
* @param {number} strokeTrailWidth - Trail stroke width |
| 18 |
*/ |
| 19 |
function animatedProgressbar(id, type, value, strokeColor, trailColor, strokeWidth, strokeTrailWidth) { |
| 20 |
var triggerClass = ".jltma-progress-bar-" + id; |
| 21 |
if ("line" == type) new ldBar(triggerClass, { |
| 22 |
"type": "stroke", |
| 23 |
"path": "M0 10L100 10", |
| 24 |
"aspect-ratio": "none", |
| 25 |
"stroke": strokeColor, |
| 26 |
"stroke-trail": trailColor, |
| 27 |
"stroke-width": strokeWidth, |
| 28 |
"stroke-trail-width": strokeTrailWidth |
| 29 |
}).set(value); |
| 30 |
if ("line-bubble" == type) { |
| 31 |
new ldBar(triggerClass, { |
| 32 |
"type": "stroke", |
| 33 |
"path": "M0 10L100 10", |
| 34 |
"aspect-ratio": "none", |
| 35 |
"stroke": strokeColor, |
| 36 |
"stroke-trail": trailColor, |
| 37 |
"stroke-width": strokeWidth, |
| 38 |
"stroke-trail-width": strokeTrailWidth |
| 39 |
}).set(value); |
| 40 |
jQuery(jQuery(".jltma-progress-bar-" + id).find(".ldBar-label")).animate({ left: value + "%" }, 1e3, "swing"); |
| 41 |
} |
| 42 |
if ("circle" == type) new ldBar(triggerClass, { |
| 43 |
"type": "stroke", |
| 44 |
"path": "M50 10A40 40 0 0 1 50 90A40 40 0 0 1 50 10", |
| 45 |
"stroke-dir": "normal", |
| 46 |
"stroke": strokeColor, |
| 47 |
"stroke-trail": trailColor, |
| 48 |
"stroke-width": strokeWidth, |
| 49 |
"stroke-trail-width": strokeTrailWidth |
| 50 |
}).set(value); |
| 51 |
if ("fan" == type) new ldBar(triggerClass, { |
| 52 |
"type": "stroke", |
| 53 |
"path": "M10 90A40 40 0 0 1 90 90", |
| 54 |
"stroke": strokeColor, |
| 55 |
"stroke-trail": trailColor, |
| 56 |
"stroke-width": strokeWidth, |
| 57 |
"stroke-trail-width": strokeTrailWidth |
| 58 |
}).set(value); |
| 59 |
} |
| 60 |
var JLTMA_ProgressBar = function($scope, $) { |
| 61 |
var id = $scope.data("id"), $progressBarWrapper = $scope.find(".jltma-progress-bar-" + id), type = $progressBarWrapper.data("type"), value = $progressBarWrapper.data("progress-bar-value"), strokeWidth = $progressBarWrapper.data("progress-bar-stroke-width"), strokeTrailWidth = $progressBarWrapper.data("progress-bar-stroke-trail-width"), color = $progressBarWrapper.data("stroke-color"), trailColor = $progressBarWrapper.data("stroke-trail-color"); |
| 62 |
$progressBarWrapper.find("svg").remove(); |
| 63 |
$progressBarWrapper.find(".ldBar-label").remove(); |
| 64 |
$progressBarWrapper.removeClass("ldBar"); |
| 65 |
animatedProgressbar(id, type, value, color, trailColor, strokeWidth, strokeTrailWidth); |
| 66 |
}; |
| 67 |
$(window).on("elementor/frontend/init", function() { |
| 68 |
elementorFrontend.hooks.addAction("frontend/element_ready/ma-progressbar.default", JLTMA_ProgressBar); |
| 69 |
}); |
| 70 |
})(jQuery, window.elementorFrontend); |
| 71 |
/** |
| 72 |
* End progressbar widget script |
| 73 |
*/ |
| 74 |
//#endregion |
| 75 |
})(); |
| 76 |
|