This repository has been archived on 2021-09-15. You can view files and clone it, but cannot push or open issues or pull requests.
UTPass-Website/mdb/js/addons/progressBar.min.js
2019-09-15 13:19:29 +02:00

4 lines
922 B
JavaScript

(function($){$.fn.progressBar=function(givenValue){const $this=$(this);function init(selector){const progressValue=selector.children().attr('aria-valuenow');selector.children().width(`${progressValue}%`);selector.children().html('<span></span>');$this.hasClass('md-progress')?selector.children().children().addClass('md-progress-bar-text'):selector.children().children().addClass('progress-bar-text');(progressValue!==100)?selector.children().children().text(`${progressValue}%`):selector.children().children().html('<i class="fas fa-check"></i>')}
function set(selector,value){selector.children().removeClass('success fail active');selector.children().attr('aria-valuenow',value);init(selector);if(value>100){return!1}else if(value===100){selector.children().addClass('success')}else if(value<30){selector.children().addClass('fail')}else{selector.children().addClass('active')}
return!0}
set($this,givenValue)}}(jQuery))