A Pen by Mfcastro

Developer
Size
2,738 Kb
Views
4,048

How do I make an a pen by mfcastro?

What is a a pen by mfcastro? How do you make a a pen by mfcastro? This script and codes were developed by Mfcastro on 20 January 2023, Friday.

A Pen by Mfcastro Previews

A Pen by Mfcastro - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>A Pen by Mfcastro</title> <link rel='stylesheet prefetch' href='http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css'>
</head>
<body>
<input id="minutes" style="width: 24px; border: none; background-color:none;">mins <input id="seconds" style="width: 26px; border: none; background-color:none;" />second <div id="timer"> <input type="button" id="Pause" value="Pause" onClick="pause();" /> </div>
<!---------------------------------------->
<div class="container-fluid"> <div class="row"> <div class="jumbotron"> <div class="row"> <div class="col-lg-6 col-md-6 col-sm-6 col-xm-6"> <p id="timer"><span id="minutes">00</span>:<span id="seconds">00</span></p> <div id="timer"><span id ="seconds"></span></div> </div> <div class="col-lg-6 col-md-6 col-sm-6 col-xm-6"> <button class="btn btn-primary " id="start" onClick = "resume();"> Start </button> </div> <div class="col-lg-6 col-md-6 col-sm-6 col-xm-6"> <button class="btn btn-danger " id="pause" onClick="pause();"> Stop </button> </div> </div> <div>Break Time <button id="subBreak">-</button><span id="breakTime">5</span> <button id="addBreak">+</button> </div> <div>Session Time <button id="subSession">-</button><span id="sessionTime"></span> <button id="addSession">+</button> </div> </div> </div> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

A Pen by Mfcastro - Script Codes JS Codes

var paused = false;
// set minutes
var timeMins = 25;
var mins = timeMins;
// calculate the seconds
var secs = mins * 60;
var timer = 0;
var flagTimer = 'resume';
var breakTime = 5;
//var sessionTime = 25;
//document.getElementById("breakTime").innerHTML = breakTime;
var sessionTime = document.getElementById("sessionTime").innerHTML = mins;
//Starts countdown
function countdown() { timer = setTimeout('decreaseTime()', 0); //Tells the browser when to start running a function.
}
//
function decreaseTime() { if (document.getElementById("timer")) { //set new variables to HTML elemets var minutes = document.getElementById("minutes"); var seconds = document.getElementById("seconds"); // if less than a minute remaining if (seconds < 59) { seconds.value = secs; //This says that we are setting the value of of seconds to 'secs'. We are still keeping the document.getElementById("seconds") we just are setting the actual value. } else { minutes.value = getminutes(); seconds.value = getseconds(); } secs--; timer = setTimeout('decreaseTime()', 1000); }
}
function getminutes() { // minutes is seconds divided by 60, rounded down mins = Math.floor(secs / 60); return mins;
}
function getseconds() { // take mins remaining (as seconds) away from total seconds remaining return secs - Math.round(mins * 60);
}
function pause() { if (flagTimer == 'resume') { clearTimeout(timer); timer = 0; document.getElementById('Pause').value = "Resume"; flagTimer = 'pause'; } else { flagTimer = 'resume'; document.getElementById('Pause').value = "Pause"; resume(); }
}
function resume() { timer = setTimeout('decreaseTime()', 1000);
}
countdown();
//-------------------------------------------------------------
//---------------FUNCTIONS-----------
//Set the visual times for the switch section
//document.getElementById("breakTime").innerHTML = breakTime;
//document.getElementById("sessionTime").innerHTML = sessionTime;
function addBreak() { return breakTime++;
}
function subBreak() { return breakTime--;
}
function addSession() { return sessionTime++;
}
function subSession() { return sessionTime--;
}
//----------------BUTTONS----------------------------------
//START
/*$("#start").click(function() { minutes = minutes * 60; display = document.querySelector('#timer'); startTimer(minutes, display);
})
//STOP
$("#stop").click(function() { alert("STOP");
})
*/
//ADD BREAK
$("#addBreak").click(function() { document.getElementById("breakTime").innerHTML = addBreak();
})
//SUB BREAK
$("#subBreak").click(function() { document.getElementById("breakTime").innerHTML = subBreak();
})
//ADD SESSION
$("#addSession").click(function() { document.getElementById("sessionTime").innerHTML = addSession();
})
//SUB SESSION
$("#subSession").click(function() { document.getElementById("sessionTime").innerHTML = subSession();
})
A Pen by Mfcastro - Script Codes
A Pen by Mfcastro - Script Codes
Home Page Home
Developer Mfcastro
Username marcocastro
Uploaded January 20, 2023
Rating 3
Size 2,738 Kb
Views 4,048
Do you need developer help for A Pen by Mfcastro?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Mfcastro (marcocastro) Script Codes
Create amazing blog posts with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!