PageSourceSearch

https://www.readersmagnet.club/wp-content/plugins/wp-survey-and-po…/assets/js/wp_sap_answer.js?ver=1.7.5

js readersmagnet.club collected 2026-10-01 15:04:30 UTC 23,662 bytes, 624 lines download raw bytes

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