OS2.faces: Unterschied zwischen den Versionen

Aus Online-Soccer-Wiki
Zur Navigation springen Zur Suche springen
(Die Seite wurde neu angelegt: „Kategorie:Greasemonkey {| style="background-color:white; font-size:11px; float: right; margin:3px 3px 3px 10px; border:1px solid #999; border-color: #8c9a7…“)
 
(Geeignet für Greasemonkey 4.0/Firefox 57.0 Quantum, @grant none, @include angepaßt)
Zeile 1: Zeile 1:
[[Kategorie:Greasemonkey]]
[[Kategorie:Greasemonkey]]
[[Kategorie:Greasemonkey WE]]
{| style="background-color:white; font-size:11px; float: right; margin:3px 3px 3px 10px; border:1px solid #999; border-color: #8c9a7c; border-collapse:collapse;" width=500 cellpadding=3 cellspacing=0
{| style="background-color:white; font-size:11px; float: right; margin:3px 3px 3px 10px; border:1px solid #999; border-color: #8c9a7c; border-collapse:collapse;" width=500 cellpadding=3 cellspacing=0
| colspan="2" style="padding:0.3em; background-color:#8c9a7c; font-size: 18px; color:#FFFFFF" align=center| '''OS2.faces'''
| colspan="2" style="padding:0.3em; background-color:#8c9a7c; font-size: 18px; color:#FFFFFF" align=center| '''OS2.faces'''
Zeile 7: Zeile 8:
|- bgcolor="#CCCCCC"
|- bgcolor="#CCCCCC"
| '''Version'''
| '''Version'''
| 0.1
| 0.1 (WebExtensions)
|- bgcolor="#CCCCCC"
|- bgcolor="#CCCCCC"
| '''Autor'''
| '''Autor'''
Zeile 25: Zeile 26:
// @name        OS2.faces
// @name        OS2.faces
// @namespace    http://os.ongapo.com/
// @namespace    http://os.ongapo.com/
// @version      0.1
// @version      0.1-SLC-WE
// @copyright    2016+
// @copyright    2016+
// @author      Roman Bauer
// @author      Roman Bauer
// @description  Farbeauswahl über HTML5 Color Picker
// @description  Farbeauswahl über HTML5 Color Picker
// @include      /^https?://(www\.|)(os\.ongapo\.com|online-soccer\.eu|os-zeitungen\.com)/osbetafaces\.php$/
// @include      /^https?://(www\.)?(os\.ongapo\.com|online-soccer\.eu|os-zeitungen\.com)/osbetafaces\.php$/
// @grant        none
// ==/UserScript==
// ==/UserScript==


Zeile 72: Zeile 74:


})();
})();
</pre>
</pre>

Version vom 16. November 2017, 10:57 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 16.11.2017

Quellcode

// ==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
			}
		}
	}

})();