PageSourceSearch

https://bulletproofmusician.com/wp-content/plugins/modal_survey/te…/js/modal_survey_answer.js?ver=2.0.1.9.6

js bulletproofmusician.com collected 2026-09-24 09:17:29 UTC 25,945 bytes, 689 lines download raw bytes

1;(function ( $, window, document, undefined ) {
2	"use strict";
3		/** Create the defaults once **/
4		var pluginName = "pmsresults",
5				defaults = {
6				style		 	: {},
7				datas    		: []
8		};
9/** The actual plugin constructor **/
10function Plugin ( element, options ) {
11		this.element = element;
12		this.settings = $.extend( {}, defaults, options );
13		this._defaults = defaults;
14		this._name = pluginName;
15		this.init();
16}
17
18/** Avoid Plugin.prototype conflicts **/
19$.extend( Plugin.prototype, {
20		init: function () {
21		var msChartSData = [], labs = [], dset = [], dset2 = [], msChartData = {}, msChartOptions = {}, bgcolors, advcolors = [], mschartelem = [];
22		var fillColor = '', fillColor2 = '', strokeColor = '', strokeColor2 = '', highlightFill = '', highlightFill2 = '', highlightStroke = '', highlightStroke2 = '', element = '', style = '', lng = {}, elementstyle = this.settings.style.style, counter, msChartType, afillColor = [], astrokeColor = [], ahighlightFill = [], ahighlightStroke = [], thismax = 0, arfillColor = [], arstrokeColor = [], arhighlightFill = [], arstrokeColor2 = [], relative_height = 0.6, general;
23		if ( this.settings.style.bgcolor == undefined ) {
24			this.settings.style.bgcolor = "";
25		}
26		general = this.settings.general;
27		this.settings.style.aftertag = "";
28		if ( this.settings.style.percentage != undefined ) {
29			if ( this.settings.style.percentage == "true" ) {
30				this.settings.style.aftertag = "%";
31			}
32		}
33		if ( this.settings.style.after != undefined ) {
34			if ( this.settings.style.after != "" ) {
35				this.settings.style.aftertag = this.settings.style.after;
36			}
37		}
38		if ( this.settings.style.legend != undefined ) {
39			if ( this.settings.style.legend != "" ) {
40				this.settings.style.legend = this.settings.style.legend;
41			}
42		}
43		if ( ( bgcolors == "" || bgcolors == undefined ) && this.settings.style.bgcolor != "" ) {
44			bgcolors = this.settings.style.bgcolor.split( "," );
45		}
46		if ( this.settings.style.style == "progressbar" || this.settings.style.style == "linebar" ) {
47			jQuery( '#' + jQuery( this.element ).attr( 'id' ) + " .survey_global_percent" ).each( function( index ) {
48				element = jQuery(this);
49				if ( elementstyle == "linebar" ) {
50					element.css( "width", parseInt( element.closest( ".lineprocess" ).find( ".hiddenperc" ).val() ) + "%" );
51					incNumbers( 0, element.closest( ".lineprocess" ).find( ".hiddenperc" ).val(), element.parent().children( ".perc" ), 16 );
52				}
53				else {
54					element.css( "width", parseInt( element.closest( ".process" ).find( ".hiddenperc" ).val() ) + "%" );					
55				}
56			})
57		}
58		function incNumbers( start, end, jqstr, speed ) {
59			var clr = null;
60			var ele = jQuery( jqstr );
61			var rand = start;
62			var res = "";
63			if ( arguments.length < 3 ) {
64				throw "missing required parameters";
65			}
66			function loop() {
67				clearTimeout( clr );
68				function inloop() {
69					res = rand += 1;
70					ele.html( res + "%" );
71					if ( !( rand < end ) ) {
72						ele.html( end + "%" );
73						return;
74					}
75					clr = setTimeout( inloop, ( speed || 32 ) );
76				};
77				inloop();
78				//  setTimeout(loop, 2500); //Increment Loop TIme
79			};
80			loop();
81		}
82		Object.size = function( obj ) {
83			var size = 0, key;
84			for ( key in obj ) {
85				if ( obj.hasOwnProperty( key ) ) {
86					size++;
87				}
88			}
89			return size;
90		};
91		
92		element = this.element;
93		style = this.settings.style;
94		if ( this.settings.style.lng != undefined ) {
95			lng = this.settings.style.lng;
96		}
97		else {
98			lng.label1 = "";
99			lng.label2 = "";		
100		}
101		if ( style.style == "barchart" || style.style == "horizontalbarchart" || style.style == "linechart" || style.style == "radarchart" || style.style == "piechart" || style.style == "doughnutchart" || style.style == "polarchart" || style.style == "bubblechart" ) {
102			var thisdatas = this.settings.datas[ 0 ];
103			var thisdatassize = 0;
104			if ( thisdatas != undefined ) {
105				if ( thisdatas.length == undefined ) {
106					thisdatassize = Object.size( thisdatas );
107				}
108				else {
109					thisdatassize = thisdatas.length;
110				}
111			}
112			if ( bgcolors == undefined && thisdatas != undefined ) {
113				for (var i = 0; i < thisdatassize; i++ ) {
114					advcolors.push( [ getFromHex( get_random_color(), 0.7 ), getFromHex( get_random_color(), 0.7 ), getFromHex( get_random_color(), 0.7 ), getFromHex( get_random_color(), 0.7 ) ] );
115				}
116			}
117			else {
118				jQuery.each( bgcolors, function ( a, bs ) {
119					if ( a == undefined ) {
120						a = 0;
121					}
122					advcolors[ a ] = bs.split( ":" );
123				})
124				for (var c = 0; c < thisdatassize; c++ ) {
125					if ( advcolors[ c ] == undefined ) {
126						if ( advcolors[ c - 1 ] != undefined ) {
127							advcolors[ c ] = advcolors[ c - 1 ];
128						}
129						else {
130							advcolors[ c ] = [ getFromHex( get_random_color(), 0.7 ), getFromHex( get_random_color(), 0.7 ), getFromHex( get_random_color(), 0.7 ), getFromHex( get_random_color(), 0.7 ) ];
131						}
132					}
133				}
134			}
135			for ( var s = 0; s < thisdatassize; s++ ) {
136				for (var c = 0; c < 4; c++ ) {
137					if ( advcolors[ s ] == undefined ) {
138						advcolors[ s ] = new Array();
139					}
140					if ( advcolors[ s ][ c ] == undefined ) {
141						advcolors[ s ][ c ] = getFromHex( get_random_color(), 0.7 );
142					}
143				}				
144			}
145			jQuery.each( this.settings.datas, function ( i, elem ) {
146			dset = [];dset2 = [];
147			fillColor = ( advcolors[ 1 ] != undefined && advcolors[ 1 ] != '' ) ? getFromHex( advcolors[ 1 ], 0.5 ) : getFromHex( get_random_color(), 0.7 ), 
148			strokeColor = ( advcolors[ 2 ] != undefined && advcolors[ 2 ] != '' ) ? getFromHex( advcolors[ 2 ], 0.5 ) : getFromHex( get_random_color(), 0.7 ), 
149			highlightFill = ( advcolors[ 3 ] != undefined && advcolors[ 3 ] != '' ) ? getFromHex( advcolors[ 3 ], 0.5 ) : getFromHex( get_random_color(), 0.7 ), 
150			highlightStroke = ( advcolors[ 4 ] != undefined && advcolors[ 4 ] != '' ) ? getFromHex( advcolors[ 4 ], 0.5 ) : getFromHex( get_random_color(), 0.7 );
151			labs = [];
152			thismax = 0;
153				jQuery.each(elem, function (e, el) {
154					labs.push( el.answer );
155					dset.push( parseFloat( el.count ).toFixed(2) );
156					if ( el.gcount != undefined ) {
157						dset2.push( el.gcount );
158					}
159					if ( bgcolors == "" ) {
160						afillColor.push( getFromHex( get_random_color(), 0.7 ) );
161						//astrokeColor.push( get_random_color() );
162						ahighlightFill.push( getFromHex( get_random_color(), 0.7 ) );
163						//ahighlightStroke.push( get_random_color() );
164					}
165				});
166				thismax = Math.max.apply(Math,dset);
167				if ( bgcolors == "" ) {
168					fillColor = afillColor;
169					strokeColor = "rgba(0, 0, 0, 0.1)";
170					highlightFill = ahighlightFill;
171					highlightStroke = "rgba(0, 0, 0, 0.2)";
172				}
173				if ( ! jQuery.isEmptyObject( dset2 ) ) {
174					if ( fillColor[ 1 ] != undefined ) {
175						if ( fillColor[ 1 ].substring( 0, 3 ) == 'rgb' ) {
176						   highlightFill = getFromRGB( fillColor[ 1 ], 0.6 );
177						   fillColor = getFromRGB( fillColor[ 1 ], 0.8 );
178						} else {
179						   highlightFill = getFromHex( fillColor[ 1 ], 0.6 );
180						   fillColor = getFromHex( fillColor[ 1 ], 0.8 );
181						}
182					}
183					else {
184						fillColor = afillColor;
185						highlightFill = ahighlightFill;
186					}
187					if ( fillColor[ 1 ] != undefined ) {
188						if ( strokeColor[ 1 ].substring( 0, 3 ) == 'rgb' ) {
189						   strokeColor = getFromRGB( strokeColor[ 1 ], 0.8 );
190						} else {
191						   strokeColor = getFromHex( strokeColor[ 1 ], 0.8 );
192						}
193					}
194					else {
195						strokeColor = "rgba(0, 0, 0, 0.1)";
196						highlightStroke = "rgba(0, 0, 0, 0.2)";
197					}
198				}
199				jQuery.each( advcolors, function ( i, ar ) {
200					jQuery.each( advcolors[ i ], function (e, el) {
201						advcolors[ i ][ e ] = getFromHex( el, 0.8 );
202					} )
203						arfillColor.push( advcolors[ i ][ 0 ] );
204						arstrokeColor.push( advcolors[ i ][ 1 ] );
205						arhighlightFill.push( advcolors[ i ][ 2 ] );
206						arstrokeColor2.push( advcolors[ i ][ 3 ] );
207				} )
208				if ( elementstyle == "radarchart" || elementstyle == "linechart" ) {
209						if ( typeof arfillcolor != 'undefined' ) {
210							var sarfillcolor = arfillcolor[ 0 ];
211						}
212						if ( arstrokeColor != undefined ) {
213							var sarstrokeColor = arstrokeColor[ 0 ];
214						}
215						if ( arhighlightFill != undefined ) {
216							var sarhighlightFill = arhighlightFill[ 0 ];
217						}
218						if ( arstrokeColor2 != undefined ) {
219							var sarstrokeColor2 = arstrokeColor2[ 0 ];
220						}
221						if ( fillColor != undefined ) {
222							var sfillColor = fillColor[ 0 ];
223						}
224						if ( strokeColor != undefined ) {
225							var sstrokeColor = strokeColor[ 0 ];
226						}
227						if ( highlightFill != undefined ) {
228							var shighlightFill = highlightFill[ 0 ];
229						}
230						if ( strokeColor != undefined ) {
231							var sstrokeColor = strokeColor[ 0 ];
232						}
233				msChartData = {
234						labels : labs,
235						datasets : [
236							{
237								label: lng.label1,
238								backgroundColor : ( typeof sarfillColor != 'undefined' ) ? sarfillColor : sfillColor,
239								borderColor : ( typeof sarstrokeColor != 'undefined' ) ? sarstrokeColor : sstrokeColor,
240								hoverBackgroundColor: ( typeof sarhighlightFill != 'undefined' ) ? sarhighlightFill : shighlightFill,
241								hoverBorderColor: ( typeof sarstrokeColor2 != 'undefined' ) ? sarstrokeColor2 : sstrokeColor,
242								pointBackgroundColor: "rgba(0, 0, 0, 0.2)",
243								pointBorderColor: "rgba(0, 0, 0, 0.2)",
244								pointHoverBackgroundColor: "rgba(0, 0, 0, 0.2)",
245								pointHoverBorderColor: "rgba(0, 0, 0, 0.2)",
246								data: dset
247							}
248						]
249
250					}
251				}
252				else {
253				msChartData = {
254						labels : labs,
255						datasets : [
256							{
257								label: lng.label1,
258								backgroundColor : ( arfillColor != undefined ) ? arfillColor : fillColor,
259								borderColor : ( arstrokeColor != undefined ) ? arstrokeColor : strokeColor,
260								hoverBackgroundColor: ( arhighlightFill != undefined ) ? arhighlightFill : highlightFill,
261								hoverBorderColor: ( arstrokeColor2 != undefined ) ? arstrokeColor2 : strokeColor,
262								pointBackgroundColor: "rgba(0, 0, 0, 0.2)",
263								pointBorderColor: "rgba(0, 0, 0, 0.2)",
264								pointHoverBackgroundColor: "rgba(0, 0, 0, 0.2)",
265								pointHoverBorderColor: "rgba(0, 0, 0, 0.2)",
266								data: dset
267							}
268						]
269
270					}
271				}
272					if ( ! jQuery.isEmptyObject( dset2 ) ) {
273						fillColor2 = getFromHex( get_random_color(), 0.7 ), 
274						strokeColor2 = getFromHex( get_random_color(), 0.7 ), 
275						highlightFill2 = getFromHex( get_random_color(), 0.7 ), 
276						highlightStroke2 = getFromHex( get_random_color(), 0.7 );
277						msChartData.datasets.push({
278								label: lng.label2,
279								backgroundColor : fillColor2,
280								borderColor : strokeColor2,
281								hoverBackgroundColor: highlightFill2,
282								hoverBorderColor: strokeColor2,
283								pointBackgroundColor: fillColor2,
284								pointBorderColor: strokeColor2,
285								pointHoverBackgroundColor: highlightFill2,
286								pointHoverBorderColor: strokeColor2,
287								data: dset2				
288						})
289					}
290				msChartOptions.tooltipTemplate = "<%if (label){%><%=label%>: <%}%><%= value %>" + style.aftertag;
291				msChartOptions.multiTooltipTemplate = "<%= datasetLabel %><%= value %>" + style.aftertag;
292				if ( style.legend == "tooltip" ) {
293					msChartOptions.showAllTooltips = true;
294				}
295				else {
296					msChartOptions.showAllTooltips = false;
297				}
298				msChartOptions.tooltips = {
299					callbacks: {
300						label: function(tooltipItem, data) {
301							var dataset = data.datasets[ tooltipItem.datasetIndex ];
302							return data.labels[ tooltipItem.index ] + ": " + parseFloat( Number( dataset.data[tooltipItem.index] ).toFixed( 2 ) ) + style.aftertag;
303						},
304						title: function() {} // hide tooltip title
305					}
306				}
307				msChartOptions.barStrokeWidth = 1;
308				if ( style.legend != "true" && Chart.defaults != undefined ) {
309					Chart.defaults.global.legend = {
310								display: false
311							}
312				}
313				if ( elementstyle == "barchart" ) {
314					msChartType = 'bar';
315					if ( style.max > 0 ) {
316						msChartOptions.scales = {
317							yAxes: [{
318								ticks: {
319									max: parseInt( style.max ),
320									stepSize: Math.ceil( style.max / 10 ),
321									beginAtZero: true
322								}
323							}],
324							xAxes: [{
325								ticks: {
326									autoSkip: false
327								}								
328							}]
329						}
330					}
331					else {
332						msChartOptions.scales = {
333							yAxes: [{
334								ticks: {
335									stepSize: Math.ceil( thismax / 10 ),
336									beginAtZero: true
337								}
338							}],
339							xAxes: [{
340								ticks: {
341									autoSkip: false
342								}								
343							}]
344						}						
345					}
346				}
347				if ( elementstyle == "horizontalbarchart" ) {
348					msChartType = 'horizontalBar';
349					if ( style.max > 0 ) {
350						msChartOptions.scales = {
351							xAxes: [{
352								ticks: {
353									max: parseInt( style.max ),
354									stepSize: Math.ceil( style.max / 10 ),
355									beginAtZero: true
356								}
357							}],
358							yAxes: [{
359								ticks: {
360									autoSkip: false,
361									beginAtZero: true
362								}								
363							}]
364						}
365					}
366					else {
367						msChartOptions.scales = {
368							xAxes: [{
369								ticks: {
370									stepSize: Math.ceil( thismax / 10 ),
371									beginAtZero: true
372								}
373							}],
374							yAxes: [{
375								ticks: {
376									autoSkip: false,
377									beginAtZero: true
378								}								
379							}]
380						}						
381					}
382				}
383				if ( elementstyle == "linechart" ) {
384					msChartType = 'line';
385					if ( style.max > 0 ) {
386						msChartOptions.scales = {
387							yAxes: [{
388								ticks: {
389									max: parseInt( style.max ),
390									min: 0,
391									stepSize: Math.ceil( style.max / 10 ),
392									beginAtZero: true
393								}
394							}],
395							xAxes: [{
396								ticks: {
397									autoSkip: false
398								}								
399							}]
400						}
401					}
402					else {
403						msChartOptions.scales = {
404							yAxes: [{
405								ticks: {
406									min: 0,
407									stepSize: Math.ceil( thismax / 10 ),
408									beginAtZero: true
409								}
410							}],
411							xAxes: [{
412								ticks: {
413									autoSkip: false
414								}								
415							}]
416						}						
417					}
418				}
419				if ( elementstyle == "radarchart" ) {
420					msChartType = 'radar';
421					if ( style.max > 0 ) {
422						msChartOptions.scale = {
423							ticks: {
424								max: parseInt( style.max ),
425								beginAtZero: true
426							}
427						}
428					}
429					else {
430						msChartOptions.scale = {
431							ticks: {
432								beginAtZero: true
433							}
434						}						
435					}
436				}
437				if ( elementstyle == "piechart" ) {
438					msChartType = 'pie';
439				}
440				if ( elementstyle == "doughnutchart" ) {
441					msChartType = 'doughnut';
442				}
443				if ( elementstyle == "polarchart" ) {
444					msChartType = 'polarArea';
445					if ( style.max > 0 ) {
446						msChartOptions.scale = {
447							ticks: {
448								max: parseInt( style.max ),
449								stepSize: Math.ceil( style.max / 10 ),
450								beginAtZero: true
451							}
452						}
453					}
454					else {
455						msChartOptions.scale = {
456							ticks: {
457								stepSize: Math.ceil( thismax / 10 ),
458								beginAtZero: true
459							}
460						}						
461					}
462				}
463				if ( elementstyle != "" ) {
464					if ( jQuery( "#" + jQuery( element ).attr( 'id' ) + " .modal-survey-chart" + i + " canvas" ) != undefined ) {
465						msChartOptions.maintainAspectRatio = true;
466						if ( style.legend != "true" ) {
467							msChartOptions.legend = false;
468						}
469						else {
470							msChartOptions.maintainAspectRatio = false;
471							//relative_height = 0.8;
472							msChartOptions.legend = {
473								display: true,
474								labels: {
475									fontColor: 'rgb(255, 99, 132)'
476								}
477							}
478						}
479							msChartOptions.responsive = true;
480							msChartOptions.layout = {
481								padding: {
482									left: 20,
483									right: 20,
484									top: 20,
485									bottom: 20
486								}
487							};
488						var chartconfig = {
489							type: msChartType,
490							data: msChartData,
491							options: msChartOptions
492						}
493						var chartcontainer_width = jQuery( "#" + jQuery( element ).attr( 'id' ) + " .modal-survey-chart" + i ).width();
494						jQuery( "#" + jQuery( element ).attr( 'id' ) + " .modal-survey-chart" + i ).css({
495							"height": chartcontainer_width * relative_height + "px"
496						});
497						//set charts to full width
498						if ( style.legend != "true" ) {
499							var newheight = jQuery( "#" + jQuery( element ).attr( 'id' ) + " .modal-survey-chart" + i + " canvas" ).width() * 0.8;
500							if ( newheight != 0 ) {
501								jQuery( "#" + jQuery( element ).attr( 'id' ) + " .modal-survey-chart" + i + " canvas" ).attr( "height", parseInt( newheight ) + "px" );
502							}
503						}
504						else {
505							var newheight = jQuery( "#" + jQuery( element ).attr( 'id' ) + " .modal-survey-chart" + i + " canvas" ).width() * 1.5;
506							if ( newheight != 0 ) {
507								jQuery( "#" + jQuery( element ).attr( 'id' ) + " .modal-survey-chart" + i + " canvas" ).attr( "height", parseInt( newheight ) + "px" );							
508							}
509						}
510						jQuery( "#" + jQuery( element ).attr( 'id' ) + " .modal-survey-chart" + i ).css( "height", "auto" );
511						
512						if ( typeof mschartelem[ jQuery( element ).attr( 'id' ) + "-" + i ] != "undefined" ) {
513							mschartelem[ jQuery( element ).attr( 'id' ) + "-" + i ].chart.destroy();
514						}
515
516						// Increase tooltip font size
517						if ( general != undefined ) {
518							if ( general.charttooltip_fontsize != false ) {
519								msChartOptions.tooltips.titleFontSize = parseInt( general.charttooltip_fontsize );
520								msChartOptions.tooltips.bodyFontSize = parseInt( general.charttooltip_fontsize );
521							}
522							// Increase chart font size
523							if ( general.chartlabel_fontsize != false ) {
524								if ( msChartOptions.scale != undefined ) {
525									msChartOptions.scale.pointLabels = {
526										fontSize: parseInt( general.chartlabel_fontsize )
527									}
528								}
529								Chart.defaults.global.defaultFontSize = parseInt( general.chartlabel_fontsize );
530							}
531						}
532						mschartelem[ jQuery( element ).attr( 'id' ) + "-" + i ] = new MSChart( jQuery( "#" + jQuery( element ).attr( 'id' ) + " .modal-survey-chart" + i + " canvas" )[ 0 ].getContext( "2d" ), chartconfig );
533					}
534				}
535			});
536		}
537		
538		jQuery( "#" + jQuery( element ).attr( 'id' ) ).find( ".ms-print-results" ).on( "click", function( e ) {
539			e.preventDefault();
540			var resarea = jQuery( this ).attr( "data-id" );
541			printDiv( resarea );
542		})
543		
544		function printDiv( divName ) {
545			jQuery( "#" + divName ).printThis({ 
546				canvas: 'true',
547				beforePrint: function() {
548					jQuery( ".ms-print-results.button" ).css( "display", "none" );
549				},
550				afterPrint: function() {
551					jQuery( ".ms-print-results.button" ).css( "display", "block" );
552				},
553				printDelay: 10
554			});
555		}
556		
557		function colourNameToHex( colour ) {
558			var colours = {"aliceblue":"#f0f8ff","antiquewhite":"#faebd7","aqua":"#00ffff","aquamarine":"#7fffd4","azure":"#f0ffff",
559			"beige":"#f5f5dc","bisque":"#ffe4c4","black":"#000000","blanchedalmond":"#ffebcd","blue":"#0000ff","blueviolet":"#8a2be2","brown":"#a52a2a","burlywood":"#deb887",
560			"cadetblue":"#5f9ea0","chartreuse":"#7fff00","chocolate":"#d2691e","coral":"#ff7f50","cornflowerblue":"#6495ed","cornsilk":"#fff8dc","crimson":"#dc143c","cyan":"#00ffff",
561			"darkblue":"#00008b","darkcyan":"#008b8b","darkgoldenrod":"#b8860b","darkgray":"#a9a9a9","darkgreen":"#006400","darkkhaki":"#bdb76b","darkmagenta":"#8b008b","darkolivegreen":"#556b2f",
562			"darkorange":"#ff8c00","darkorchid":"#9932cc","darkred":"#8b0000","darksalmon":"#e9967a","darkseagreen":"#8fbc8f","darkslateblue":"#483d8b","darkslategray":"#2f4f4f","darkturquoise":"#00ced1",
563			"darkviolet":"#9400d3","deeppink":"#ff1493","deepskyblue":"#00bfff","dimgray":"#696969","dodgerblue":"#1e90ff",
564			"firebrick":"#b22222","floralwhite":"#fffaf0","forestgreen":"#228b22","fuchsia":"#ff00ff",
565			"gainsboro":"#dcdcdc","ghostwhite":"#f8f8ff","gold":"#ffd700","goldenrod":"#daa520","gray":"#808080","grey":"#808080","green":"#008000","greenyellow":"#adff2f",
566			"honeydew":"#f0fff0","hotpink":"#ff69b4",
567			"indianred ":"#cd5c5c","indigo":"#4b0082","ivory":"#fffff0","khaki":"#f0e68c",
568			"lavender":"#e6e6fa","lavenderblush":"#fff0f5","lawngreen":"#7cfc00","lemonchiffon":"#fffacd","lightblue":"#add8e6","lightcoral":"#f08080","lightcyan":"#e0ffff","lightgoldenrodyellow":"#fafad2",
569			"lightgrey":"#d3d3d3","lightgreen":"#90ee90","lightpink":"#ffb6c1","lightsalmon":"#ffa07a","lightseagreen":"#20b2aa","lightskyblue":"#87cefa","lightslategray":"#778899","lightsteelblue":"#b0c4de",
570			"lightyellow":"#ffffe0","lime":"#00ff00","limegreen":"#32cd32","linen":"#faf0e6",
571			"magenta":"#ff00ff","maroon":"#800000","mediumaquamarine":"#66cdaa","mediumblue":"#0000cd","mediumorchid":"#ba55d3","mediumpurple":"#9370d8","mediumseagreen":"#3cb371","mediumslateblue":"#7b68ee",
572			"mediumspringgreen":"#00fa9a","mediumturquoise":"#48d1cc","mediumvioletred":"#c71585","midnightblue":"#191970","mintcream":"#f5fffa","mistyrose":"#ffe4e1","moccasin":"#ffe4b5",
573			"navajowhite":"#ffdead","navy":"#000080",
574			"oldlace":"#fdf5e6","olive":"#808000","olivedrab":"#6b8e23","orange":"#ffa500","orangered":"#ff4500","orchid":"#da70d6",
575			"palegoldenrod":"#eee8aa","palegreen":"#98fb98","paleturquoise":"#afeeee","palevioletred":"#d87093","papayawhip":"#ffefd5","peachpuff":"#ffdab9","peru":"#cd853f","pink":"#ffc0cb","plum":"#dda0dd","powderblue":"#b0e0e6","purple":"#800080",
576			"red":"#ff0000","rosybrown":"#bc8f8f","royalblue":"#4169e1",
577			"saddlebrown":"#8b4513","salmon":"#fa8072","sandybrown":"#f4a460","seagreen":"#2e8b57","seashell":"#fff5ee","sienna":"#a0522d","silver":"#c0c0c0","skyblue":"#87ceeb","slateblue":"#6a5acd","slategray":"#708090","snow":"#fffafa","springgreen":"#00ff7f","steelblue":"#4682b4",
578			"tan":"#d2b48c","teal":"#008080","thistle":"#d8bfd8","tomato":"#ff6347","turquoise":"#40e0d0",
579			"violet":"#ee82ee",
580			"wheat":"#f5deb3","white":"#ffffff","whitesmoke":"#f5f5f5",
581			"yellow":"#ffff00","yellowgreen":"#9acd32"};
582
583			if (typeof colours[colour.toLowerCase()] != 'undefined')
584				return colours[colour.trim().toLowerCase()];
585
586			return "#808080";
587		}		
588		function getFromRGB( color, transparency ) {
589			var result = "";
590			if ( color.indexOf( 'a' ) == -1 ){
591				result = color.replace( ')', ', ' + transparency + ' )').replace( 'rgb', 'rgba' );
592			}
593			return result;
594		}
595
596		function getFromHex( color, transparency ) {
597			var searchrgba = new RegExp( "rgba" );;
598			if ( searchrgba.test( color ) == false ) {
599				if ( typeof color === 'string' ) {
600					var patt = /^#([\da-fA-F]{2})([\da-fA-F]{2})([\da-fA-F]{2})$/;
601					var matches = patt.exec( color.trim() );
602					if ( matches == null && searchrgba.test( color ) == false ) {
603						var matches = patt.exec( colourNameToHex( color.trim() ) );
604					}
605					var rgba = "rgba(" + parseInt( matches[ 1 ], 16 ) + "," + parseInt( matches[ 2 ], 16 ) + "," + parseInt( matches[ 3 ], 16 ) + ", " + transparency + ")";
606					return rgba;
607				}
608				else {
609					var colorcodes = [];
610					jQuery.each( color, function ( i, elem ) {
611						var patt = /^#([\da-fA-F]{2})([\da-fA-F]{2})([\da-fA-F]{2})$/;
612						var matches = patt.exec( elem.trim() );
613						if ( matches == null && searchrgba.test( color ) == false ) {
614							var matches = patt.exec( colourNameToHex( elem.trim() ) );
615						}
616						colorcodes[ i ] = "rgba(" + parseInt( matches[ 1 ], 16 ) + "," + parseInt( matches[ 2 ], 16 ) + "," + parseInt( matches[ 3 ], 16 ) + ", " + transparency + ")";
617					})
618					return colorcodes;
619				}
620			}
621			else {
622				return color;
623			}
624		}			
625		function get_random_color() {
626			var letters = '0123456789ABCDEF'.split('');
627			var color = '#';
628			for (var i = 0; i < 6; i++ ) {
629				color += letters[Math.round(Math.random() * 15)];
630			}
631			return color;
632		}
633	}
634});
635		$.fn[ pluginName ] = function ( options ) {
636				return this.each(function() {
637						if ( !$.data( this, "plugin_" + pluginName ) ) {
638								$.data( this, "plugin_" + pluginName, new Plugin( this, options ) );
639						}
640				});
641		};
642
643		// Show tooltips always even the stats are zero
644
645		Chart.pluginService.register({
646		  beforeRender: function(chart) {
647			if (chart.config.options.showAllTooltips) {
648			  // create an array of tooltips
649			  // we can't use the chart tooltip because there is only one tooltip per chart
650			  chart.pluginTooltips = [];
651			  chart.config.data.datasets.forEach(function(dataset, i) {
652				chart.getDatasetMeta(i).data.forEach(function(sector, j) {
653				  chart.pluginTooltips.push(new Chart.Tooltip({
654					_chart: chart.chart,
655					_chartInstance: chart,
656					_data: chart.data,
657					_options: chart.options.tooltips,
658					_active: [sector]
659				  }, chart));
660				});
661			  });
662
663			  // turn off normal tooltips
664			  chart.options.tooltips.enabled = false;
665			}
666		  },
667		  afterDraw: function(chart, easing) {
668			if (chart.config.options.showAllTooltips) {
669			  // we don't want the permanent tooltips to animate, so don't do anything till the animation runs atleast once
670			  if (!chart.allTooltipsOnce) {
671				if (easing !== 1)
672				  return;
673				chart.allTooltipsOnce = true;
674			  }
675
676			  // turn on tooltips
677			  chart.options.tooltips.enabled = true;
678			  Chart.helpers.each(chart.pluginTooltips, function(tooltip) {
679				tooltip.initialize();
680				tooltip.update();
681				// we don't actually need this since we are not animating tooltips
682				tooltip.pivot();
683				tooltip.transition(easing).draw();
684			  });
685			  chart.options.tooltips.enabled = false;
686			}
687		  }
688		});
689})( jQuery, window, document );

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.