├── README.md
├── background.html
├── components
├── FaceInfo
│ ├── index.html
│ └── index.js
├── Moyu
│ ├── index.html
│ └── index.js
└── SetDuck
│ ├── index.html
│ └── index.js
├── css
├── juejin.css
└── popup.css
├── img
├── back.jpg
├── bgimg-1.jpeg
├── biaoqing.png
├── changeBgimg.png
├── close.png
├── daizhu.png
├── icon.png
├── kaoya.png
├── kuqi.png
├── moyu.png
├── moyubg.jpg
├── nipple.png
├── pifu.png
├── popupBgimg
│ ├── bgimg-0.jpg
│ ├── bgimg-1.jpg
│ ├── bgimg-10.jpg
│ ├── bgimg-11.jpg
│ ├── bgimg-2.jpg
│ ├── bgimg-3.jpg
│ ├── bgimg-4.jpg
│ ├── bgimg-5.jpg
│ ├── bgimg-6.jpg
│ ├── bgimg-7.jpg
│ ├── bgimg-8.jpg
│ └── bgimg-9.jpg
├── setup.png
├── timers.png
├── xiaoyazi.png
└── yinyue.png
├── js
├── background.js
├── dayjs.min.js
├── jquery-3.5.1.min.js
├── juejin.js
├── popup.js
├── tools.js
└── vue.js
├── manifest.json
└── popup.html
/README.md:
--------------------------------------------------------------------------------
1 | ## 🐥小鸭子叫你喝水啦~~~
2 |
3 | > 在我们日常工作中,经常会因为长时间伏案工作而忘记了喝水或起来走动走动,扭扭腰。于是乎,我开发了一款提醒各位码友定时喝水的chrome插件,我亲切的称呼其为**水货**
4 |
5 | 😲身体是革命的本钱,小鸭子为了让大家喝水也是操碎了心,请大家爱惜身体,悉心照顾好小鸭子~~~
6 |
7 |
8 |

9 |
10 |
11 | ## 主要功能
12 |
13 | - 小鸭子默认30分钟提醒码友喝一次水,如果小鸭子游到对岸了,你还没有喝水的话,可怜的小鸭子就会变成一只烤鸭😭
14 |
15 | - 可通过查看小鸭子下标知道喝水时间
16 |
17 | - 到了喝水的点,小鸭子会弹出系统通知,来提醒你喝水
18 |
19 | - 小鸭子支持自定义喝水时间间隔以及提醒文案
20 |
21 | - 小鸭子支持暂停喝水时间
22 |
23 | - 支持掘金换肤,为你提供沉浸式阅读体验
24 |
25 | - 多款皮肤,支持视频模式和护眼模式
26 |
27 | - 提供丰富表情包大全,方便创作时随时谁地添加小表情
28 |
29 | - 摸鱼办提醒你该摸鱼啦,看看最近热搜趣事
30 |
31 | - 丰富的背景卡片素材图,快速切换
32 |
33 | ### ❤️温馨提示
34 |
35 | - 点击小黄鸭可触发对话
36 | - 请将小鸭子固定到插件栏,以便更容易观察到小鸭子动态,及时喝水
37 |
38 | 目前**水货**已上架到谷歌插件应用市场,欢迎大家下载😄
39 |
40 | [水货谷歌插件应用市场](https://chrome.google.com/webstore/detail/%E6%B0%B4%E8%B4%A7/joocpekibdmekmbolmkocechafaodpif?utm_source=chrome-ntp-icon)
41 |
42 | ### ❤️感谢
43 |
44 | 海阔凭鱼跃,天高任鸟飞。Hey 你好!我是猫力Molly。欢迎关注我的个人微信公众号【前端有猫腻】,每天给你推送新鲜的优质好文。愿你一路前行,眼里有光。
45 |
46 | 微信号:【yuyue540880】添加好友,拉你进群和众多前端小伙伴一起交流学习
47 |
48 |
49 |
50 |

51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/background.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/components/FaceInfo/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 表情大全(点击复制表情)
6 | 复制成功
7 |
8 |
9 |

10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/components/FaceInfo/index.js:
--------------------------------------------------------------------------------
1 |
2 | $(function () {
3 |
4 | function renderFace() {
5 | const str = '😄😆😊😃😏😍😘😚😳😌😆😁😉😜😝😀😗😙😛😴😟😦😧😮😬😕😯😑😒😅😓😥😩😔😞😖😨😰😣😢😭😂😲😱😫😠😡😤😪😋😷😎😵👿😈😐😶😇👽💛💙💜💚💔💓💗💕💞💘💖✨🌟💫💥💤💨💦🎶🎵🔥💩👍👎👌👊✊👋✋👐👇👈👉🙌🙏👆👏💪🤘🖕🏃👫👪👬💃👯🙆🙅💁🙋👰🙎🙍🙇💑💆💇💅👦👧👩👨👶👵👴👱👲👳👷👮👼👸😺😸😻😽😼🙀😿😹😾👹👺🙈🙉🙊💂💀🐾👄💋💧👂👀👃👅💌👤👥💬💭'
6 | const str1 = '🌀🌁🌊🐱🐶🐭🐹🐰🐺🐸🐯🐨🐻🐷🐽🐮🐗🐵🐒🐴🐎🐫🐑🐘🐼🐍🐦🐤🐥🐣🐔🐧🐢🐛🐝🐜🐞🐌🐙🐠🐟🐳🐋🐬🐄🐏🐀🐃🐅🐇🐉🐐🐓🐕🐖🐁🐂🐲🐡🐊🐪🐆🐈🐩🐾💐🌸🌷🍀🌹🌻🌺🍁🍃🍂🌿🍄🌵🌴🌲🌳🌰🌱🌼🌾🐚🌐🌞🌝🌚🌑🌒🌓🌔🌕🌖🌗🌘🌜🌛🌙🌍🌎🌏🌋'
7 | const str2 = '🏢🏣🏥🏦🏪🏩🏨💒🏬🏤🌇🌆🏯🏰🏭🗼🌄🌅🌠🗽🌉🎠🌈🚀🚁🚂🚊🚞🚡🚟🚠🚜🚙🚘🚗🚗🚕🚖🚛🚌🚍🚨🚓🚔🚒🚑🚐🚚🚋🚉🚆🚅🚄🚈🚝🚃🚎🎫🚦🚥🚧🔰🏧🎰🚏💈🏁🎌🏮🗿🎪🎭📍🚩'
8 | const list = Array.from(str)
9 | const list1 = Array.from(str1)
10 | const list2 = Array.from(str2)
11 | let htmlStr = ''
12 | const allList = [...list, ...list1, ...list2]
13 | allList.forEach((e) => {
14 | console.log(e == '');
15 | if (e != '') {
16 | htmlStr += `${e}
`
17 | }
18 | })
19 | $('body').find('#faceListId').html(htmlStr)
20 | $('#maxBoxId').css({ width: 700 + 'px', height: 700 + 'px' })
21 | }
22 | // 关闭弹层
23 | $('body').on('click', '#closeModalId-1', function () {
24 | $('#maxBoxId').css({ width: 400 + 'px', height: 200 + 'px' })
25 | $('#modalSetId-1').fadeOut()
26 | })
27 | // 显示表情包弹层
28 | $('body').on('click', '#faceModelId', function () {
29 | $('#modalSetId-1').fadeIn()
30 | renderFace()
31 | })
32 | // 复制
33 | $('body').on('click','#faceListId .item',function(){
34 | const text = $(this).text();
35 | navigator.clipboard.writeText(text);
36 | $('#msgfaceId').text(`${text} -> 复制成功 <- ${text}`)
37 | $('#msgfaceId').fadeIn()
38 | setTimeout(() => {
39 | $('#msgfaceId').fadeOut()
40 | }, 1000);
41 | })
42 | })
43 |
44 |
--------------------------------------------------------------------------------
/components/Moyu/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |

8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
微博热搜
16 |
知乎热搜
17 |
百度热搜
18 |
今日头条
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/components/Moyu/index.js:
--------------------------------------------------------------------------------
1 | const headers = {
2 | 'access-key': "43be388d9d0e3e3f46b029eb9bd99c27",
3 | 'secret-key': "9f902e85dfd766753262b4dc7ddba89e",
4 | }
5 | const baseUrl = 'https://www.coderutil.com'
6 | $(function () {
7 | // 显示弹层
8 | $('body').on('click', '#moyuModelId', function () {
9 | $('#modalSetId-2').fadeIn()
10 | $('#maxBoxId').css({ width: 700 + 'px', height: 700 + 'px' })
11 | getReSou();
12 | setText();
13 | moyuLinkList();
14 | })
15 | // 关闭弹层
16 | $('body').on('click', '#closeModalId-2', function () {
17 | $('#maxBoxId').css({ width: 400 + 'px', height: 200 + 'px' })
18 | $('#modalSetId-2').fadeOut()
19 | })
20 | // 获取新闻
21 | const resouObj = {
22 | weibo:[],
23 | zhihu:[],
24 | toutiao:[],
25 | }
26 | function getReSou(){
27 | const params = {
28 | headers,
29 | type: 'get',
30 | data:{size:10},
31 | }
32 | const list = [
33 | {url:baseUrl+'/api/resou/v1/weibo',type:'weibo'},
34 | {url:baseUrl+'/api/resou/v1/zhihu',type:'zhihu'},
35 | {url:baseUrl+'/api/resou/v1/toutiao',type:'toutiao'},
36 | {url:baseUrl+'/api/resou/v1/baidu',type:'baidu'}
37 | ]
38 | list.forEach(({url, type})=>{
39 | $.ajax({
40 | ...params,
41 | url,
42 | success: function ({data}) {
43 | resouObj[type] = data
44 | type==='weibo' && getReSouList('weibo')
45 | }
46 | })
47 | })
48 | }
49 | // 设置标题内容
50 | function setText(){
51 | const datef = parseTime(new Date(),'{y}年{m}月{d}日')
52 | const week = ['日', '一', '二', '三', '四', '五', '六']
53 | var weekNum = new Date().getDay()
54 | const str = `【摸鱼办】提醒您:摸鱼人!工作再累,一定不要忘记摸鱼哦!有事没事起身去茶水间,
55 | 去厕所,去廊道走走别老在工位上坐着,钱是老板的,但命是自己的。`
56 | const str2 = `【快乐摸鱼办】${datef} 星期${week[weekNum]}`
57 | $('#contentId').text(str)
58 | $('#modalTitle').text(str2)
59 | }
60 | // 设置头条展示
61 | function getReSouList(key){
62 | let str = ``
63 | resouObj[key].forEach((e)=>{
64 | str+=``
65 | })
66 | $('#resouListId').html(str)
67 | }
68 | // 切换热搜tab
69 | $('body').on('click', '#resouTabId .item',function(){
70 | const type = $(this).attr('data-type')
71 | $(this).siblings().removeClass('title-act')
72 | $(this).addClass('title-act')
73 | getReSouList(type)
74 | })
75 | // 随机获取一个颜色
76 | function getRandomColor(){
77 | let color = '#';
78 | const randomArr=['0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'];
79 | for (let i=0;i<6;i++) {
80 | color += randomArr[parseInt(Math.random()*15)];
81 | }
82 | return color;
83 | }
84 | // 摸鱼传送门
85 | function moyuLinkList(){
86 | const list = [
87 | {name:'小霸王游戏机', url:'https://www.yikm.net', color:getRandomColor()},
88 | {name:'贪吃蛇', url:'http://slither.io', color:getRandomColor()},
89 | {name:'合成大西瓜', url:'http://www.wesane.com/game/654', color:getRandomColor()},
90 | {name:'看看大熊猫', url:'http://live.ipanda.com/xmcd', color:getRandomColor()},
91 | {name:'云游故宫', url:'https://www.dpm.org.cn/yygg.html', color:getRandomColor()},
92 | {name:'假装更新系统', url:'https://fakeupdate.net', color:getRandomColor()},
93 | {name:'假装是黑客', url:'https://geektyper.com', color:getRandomColor()},
94 | {name:'鼠标在哪里', url:'https://pointerpointer.com', color:getRandomColor()},
95 | {name:'照片转卡通画', url:'https://toonme.com', color:getRandomColor()},
96 | {name:'淦!中幻术了', url:'https://zoomquilt.org', color:getRandomColor()},
97 | {name:'沙雕导航', url:'https://shadiao.app', color:getRandomColor()},
98 | {name:'置身海洋', url:'https://virtocean.com', color:getRandomColor()},
99 | {name:'拥抱大自然', url:'https://asoftmurmur.com', color:getRandomColor()},
100 | {name:'60s冥想', url:'https://www.pixelthoughts.co', color:getRandomColor()},
101 | ]
102 | let str = ''
103 | list.forEach((e)=>{
104 | str += `${e.name}`
105 | })
106 | $('#moyuLinkListId').html(str)
107 | }
108 | })
--------------------------------------------------------------------------------
/components/SetDuck/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
个性化设置
4 |
5 |

6 |
7 |
8 |
69 |
73 |
74 |
--------------------------------------------------------------------------------
/components/SetDuck/index.js:
--------------------------------------------------------------------------------
1 | // 关闭弹层
2 | $('body').on('click','#closeModalId, #closeModalBtnId', function () {
3 | $('#modalSetId').fadeOut()
4 | })
5 | // 个性化设置
6 | $('body').on('click','#setUpSub', function () {
7 | const duration = $('#formTime').val()
8 | const title = $('#formTitle').val()
9 | const content = $('#formCon').val()
10 | const btnleft = $('#formLeftBtn').val()
11 | const btnright = $('#formRightBtn').val()
12 | let nickTextObj = {
13 | duration: duration,
14 | title: title,
15 | content: content,
16 | btnleft: btnleft,
17 | btnright: btnright,
18 | }
19 | BG.setUpLocal(nickTextObj)
20 | $('#modalSetId').fadeOut()
21 | setTimeout(() => {
22 | $('#xiaoyaziId').css('left', `calc(0% - 20px)`)
23 | $('#seepItemId').css('width', `0%`)
24 | }, 500);
25 | })
--------------------------------------------------------------------------------
/css/juejin.css:
--------------------------------------------------------------------------------
1 | /* 掘金视频模式 */
2 | .my-video{
3 | width: 100%;
4 | height: 100%;
5 | object-fit: fill;
6 | position: fixed;
7 | top: 0;
8 | left: 0;
9 | z-index: -1;
10 | }
11 | .jj-video-box #juejin{
12 | opacity: 0.82;
13 | }
14 | /* .jj-video-box .main-area>*{
15 | background-color: rgba(255, 255, 255, 0.3) !important;
16 | backdrop-filter: blur(10px);
17 | } */
18 | .my-audio{
19 | position: fixed;
20 | bottom: 20px;
21 | left: 20px;
22 | z-index: 999;
23 | }
24 | /* 掘金暗黑模式----------- */
25 | .jj-dark-box{
26 | background-color: #121212 !important;
27 | color: #aaa !important;
28 | border-color: #aaa !important;
29 | }
30 | /* 代码片段 */
31 | .jj-dark-box code{
32 | background: #3a3a3a !important;
33 | }
34 | .jj-dark-box code.hljs,
35 | .jj-dark-box code.copyable{
36 | background: #121212 !important;
37 | color: #aaa !important;
38 | opacity:1 !important;
39 | }
40 | .jj-dark-box code .hljs-keyword
41 | {
42 | color: #aaa ;
43 | }
44 | /* 导航 */
45 | .jj-dark-box .main-header{
46 | background: #272727 !important;
47 | border-bottom: 1px solid #222 !important;
48 | }
49 | .jj-dark-box .notification,
50 | .jj-dark-box .menu,
51 | .jj-dark-box .search-form{
52 | background: #272727 !important;
53 | }
54 | .jj-dark-box .seach-icon-container{
55 | background: #3a3a3a !important;
56 | }
57 | .jj-dark-box .typehead{
58 | background: #3a3a3a !important;
59 | color: #aaa !important;
60 | }
61 | .jj-dark-box .typehead div{
62 | color: #aaa !important;
63 | }
64 | .jj-dark-box .typehead .list div:hover{
65 | background:#272727 !important;
66 | }
67 | .jj-dark-box .main-header .nav-item>a{
68 | color: #eee !important;
69 | }
70 | /* 文章内容板块 */
71 | .jj-dark-box .main-area>*{
72 | background-color: #272727 !important;
73 | }
74 | /* 文章标题 */
75 | .jj-dark-box .article-title,
76 | .jj-dark-box .title,
77 | .jj-dark-box .comment-form .header-title,
78 | .jj-dark-box .title-content,
79 | .jj-dark-box .popover-box.user-popover{
80 | color: #aaa !important;
81 | }
82 | /* 文章内容细节 */
83 | .jj-dark-box .markdown-body{
84 | color: #aaa !important;
85 | background: #272727 !important;
86 | }
87 | .jj-dark-box .markdown-body>p,
88 | .jj-dark-box .markdown-body li
89 | {
90 | color: #aaa;
91 | }
92 | /* 右边栏目 */
93 | .jj-dark-box .sidebar p,
94 | .jj-dark-box .sidebar span,
95 | .jj-dark-box .sidebar a,
96 | .jj-dark-box .sidebar div
97 | {
98 | color: #aaa !important;
99 | background: #272727 !important;
100 | }
101 | .jj-dark-box .article-catalog{
102 | background: #272727 !important;
103 | }
104 | /* 悬浮按钮 */
105 | .jj-dark-box .suspension-panel .btn, .jj-dark-box .panel-btn{
106 | background-color: initial !important;
107 | border: 1px solid #aaa !important;
108 | }
109 | .jj-dark-box .panel-btn.with-badge:after{
110 | background-color: #777 !important;
111 | }
112 | /* 评论区 */
113 | .jj-dark-box .input-box{
114 | background: #3a3a3a !important;
115 | border: 1px solid #777 !important;
116 | }
117 | .jj-dark-box .rich-input{
118 | color: #aaa !important;
119 | }
120 | .jj-dark-box .sub-comment-list{
121 | background: #3a3a3a !important;
122 | }
123 | .jj-dark-box .parent-wrapper{
124 | background: #3a3a3a !important;
125 | border: 1px solid #777 !important;
126 | }
127 | .jj-dark-box .content-box a,
128 | .jj-dark-box .content-box p,
129 | .jj-dark-box .content-box span,
130 | .jj-dark-box .content-box div
131 | {
132 | color: #aaa !important;
133 | }
134 | /* 更多文章推荐 */
135 | .jj-dark-box .entry{
136 | background: #272727 !important;
137 | }
138 | .jj-dark-box .content-wrapper,
139 | .jj-dark-box .recommended-list-title-wrapper .title{
140 | border-bottom: 1px solid #777 !important;
141 | }
142 | .jj-dark-box .content-wrapper::before{
143 | background: #777 !important;
144 | }
145 | .jj-dark-box .content-wrapper a,
146 | .jj-dark-box .content-wrapper p,
147 | .jj-dark-box .content-wrapper span,
148 | .jj-dark-box .content-wrapper div
149 | {
150 | color: #aaa !important;
151 | }
152 | .jj-dark-box
153 | .fetch-more-comment,
154 | .jj-dark-box .column-container,
155 | .jj-dark-box .markdown-body blockquote,
156 | .jj-dark-box .markdown-body blockquote>p
157 | {
158 | background: #3a3a3a !important;
159 | color: #aaa !important;
160 | }
161 |
162 | .jj-dark-box .title .sort{
163 | background: #3a3a3a !important;
164 | }
165 | .jj-dark-box .title .sort .active{
166 | background: #272727 !important;
167 | }
168 |
169 | .jj-dark-box .item-container:hover{
170 | background: #3a3a3a !important;
171 | }
--------------------------------------------------------------------------------
/css/popup.css:
--------------------------------------------------------------------------------
1 | html, body,*{
2 | margin: 0;
3 | padding: 0;
4 | }
5 | a{
6 | text-decoration: none;
7 | color: #333;
8 | }
9 | .w100{
10 | width: 100%;
11 | }
12 | .backwack{
13 | -webkit-filter: grayscale(100%);
14 | -moz-filter: grayscale(100%);
15 | -ms-filter: grayscale(100%);
16 | -o-filter: grayscale(100%);
17 | filter:progid:DXImageTransform.Microsoft.BasicImage(grayscale=1);
18 | _filter:none;
19 | }
20 | .max-box{
21 | height: 200px;
22 | width: 400px;
23 | overflow-y: hidden;
24 | position: relative;
25 | }
26 | .max-bgimg-0{
27 | background: url('../img/popupBgimg/bgimg-0.jpg') no-repeat;
28 | background-size: 100% 100% ;
29 | }
30 | .xiaoyazi{
31 | height: 40px;
32 | width: 40px;
33 | background: url('../img/xiaoyazi.png') no-repeat;
34 | background-size: 100% 100%;
35 | position: absolute;
36 | bottom: 5px;
37 | left: calc(0% - 20px);
38 | transition: all 0.3s;
39 | animation: duck 0.5s linear infinite alternate;
40 | cursor: pointer;
41 | }
42 | @keyframes duck{
43 | 0% {
44 | transform: rotate(-10deg);
45 | }
46 | 100% {
47 | transform: rotate(10deg);
48 | }
49 | }
50 | .xiaoyazi:hover{
51 | height: 50px;
52 | width: 50px;
53 | transition: all 0.3s;
54 | }
55 | .roasted-duck{
56 | height: 50px;
57 | width: 50px;
58 | background: url('../img/kaoya.png') no-repeat;
59 | background-size: 100% 100%;
60 | bottom: 10px;
61 | }
62 | /* 进度条 */
63 | .seep-box{
64 | background-color: rgba(255, 255, 255, 0.5);
65 | height: 6px;
66 | width: 100%;
67 | position: absolute;
68 | bottom: 0;
69 | left: 0;
70 | }
71 | .seep-box>.seep-item{
72 | background-image: linear-gradient(to right,#00f2fe, #4facfe);
73 | height: 100%;
74 | width: 0%;
75 | transition: all 0.3s;
76 | }
77 |
78 | /* 按钮组 */
79 | .btn-list{
80 | display: flex;
81 | justify-content: flex-end;
82 | }
83 | .btn-list>.item{
84 | height: 40px;
85 | width: 40px;
86 | display: flex;
87 | align-items: center;
88 | justify-content: center;
89 | }
90 | .btn-list>.item>img{
91 | width: 28px;
92 | cursor: pointer;
93 | transition: all 0.2s;
94 | }
95 | .btn-list>.item>img:hover{
96 | width: 36px;
97 | transition: all 0.2s;
98 | }
99 | /* 喝水描述 */
100 | .msg-box{
101 | position: absolute;
102 | color: #fff;
103 | font-size: 14px;
104 | left: 30px;
105 | top: 40%;
106 | text-shadow: 2px 2px 5px #000;
107 | display: none;
108 | }
109 |
110 | /* 设置弹层 */
111 | .set-modal{
112 | background-color: rgba(255, 255, 255, 0.7);
113 | width: 100%;
114 | height: 100%;
115 | position: fixed;
116 | left: 0;
117 | top: 0;
118 | z-index: 100;
119 | display: none;
120 | }
121 | .mod-title{
122 | display: flex;
123 | height: 40px;
124 | line-height: 40px;
125 | padding: 0 20px;
126 | background-color: rgba(255, 255, 255, 0.7);
127 | font-size: 16px;
128 | }
129 | .mod-title>.left{
130 | flex-grow: 1;
131 | font-size: 16px;
132 | }
133 | .mod-title>.right{
134 | width: 40px;
135 | text-align: right;
136 | display: flex;
137 | align-items: center;
138 | justify-content: flex-end;
139 | cursor: pointer;
140 | }
141 | .mod-title>.right>img{
142 | height: 24px;
143 | }
144 | .form-list{
145 | padding: 0 20px;
146 | }
147 | .form-list>.item{
148 | display: flex;
149 | height: 30px;
150 | align-items: center;
151 | }
152 | .form-list>.item>.left{
153 | display: flex;
154 | width: 80px;
155 | }
156 | .form-list>.item>.right{
157 | display: flex;
158 | flex-grow: 1;
159 | }
160 | .form-btn-name{
161 | display: flex;
162 | }
163 | .form-btn-name>.item{
164 | display: flex;
165 | width: 50%;
166 | height: 30px;
167 | align-items: center;
168 | }
169 | .form-btn-name>.item>.left{
170 | display: flex;
171 | width: 70px;
172 | justify-content: center;
173 | }
174 | .form-btn-name>.item>.right{
175 | display: flex;
176 | flex-grow: 1;
177 | }
178 | .modal-foort{
179 | height: 40px;
180 | display: flex;
181 | align-items: center;
182 | justify-content: flex-end;
183 | padding: 0 20px;
184 | }
185 | .suc-btn{
186 | padding: 6px 12px;
187 | background-color: #1daeff;
188 | border-radius: 8px;
189 | color: #fff;
190 | cursor: pointer;
191 | margin-left: 10px;
192 | }
193 | .close-btn{
194 | padding: 6px 12px;
195 | background-color: #eee;
196 | border-radius: 8px;
197 | color: #333;
198 | cursor: pointer;
199 | margin-left: 10px;
200 | }
201 |
202 | /* 换肤弹框 */
203 | .skin-modal{
204 | position: fixed;
205 | bottom: 0;
206 | left: 0;
207 | z-index: 100;
208 | width: 100%;
209 | display: none;
210 | background-color: rgba(255, 255, 255, 0.7);
211 |
212 | }
213 | .title-box{
214 | display: flex;
215 | height: 30px;
216 | align-items: center;
217 | padding: 0 10px;
218 | }
219 | .title-box>div{
220 | display: flex;
221 |
222 | margin-right: 10px;
223 | }
224 | .btn-list-box{
225 | display: flex;
226 | flex-wrap: wrap;
227 | padding: 10px;
228 | padding-top: 0;
229 | }
230 | .btn-box{
231 | padding: 4px 8px;
232 | font-size: 14px;
233 | color: #666;
234 | text-align: center;
235 | border-radius: 6px;
236 | border: solid 1px #ccc;
237 | margin: 2px 4px;
238 | background-color: rgba(255, 255, 255, 0.5);
239 | cursor: pointer;
240 | }
241 | .btn-box:hover{
242 | background-color: #fff;
243 | color: #333;
244 | }
245 | .bgm-loading {
246 | animation: loadingbgm 3s linear infinite;
247 | }
248 | /* bgm图标旋转 */
249 | @keyframes loadingbgm {
250 | 0% {
251 | transform: rotate(0deg);
252 | }
253 | 100% {
254 | transform: rotate(360deg);
255 | }
256 | }
--------------------------------------------------------------------------------
/img/back.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mollydl/drink-water/4ad5af83e899f838287a6e819ed5b4a1d6814f39/img/back.jpg
--------------------------------------------------------------------------------
/img/bgimg-1.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mollydl/drink-water/4ad5af83e899f838287a6e819ed5b4a1d6814f39/img/bgimg-1.jpeg
--------------------------------------------------------------------------------
/img/biaoqing.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mollydl/drink-water/4ad5af83e899f838287a6e819ed5b4a1d6814f39/img/biaoqing.png
--------------------------------------------------------------------------------
/img/changeBgimg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mollydl/drink-water/4ad5af83e899f838287a6e819ed5b4a1d6814f39/img/changeBgimg.png
--------------------------------------------------------------------------------
/img/close.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mollydl/drink-water/4ad5af83e899f838287a6e819ed5b4a1d6814f39/img/close.png
--------------------------------------------------------------------------------
/img/daizhu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mollydl/drink-water/4ad5af83e899f838287a6e819ed5b4a1d6814f39/img/daizhu.png
--------------------------------------------------------------------------------
/img/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mollydl/drink-water/4ad5af83e899f838287a6e819ed5b4a1d6814f39/img/icon.png
--------------------------------------------------------------------------------
/img/kaoya.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mollydl/drink-water/4ad5af83e899f838287a6e819ed5b4a1d6814f39/img/kaoya.png
--------------------------------------------------------------------------------
/img/kuqi.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mollydl/drink-water/4ad5af83e899f838287a6e819ed5b4a1d6814f39/img/kuqi.png
--------------------------------------------------------------------------------
/img/moyu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mollydl/drink-water/4ad5af83e899f838287a6e819ed5b4a1d6814f39/img/moyu.png
--------------------------------------------------------------------------------
/img/moyubg.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mollydl/drink-water/4ad5af83e899f838287a6e819ed5b4a1d6814f39/img/moyubg.jpg
--------------------------------------------------------------------------------
/img/nipple.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mollydl/drink-water/4ad5af83e899f838287a6e819ed5b4a1d6814f39/img/nipple.png
--------------------------------------------------------------------------------
/img/pifu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mollydl/drink-water/4ad5af83e899f838287a6e819ed5b4a1d6814f39/img/pifu.png
--------------------------------------------------------------------------------
/img/popupBgimg/bgimg-0.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mollydl/drink-water/4ad5af83e899f838287a6e819ed5b4a1d6814f39/img/popupBgimg/bgimg-0.jpg
--------------------------------------------------------------------------------
/img/popupBgimg/bgimg-1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mollydl/drink-water/4ad5af83e899f838287a6e819ed5b4a1d6814f39/img/popupBgimg/bgimg-1.jpg
--------------------------------------------------------------------------------
/img/popupBgimg/bgimg-10.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mollydl/drink-water/4ad5af83e899f838287a6e819ed5b4a1d6814f39/img/popupBgimg/bgimg-10.jpg
--------------------------------------------------------------------------------
/img/popupBgimg/bgimg-11.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mollydl/drink-water/4ad5af83e899f838287a6e819ed5b4a1d6814f39/img/popupBgimg/bgimg-11.jpg
--------------------------------------------------------------------------------
/img/popupBgimg/bgimg-2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mollydl/drink-water/4ad5af83e899f838287a6e819ed5b4a1d6814f39/img/popupBgimg/bgimg-2.jpg
--------------------------------------------------------------------------------
/img/popupBgimg/bgimg-3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mollydl/drink-water/4ad5af83e899f838287a6e819ed5b4a1d6814f39/img/popupBgimg/bgimg-3.jpg
--------------------------------------------------------------------------------
/img/popupBgimg/bgimg-4.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mollydl/drink-water/4ad5af83e899f838287a6e819ed5b4a1d6814f39/img/popupBgimg/bgimg-4.jpg
--------------------------------------------------------------------------------
/img/popupBgimg/bgimg-5.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mollydl/drink-water/4ad5af83e899f838287a6e819ed5b4a1d6814f39/img/popupBgimg/bgimg-5.jpg
--------------------------------------------------------------------------------
/img/popupBgimg/bgimg-6.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mollydl/drink-water/4ad5af83e899f838287a6e819ed5b4a1d6814f39/img/popupBgimg/bgimg-6.jpg
--------------------------------------------------------------------------------
/img/popupBgimg/bgimg-7.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mollydl/drink-water/4ad5af83e899f838287a6e819ed5b4a1d6814f39/img/popupBgimg/bgimg-7.jpg
--------------------------------------------------------------------------------
/img/popupBgimg/bgimg-8.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mollydl/drink-water/4ad5af83e899f838287a6e819ed5b4a1d6814f39/img/popupBgimg/bgimg-8.jpg
--------------------------------------------------------------------------------
/img/popupBgimg/bgimg-9.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mollydl/drink-water/4ad5af83e899f838287a6e819ed5b4a1d6814f39/img/popupBgimg/bgimg-9.jpg
--------------------------------------------------------------------------------
/img/setup.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mollydl/drink-water/4ad5af83e899f838287a6e819ed5b4a1d6814f39/img/setup.png
--------------------------------------------------------------------------------
/img/timers.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mollydl/drink-water/4ad5af83e899f838287a6e819ed5b4a1d6814f39/img/timers.png
--------------------------------------------------------------------------------
/img/xiaoyazi.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mollydl/drink-water/4ad5af83e899f838287a6e819ed5b4a1d6814f39/img/xiaoyazi.png
--------------------------------------------------------------------------------
/img/yinyue.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mollydl/drink-water/4ad5af83e899f838287a6e819ed5b4a1d6814f39/img/yinyue.png
--------------------------------------------------------------------------------
/js/background.js:
--------------------------------------------------------------------------------
1 | let timer = null
2 | let duration = 1800
3 | let seepDuration = 0
4 | let seepNum = 0
5 | let nickTextObj = {}
6 | let timeStopStart = false
7 | initSetUp()
8 |
9 | function starTimer(fun=function(){}){
10 | clearInterval(timer)
11 | timer = setInterval(function(){
12 | if(seepNum>=100){
13 | clearInterval(timer)
14 | noticeWater()
15 | }else{
16 | seepDuration +=1
17 | seepNum = (seepDuration / duration) * 100
18 | iconTimer(seepDuration)
19 | fun({seepNum, seepDuration})
20 | }
21 | },1000)
22 |
23 | return {seepNum, seepDuration}
24 | }
25 | starTimer()
26 |
27 | // 获取基本信息
28 | function getBginfo(){
29 | return {
30 | duration,
31 | seepDuration,
32 | seepNum
33 | }
34 | }
35 |
36 | // 重置信息
37 | function resetInfo(fun=function(){}){
38 | clearInterval(timer)
39 | seepDuration = 0
40 | seepNum = 0
41 | starTimer()
42 | fun({
43 | duration,
44 | seepDuration,
45 | seepNum
46 | })
47 | }
48 |
49 | // 发送通知
50 | function noticeWater(){
51 | const {title, content, btnleft, btnright} = initSetUp()
52 | chrome.notifications.create({
53 | type: 'basic',
54 | iconUrl: '../img/icon.png',
55 | title,
56 | buttons: [{
57 | title: btnleft,
58 | iconUrl: '../img/daizhu.png'
59 | }, {
60 | title: btnright,
61 | iconUrl: '../img/kuqi.png'
62 | }],
63 | message: content
64 | })
65 | }
66 | chrome.notifications.onButtonClicked.addListener(function (id, btnIndex) {
67 | if(btnIndex===0){
68 | resetInfo()
69 | }
70 | });
71 |
72 | // 设置小鸭子下标
73 | function iconTimer(num=0){
74 | const text = num < duration ? Math.floor(num / 60) + '' : '危'
75 | const color = num < duration ? '#1daeff' : '#ff4000'
76 | const cb = chrome.browserAction
77 | cb.setBadgeText({
78 | text: text
79 | })
80 | cb.setBadgeBackgroundColor({
81 | color: color
82 | })
83 | }
84 |
85 | // 个性化设置存入缓存
86 | function setUpLocal(data){
87 | setLoacl({key:'setUp', val:data})
88 | initSetUp()
89 | location.reload()
90 | }
91 |
92 | // 初始化个性设置
93 | function initSetUp(){
94 | const {
95 | duration:durationloc='1800',
96 | title='快喝水~',
97 | content='已经很久没喝水了,变烤鸭啦~',
98 | btnleft='马上喝',
99 | btnright='我偏不'
100 | } = getLoacl({key:'setUp'}) || {}
101 | duration = Number(durationloc)
102 | nickTextObj.title = title
103 | nickTextObj.content = content
104 | nickTextObj.btnleft = btnleft
105 | nickTextObj.btnright = btnright
106 | return nickTextObj
107 | }
108 |
109 | // 暂停时间(切换)
110 | function changeTime(flag){
111 | timeStopStart = flag
112 | if(timeStopStart){
113 | clearInterval(timer)
114 | }else{
115 | starTimer()
116 | }
117 | }
118 |
119 | // 获取暂停时间状态
120 | function getTimeStart(){
121 | return timeStopStart
122 | }
123 |
124 | // 解决chrome插件,ajax访问跨域问题 ----------- start
125 | function removeMatchingHeaders(headers, regex) {
126 | for (var i = 0, header; (header = headers[i]); i++) {
127 | if (header.name.match(regex)) {
128 | headers.splice(i, 1);
129 | return;
130 | }
131 | }
132 | }
133 |
134 | function responseListener(details) {
135 | removeMatchingHeaders(details.responseHeaders, /access-control-allow-origin/i);
136 | details.responseHeaders.push({ name: 'Access-Control-Allow-Origin', value: '*' });
137 | return { responseHeaders: details.responseHeaders };
138 | }
139 |
140 | chrome.webRequest.onHeadersReceived.addListener(responseListener, {
141 | urls: ['*://*/*']
142 | }, [
143 | 'blocking',
144 | 'responseHeaders',
145 | 'extraHeaders'
146 | ]);
147 | // 解决chrome插件,ajax访问跨域问题 ----------- end
148 |
149 | // 监听浏览器地址栏变化
150 | chrome.tabs.onUpdated.addListener(function(tabId,changeInfo,curtab){
151 | if(changeInfo.status === 'complete'){ // 表示页面访问结束
152 | // 向content_scripts发送消息
153 | chrome.tabs.query({ active: true, currentWindow: true }, function (tab) {
154 | chrome.tabs.sendMessage(tab[0].id, {
155 | actionType: "tabChange",
156 | obj:{tabId, changeInfo, curtab}
157 | });
158 | });
159 | const skinType = getLoacl({key:'skinType', isObj:false}) || 'init'
160 | const hasJueJin = curtab.url.includes('https://juejin.cn/post')
161 | if((skinType!=='init' || skinType !== 'dark') && hasJueJin){
162 | !curtab.url.includes('#') && changeAudio({skin: skinType})
163 | }
164 | }
165 | });
166 |
167 | // popup切换歌曲回调
168 | function changeAudio(data){
169 | const micObj = {
170 | 'video-fengchuimailang':'https://www.qqmc.com/mp3/music239653.mp3',
171 | 'video-huanghun':'https://www.qqmc.com/mp3/music6874743.mp3',
172 | 'video-yuai':'https://www.qqmc.com/mp3/music38615712.mp3',
173 | 'video-gwysgdsj':'https://www.qqmc.com/mp3/music440614.mp3',
174 | 'video-nnhdws':'https://www.qqmc.com/mp3/music221804.mp3',
175 | 'video-dafengchui':'https://www.qqmc.com/mp3/music169428024.mp3',
176 | }
177 | const aUrl = micObj[data.skin]
178 | setLoacl({key:'skinType', val:data.skin, isObj:false})
179 | const flag = $('#bg_music').length <1
180 | const audioNode = ``
181 | const hasAudioMute = getLoacl({key:'hasAudioMute'}) || {chexVal:false}
182 | if(flag){
183 | !hasAudioMute.chexVal && $('body').append(audioNode)
184 | }else{
185 | $('#bg_music').attr('src',aUrl)
186 | }
187 | }
188 | // 获取背景缓存
189 | function getBgLoacl({key='', isObj=true}){
190 | return getLoacl({key, isObj})
191 | }
192 | // 获取背景音频播放状态: 暂停:true, 播放中:false
193 | function getPaused(){
194 | const audio = document.querySelector('#bg_music')
195 | if(audio){
196 | return audio.paused
197 | }else{
198 | return true
199 | }
200 | }
201 | // 根据当前播放状态设置暂停、播放背景音乐
202 | function togglePalyBgm(){
203 | const status = getPaused()
204 | const audio = document.querySelector('#bg_music')
205 | !status ? audio.pause() : audio.play()
206 | }
207 | // 存储静音模式,且控制播放
208 | function setPlayModel(chexVal){
209 | const skinType = getLoacl({key:'skinType', isObj:false}) || 'init'
210 | setLoacl({key:'hasAudioMute', val:{chexVal}})
211 | changeAudio({skin: skinType})
212 | }
213 | // 设置暂停播放
214 | function audioToPause(flag){
215 | const audio = document.querySelector('#bg_music')
216 | if(audio){
217 | flag ? audio.pause() : audio.play()
218 | }
219 | }
220 | // 获取静音模式缓存值
221 | function getHasAudioMute(){
222 | const hasAudioMute = getLoacl({key:'hasAudioMute'}) || {chexVal:false}
223 | return hasAudioMute.chexVal
224 | }
225 | // 移除audio播放器
226 | function removeAudio(){
227 | const aid = $('#bg_music')
228 | aid && aid.remove()
229 | }
230 | // 移除掘金标签,暂停歌曲
231 | chrome.tabs.onRemoved.addListener(function(){
232 | chrome.tabs.getAllInWindow(null,function(tabs){
233 | const hasJueJin = tabs.some(function(item){
234 | return item.url.includes('juejin')
235 | })
236 | !hasJueJin && audioToPause(true)
237 | })
238 | })
239 |
240 |
--------------------------------------------------------------------------------
/js/dayjs.min.js:
--------------------------------------------------------------------------------
1 | !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.dayjs=e()}(this,function(){"use strict";const t=60,e=60*t,s=24*e,r=7*s,n=(t,e,s)=>!t||t.length>=e?t:`${Array(e+1-t.length).join(s)}${t}`;class i{constructor(t){this.utc=!1;const e=this.parseConfig(t);this.date=new Date(e),this.timeZone=this.date.getTimezoneOffset()/60,this.timeZoneString=n(String(-1*this.timeZone).replace(/^(.)?(\d)/,"$10$200"),5,"+"),this.mYear=this.date.getFullYear(),this.mMonth=this.date.getMonth(),this.mDay=this.date.getDate(),this.mWeek=this.date.getDay(),this.mHour=this.date.getHours(),this.mMinute=this.date.getMinutes(),this.mSecond=this.date.getSeconds()}parseConfig(t){if(!t)return new Date;if(t instanceof Date)return t;if(/^(\d){8}$/.test(t)){return this.utc=!0,`${t.substr(0,4)}-${t.substr(4,2)}-${t.substr(6,2)}`}return t}year(){return this.mYear}month(){return this.mMonth}unix(){const t=this.utc?60*this.timeZone*60*1e3:0;return Math.floor((this.date.getTime()+t)/1e3)}toString(){return this.date.toUTCString()}startOf(t){switch(t){case"year":return new i(new Date(this.year(),0,1));case"month":return new i(new Date(this.year(),this.month(),1));default:return this}}add(n,a){let h;switch(a){case"m":case"minutes":h=t;break;case"h":case"hours":h=e;break;case"d":case"days":h=s;break;case"w":case"weeks":h=r;break;default:h=1}const u=this.unix()+n*h;return new i(1e3*u)}subtract(t,e){return this.add(-1*t,e)}format(t="YYYY-MM-DDTHH:mm:ssZ"){const e=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];return t.replace(/Y{2,4}|M{1,2}|D{1,2}|d{1,4}|H{1,2}|m{1,2}|s{1,2}|Z{1,2}/g,t=>{switch(t){case"YY":return String(this.mYear).slice(-2);case"YYYY":return String(this.mYear);case"M":return String(this.mMonth+1);case"MM":return n(String(this.mMonth+1),2,"0");case"D":return String(this.mDay);case"DD":return n(String(this.mDay),2,"0");case"d":return String(this.mWeek);case"dddd":return e[this.mWeek];case"H":return String(this.mHour);case"HH":return n(String(this.mHour),2,"0");case"m":return String(this.mMinute);case"mm":return n(String(this.mMinute),2,"0");case"s":return String(this.mSecond);case"ss":return n(String(this.mSecond),2,"0");case"Z":return`${this.timeZoneString.slice(0,-2)}:00`;case"ZZ":return this.timeZoneString;default:return t}})}}return t=>new i(t)});
2 |
--------------------------------------------------------------------------------
/js/jquery-3.5.1.min.js:
--------------------------------------------------------------------------------
1 | /*! jQuery v3.5.1 | (c) JS Foundation and other contributors | jquery.org/license */
2 | !function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(C,e){"use strict";var t=[],r=Object.getPrototypeOf,s=t.slice,g=t.flat?function(e){return t.flat.call(e)}:function(e){return t.concat.apply([],e)},u=t.push,i=t.indexOf,n={},o=n.toString,v=n.hasOwnProperty,a=v.toString,l=a.call(Object),y={},m=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},x=function(e){return null!=e&&e===e.window},E=C.document,c={type:!0,src:!0,nonce:!0,noModule:!0};function b(e,t,n){var r,i,o=(n=n||E).createElement("script");if(o.text=e,t)for(r in c)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function w(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[o.call(e)]||"object":typeof e}var f="3.5.1",S=function(e,t){return new S.fn.init(e,t)};function p(e){var t=!!e&&"length"in e&&e.length,n=w(e);return!m(e)&&!x(e)&&("array"===n||0===t||"number"==typeof t&&0+~]|"+M+")"+M+"*"),U=new RegExp(M+"|>"),X=new RegExp(F),V=new RegExp("^"+I+"$"),G={ID:new RegExp("^#("+I+")"),CLASS:new RegExp("^\\.("+I+")"),TAG:new RegExp("^("+I+"|[*])"),ATTR:new RegExp("^"+W),PSEUDO:new RegExp("^"+F),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+R+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/HTML$/i,Q=/^(?:input|select|textarea|button)$/i,J=/^h\d$/i,K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/[+~]/,te=new RegExp("\\\\[\\da-fA-F]{1,6}"+M+"?|\\\\([^\\r\\n\\f])","g"),ne=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},re=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ie=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},oe=function(){T()},ae=be(function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()},{dir:"parentNode",next:"legend"});try{H.apply(t=O.call(p.childNodes),p.childNodes),t[p.childNodes.length].nodeType}catch(e){H={apply:t.length?function(e,t){L.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function se(t,e,n,r){var i,o,a,s,u,l,c,f=e&&e.ownerDocument,p=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==p&&9!==p&&11!==p)return n;if(!r&&(T(e),e=e||C,E)){if(11!==p&&(u=Z.exec(t)))if(i=u[1]){if(9===p){if(!(a=e.getElementById(i)))return n;if(a.id===i)return n.push(a),n}else if(f&&(a=f.getElementById(i))&&y(e,a)&&a.id===i)return n.push(a),n}else{if(u[2])return H.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&d.getElementsByClassName&&e.getElementsByClassName)return H.apply(n,e.getElementsByClassName(i)),n}if(d.qsa&&!N[t+" "]&&(!v||!v.test(t))&&(1!==p||"object"!==e.nodeName.toLowerCase())){if(c=t,f=e,1===p&&(U.test(t)||z.test(t))){(f=ee.test(t)&&ye(e.parentNode)||e)===e&&d.scope||((s=e.getAttribute("id"))?s=s.replace(re,ie):e.setAttribute("id",s=S)),o=(l=h(t)).length;while(o--)l[o]=(s?"#"+s:":scope")+" "+xe(l[o]);c=l.join(",")}try{return H.apply(n,f.querySelectorAll(c)),n}catch(e){N(t,!0)}finally{s===S&&e.removeAttribute("id")}}}return g(t.replace($,"$1"),e,n,r)}function ue(){var r=[];return function e(t,n){return r.push(t+" ")>b.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function le(e){return e[S]=!0,e}function ce(e){var t=C.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function fe(e,t){var n=e.split("|"),r=n.length;while(r--)b.attrHandle[n[r]]=t}function pe(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function de(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function he(n){return function(e){var t=e.nodeName.toLowerCase();return("input"===t||"button"===t)&&e.type===n}}function ge(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&ae(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function ve(a){return le(function(o){return o=+o,le(function(e,t){var n,r=a([],e.length,o),i=r.length;while(i--)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function ye(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}for(e in d=se.support={},i=se.isXML=function(e){var t=e.namespaceURI,n=(e.ownerDocument||e).documentElement;return!Y.test(t||n&&n.nodeName||"HTML")},T=se.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:p;return r!=C&&9===r.nodeType&&r.documentElement&&(a=(C=r).documentElement,E=!i(C),p!=C&&(n=C.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",oe,!1):n.attachEvent&&n.attachEvent("onunload",oe)),d.scope=ce(function(e){return a.appendChild(e).appendChild(C.createElement("div")),"undefined"!=typeof e.querySelectorAll&&!e.querySelectorAll(":scope fieldset div").length}),d.attributes=ce(function(e){return e.className="i",!e.getAttribute("className")}),d.getElementsByTagName=ce(function(e){return e.appendChild(C.createComment("")),!e.getElementsByTagName("*").length}),d.getElementsByClassName=K.test(C.getElementsByClassName),d.getById=ce(function(e){return a.appendChild(e).id=S,!C.getElementsByName||!C.getElementsByName(S).length}),d.getById?(b.filter.ID=function(e){var t=e.replace(te,ne);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n=t.getElementById(e);return n?[n]:[]}}):(b.filter.ID=function(e){var n=e.replace(te,ne);return function(e){var t="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),b.find.TAG=d.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):d.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},b.find.CLASS=d.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&E)return t.getElementsByClassName(e)},s=[],v=[],(d.qsa=K.test(C.querySelectorAll))&&(ce(function(e){var t;a.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&v.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||v.push("\\["+M+"*(?:value|"+R+")"),e.querySelectorAll("[id~="+S+"-]").length||v.push("~="),(t=C.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||v.push("\\["+M+"*name"+M+"*="+M+"*(?:''|\"\")"),e.querySelectorAll(":checked").length||v.push(":checked"),e.querySelectorAll("a#"+S+"+*").length||v.push(".#.+[+~]"),e.querySelectorAll("\\\f"),v.push("[\\r\\n\\f]")}),ce(function(e){e.innerHTML="";var t=C.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&v.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&v.push(":enabled",":disabled"),a.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&v.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),v.push(",.*:")})),(d.matchesSelector=K.test(c=a.matches||a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.msMatchesSelector))&&ce(function(e){d.disconnectedMatch=c.call(e,"*"),c.call(e,"[s!='']:x"),s.push("!=",F)}),v=v.length&&new RegExp(v.join("|")),s=s.length&&new RegExp(s.join("|")),t=K.test(a.compareDocumentPosition),y=t||K.test(a.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},D=t?function(e,t){if(e===t)return l=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!d.sortDetached&&t.compareDocumentPosition(e)===n?e==C||e.ownerDocument==p&&y(p,e)?-1:t==C||t.ownerDocument==p&&y(p,t)?1:u?P(u,e)-P(u,t):0:4&n?-1:1)}:function(e,t){if(e===t)return l=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e==C?-1:t==C?1:i?-1:o?1:u?P(u,e)-P(u,t):0;if(i===o)return pe(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?pe(a[r],s[r]):a[r]==p?-1:s[r]==p?1:0}),C},se.matches=function(e,t){return se(e,null,null,t)},se.matchesSelector=function(e,t){if(T(e),d.matchesSelector&&E&&!N[t+" "]&&(!s||!s.test(t))&&(!v||!v.test(t)))try{var n=c.call(e,t);if(n||d.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){N(t,!0)}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(te,ne),e[3]=(e[3]||e[4]||e[5]||"").replace(te,ne),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||se.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&se.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return G.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=h(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,ne).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=m[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&m(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,r,i){return function(e){var t=se.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===i:"!="===r?t!==i:"^="===r?i&&0===t.indexOf(i):"*="===r?i&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function D(e,n,r){return m(n)?S.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?S.grep(e,function(e){return e===n!==r}):"string"!=typeof n?S.grep(e,function(e){return-1)[^>]*|#([\w-]+))$/;(S.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||j,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:q.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof S?t[0]:t,S.merge(this,S.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:E,!0)),N.test(r[1])&&S.isPlainObject(t))for(r in t)m(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=E.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):m(e)?void 0!==n.ready?n.ready(e):e(S):S.makeArray(e,this)}).prototype=S.fn,j=S(E);var L=/^(?:parents|prev(?:Until|All))/,H={children:!0,contents:!0,next:!0,prev:!0};function O(e,t){while((e=e[t])&&1!==e.nodeType);return e}S.fn.extend({has:function(e){var t=S(e,this),n=t.length;return this.filter(function(){for(var e=0;e\x20\t\r\n\f]*)/i,he=/^$|^module$|\/(?:java|ecma)script/i;ce=E.createDocumentFragment().appendChild(E.createElement("div")),(fe=E.createElement("input")).setAttribute("type","radio"),fe.setAttribute("checked","checked"),fe.setAttribute("name","t"),ce.appendChild(fe),y.checkClone=ce.cloneNode(!0).cloneNode(!0).lastChild.checked,ce.innerHTML="",y.noCloneChecked=!!ce.cloneNode(!0).lastChild.defaultValue,ce.innerHTML="",y.option=!!ce.lastChild;var ge={thead:[1,""],col:[2,""],tr:[2,""],td:[3,""],_default:[0,"",""]};function ve(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&A(e,t)?S.merge([e],n):n}function ye(e,t){for(var n=0,r=e.length;n",""]);var me=/<|?\w+;/;function xe(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;d\s*$/g;function qe(e,t){return A(e,"table")&&A(11!==t.nodeType?t:t.firstChild,"tr")&&S(e).children("tbody")[0]||e}function Le(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function He(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Oe(e,t){var n,r,i,o,a,s;if(1===t.nodeType){if(Y.hasData(e)&&(s=Y.get(e).events))for(i in Y.remove(t,"handle events"),s)for(n=0,r=s[i].length;n").attr(n.scriptAttrs||{}).prop({charset:n.scriptCharset,src:n.url}).on("load error",i=function(e){r.remove(),i=null,e&&t("error"===e.type?404:200,e.type)}),E.head.appendChild(r[0])},abort:function(){i&&i()}}});var Ut,Xt=[],Vt=/(=)\?(?=&|$)|\?\?/;S.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Xt.pop()||S.expando+"_"+Ct.guid++;return this[e]=!0,e}}),S.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Vt.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Vt.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=m(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Vt,"$1"+r):!1!==e.jsonp&&(e.url+=(Et.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||S.error(r+" was not called"),o[0]},e.dataTypes[0]="json",i=C[r],C[r]=function(){o=arguments},n.always(function(){void 0===i?S(C).removeProp(r):C[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,Xt.push(r)),o&&m(i)&&i(o[0]),o=i=void 0}),"script"}),y.createHTMLDocument=((Ut=E.implementation.createHTMLDocument("").body).innerHTML="",2===Ut.childNodes.length),S.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(y.createHTMLDocument?((r=(t=E.implementation.createHTMLDocument("")).createElement("base")).href=E.location.href,t.head.appendChild(r)):t=E),o=!n&&[],(i=N.exec(e))?[t.createElement(i[1])]:(i=xe([e],t,o),o&&o.length&&S(o).remove(),S.merge([],i.childNodes)));var r,i,o},S.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return-1").append(S.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},S.expr.pseudos.animated=function(t){return S.grep(S.timers,function(e){return t===e.elem}).length},S.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=S.css(e,"position"),c=S(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=S.css(e,"top"),u=S.css(e,"left"),("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),m(t)&&(t=t.call(e,n,S.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):("number"==typeof f.top&&(f.top+="px"),"number"==typeof f.left&&(f.left+="px"),c.css(f))}},S.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){S.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===S.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===S.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=S(e).offset()).top+=S.css(e,"borderTopWidth",!0),i.left+=S.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-S.css(r,"marginTop",!0),left:t.left-i.left-S.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===S.css(e,"position"))e=e.offsetParent;return e||re})}}),S.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;S.fn[t]=function(e){return $(this,function(e,t,n){var r;if(x(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),S.each(["top","left"],function(e,n){S.cssHooks[n]=$e(y.pixelPosition,function(e,t){if(t)return t=Be(e,n),Me.test(t)?S(e).position()[n]+"px":t})}),S.each({Height:"height",Width:"width"},function(a,s){S.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,o){S.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return $(this,function(e,t,n){var r;return x(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+a],r["scroll"+a],e.body["offset"+a],r["offset"+a],r["client"+a])):void 0===n?S.css(e,t,i):S.style(e,t,n,i)},s,n?e:void 0,n)}})}),S.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){S.fn[t]=function(e){return this.on(t,e)}}),S.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),S.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,n){S.fn[n]=function(e,t){return 0 {
41 | !curtab.url.includes('#') && funObj[skinType](skinType)
42 | }, 500);
43 | }else{
44 | skinInit(skinType)
45 | }
46 | }
47 | // 一键还原
48 | function skinInit(type='init'){
49 | const vid = $('#bg_video')
50 | $('body').removeClass('jj-dark-box')
51 | $('body').removeClass('jj-video-box')
52 | $('#juejin').css('opacity',1)
53 | vid && vid.remove()
54 | $('.logo-img').attr('src','https://lf3-cdn-tos.bytescm.com/obj/static/xitu_juejin_web/e08da34488b114bd4c665ba2fa520a31.svg')
55 | localStorage.setItem('skinType', type)
56 | }
57 | // 暗黑模式
58 | function skinDark(type='init'){
59 | skinInit()
60 | $('body').addClass('jj-dark-box');
61 | $('.jj-dark-box .logo-img').attr('src','https://lf-cdn-tos.bytescm.com/obj/static/xitu_extension/static/brand-dark.3111cff6.svg')
62 | localStorage.setItem('skinType', type)
63 | }
64 | // 视频模式-风吹麦浪
65 | function skinVideoFcml(type='init'){
66 | const vUrl = 'https://cdn.videvo.net/videvo_files/video/free/2021-08/large_watermarked/210722_05_Festival_4k_073_preview.mp4'
67 | videoMooe(vUrl, type)
68 | }
69 | // 视频模式-黄昏
70 | function skinVideoHh(type='init'){
71 | const vUrl = 'https://cdn.videvo.net/videvo_files/video/free/2015-09/large_watermarked/sunrise_over_the_lake2_preview.mp4'
72 | videoMooe(vUrl, type)
73 | }
74 | // 视频模式-雨爱
75 | function skinVideoYa(type='init'){
76 | const vUrl = 'https://cdn.videvo.net/videvo_files/video/free/2020-01/large_watermarked/200116_Lens%20effect_4k_073_preview.mp4'
77 | videoMooe(vUrl, type)
78 | }
79 | // 视频模式-给我一首歌的时间
80 | function skinVideoGwysgdsj(type='init'){
81 | const vUrl = 'https://cdn.videvo.net/videvo_files/video/free/2015-08/large_watermarked/sunrise_01_preview.mp4'
82 | videoMooe(vUrl, type)
83 | }
84 | // 视频模式-那女孩对我说
85 | function skinVideoNnhdws(type='init'){
86 | const vUrl = 'https://cdn.videvo.net/videvo_files/video/free/2014-12/large_watermarked/Raindrops_Videvo_preview.mp4'
87 | videoMooe(vUrl, type)
88 | }
89 | // 视频模式-大风吹
90 | function skinVideoDfc(type='init'){
91 | const vUrl = 'https://cdn.videvo.net/videvo_files/video/free/2013-09/large_watermarked/DiscoLights2Videvo_preview.mp4'
92 | videoMooe(vUrl, type)
93 | }
94 |
95 | // 视频模式前置动作
96 | function videoMooe(vUrl='', type='init'){
97 | const flag = $('.my-video').length <1
98 | const node = ``
99 | const hasDark = $('body').hasClass('jj-dark-box')
100 | hasDark && skinInit()
101 | if(flag){
102 | $('body').append(node)
103 | $('body').addClass('jj-video-box')
104 | }else{
105 | $('#bg_video').attr('src',vUrl)
106 | }
107 | initBardOpacity()
108 | localStorage.setItem('skinType', type)
109 | }
110 |
111 |
112 |
113 |
114 |
--------------------------------------------------------------------------------
/js/popup.js:
--------------------------------------------------------------------------------
1 |
2 | const BG = chrome.extension.getBackgroundPage()
3 | const { seepNum, seepDuration } = BG.getBginfo()
4 | const msgList = [
5 | { text: '吨~吨~吨~小鸭子喝水啦!' },
6 | { text: '每天八杯水,开心的源泉~' },
7 | { text: '辛苦撸代码的同时,也要多喝水哟~' },
8 | { text: '今天你多喝水了么?' },
9 | { text: '别光喝水,起来走动走动吧~' },
10 | { text: '工作一天了,点杯奶茶犒劳自己吧~' },
11 | ]
12 | $(function () {
13 | mounted();
14 | // 初始化函数
15 | function mounted(){
16 | // 加载设置小鸭子模块框
17 | $('#SetDuckCom').load('../components/SetDuck/index.html');
18 | // 加载表情包大全模块
19 | $('#FaceInfoCom').load('../components/FaceInfo/index.html');
20 | // 加载摸鱼办模块
21 | $('#moyuCom').load('../components/Moyu/index.html');
22 | $('#maxBoxId')[BG.getTimeStart() ? 'addClass' : 'removeClass']('backwack')
23 | // 初始化调用鸭子移动
24 | setNodeSeep()
25 | }
26 | // 喝水啦
27 | let waterRepeat = true
28 | $('#resetInitId').on('click', function () {
29 | if (!waterRepeat) return // 防止重复点击
30 | waterRepeat = false
31 | BG.resetInfo(function () {
32 | const num = Math.floor(Math.random() * (msgList.length));
33 | $('#xiaoyaziId').removeClass('roasted-duck')
34 | $('#msgtextId').text(msgList[num].text)
35 | $('#msgtextId').fadeIn()
36 | setTimeout(() => {
37 | $('#msgtextId').fadeOut()
38 | waterRepeat = true
39 | }, 3000);
40 | setNodeSeep()
41 | })
42 | })
43 | // 设置鸭子节点样式
44 | function setNodeSeep() {
45 | const { seepNum = 0 } = BG.getBginfo()
46 | $('#xiaoyaziId').css('left', `calc(${seepNum}% - 20px)`)
47 | $('#seepItemId').css('width', `${seepNum}%`)
48 | if (seepNum >= 100) {
49 | $('#xiaoyaziId').css('left', '86%')
50 | $('#xiaoyaziId').addClass('roasted-duck')
51 | }
52 | }
53 | // 点击小鸭子,弹出对话
54 | $('body').on('click','#xiaoyaziId',fangdou(showTalk))
55 | function showTalk(){
56 | const sayList = [
57 | '戳我干嘛?快喝水',
58 | '戳戳戳,就知道戳我,快去写BUG',
59 | '一杯茶,一包烟,一个BUG改一天',
60 | '忙一天了,去摸鱼办看看热搜新鲜事儿',
61 | '世上无难事,只要肯放弃',
62 | '只要思想不滑坡,办法总比困难多',
63 | '起来扭扭腰,动动脖吧',
64 | '我是一只小黄鸭,天大地大我最大',
65 | '嘘!老板在你身后盯着你呢',
66 | '我不想变烤鸭!呜呜呜~',
67 | ]
68 | const num = Math.floor(Math.random() * sayList.length) || 0
69 | totalText(sayList[num])
70 | }
71 | // 显示弹层
72 | $('#setupId').on('click', function () {
73 | const {
74 | duration = '1800',
75 | title = '快喝水~',
76 | content = '已经很久没喝水了,变烤鸭啦~',
77 | btnleft = '马上喝',
78 | btnright = '我偏不'
79 | } = getLoacl({ key: 'setUp' }) || {}
80 | $('#formTime').val(duration)
81 | $('#formTitle').val(title)
82 | $('#formCon').val(content)
83 | $('#formLeftBtn').val(btnleft)
84 | $('#formRightBtn').val(btnright)
85 | $('#modalSetId').fadeIn()
86 | })
87 |
88 | // 暂停时间
89 | $('#suspendTimeId').on('click', function () {
90 | $('#maxBoxId').toggleClass('backwack')
91 | const flag = $('#maxBoxId').hasClass('backwack')
92 | BG.changeTime(flag)
93 | flag ? totalText('黑魔法让时间暂停了') : totalText('时间恢复,快乐喝水吧~')
94 | })
95 | // 轻提示
96 | let timeOut = null
97 | function totalText(text = '温馨提示') {
98 | $('#msgtextId').text(text)
99 | $('#msgtextId').fadeIn()
100 | clearTimeout(timeOut)
101 | timeOut = setTimeout(() => {
102 | $('#msgtextId').fadeOut()
103 | }, 3000);
104 | }
105 | // 查询当前tab是否在掘金文章页
106 | function getCurrentTab(fun){
107 | chrome.tabs.query({ active: true, currentWindow: true }, function (tab) {
108 | const item = tab[0]
109 | if(item.url.includes('https://juejin.cn/post')){
110 | fun(tab[0])
111 | }else{
112 | totalText('请在掘金文章详情页操作哟~')
113 | }
114 | })
115 | }
116 | // 换肤、触发juejin.js 换肤方法
117 | $('#changeSkinId').on('click', function () {
118 | getCurrentTab(function(){
119 | $("#skinModalId").slideToggle(100)
120 | const chex = BG.getHasAudioMute()
121 | const opt = localStorage.getItem('bardOpacity')
122 | $('#muteModelId').attr('checked', chex)
123 | $('#rangeId').val(opt)
124 | })
125 | })
126 | $('#skinModalId').on('click', '.btn-box', function(){
127 | const type = $(this).attr('data-type')
128 | BG.changeAudio({skin:type})
129 | const local = BG.getBgLoacl({key: 'skinType', isObj: false})
130 | chrome.tabs.query({ active: true, currentWindow: true }, function (tab) {
131 | chrome.tabs.sendMessage(tab[0].id, {
132 | actionType:'changeBgm',
133 | skinType:local
134 | });
135 | });
136 | })
137 | // 设置播放图标状态
138 | function setPausedIcon(){
139 | const status = BG.getPaused()
140 | if(!status){
141 | $('#bgmIconId').addClass('bgm-loading')
142 | }else{
143 | $('#bgmIconId').removeClass('bgm-loading')
144 | }
145 | }
146 | setPausedIcon()
147 | // 控制背景音乐播放,暂停
148 | $('body').on('click','#bgmIconId',function(){
149 | getCurrentTab(function(){
150 | BG.togglePalyBgm()
151 | setPausedIcon()
152 | })
153 | })
154 | // 控制文章背景透明度
155 | $('body').on('change','#rangeId',function(){
156 | const val = $(this).val()
157 | localStorage.setItem('bardOpacity', val)
158 | chrome.tabs.query({ active: true, currentWindow: true }, function (tab) {
159 | chrome.tabs.sendMessage(tab[0].id, {
160 | actionType:'changeBard',
161 | val
162 | });
163 | });
164 | })
165 | // 设置静音模式
166 | $('body').on('change', '#muteModelId', function(){
167 | const val = $(this).is(':checked')
168 | if(val){
169 | $('#bgmIconId').removeClass('bgm-loading')
170 | BG.removeAudio()
171 | }else{
172 | $('#bgmIconId').addClass('bgm-loading')
173 | }
174 | BG.setPlayModel(val)
175 | })
176 | // 切换popup背景图片
177 | const imgList = [
178 | '../img/popupBgimg/bgimg-0.jpg',
179 | '../img/popupBgimg/bgimg-1.jpg',
180 | '../img/popupBgimg/bgimg-2.jpg',
181 | '../img/popupBgimg/bgimg-3.jpg',
182 | '../img/popupBgimg/bgimg-4.jpg',
183 | '../img/popupBgimg/bgimg-5.jpg',
184 | '../img/popupBgimg/bgimg-6.jpg',
185 | '../img/popupBgimg/bgimg-7.jpg',
186 | '../img/popupBgimg/bgimg-8.jpg',
187 | '../img/popupBgimg/bgimg-9.jpg',
188 | '../img/popupBgimg/bgimg-10.jpg',
189 | '../img/popupBgimg/bgimg-11.jpg',
190 | ]
191 | $('body').on('click','#bgImgChangeId',fangdou(changeBgImg))
192 | function changeBgImg(){
193 | const le = imgList.length
194 | const num = Math.floor(Math.random() * le) || 0
195 | $('#maxBoxId').css('background-image',`url(${imgList[num]})`)
196 | localStorage.setItem('popupBgimg',num)
197 | }
198 | // 初始化popup背景图
199 | function initBgimg(){
200 | const num = +localStorage.getItem('popupBgimg') || 0
201 | $('#maxBoxId').css('background-image',`url(${imgList[num]})`)
202 | }
203 | initBgimg()
204 | })
205 |
206 |
--------------------------------------------------------------------------------
/js/tools.js:
--------------------------------------------------------------------------------
1 | function setLoacl({key='', val='', isObj=true}){
2 | const newVal = isObj ? JSON.stringify(val) : val
3 | localStorage.setItem(key, newVal)
4 | }
5 | function getLoacl({key='', isObj=true}){
6 | const val = localStorage.getItem(key)
7 | const newVal = isObj ? JSON.parse(val) : val
8 | return newVal
9 | }
10 | function delLoacl(key=''){
11 | localStorage.removeItem(key)
12 | }
13 | // 日期格式化
14 | function parseTime(time, cFormat) {
15 | if (arguments.length === 0 || !time) {
16 | return null
17 | }
18 | const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}'
19 | let date
20 | if (typeof time === 'object') {
21 | date = time
22 | } else {
23 | if ((typeof time === 'string')) {
24 | if ((/^[0-9]+$/.test(time))) {
25 | // support "1548221490638"
26 | time = parseInt(time)
27 | } else {
28 | // support safari
29 | // https://stackoverflow.com/questions/4310953/invalid-date-in-safari
30 | time = time.replace(new RegExp(/-/gm), '/')
31 | }
32 | }
33 |
34 | if ((typeof time === 'number') && (time.toString().length === 10)) {
35 | time = time * 1000
36 | }
37 | date = new Date(time)
38 | }
39 | const formatObj = {
40 | y: date.getFullYear(),
41 | m: date.getMonth() + 1,
42 | d: date.getDate(),
43 | h: date.getHours(),
44 | i: date.getMinutes(),
45 | s: date.getSeconds(),
46 | a: date.getDay()
47 | }
48 | const time_str = format.replace(/{([ymdhisa])+}/g, (result, key) => {
49 | const value = formatObj[key]
50 | // Note: getDay() returns 0 on Sunday
51 | if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value ] }
52 | return value.toString().padStart(2, '0')
53 | })
54 | return time_str
55 | }
56 | // 防抖
57 | function fangdou(fun, time=500){
58 | return (...arge)=>{
59 | clearTimeout(fun.id)
60 | fun.id = setTimeout(()=>{
61 | fun.apply(this, arge)
62 | }, time)
63 | }
64 | }
--------------------------------------------------------------------------------
/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "manifest_version": 2,
3 | "name": "水货",
4 | "version": "1.1.1",
5 | "description": "小鸭子叫你喝水啦~~~",
6 | "icons":{
7 | "16": "./img/icon.png",
8 | "48": "./img/icon.png",
9 | "128": "./img/icon.png"
10 | },
11 | "browser_action":{
12 | "default_icon": "./img/icon.png",
13 | "default_title": "快喝水,每天八杯水~",
14 | "default_popup": "./popup.html"
15 | },
16 | "background": {
17 | "page": "./background.html"
18 | },
19 | "permissions": [
20 | "notifications",
21 | "webRequest",
22 | "webRequestBlocking",
23 | "https://www.coderutil.com/*",
24 | "tabs"
25 | ],
26 | "content_scripts": [
27 | {
28 | "matches": ["https://juejin.cn/post/*"],
29 | "css": ["./css/juejin.css"],
30 | "js": ["./js/jquery-3.5.1.min.js","./js/juejin.js"],
31 | "run_at": "document_idle"
32 | }
33 | ]
34 | }
35 |
--------------------------------------------------------------------------------
/popup.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | 快喝水
8 |
9 |
10 |
11 |
12 |
13 |
14 |
17 |
18 |
19 |

20 |
21 |
22 |

23 |
24 |
25 |

26 |
27 |
28 |

29 |
30 |
31 |

32 |
33 |
34 |

35 |
36 |
37 |

38 |
39 |
40 |

41 |
42 |
43 |
44 |
45 |
46 |
56 |
57 |
一键还原
58 |
护眼模式
59 |
风吹麦浪
60 |
黄昏
61 |
雨爱
62 |
给我一首歌的时间
63 |
那女孩对我说
64 |
大风吹
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
--------------------------------------------------------------------------------