PageSourceSearch

https://www.databankgroup.com/wp-content/themes/advisor/js/progressbar.js?ver=1

js databankgroup.com collected 2026-09-25 05:47:25 UTC 3,194 bytes, 112 lines download raw bytes

1
2(function($) {
3
4	jQuery.fn.progressBar = function( options ) {
5
6		//Default values for progress_bar
7		var defaults = {
8			height : "6",
9			backgroundColor : "#d9d9d9",
10			barColor : "#f71735",
11			targetBarColor : "#CCC",
12			percentage : true,
13			shadow : false,
14			border : false,
15			animation : false,
16			animateTarget : false,
17		};
18
19		var settings = $.extend( {}, defaults, options );
20
21		return this.each( function() {
22			var elem = $( this );
23			$.fn.replaceProgressBar( elem, settings );
24		});
25	};
26
27	$.fn.replaceProgressBar = function( item, settings ) {
28		var skill		= item.text();
29		var progress	= item.data( 'width' );
30		var target		= item.data ( 'target' );
31		var bar_classes = ' ';
32		var animation_class = '';
33		var bar_styles	= 'background-color:' + settings.backgroundColor + ';height:' + settings.height + 'px;';
34		if ( settings.shadow ) { bar_classes += 'shadow'; }
35		if ( settings.border ) { bar_classes += ' border'; }
36		if ( settings.animation ) { animation_class = ' animate'; }
37
38		var overlay = '<div class="sonny_progressbar' + animation_class + '" data-width="' + progress + '">';
39		overlay += '<p class="title">' + skill + '</p>';
40		overlay += '<div class="bar-container' + bar_classes + '" style="' + bar_styles + '">';
41
42		// Render the progress bar background
43		overlay += '<span class="backgroundBar"></span>';
44
45		// Display target bar only if set
46		if ( target ) {
47			if ( settings.animateTarget ) {
48				overlay += '<span class="targetBar loader" style="width:' + target + '%;background-color:' + settings.targetBarColor + ';"></span>';
49			}
50			else {
51				overlay += '<span class="targetBar" style="width:' + target + '%;background-color:' + settings.targetBarColor + ';"></span>';
52			}
53		}
54
55		// Render the progress bar
56		if ( settings.animation ) {
57			overlay += '<span class="bar" style="background-color:' + settings.barColor + ';"></span>';
58		}
59		else {
60			overlay += '<span class="bar" style="width:' + progress + '%;background-color:' + settings.barColor + ';"></span>';
61		}
62
63		// Render the percentage if enabled
64		if ( settings.percentage ) {
65			overlay += '<span class="progress-percent" style="line-height:' + settings.height + 'px;">' + progress + '%</span>';
66		}
67
68		// End
69		overlay += '</div></div>';
70
71		// Render the progress bar on the page
72		$( item ).replaceWith( overlay );
73
74	};
75
76	var animate = function() {
77
78		var doc_height = $(window).height();
79
80		$( '.sonny_progressbar.animate' ).each( function() {
81			var position = $( this ).offset().top;
82
83			if ( ( $(window).scrollTop() + doc_height - 60 ) > position ) {
84				var progress = $( this ).data( 'width' ) + "%";
85
86				$( this ).removeClass( 'animate' );
87				$( this ).find( '.bar' ).css('opacity', '0.1');
88
89				$( this ).find( '.bar' ).animate({
90					width : progress,
91					opacity : 1
92				}, 3000 );
93			}
94
95		});
96
97	};
98
99	// Looking for an animation element in the view
100	$(window).scroll(function() {
101
102		if ( $( '.sonny_progressbar.animate' ).length < 1 ) {
103			return;
104		}
105
106		// If there is an animate element visible on the page, trigger the animation
107		animate();
108
109	});
110
111
112})(jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.