timer-mit-prozessbalken-mit-oninput-event.php


Quell Code


<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>

<style>
#helper{
  position:absolute;
  left:0px;
  bottom:0px;
  border:1px solid black;
  height:30px;
  width:300px;
overflow:hidden;

}
#conti{
  position:relative;
  top:0px;
  left:0px;
  height:30px;
  width:10300px;
  background:linear-gradient(
   to right,
   red 25%, orange 50%, yellow 70%,green 100%);
}
#aus{
  position:absolute;
  margin-left:130px;
  font-size:25px;
  font-weight:900;
}
#contibalken{
  top:100px;
  position:absolute;
  left:calc(50% - 150px);
  width:300px;
  height:300px;
  border:2px solid black;
  text-align:center;
}
#contibalken p{
 
  width:220px;
  text-align:center;
 font-weight:900;
  font-size:25px;
  margin:0;
  margin-left:40px;
}
#sekundenbalken{
  width:200px;
  height:25px;
  border:2px solid black;
  border-radius:10px;
  text-align:center;
  font-size:20px;
  font-weight:900;
  margin-top:10px;
 
}


#hoverinfo{
  display:none;
  position:relative;
  top:-120px;
  left:10px;
  background:black;
  color:white;
  padding:5px;
  font-size:20px;
}

#contibalken:hover > #hoverinfo{
  display:block;
}
#sekundenbalken:hover{
  border:5px solid green;
}
#time,.blinkno{
  font-size:30px;
  color:black;
}

.blink{
 animation:blinki linear forwards 1s infinite;
}
@keyframes blinki{
  0%,49%,100%{
    color:white;
  }50%{
    color:red;
  }
}

#bastilink{
position:absolute;
bottom:20px;
left:40%;
}


</style>
  </head>
<body>

<h1>Beschreibung</h1>
<ul>
  <li>Eingabe von Sekunden.</li>
  <li>Uhr läuft rückwärts.</li>
  <li>Die letzten 10 Sekunden blinkt die Zeit.</li>
  <li>Einfacher Neustart durch Oninput Event.</li>
  <li>Restzeit wird nach Eingabe sofort angezeigt<br>auch wenn wärend des laufens eine neue Zeit eingegeben wird.</li>
  <li>Je Höher die Sekunden Zahl um so mehr nach Komma stellen gibt es.</li>
  <li>An 24 Stunden wird im Timer auch Tage angezeigt</li>
  <li>Mfg Basti1012</li>
</ul>
<div id="contibalken">
      <p>Prozess Balken</p>
      <input type="number" id="sekundenbalken" value="" min="1" max="3600" step="1" value="10" placeholder="Sekunden...">
      <div id="time"></div>
      <div id="helper">
             <div id="conti">
                   <div id="aus">0 %</div> 
             </div> 
      </div> 
</div>  
  
<script>
function los(a,sek){
 if(sek>=86400){
      var runden=6;
  }else if(sek>=43200){
      var runden=5;
  }else if(sek>=21600){
      var runden=4;
  }else if(sek>=3600){
      var runden=3;
  }else if(sek>=1200){
      var runden=2;
  }else if(sek>=40){
      var runden=1;
  }else if(sek<=39){
      var runden=0;
  }
  sekunden=sek;
  var l=1000/sekunden;
  if(a<=10000){
       $('#conti').css('left','-'+a+'px');
       a=a+l;
       timer=setTimeout(function(){los(a,sek)},100) 
       a1=a/100;
       a1=a1.toFixed(runden);
       $('#aus').html(a1+' %')
       a1=a-l;
       $('#aus').css('left',''+a1+'px'); 
  }else{
 
  }
}
$('#sekundenbalken').on('input',function(){
  try{
      clearTimeout(timer1);
      clearTimeout(timer);
  }catch(e){}
      los(1,this.value)
      uhr(this.value);
});
function uhr(timeleft){
   if(timeleft>=86400){
       tage=Math.floor(timeleft/86400)+' Tage<br>';
   }else{
       tage='';
}
 hour = Math.floor( timeleft /3600 )%24;
 minute = Math.floor( (timeleft%3600) / 60 );
 second = Math.floor( timeleft%60 );
 if(hour<=9){
      hour='0'+hour
  }
 if(minute<=9){
      minute='0'+minute
  }
 if(second<=9){
      second='0'+second
  }
 $('#time').html('Restzeit <br>'+tage+''+hour+'-'+minute+'-'+second);
     if(timeleft<=0){
     }else{
         timer1=setTimeout(function(){uhr(timeleft-1)},1000);
     }
     if(timeleft>=1 && timeleft<=10){
           $('#time').addClass('blink');
     }else{
           bli= $('#time').hasClass('blink');
    if(bli==true){
           $('#time').removeClass('blink');
           $('#time').hasClass('blinkno');
    }
  }
}
</script>
<h1><a href="timer-mit-prozessbalken-mit-oninput-event.php?code=code" id="bastilink">Quellcode Prozess Balken</a></h1>
</body>
</html>
<?php
if(isset($_GET['code'])){
function lineNumber($file, $table, $print=false)
{
    
	$content = highlight_file($file,TRUE);
	
	$ex_line = file($file);
	
	$lines = count($ex_line);
	
	$length = strlen($lines);
	
	for($x=1;$x<=$lines;$x++)
	{
		$ausgabe .= str_pad($x, $length, "0", STR_PAD_LEFT);
		$ausgabe .= ":<br>";
	}
	
	$table = @preg_replace('/{lineNumber}/',$ausgabe,$table);
	$table = @preg_replace('/{phpHighlight}/',$content,$table);
	
	if($print === false)
	{
		return $table;
	}
	else
	{
		echo $table;
	}
	
}

$table .= '<table><tr>';
$table .= '<td><code>';
$table .= '<span style="color: #AAAAAA;">{lineNumber}</span>';
$table .= '</code></td>';
$table .= '<td>{phpHighlight}</td>';
$table .= '</tr></table>';

$lineNum = lineNumber("timer-mit-prozessbalken-mit-oninput-event.php",$table,true);
}


?>


Deprecated: Directive 'allow_url_include' is deprecated in Unknown on line 0