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…“)
 
(→‎Quellcode: Installations- und Ansichtslink auf GitHub)
 
(Eine dazwischenliegende Version desselben Benutzers wird nicht angezeigt)
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 20: 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==
// @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>

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

})();