Google Timer Google Apps Script

Google Timer Google Apps Script

Timer adalah alat yang digunakan untuk mengukur waktu. Timer dapat digunakan untuk berbagai keperluan. Google Timer adalah aplikasi timer gratis yang tersedia secara online dan dapat diakses dari berbagai perangkat, termasuk PC, laptop, tablet, dan smartphone. Aplikasi ini memungkinkan Anda untuk mengatur timer mundur dengan mudah dan cepat, dengan beberapa fitur tambahan seperti:

  • Beberapa timer: Anda dapat mengatur beberapa timer sekaligus dan mengelolanya dengan mudah.

  • Suara: Anda dapat memilih suara alarm yang berbeda untuk setiap timer.

  • Integrasi Google Assistant: Anda dapat menggunakan suara Anda untuk mengatur dan menghentikan timer dengan Google Assistant.

  • Ekstensi Chrome: Anda dapat menambahkan ekstensi Google Timer ke browser Chrome Anda untuk akses yang lebih mudah.

  • Aplikasi mobile: Anda dapat mengunduh aplikasi Google Timer untuk Android dan iOS untuk akses yang lebih portabel.

Google Timer adalah alat yang berguna untuk membantu Anda tetap fokus dan tepat waktu. Aplikasi ini mudah digunakan dan memiliki banyak fitur yang membuatnya ideal untuk berbagai macam kebutuhan.

Berikut adalah beberapa manfaat menggunakan Google Timer:

  • Meningkatkan produktivitas

  • Mengelola waktu dengan lebih baik

  • Menghindari terlambat

  • Tetap fokus pada tugas

  • Memenuhi tenggat waktu

  • Meningkatkan efisiensi

Google Timer adalah aplikasi yang bagus untuk siapa saja yang ingin lebih mengontrol waktunya.

Google Timer tidak tersedia untuk diunduh di PC. Anda dapat mengaksesnya secara online.

Kode untuk Google Timer yang Berjalan di Google Apps Script

<!-- Create By AkoMSentani -->
<!DOCTYPE html>
<html>
<head>
<title>Google Timer & Stopwatch</title>
<style>
body {
font-family: 'Arial', sans-serif;
background-color: #f4f4f4;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
margin: 0;
}
.tab {
display: flex;
justify-content: center;
margin-bottom: 20px;
}
.tab button {
background-color: #4CAF50;
color: white;
border: none;
outline: none;
cursor: pointer;
padding: 14px 20px;
margin: 0 5px;
transition: 0.3s;
font-size: 17px;
border-radius: 5px 5px 0 0;
}
.tab button:hover {
background-color: #45a049;
}
.tab button.active {
background-color: #3e8e41;
}
.tabcontent {
display: none;
padding: 20px;
border: 1px solid #ccc;
border-top: none;
border-radius: 0 0 5px 5px;
background-color: white;
width: 80%;
max-width: 600px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
text-align: center; /* Center-align content */
}
.timer, .stopwatch {
font-size: 48px;
font-weight: bold;
margin: 20px 0;
color: #333;
}
.controls button {
font-size: 20px;
padding: 10px 20px;
margin: 10px;
border: none;
border-radius: 5px;
background-color: #4CAF50;
color: white;
cursor: pointer;
transition: background-color 0.3s;
}
.controls button:hover {
background-color: #45a049;
}
.preset-buttons button {
font-size: 18px;
padding: 10px 15px;
margin: 5px;
border: none;
border-radius: 5px;
background-color: #4CAF50;
color: white;
cursor: pointer;
transition: background-color 0.3s;
}
.preset-buttons button:hover {
background-color: #45a049;
}
input[type="number"] {
padding: 10px;
font-size: 18px;
margin: 10px 5px;
border-radius: 5px;
border: 1px solid #ccc;
width: 80px;
text-align: center;
}
</style>
</head>
<body>
<div class="tab">
<button class="tablinks" onclick="openTab(event, 'Timer')" id="defaultOpen">Timer</button>
<button class="tablinks" onclick="openTab(event, 'Stopwatch')">Stopwatch</button>
</div>
<div id="Timer" class="tabcontent">
<h1>Timer</h1>
<div>
<div class="timer" id="timer">00:00:00.0</div>
<div class="preset-buttons">
<button onclick="setPresetTime(5)">5 Menit</button>
<button onclick="setPresetTime(10)">10 Menit</button>
<button onclick="setPresetTime(15)">15 Menit</button>
</div>
<input type="number" id="manualMinutes" placeholder="Menit" min="0">
<button onclick="setManualTime()">Set Manual</button>
<div class="controls">
<button onclick="startTimer()">Mulai</button>
<button onclick="stopTimer()">Berhenti</button>
<button onclick="resetTimer()">Reset</button>
</div>
</div>
</div>
<div id="Stopwatch" class="tabcontent">
<h1>Stopwatch</h1>
<div>
<div class="stopwatch" id="stopwatch">00:00:00.0</div>
<div class="controls">
<button onclick="startStopwatch()">Mulai</button>
<button onclick="stopStopwatch()">Berhenti</button>
<button onclick="resetStopwatch()">Reset</button>
</div>
</div>
</div>
<script>
function openTab(evt, tabName) {
var i, tabcontent, tablinks;
tabcontent = document.getElementsByClassName("tabcontent");
for (i = 0; i < tabcontent.length; i++) {
tabcontent[i].style.display = "none";
}
tablinks = document.getElementsByClassName("tablinks");
for (i = 0; i < tablinks.length; i++) {
tablinks[i].className = tablinks[i].className.replace(" active", "");
}
document.getElementById(tabName).style.display = "block";
evt.currentTarget.className += " active";
}
document.getElementById("defaultOpen").click();
let timerInterval;
let stopwatchInterval;
let timerTotalMilliseconds = 0;
let stopwatchTotalMilliseconds = 0;
let timerRunning = false;
let stopwatchRunning = false;
function setPresetTime(minutes) {
timerTotalMilliseconds = minutes * 60 * 1000;
updateTimerDisplay();
}
function setManualTime() {
const manualMinutes = document.getElementById('manualMinutes').value;
if (manualMinutes >= 0) {
timerTotalMilliseconds = manualMinutes * 60 * 1000;
updateTimerDisplay();
}
}
function startTimer() {
if (!timerRunning) {
timerRunning = true;
timerInterval = setInterval(() => {
if (timerTotalMilliseconds > 0) {
timerTotalMilliseconds -= 100;
updateTimerDisplay();
} else {
stopTimer();
}
}, 100);
}
}
function stopTimer() {
clearInterval(timerInterval);
timerRunning = false;
}
function resetTimer() {
clearInterval(timerInterval);
timerRunning = false;
timerTotalMilliseconds = 0;
updateTimerDisplay();
}
function updateTimerDisplay() {
let totalSeconds = Math.floor(timerTotalMilliseconds / 1000);
let milliseconds = Math.floor((timerTotalMilliseconds % 1000) / 100);
let hours = Math.floor(totalSeconds / 3600);
let minutes = Math.floor((totalSeconds % 3600) / 60);
let seconds = totalSeconds % 60;
document.getElementById('timer').innerText =
(hours > 9 ? hours : "0" + hours) + ":" +
(minutes > 9 ? minutes : "0" + minutes) + ":" +
(seconds > 9 ? seconds : "0" + seconds) + "." +
milliseconds;
}
function startStopwatch() {
if (!stopwatchRunning) {
stopwatchRunning = true;
stopwatchInterval = setInterval(() => {
stopwatchTotalMilliseconds += 100;
updateStopwatchDisplay();
}, 100);
}
}
function stopStopwatch() {
clearInterval(stopwatchInterval);
stopwatchRunning = false;
}
function resetStopwatch() {
clearInterval(stopwatchInterval);
stopwatchRunning = false;
stopwatchTotalMilliseconds = 0;
updateStopwatchDisplay();
}
function updateStopwatchDisplay() {
let totalSeconds = Math.floor(stopwatchTotalMilliseconds / 1000);
let milliseconds = Math.floor((stopwatchTotalMilliseconds % 1000) / 100);
let hours = Math.floor(totalSeconds / 3600);
let minutes = Math.floor((totalSeconds % 3600) / 60);
let seconds = totalSeconds % 60;
document.getElementById('stopwatch').innerText =
(hours > 9 ? hours : "0" + hours) + ":" +
(minutes > 9 ? minutes : "0" + minutes) + ":" +
(seconds > 9 ? seconds : "0" + seconds) + "." +
milliseconds;
}
</script>
</body>
</html>
view raw index.html hosted with ❤ by GitHub
/// <!-- Create By AkoMSentani -->
function doGet() {
return HtmlService.createHtmlOutputFromFile('index');
}
view raw kode.gs hosted with ❤ by GitHub
Reactions

Post a Comment

0 Comments