Vorlage:Uhr: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
Loki (Diskussion | Beiträge) (Die Seite wurde neu angelegt: <center><div style="font-size:200%; text-align:center; background-color:{{#switch: {{#switch: {{CURRENTMONTH}} | 1 | 12 = {{#switch: {{LOCALHOUR}} | 4 |...) |
K (Vorlagen-Kategorie umbenannt) |
||
(5 dazwischenliegende Versionen von einem anderen Benutzer werden nicht angezeigt) | |||
Zeile 1: | Zeile 1: | ||
<center><div style="font-size:200%; text-align:center; background-color:{{#switch: | <center><div class="clock" style="border-collapse: separate; font-size:200%; text-align:center; background-color:{{#switch: | ||
{{#switch: {{CURRENTMONTH}} | {{#switch: {{CURRENTMONTH}} | ||
| 1 | | 1 | ||
Zeile 111: | Zeile 111: | ||
| dawn1 = {{VarFarbe|0/3/0/f/3/9|r={{#expr:{{#time:i}}*(242/60) round 0}}|g={{#expr:{{#time:i}}*(110/60) round 0}}|b={{#expr:{{#time:i}}*(10/60) round 0}}}} | | dawn1 = {{VarFarbe|0/3/0/f/3/9|r={{#expr:{{#time:i}}*(242/60) round 0}}|g={{#expr:{{#time:i}}*(110/60) round 0}}|b={{#expr:{{#time:i}}*(10/60) round 0}}}} | ||
| dawn2 = {{VarFarbe|f/5/7/d/4/9|r={{#expr:{{#time:i}}*(-43/60) round 0}}|g={{#expr:{{#time:i}}*(86/60) round 0}}|b={{#expr:{{#time:i}}*(155/60) round 0}}}} | | dawn2 = {{VarFarbe|f/5/7/d/4/9|r={{#expr:{{#time:i}}*(-43/60) round 0}}|g={{#expr:{{#time:i}}*(86/60) round 0}}|b={{#expr:{{#time:i}}*(155/60) round 0}}}} | ||
| postdawn = {{VarFarbe|c/a/d/3/e/4|r={{#expr:{{#time: | | postdawn = {{VarFarbe|c/a/d/3/e/4|r={{#expr:{{#time:s}}/5 - 6 round 0}}|g={{#expr:{{#time:s}}/5 - 6 round 0}}|b={{#expr:{{#time:s}}/5 - 6 round 0}}}} | ||
| 9 = {{VarFarbe|c/a/d/3/e/4|r={{#expr:{{#time:i}}*(-14/60) round 0}}|g={{#expr:{{#time:i}}*(-10/60) round 0}}|b={{#expr:{{#time:i}}*(-8/60) round 0}}}} | | 9 = {{VarFarbe|c/a/d/3/e/4|r={{#expr:{{#time:i}}*(-14/60) round 0}}|g={{#expr:{{#time:i}}*(-10/60) round 0}}|b={{#expr:{{#time:i}}*(-8/60) round 0}}}} | ||
| 10 = # | | 10 = {{VarFarbe|b/c/c/9/d/c|r={{#expr:{{#time:s}}/5 - 6 round 0}}|g={{#expr:{{#time:s}}/5 - 6 round 0}}|b={{#expr:{{#time:s}}/5 - 6 round 0}}}} | ||
| 11 = {{VarFarbe|b/c/c/9/d/c|r={{#expr: | | 11 = {{VarFarbe|b/c/c/9/d/c|r={{#expr:{{#time:s}}/5 - 6 round 0}}|g={{#expr:{{#time:s}}/5 - 6 round 0}}|b={{#expr:{{#time:s}}/5 - 6 round 0}}}} | ||
| 12 = {{VarFarbe|b/c/c/9/d/c|r={{#expr:{{#time: | | 12 = {{VarFarbe|b/c/c/9/d/c|r={{#expr:{{#time:s}}/5 - 6 round 0}}|g={{#expr:{{#time:s}}/5 - 6 round 0}}|b={{#expr:{{#time:s}}/5 - 6 round 0}}}} | ||
| 13 = # | | 13 = {{VarFarbe|b/c/c/9/d/c|r={{#expr:{{#time:s}}/5 - 6 round 0}}|g={{#expr:{{#time:s}}/5 - 6 round 0}}|b={{#expr:{{#time:s}}/5 - 6 round 0}}}} | ||
| 14 = {{VarFarbe|b/c/c/9/d/c|r={{#expr:{{#time:i}}*(-12/60) round 0}}|g={{#expr:{{#time:i}}*(-11/60) round 0}}|b={{#expr:{{#time:i}}*(-4/60) round 0}}}} | | 14 = {{VarFarbe|b/c/c/9/d/c|r={{#expr:{{#time:i}}*(-12/60) round 0}}|g={{#expr:{{#time:i}}*(-11/60) round 0}}|b={{#expr:{{#time:i}}*(-4/60) round 0}}}} | ||
| predusk = {{VarFarbe|b/0/b/e/d/8|r={{#expr:{{#time:i}}/30 - 1 round 0}}|g={{#expr:-{{#time:i}}/30 + 1 round 0}}|b={{#expr:{{#time:i}}/30 - 1 round 0}}}} | | predusk = {{VarFarbe|b/0/b/e/d/8|r={{#expr:{{#time:i}}/30 - 1 round 0}}|g={{#expr:-{{#time:i}}/30 + 1 round 0}}|b={{#expr:{{#time:i}}/30 - 1 round 0}}}} | ||
Zeile 126: | Zeile 126: | ||
}}; color:white; width:45%"> | }}; color:white; width:45%"> | ||
Its {{LOCALTIME}}:{{#time:s}} <br/> Do You Know Where Your Meat Body Is? | Its {{LOCALTIME}}:{{#time:s}} <br/> Do You Know Where Your Meat Body Is? | ||
</div></center> | </div></center><noinclude> | ||
Die volle Funktionsfähigkeit erreicht die '''Vorlage:Uhr''' durch Einfügen des folgenden Javascripts auf der monobook.js-Seite (Link: <nowiki>http://wiki.shadowhelix.de/Benutzer:Name_des_Benutzers/monobook.js</nowiki>): | |||
<pre> | |||
/* Uhr */ | |||
function updateClock () { | |||
var Clock = document.getElementsByTagName( "div" ); | |||
for ( var i = 0; i < Clock.length; i++ ) { | |||
// div mit class="clock" raussuchen | |||
if ( hasClass( Clock[i], "clock" ) ) { | |||
// div wird geleert | |||
while(Clock[i].hasChildNodes()){ | |||
Clock[i].removeChild(Clock[i].lastChild); | |||
} | |||
var currentTime = new Date (); | |||
var currentHours = currentTime.getHours(); | |||
var currentMinutes = currentTime.getMinutes(); | |||
var currentSeconds = currentTime.getSeconds(); | |||
// ergänzung einer null, wenn sec, min, std nur eine ziffer haben | |||
if ( currentHours < 10) { currentHours = "0"+currentHours} | |||
if (currentMinutes < 10) {currentMinutes = "0"+currentMinutes} | |||
if (currentSeconds < 10) {currentSeconds = "0"+currentSeconds} | |||
// text + aktuelle uhrzeit | |||
var ClockText2 = document.createTextNode( "Do You Know Where Your " | |||
+"Meat Body Is?" ); | |||
var ClockText1 = document.createTextNode( "Its "+currentHours+":" | |||
+currentMinutes+":" | |||
+currentSeconds ); | |||
var Brk = document.createElement( "br" ); | |||
// einfügen in div | |||
Clock[i].insertBefore( ClockText2, Clock[i].childNodes[0] ); | |||
Clock[i].insertBefore( Brk, Clock[i].childNodes[0] ); | |||
Clock[i].insertBefore( ClockText1, Clock[i].childNodes[0] ); | |||
// reset der lineHeight notwendig | |||
Clock[i].style.lineHeight = "1.5em"; | |||
// nächster aufruf von updateClock() nach 1000ms | |||
setTimeout('updateClock();',1000); | |||
} | |||
} | |||
} | |||
addOnloadHook( updateClock ); | |||
</pre> | |||
[[Kategorie:!Vorlagen/Gimmick|Uhr]]</noinclude> |
Aktuelle Version vom 2. Mai 2013, 15:45 Uhr
Its 09:57:10
Do You Know Where Your Meat Body Is?
Die volle Funktionsfähigkeit erreicht die Vorlage:Uhr durch Einfügen des folgenden Javascripts auf der monobook.js-Seite (Link: http://wiki.shadowhelix.de/Benutzer:Name_des_Benutzers/monobook.js):
/* Uhr */ function updateClock () { var Clock = document.getElementsByTagName( "div" ); for ( var i = 0; i < Clock.length; i++ ) { // div mit class="clock" raussuchen if ( hasClass( Clock[i], "clock" ) ) { // div wird geleert while(Clock[i].hasChildNodes()){ Clock[i].removeChild(Clock[i].lastChild); } var currentTime = new Date (); var currentHours = currentTime.getHours(); var currentMinutes = currentTime.getMinutes(); var currentSeconds = currentTime.getSeconds(); // ergänzung einer null, wenn sec, min, std nur eine ziffer haben if ( currentHours < 10) { currentHours = "0"+currentHours} if (currentMinutes < 10) {currentMinutes = "0"+currentMinutes} if (currentSeconds < 10) {currentSeconds = "0"+currentSeconds} // text + aktuelle uhrzeit var ClockText2 = document.createTextNode( "Do You Know Where Your " +"Meat Body Is?" ); var ClockText1 = document.createTextNode( "Its "+currentHours+":" +currentMinutes+":" +currentSeconds ); var Brk = document.createElement( "br" ); // einfügen in div Clock[i].insertBefore( ClockText2, Clock[i].childNodes[0] ); Clock[i].insertBefore( Brk, Clock[i].childNodes[0] ); Clock[i].insertBefore( ClockText1, Clock[i].childNodes[0] ); // reset der lineHeight notwendig Clock[i].style.lineHeight = "1.5em"; // nächster aufruf von updateClock() nach 1000ms setTimeout('updateClock();',1000); } } } addOnloadHook( updateClock );