_ _    _ _____  ___   __                       
 __      _(_) | _(_)___ / ( _ ) / /_   ___ ___  _ __ ___  
 \ \ /\ / / | |/ / | |_ \ / _ \| '_ \ / __/ _ \| '_ ` _ \ 
  \ V  V /| |   <| |___) | (_) | (_) | (_| (_) | | | | | |
   \_/\_/ |_|_|\_\_|____/ \___/ \___(_)___\___/|_| |_| |_|

User:Alex 21/script-linecolour.js

The topic of User:Alex 21/script-linecolour.js is undoubtedly one of the most relevant today. This is a topic that has had a great impact on society and has generated a wide debate in different areas. User:Alex 21/script-linecolour.js has aroused the interest of experts, academics, politicians and ordinary citizens, who seek to understand and thoroughly analyze its implications. In this article, we will explore the different perspectives and opinions on User:Alex 21/script-linecolour.js, as well as its impact on various sectors. From its origin to its future projection, User:Alex 21/script-linecolour.js represents a topic of great importance that deserves to be addressed in a detailed and critical manner.
$(function($) {
	setTimeout(function() {
		$.when( mw.loader.using( ), $.ready ).then(function() {
			var portletlink = mw.util.addPortletLink('p-tv', '#', 'Line colours');
			$(portletlink).click( function(e) {
				e.preventDefault();
				// Default parameters and determine if we need to go to the editing page
				var loc = window.location.href; var wpTextbox1 = document.getElementById('wpTextbox1'); var i;
				if (loc.indexOf('action=edit') < 0 && loc.indexOf('action=submit') < 0) {
					alert("Go to the edit page to use this script.");
				} else {
					// Gather colours from text of textarea
					var colours = ;
					var topcolours = ;
					var s = wpTextbox1.value.split("\n");
					for (i = 0; i < s.length; i++) {
						if (s.indexOf('LineColor') > 0 || s.indexOf('TopColor') > 0 || s.indexOf('line_color') > 0) {
							// LineColor regex
							var reg = /\|\s*(LineColor|TopColor|line_color)*(*)/g;
							var t = reg.exec(s);
							if (!t) continue;
							// Add colour to saved colours if its not already added
							var fontColor = t;
							if (colours.indexOf(fontColor) >= 0) continue;
							colours = fontColor;
							if (s.indexOf('TopColor') > 0) topcolours = fontColor;
						}
					}
					
					for (i = 0; i < colours.length; i++) {
						// Gather colour, and individually adjust to AAA compliancy
						var thiscolour = colours;
						var fground = (topcolours.indexOf(thiscolour) >= 0 ? '0645AD' : false);
						var newcolour = colourCompliance(thiscolour,fground);
						
						// Update if the original colour has been changed to be compliant
						if (thiscolour != newcolour) {
							// 3-digits codes (e.g. #FF3344 = #F34)
							var _3code;
							if (thiscolour == thiscolour && thiscolour == thiscolour && thiscolour == thiscolour)
								_3code = thiscolour+thiscolour+thiscolour+'|';
							else _3code = '';
							
							// Replace colours, check for minus error
							var reg2 = new RegExp('\\b'+_3code+thiscolour+'\\b','gi');
							if (newcolour.indexOf("-") < 0) wpTextbox1.value = wpTextbox1.value.replace(reg2,newcolour);
							else alert("Error fixing colour code "+thiscolour+" - please fix manually.");
						}
					}
					
					// Done
					document.getElementById('wpSummary').value += "Adjusted color contrasts via ] per ] and ].";
				}
			});
		});
	},300);
});