Repository: sologgfun/drinkNow
Branch: master
Commit: 77d04dfd7bb3
Files: 7
Total size: 11.9 KB
Directory structure:
gitextract_u4g1_o8h/
├── README.md
├── background.html
├── js/
│ ├── background.js
│ ├── content-script.js
│ └── popup.js
├── manifest.json
└── popup.html
================================================
FILE CONTENTS
================================================
================================================
FILE: README.md
================================================
感觉工作之后写代码经常忘记喝水,而且我本身因为以前经常不吃早饭,有点胆结石,医生也提醒说要多喝水多运动,但是写代码集中精神之后就经常忘记了。。
前段时间公司体检后发现颈椎有点前倾,明明才刚毕业几个月,,大家一起注意身体健康吧!下面是插件的详细内容~
**干杯!妈妈再也不担心我不喝水了!**
v0.08更新!2019-9-7 13.04
修复浏览器console报错的小bug🙇
v0.07更新!11-9 19.40
修复了小鸭子倒着游的重大bug🙇
v0.06更新!10-19 15.00
之前计时重复了,30分钟喝一杯了,我对不起大家!小鸭子替我道歉🙇
v0.05更新!10-18 19:55
1.白天点击refresh小鸭子变大,晚上点击小鸭子会变小(否则小鸭子似乎经常遭到毒手变的太大回不去!
2.提示出来之后点击喝水按钮后就刷新计时,不需要在标签里点击刷新啦!
3.谢谢大家的支持!
*年轻人的第一个chrome插件!*
*关注大家的身体健康;*
*rua!!!*
**主要功能:**
①通过标签提醒距离上次喝水已经过了多久
②点击右上角刷新时间
③点击太阳切换白昼/黑夜暂停时间
④60分钟会提示并且标签会变色
(其实这个是一个养成类的游戏,小鸭子喝水会变大,不及时喝水会变小。哈哈哈哈哈哈
(感谢小朋友🐏医生)
The first chrome plugin for young people!
Teach young people write plugins at the same time;
Pay attention to your health;
Rua!!!
The main function:
①Through the badge to remind you how long it has been since drinking the last time
②click the top right corner to refresh the countdown
③click the sun to switch to the day/night to pause time losing
④every 60 minutes will prompt at once and the label will change color
(In fact, this is a game , the ducklings will get bigger when you drink water and refresh, and they will get smaller if they don’t drink in time. Hahahahahaha
(Thanks to doctors 🐏 - the one I love!❤)


chrome插件地址:https://chrome.google.com/webstore/search/%E5%B9%B2%E6%9D%AF?hl=zh-CN
github地址:https://github.com/sologgfun/drinkNow
================================================
FILE: background.html
================================================
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>background</title>
</head>
<body>
</body>
<script src="./js/background.js"></script>
</html>
================================================
FILE: js/background.js
================================================
var count = 0;
var winWidth = 1440;
var winHeight = 860;
var notificationId;
var countdownId = 0;
var light = true;
var duckwidth = 15;
chrome.runtime.onMessage.addListener(function (request, sender, sendResponse) {
winWidth = request.winWidth;
winHeight = request.winHeight;
sendResponse('');
});
function duckbecomeslim() {
duckwidth = duckwidth - 4;
}
function duckbecomefat() {
duckwidth = duckwidth + 2;
}
function smallduck() {
duckwidth = duckwidth - 2;
}
function getduckwidth() {
return duckwidth;
}
function checklight() {
return light
}
function turnlight() {
light = !light;
}
//计时器,在后台默默计时
function timer() {
//黑夜停止计时
if (!light) {
return count / 36
}
if (count < 3600) {
count++;
//给浏览器右上角图标加上计时badge
chrome.browserAction.setBadgeText({
text: Math.floor(count / 60) + ''
});
chrome.browserAction.setBadgeBackgroundColor({
color: "#70d2c9"
});
}
//60分钟通知喝水!
if (count == 3600) {
duckbecomeslim();
notificationAction();
count++;
}
if (count >= 3600) {
//图标改成红色和sos文案!
chrome.browserAction.setBadgeText({
text: 'sos'
});
chrome.browserAction.setBadgeBackgroundColor({
color: [255, 0, 0, 255]
});
}
return count / 36
}
function refresh() {
count = 0;
//清除五分钟倒计时
window.clearInterval(countdownId);
}
var fivemin = 0;
var Countdown = function () {
fivemin++;
if (fivemin == 300) {
notificationAction();
fivemin = 0;
}
};
function notificationAction() {
//notification的id要清空,否则create的时候之前id没有清空则会失效
chrome.notifications.clear("1",
(id) => {
});
chrome.notifications.create("1", {
type: 'basic',
iconUrl: 'img/logo.png',
title: '快喝水!',
buttons: [{
title: "喝水",
iconUrl: 'img/yellowsmile.png'
}, {
title: "等会儿",
iconUrl: 'img/redsmile.png'
}],
message: '已经一个小时没喝水了!小鸭子渴死了!'
});
}
chrome.notifications.onButtonClicked.addListener(function (id, btnIndex) {
count = btnIndex ? count : 0;
});
function getWandH() {
var WandH = {
winWidth: winWidth,
winHeight: winHeight
}
return WandH
}
setInterval(timer, 1000);
================================================
FILE: js/content-script.js
================================================
var winWidth, winHeight;
//屏幕分辨率版本
winWidth = window.screen.width;
winHeight = window.screen.height;
chrome.runtime.sendMessage({
winWidth: winWidth,
winHeight: winHeight
}, function (response) {
});
================================================
FILE: js/popup.js
================================================
var bg = chrome.extension.getBackgroundPage();
var getHtml = document.getElementsByTagName("html")[0];
var getClock = document.getElementById("img");
var getImg = document.getElementById("clock");
var progressbar = document.getElementById("progressbar");
var light = bg.checklight();
var check = document.getElementById("toggle");
var duckwidth = bg.getduckwidth();
//true为黑夜
getClock.style.width = duckwidth + "%";
if (!light) {
getImg.innerText = `大魔法让时间停止了!`;
check.checked = true;
getHtml.id = "htmlbg2";
progressbar.id = "progressbar2";
}
//自适应窗口大小
var WandH = bg.getWandH();
getHtml.style.width = WandH.winWidth * 1 / 5 + "px";
getHtml.style.height = WandH.winHeight * 1 / 7 + "px";
console.log(getHtml.style.width);
//文字提示和小鸭子前进
getClock.style.left = `${bg.timer() - 10}%`;
if (Math.floor(bg.timer() * 36 / 60) == 60) {
getImg.innerText = `快给我水给我水给我水!`;
getClock.src = "../img/dead.png";
}
//水向前变色
document.getElementsByClassName("bar")[0].style.width = `${bg.timer()}%`;
document.getElementById("refresh").addEventListener("click", function (e) {
//刷新计数,小鸭子跑回去
bg.refresh();
if (!light) {
getClock.style.width = duckwidth - 2 + "%";
bg.smallduck();
duckwidth = duckwidth - 2;
} else {
getClock.style.width = duckwidth + 2 + "%";
bg.duckbecomefat();
duckwidth = duckwidth + 2;
}
getClock.src = "../img/imok.png";
getImg.innerText = `哧溜哧溜~喝水了!`;
getClock.style.left = `-10%`;
document.getElementsByClassName("bar")[0].style.width = `0%`;
});
//点击太阳时改变样式,并且让background.js中的计数暂停
document.getElementById("sun").addEventListener("click", function (e) {
//暂停计数
bg.turnlight();
light = !light;
//样式改变
if (bg.checklight()) {
getImg.innerText = ``;
check.checked = false;
getHtml.id = "htmlbg";
progressbar.id = "progressbar";
} else {
getImg.innerText = `大魔法让时间停止了!`;
check.checked = true;
getHtml.id = "htmlbg2";
progressbar.id = "progressbar2";
}
});
================================================
FILE: manifest.json
================================================
{
"manifest_version": 2,
"name": "干杯!cheers~!",
"version": "0.0.8",
"description": "干杯!妈妈再也不担心我不喝水了!cheers!Mom is no longer worried that I will not drink water!",
"icons": {
"16": "./img/logo.png",
"48": "./img/logo.png",
"128": "./img/logo.png"
},
"permissions": [
"notifications",
"webRequestBlocking",
"storage"
],
"background": {
"page": "./background.html"
},
"browser_action": {
"default_icon": "./img/logo.png",
"default_title": "drinkNow!",
"default_popup": "./popup.html"
},
"content_scripts": [
{
"matches": [
"<all_urls>"
],
"js": [
"js/content-script.js"
],
"run_at": "document_start"
}
]
}
================================================
FILE: popup.html
================================================
<!DOCTYPE html>
<html lang="en" id="htmlbg">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>drinknow</title>
</head>
<body>
<input id="toggle" class="switch" type="checkbox">
<div id="wrapper">
<div class="toplayer">
<div id="sun" class="sun"></div>
<div id="clock" class="clock"></div>
<img src="./img/refresh.png" alt="imok" id="refresh">
</div>
<div class="imgWrap">
<img src="./img/imok.png" alt="imok" id="img">
<div class="progressbar" id="progressbar">
<span class="bar"></span>
</div>
</div>
</div>
</body>
<style scoped>
*,
:after,
:before {
box-sizing: border-box;
}
#htmlbg {
width: 400px;
height: 150px;
margin: 0;
background-color: #fffce6c7;
}
#htmlbg2 {
width: 400px;
height: 150px;
margin: 0;
background-color: #333e7d;
}
.switch {
display: none;
}
body {
margin: 0;
width: 100%;
height: 100%;
position: relative;
/* background-color: rgb(54, 106, 211); */
}
#wrapper {
display: flex;
flex-direction: column;
justify-content: space-around;
margin-left: 5%;
width: 90%;
height: 100%;
margin-top: 1%;
/* background-color: rgb(54, 106, 211); */
}
.progressbar {
height: 80%;
position: relative;
left: -10%;
width: 120%;
background-color: #a4cfe8;
border-radius: 20px;
transition: all .4s ease-in-out 0s;
}
.bar {
display: block;
width: 0%;
height: 100%;
background-color: rgb(54, 106, 211);
border-radius: 20px;
transition: width 1s linear, background-color .4s ease-in-out 0s;
}
#img {
width: 15%;
position: relative;
animation: duck 0.5s linear infinite alternate;
transition: left 1s linear;
}
.toplayer {
width: 100%;
height: 20%;
display: flex;
justify-content: space-between;
align-items: center;
}
.clock {
position: relative;
left: -15%;
}
.imgWrap {
width: 100%;
height: 20%;
}
.sun {
width: 50px;
height: 50px;
background-color: #ff3f2b;
border-radius: 50%;
cursor: pointer;
transition: all .4s ease-in-out 0s;
}
#refresh {
position: absolute;
top: 1%;
right: 2%;
width: 8%;
cursor: pointer;
}
@keyframes duck {
from {
transform: rotate(-10deg);
}
to {
transform: rotate(10deg);
}
}
#progressbar:before {
z-index: -2;
border: 60px solid transparent;
border-bottom: 100px solid rgba(0, 0, 0, .25);
border-left-width: 75px;
border-right-width: 65px;
width: 0;
height: 0;
bottom: 0;
transition: all .4s ease-in-out 0s;
content: '';
position: absolute;
}
#progressbar:after {
z-index: -2;
right: 0;
border: 60px solid transparent;
border-bottom: 140px solid rgba(0, 0, 0, .35);
border-left-width: 100px;
border-right-width: 100px;
width: 0;
height: 0;
bottom: 0;
transition: all .4s ease-in-out 0s;
content: '';
position: absolute;
}
#progressbar2:before {
z-index: -2;
left: 50%;
border: 60px solid transparent;
border-bottom: 100px solid rgba(255, 255, 255, .15);
border-left-width: 75px;
border-right-width: 65px;
width: 0;
height: 0;
bottom: 0;
transition: all .4s ease-in-out 0s;
content: '';
position: absolute;
}
#progressbar2:after {
z-index: -2;
right: 30%;
border: 60px solid transparent;
border-bottom: 140px solid rgba(255, 255, 255, .2);
border-left-width: 100px;
border-right-width: 100px;
width: 0;
height: 0;
bottom: 0;
transition: all .4s ease-in-out 0s;
content: '';
position: absolute;
}
#toggle:checked+#wrapper .sun {
transform: scale(0.8);
background-color: #fff;
transition: all .4s ease-in-out 0s;
}
#toggle:checked+#wrapper .clock {
color: #fff
}
#toggle:checked+#wrapper .bar {
background-color: rgb(53, 79, 132);
}
#toggle:checked+#wrapper .progressbar {
background-color: #99c0d6;
}
</style>
<script src="js/popup.js"></script>
</html>
gitextract_u4g1_o8h/ ├── README.md ├── background.html ├── js/ │ ├── background.js │ ├── content-script.js │ └── popup.js ├── manifest.json └── popup.html
SYMBOL INDEX (10 symbols across 1 files)
FILE: js/background.js
function duckbecomeslim (line 15) | function duckbecomeslim() {
function duckbecomefat (line 19) | function duckbecomefat() {
function smallduck (line 23) | function smallduck() {
function getduckwidth (line 27) | function getduckwidth() {
function checklight (line 31) | function checklight() {
function turnlight (line 35) | function turnlight() {
function timer (line 39) | function timer() {
function refresh (line 72) | function refresh() {
function notificationAction (line 87) | function notificationAction() {
function getWandH (line 112) | function getWandH() {
Condensed preview — 7 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (15K chars).
[
{
"path": "README.md",
"chars": 1500,
"preview": "\n感觉工作之后写代码经常忘记喝水,而且我本身因为以前经常不吃早饭,有点胆结石,医生也提醒说要多喝水多运动,但是写代码集中精神之后就经常忘记了。。\n\n前段时间公司体检后发现颈椎有点前倾,明明才刚毕业几个月,,大家一起注意身体健康吧!下面是插件"
},
{
"path": "background.html",
"chars": 307,
"preview": "<!DOCTYPE html>\n<html lang=\"en\">\n\n<head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-widt"
},
{
"path": "js/background.js",
"chars": 2383,
"preview": "var count = 0;\nvar winWidth = 1440;\nvar winHeight = 860;\nvar notificationId;\nvar countdownId = 0;\nvar light = true;\nvar "
},
{
"path": "js/content-script.js",
"chars": 203,
"preview": "var winWidth, winHeight;\n\n//屏幕分辨率版本\nwinWidth = window.screen.width;\nwinHeight = window.screen.height;\n\nchrome.runtime.se"
},
{
"path": "js/popup.js",
"chars": 2056,
"preview": "var bg = chrome.extension.getBackgroundPage();\nvar getHtml = document.getElementsByTagName(\"html\")[0];\nvar getClock = do"
},
{
"path": "manifest.json",
"chars": 846,
"preview": "{\n \"manifest_version\": 2,\n \"name\": \"干杯!cheers~!\",\n \"version\": \"0.0.8\",\n \"description\": \"干杯!妈妈再也不担心我不喝水了!chee"
},
{
"path": "popup.html",
"chars": 4931,
"preview": "<!DOCTYPE html>\n<html lang=\"en\" id=\"htmlbg\">\n\n<head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width"
}
]
About this extraction
This page contains the full source code of the sologgfun/drinkNow GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 7 files (11.9 KB), approximately 3.9k tokens, and a symbol index with 10 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.