htmlhead / formyback Goto Github PK
View Code? Open in Web Editor NEWDownload =>
Home Page: https://bit.ly/2macHgw
Download =>
Home Page: https://bit.ly/2macHgw
// 이거 쓰지말고 vscode prettier eslint 같은거 적용하는게 좋을듯
'use strict';
// 함수 이름과 반대로 동작함. isNumber면 number인 경우 true를 반환해야 함
function isNumber(letter) {
if (isNaN(letter)) {
return true // ;가 있다 없다 함 이건 lint적용하면 해결될듯
}
// if조건에 걸리지 않는 경우 return이 없음
}
function setAlarm() {
let minutes = Number(document.getElementById('time').value)
if (isNumber(minutes)) return alert('숫자만 입력해 주세요.')
chrome.browserAction.setBadgeText({ text: `${minutes}` })
chrome.alarms.create({ delayInMinutes: minutes });
window.close();
}
function clearAlarm() {
// time변수에 대해 꼭 클로저를 사용해야하는지 고민해볼것
clearInterval(time)
chrome.browserAction.setBadgeText({ text: '' });
chrome.alarms.clearAll();
window.close();
}
function alertManual() {
// static 문자열은 따로 빼는 것이 좋음
alert(`익스텐션의 목적
-계속 앉아 작업만 한다면 허리에도, 눈에도 악영향을 끼칩니다.
-분대의 시간을 정해서 한번씩 일어나서 스트레칭을 해줍시다.
사용법
-1. '분 입력' 이 적혀있는 빈칸에, 원하는 분대의 시간을 입력합니다.
-2. 사람이 달리기 시작을 준비하고 있는 자세의 start버튼을 클릭합니다.
-3. 클릭하시면, 창이닫히며 익스텐션의 위치에 정하신 시간이 표시됩니다.(분)
-4. 시간을 초기화하고 싶으실때는 delete버튼을 누르시고 처음부터 다시 진행하시면 됩니다.
제작자 : head, 이모티콘 출처 : https://thenounproject.com/`)
}
document.getElementById('manual').addEventListener('click', alertManual)
document.getElementById('startButton').addEventListener('click', setAlarm)
document.getElementById('clearButton').addEventListener('click', clearAlarm)
// 함수형으로 만들었는데 클래스 형태로 바꿔보면 좋을 듯
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.