OS2.faces: Unterschied zwischen den Versionen
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…“) |
(kein Unterschied)
|
Version vom 25. November 2016, 21:25 Uhr
OS2.faces | |
Dateiname | os2.faces.user.js |
Version | 0.1 |
Autor | Roman Bauer, FC Cork |
Beschreibung | Farbeauswahl über HTML5 Color Picker |
Letzte Änderung | 25.11.2016 |
Quellcode
// ==UserScript== // @name OS2.faces // @namespace http://os.ongapo.com/ // @version 0.1 // @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$/ // ==/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 } } } })();