OS2.faces: Unterschied zwischen den Versionen
		
		
		
		
		
		Zur Navigation springen
		Zur Suche springen
		
				
		
		
	
SLC (Diskussion | Beiträge)  (Geeignet für Greasemonkey 4.0/Firefox 57.0 Quantum, @grant none, @include angepaßt)  | 
				SLC (Diskussion | Beiträge)   (→Quellcode:  Installations- und Ansichtslink auf GitHub)  | 
				||
| Zeile 21: | Zeile 21: | ||
|}  | |}  | ||
== Quellcode ==  | == [https://github.com/Eselce/OS2.scripts/blob/master/OS2.faces.user.js Quellcode] [https://eselce.github.io/OS2.scripts/OS2.faces.user.js INSTALLATION] ==  | ||
<pre>  | <pre>  | ||
// ==UserScript==  | // ==UserScript==  | ||
Aktuelle Version vom 19. November 2017, 11:24 Uhr
| OS2.faces | |
| Dateiname | os2.faces.user.js | 
| Version | 0.1 (WebExtensions) | 
| Autor | Roman Bauer, FC Cork | 
| Beschreibung | Farbeauswahl über HTML5 Color Picker | 
| Letzte Änderung | 19.11.2017 | 
Quellcode INSTALLATION[Bearbeiten]
// ==UserScript==
// @name         OS2.faces
// @namespace    http://os.ongapo.com/
// @version      0.1-SLC-WE
// @copyright    2016+
// @author       Roman Bauer
// @description  Farbeauswahl über HTML5 Color Picker
// @include      /^https?://(www\.)?(os\.ongapo\.com|online-soccer\.eu|os-zeitungen\.com)/osbetafaces\.php$/
// @grant        none
// ==/UserScript==
/*jshint loopfunc: true */
(function () {
	"use strict";
	var colorPickerAvailable = (function () {
		var e = document.createElement("input");
		e.setAttribute("type", "color");
		return e.type !== "text";
	})();
	if (colorPickerAvailable) {
		var inputs = document.getElementsByTagName("input"), i;
		for (i = 0; i < inputs.length; i++) {
			var textInput = inputs[i];
			if (textInput.name && textInput.name.search(/.*farbe.*/) !== -1 && textInput.type === "text") {
				var colorPicker = document.createElement("input");
				colorPicker.type = "color";
				colorPicker.value = "#" + inputs[i].value;
				colorPicker.oninput = function () {
					this.nextSibling.value = this.value.substr(1);
				};
				textInput.parentNode.insertBefore(colorPicker, textInput);
				textInput.style.display = "none";
				i++; // cause of new input
			}
		}
	}
})();