Usuario:Hasley/sandbox/test.js

/**
 * @todo
 * $('.progress-bar').append(progressBar.$element);  //progressBar.$element
 * 
 * var progress = [];
 * var test = $.each($('.progress-bar'), function(index, value) {
 *  //console.log(index + ':' + $(value).text());
 *   progress.push( $( value ).text() );
 * });
 * console.log(progress)
 * 
 * console.log( progress.slice( -1 )[ 0 ] ) // end
 * progress[ 0 ] // start
 *  progress.slice( -1 )[ 0 ]
 * 
 * $.each($('.progress-bar'), function(index, value) {
 *  console.log(index + ':' + $(value).text());
 * });
**/


// barra de progreso
if ( mw.config.get( 'wgPageName' ) === 'Usuario:Hasley/sandbox2' ) {

	$.when( $.ready, mw.loader.using( [ 'oojs-ui' ] ) ).then( function () {	

    	barId = 1;

		var number = $( '#progress-bar-' + barId ).attr( 'data-id-' + barId )

		var progressBar = new OO.ui.ProgressBarWidget( {
			progress: number
		} );

		progressBar.$element.css({
			borderRadius: '.2rem',
			margin: '0 auto',
		});

		if ( progressBar.progress < 100 ) {
		    progressBar.pushPending();
		}

		$( '#progress-bar-' + barId ).append( progressBar.$element );

	} );
}