{"id":48,"date":"2026-01-22T19:36:51","date_gmt":"2026-01-22T18:36:51","guid":{"rendered":"https:\/\/triburunlanciano.it\/httpdocs\/?page_id=48"},"modified":"2026-02-04T08:09:06","modified_gmt":"2026-02-04T07:09:06","slug":"calcola-il-tuo-tempo","status":"publish","type":"page","link":"https:\/\/triburunlanciano.it\/httpdocs\/calcola-il-tuo-tempo\/","title":{"rendered":"Calcola il tuo tempo"},"content":{"rendered":"\n<div class=\"trl-calcola-wrapper\">\n\n  <h2 class=\"trl-calcola-titolo\">Controlla il tuo tempo in gara!<\/h2>\n  <p class=\"trl-calcola-intro\">Inserisci i tuoi risultati nei campi sottostanti per calcolare il tempo finale.<\/p>\n\n  <div class=\"trl-calcola-grid\">\n\n    <div class=\"trl-calcola-field\">\n      <label for=\"km\">Km percorsi<\/label>\n      <input type=\"text\" id=\"km\" placeholder=\"es: 10.500\">\n      <small>Usa il punto come separatore decimale<\/small>\n    <\/div>\n\n    <div class=\"trl-calcola-field\">\n      <label for=\"ore\">Ore<\/label>\n      <input type=\"number\" id=\"ore\" min=\"0\" placeholder=\"\">\n    <\/div>\n\n    <div class=\"trl-calcola-field\">\n      <label for=\"minuti\">Minuti<\/label>\n      <input type=\"number\" id=\"minuti\" min=\"0\" max=\"59\" placeholder=\"\">\n    <\/div>\n\n    <div class=\"trl-calcola-field\">\n      <label for=\"secondi\">Secondi<\/label>\n      <input type=\"number\" id=\"secondi\" min=\"0\" max=\"59\" placeholder=\"\">\n    <\/div>\n\n  <\/div>\n\n  <div class=\"trl-calcola-bottoni\">\n    <button class=\"trl-btn-calcola\" onclick=\"calcolaTempo()\">Calcola il Tempo<\/button>\n    <button class=\"trl-btn-reset\" onclick=\"resetCampi()\">Reimposta<\/button>\n  <\/div>\n\n  <div class=\"trl-calcola-risultato\" id=\"risultato\"><\/div>\n\n<\/div>\n\n<script>\nfunction calcolaTempo() {\n  let km = parseFloat(document.getElementById(\"km\").value.replace(\",\", \".\"));\n  let ore = parseInt(document.getElementById(\"ore\").value) || 0;\n  let minuti = parseInt(document.getElementById(\"minuti\").value) || 0;\n  let secondi = parseInt(document.getElementById(\"secondi\").value) || 0;\n\n  if (isNaN(km) || km <= 0) {\n    document.getElementById(\"risultato\").innerHTML = \"<p>Inserisci un valore valido per i km.<\/p>\";\n    return;\n  }\n\n  let tempoTotaleSec = (ore * 3600) + (minuti * 60) + secondi;\n\n  if (tempoTotaleSec <= 0) {\n    document.getElementById(\"risultato\").innerHTML = \"<p>Inserisci un tempo valido.<\/p>\";\n    return;\n  }\n\n  \/\/ Velocit\u00e0 Km\/h\n  let velocita = (km \/ (tempoTotaleSec \/ 3600)).toFixed(1);\n\n  \/\/ Passo Min\/Km\n  let passoSec = tempoTotaleSec \/ km;\n  let passoMin = Math.floor(passoSec \/ 60);\n  let passoRestoSec = Math.round(passoSec % 60);\n  if (passoRestoSec < 10) passoRestoSec = \"0\" + passoRestoSec;\n\n  document.getElementById(\"risultato\").innerHTML = `\n    <h3>Risultato<\/h3>\n    <p>Hai percorso il tragitto alla velocit\u00e0 di <strong>${velocita} Km\/h<\/strong><\/p>\n    <p>La tua media \u00e8 stata di <strong>${passoMin}:${passoRestoSec} Min\/Km<\/strong><\/p>\n  `;\n}\n\nfunction resetCampi() {\n  document.getElementById(\"km\").value = \"\";\n  document.getElementById(\"ore\").value = \"\";\n  document.getElementById(\"minuti\").value = \"\";\n  document.getElementById(\"secondi\").value = \"\";\n  document.getElementById(\"risultato\").innerHTML = \"\";\n}\n<\/script>\n","protected":false},"excerpt":{"rendered":"<p>Controlla il tuo tempo in gara! Inserisci i tuoi risultati nei campi sottostanti per calcolare il tempo finale. Km percorsi Usa il punto come separatore decimale Ore Minuti Secondi Calcola il Tempo Reimposta<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_acf_changed":false,"footnotes":""},"class_list":["post-48","page","type-page","status-publish","hentry"],"acf":[],"_links":{"self":[{"href":"https:\/\/triburunlanciano.it\/httpdocs\/wp-json\/wp\/v2\/pages\/48","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/triburunlanciano.it\/httpdocs\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/triburunlanciano.it\/httpdocs\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/triburunlanciano.it\/httpdocs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/triburunlanciano.it\/httpdocs\/wp-json\/wp\/v2\/comments?post=48"}],"version-history":[{"count":6,"href":"https:\/\/triburunlanciano.it\/httpdocs\/wp-json\/wp\/v2\/pages\/48\/revisions"}],"predecessor-version":[{"id":2830,"href":"https:\/\/triburunlanciano.it\/httpdocs\/wp-json\/wp\/v2\/pages\/48\/revisions\/2830"}],"wp:attachment":[{"href":"https:\/\/triburunlanciano.it\/httpdocs\/wp-json\/wp\/v2\/media?parent=48"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}