Merge branch 'develop' of gitee.com:bitdance-team/chrome-extension into feat-sst
							
								
								
									
										61
									
								
								README.md
									
									
									
									
									
								
							
							
						
						@@ -1,34 +1,55 @@
 | 
			
		||||
# BitDance浏览器插件
 | 
			
		||||
# 学生助手 Chrome浏览器插件
 | 
			
		||||
 | 
			
		||||
> bitdance-chrome-extension
 | 
			
		||||
## 简介 Overview
 | 
			
		||||
 | 
			
		||||
## Overview
 | 
			
		||||
本项目名为学生助手,是一个Chrome浏览器扩展插件。主要针对学生群体,提高资料检索以及日常使用的便捷性、高效性及可定制性。
 | 
			
		||||
 | 
			
		||||
xxx
 | 
			
		||||
## 链接汇总 Link Summary
 | 
			
		||||
 | 
			
		||||
## Quick Start
 | 
			
		||||
Gitee仓库:https://gitee.com/bitdance-team/chrome-extension
 | 
			
		||||
 | 
			
		||||
xxx
 | 
			
		||||
GitHub仓库:https://github.com/bitdance-team/chrome-extension
 | 
			
		||||
 | 
			
		||||
## Using
 | 
			
		||||
后台Api接口(轻服务):https://qcmma8.app.cloudendpoint.cn/api/swagger-html
 | 
			
		||||
 | 
			
		||||
xxx
 | 
			
		||||
项目文档:https://qca566.api.cloudendpoint.cn/getFile?file=doc
 | 
			
		||||
 | 
			
		||||
## Screenshots
 | 
			
		||||
项目展示PPT:https://qca566.api.cloudendpoint.cn/getFile?file=ppt
 | 
			
		||||
 | 
			
		||||
xxx
 | 
			
		||||
## 快速上手 Quick Start
 | 
			
		||||
 | 
			
		||||
## Authors
 | 
			
		||||
第一步 下载扩展包并解压:[码云下载](https://gitee.com/bitdance-team/chrome-extension/repository/archive/master.zip) [GitHub下载](https://codeload.github.com/bitdance-team/chrome-extension/zip/refs/heads/master)
 | 
			
		||||
 | 
			
		||||
- [xiaomo](https://github.com/coder-xiaomo)
 | 
			
		||||
- [xxx](xxx)
 | 
			
		||||
- [xxx](xxx)
 | 
			
		||||
- [xxx](xxx)
 | 
			
		||||
- [xxx](xxx)
 | 
			
		||||
- [xxx](xxx)
 | 
			
		||||
- [xxx](xxx)
 | 
			
		||||
第二步 打开Chrome浏览器并访问`chrome://extensions/`
 | 
			
		||||
 | 
			
		||||
## License
 | 
			
		||||
> 请确保你已经安装了谷歌浏览器。如果没有安装,[点击此处下载](https://www.google.com/intl/zh-CN/chrome/)
 | 
			
		||||
 | 
			
		||||
第三步 打开开发者模式
 | 
			
		||||
 | 
			
		||||
第四步 点击“加载已解压的扩展程序”
 | 
			
		||||
 | 
			
		||||
第五步 选择刚刚下载的压缩包的 `packages/shell-chrome` 目录即可完成安装
 | 
			
		||||
 | 
			
		||||
## 作者 Authors
 | 
			
		||||
 | 
			
		||||
[张博凯](https://github.com/coder-xiaomo)、[郑丽](https://gitee.com/zhneglili)、[郑小双](https://gitee.com/xiao_io)、张君秋、[舒诗铜](https://gitee.com/pikoyo)、张松、朱穆峰
 | 
			
		||||
 | 
			
		||||
### 分工 Division of labor
 | 
			
		||||
 | 
			
		||||
张博凯:DoubleS快捷搜索,Google广告屏蔽,代码仓库分支合并,项目Bug修复
 | 
			
		||||
 | 
			
		||||
郑小双:扩展主面板,阅读原文自动展开,鼠标样式及鼠标动效
 | 
			
		||||
 | 
			
		||||
郑丽:天气展示功能,翻译功能(使用轻服务云函数构建Api)
 | 
			
		||||
 | 
			
		||||
张君秋:网页截图功能,PPT制作
 | 
			
		||||
 | 
			
		||||
张松:确认页直接跳转功能,番茄钟
 | 
			
		||||
 | 
			
		||||
舒诗铜:轻服务后端Api(用户登录、文件上传、备忘录等),备忘录功能,仓库架构
 | 
			
		||||
 | 
			
		||||
朱穆峰:护眼模式,夜间模式
 | 
			
		||||
 | 
			
		||||
## 许可证 License
 | 
			
		||||
 | 
			
		||||
This project is licensed under the MIT License. See the [LICENSE](./LICENSE) file for the full license text.
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -9,8 +9,7 @@ a {
 | 
			
		||||
  text-decoration: none;
 | 
			
		||||
}
 | 
			
		||||
body {
 | 
			
		||||
  background: url(../image/weather/yun.webp);
 | 
			
		||||
  /* background: linear-gradient(to right bottom, #fbc2eb 0%, #a6c1ee 51%, #fbc2eb 100%); */
 | 
			
		||||
  background: linear-gradient(to right bottom, #fbc2eb 0%, #a6c1ee 51%, #fbc2eb 100%);
 | 
			
		||||
}
 | 
			
		||||
#popup {
 | 
			
		||||
  min-height: 450px;
 | 
			
		||||
@@ -18,39 +17,117 @@ body {
 | 
			
		||||
}
 | 
			
		||||
#popup header {
 | 
			
		||||
  width: inherit;
 | 
			
		||||
  height: 30px;
 | 
			
		||||
  background: linear-gradient(to right, #f6d365 0%, #fda085 51%, #f6d365 100%);
 | 
			
		||||
  height: 40px;
 | 
			
		||||
  background: #ffd13fcf;
 | 
			
		||||
}
 | 
			
		||||
#popup header img {
 | 
			
		||||
#popup header #logo {
 | 
			
		||||
  height: inherit;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* 天气的css */
 | 
			
		||||
#weather{
 | 
			
		||||
  display: inline-block;
 | 
			
		||||
#popup header #weather {
 | 
			
		||||
  float: right;
 | 
			
		||||
  height: 100%;
 | 
			
		||||
  line-height: 40px;
 | 
			
		||||
  margin-right: 10px;
 | 
			
		||||
}
 | 
			
		||||
#weatherSite{
 | 
			
		||||
  display: inline-block;
 | 
			
		||||
#popup header #weather #weatherSiteSelet {
 | 
			
		||||
  border: none;
 | 
			
		||||
  appearance: none;
 | 
			
		||||
  background: transparent;
 | 
			
		||||
}
 | 
			
		||||
#weatherText{
 | 
			
		||||
  display: inline-block
 | 
			
		||||
#popup header #weather #svg_w {
 | 
			
		||||
  height: 15px;
 | 
			
		||||
  vertical-align: text-bottom;
 | 
			
		||||
}
 | 
			
		||||
#weatherTemp{
 | 
			
		||||
  display: inline-block
 | 
			
		||||
#popup header #weather #weatherText {
 | 
			
		||||
  font-size: 13px;
 | 
			
		||||
}
 | 
			
		||||
/* 天气的css end */
 | 
			
		||||
 | 
			
		||||
#popup .article ul li {
 | 
			
		||||
  margin: 5px 0;
 | 
			
		||||
#popup header #weather #weatherTemp {
 | 
			
		||||
  font-size: 13px;
 | 
			
		||||
}
 | 
			
		||||
#popup #back {
 | 
			
		||||
  display: none;
 | 
			
		||||
  position: absolute;
 | 
			
		||||
  top: 54px;
 | 
			
		||||
  left: 10px;
 | 
			
		||||
  width: 15px;
 | 
			
		||||
  height: 15px;
 | 
			
		||||
  background-color: transparent;
 | 
			
		||||
  border-top: 2px solid #fff;
 | 
			
		||||
  border-left: 2px solid #fff;
 | 
			
		||||
  transform: rotate(-45deg);
 | 
			
		||||
  cursor: pointer;
 | 
			
		||||
}
 | 
			
		||||
#popup #article #buttons {
 | 
			
		||||
  position: relative;
 | 
			
		||||
  margin-top: 12px;
 | 
			
		||||
}
 | 
			
		||||
#popup #article #buttons #btnScreenshot,
 | 
			
		||||
#popup #article #buttons #transform {
 | 
			
		||||
  float: left;
 | 
			
		||||
  top: 1px;
 | 
			
		||||
  right: 5px;
 | 
			
		||||
  width: 90px;
 | 
			
		||||
  height: 40px;
 | 
			
		||||
  color: #fff;
 | 
			
		||||
  font-weight: 500;
 | 
			
		||||
  cursor: pointer;
 | 
			
		||||
  background-color: #71b0f3;
 | 
			
		||||
  border: none;
 | 
			
		||||
  border-radius: 4px;
 | 
			
		||||
}
 | 
			
		||||
#popup #article #buttons #btnScreenshot:hover {
 | 
			
		||||
  background-color: #6FC6FF;
 | 
			
		||||
}
 | 
			
		||||
#popup #article #buttons #btnScreenshot:active {
 | 
			
		||||
  transform: translate(0px, 1px);
 | 
			
		||||
  box-shadow: 0px 1px 0px 0px;
 | 
			
		||||
}
 | 
			
		||||
#popup #article #buttons #transform {
 | 
			
		||||
  margin-left: 10px;
 | 
			
		||||
  background-color: #71b0f3;
 | 
			
		||||
}
 | 
			
		||||
#popup #article #buttons #transform:hover {
 | 
			
		||||
  background-color: #6FC6FF;
 | 
			
		||||
}
 | 
			
		||||
#popup #article #buttons #transform:active {
 | 
			
		||||
  transform: translate(0px, 1px);
 | 
			
		||||
  box-shadow: 0px 1px 0px 0px;
 | 
			
		||||
}
 | 
			
		||||
#popup #article #buttons #clock {
 | 
			
		||||
  float: left;
 | 
			
		||||
  margin-left: 30px;
 | 
			
		||||
  margin-right: 30px;
 | 
			
		||||
  width: 42px;
 | 
			
		||||
  height: 42px;
 | 
			
		||||
  background-color: #F7BAEF;
 | 
			
		||||
  border-radius: 50%;
 | 
			
		||||
  text-align: center;
 | 
			
		||||
  line-height: 40px;
 | 
			
		||||
  cursor: pointer;
 | 
			
		||||
  font-size: 12px;
 | 
			
		||||
}
 | 
			
		||||
#popup #article #buttons #clock:active {
 | 
			
		||||
  transform: translate(0px, 1px);
 | 
			
		||||
  box-shadow: 0px 1px 0px 0px;
 | 
			
		||||
}
 | 
			
		||||
#popup #article .setting {
 | 
			
		||||
  float: left;
 | 
			
		||||
  width: 100%;
 | 
			
		||||
  margin-top: 12px;
 | 
			
		||||
}
 | 
			
		||||
#popup #article .setting ul li {
 | 
			
		||||
  margin: 7px 5px;
 | 
			
		||||
  height: 45px;
 | 
			
		||||
  background: linear-gradient(to right, #84fab0 0%, #8fd3f4 51%, #84fab0 100%);
 | 
			
		||||
  border-radius: 25px;
 | 
			
		||||
  background: #ffffffc9;
 | 
			
		||||
  padding: 0 1px 0 12px;
 | 
			
		||||
}
 | 
			
		||||
#popup .article ul li span {
 | 
			
		||||
#popup #article .setting ul li span {
 | 
			
		||||
  font-size: 16px;
 | 
			
		||||
  line-height: 45px;
 | 
			
		||||
  margin-left: 5px;
 | 
			
		||||
}
 | 
			
		||||
#popup .article ul li #click-per .button {
 | 
			
		||||
#popup #article .setting ul li .setting-item .button {
 | 
			
		||||
  position: relative;
 | 
			
		||||
  float: right;
 | 
			
		||||
  top: 6px;
 | 
			
		||||
@@ -59,7 +136,7 @@ body {
 | 
			
		||||
  height: 32px;
 | 
			
		||||
  border-radius: 100px;
 | 
			
		||||
}
 | 
			
		||||
#popup .article ul li #click-per .button .checkbox {
 | 
			
		||||
#popup #article .setting ul li .setting-item .button .checkbox {
 | 
			
		||||
  position: relative;
 | 
			
		||||
  width: 100%;
 | 
			
		||||
  height: 100%;
 | 
			
		||||
@@ -67,24 +144,24 @@ body {
 | 
			
		||||
  cursor: pointer;
 | 
			
		||||
  z-index: 3;
 | 
			
		||||
}
 | 
			
		||||
#popup .article ul li #click-per .button .knobs,
 | 
			
		||||
#popup .article ul li #click-per .button .layer {
 | 
			
		||||
#popup #article .setting ul li .setting-item .button .knobs,
 | 
			
		||||
#popup #article .setting ul li .setting-item .button .layer {
 | 
			
		||||
  position: absolute;
 | 
			
		||||
  top: 0;
 | 
			
		||||
  right: 0;
 | 
			
		||||
  bottom: 0;
 | 
			
		||||
  left: 0;
 | 
			
		||||
}
 | 
			
		||||
#popup .article ul li #click-per .button .knobs {
 | 
			
		||||
#popup #article .setting ul li .setting-item .button .knobs {
 | 
			
		||||
  z-index: 2;
 | 
			
		||||
}
 | 
			
		||||
#popup .article ul li #click-per .button .layer {
 | 
			
		||||
#popup #article .setting ul li .setting-item .button .layer {
 | 
			
		||||
  border-radius: 100px;
 | 
			
		||||
  width: 100%;
 | 
			
		||||
  background-color: #ebf7fc;
 | 
			
		||||
  z-index: 1;
 | 
			
		||||
}
 | 
			
		||||
#popup .article ul li #click-per .button .knobs::before {
 | 
			
		||||
#popup #article .setting ul li .setting-item .button .knobs::before {
 | 
			
		||||
  content: "YES";
 | 
			
		||||
  position: absolute;
 | 
			
		||||
  top: 2px;
 | 
			
		||||
@@ -100,79 +177,16 @@ body {
 | 
			
		||||
  background-color: #03a9f4;
 | 
			
		||||
  border-radius: 50%;
 | 
			
		||||
}
 | 
			
		||||
#popup .article ul li #click-per .button .checkbox:checked + .knobs:before {
 | 
			
		||||
#popup #article .setting ul li .setting-item .button .checkbox:checked + .knobs:before {
 | 
			
		||||
  content: "NO";
 | 
			
		||||
  left: 3px;
 | 
			
		||||
  background-color: #f44336;
 | 
			
		||||
}
 | 
			
		||||
#popup .article ul li #click-per .button .checkbox:checked ~ .layer {
 | 
			
		||||
#popup #article .setting ul li .setting-item .button .checkbox:checked ~ .layer {
 | 
			
		||||
  background-color: #fcebeb;
 | 
			
		||||
}
 | 
			
		||||
#popup .article ul li #click-per .button .knobs,
 | 
			
		||||
#popup .article ul li #click-per .button .knobs:before,
 | 
			
		||||
#popup .article ul li #click-per .button .layer {
 | 
			
		||||
  transition: 0.3s ease all;
 | 
			
		||||
}
 | 
			
		||||
#popup .article ul li #mouse-style .button {
 | 
			
		||||
  position: relative;
 | 
			
		||||
  float: right;
 | 
			
		||||
  top: 6px;
 | 
			
		||||
  right: 6px;
 | 
			
		||||
  width: 66px;
 | 
			
		||||
  height: 32px;
 | 
			
		||||
  border-radius: 100px;
 | 
			
		||||
}
 | 
			
		||||
#popup .article ul li #mouse-style .button .checkbox {
 | 
			
		||||
  position: relative;
 | 
			
		||||
  width: 100%;
 | 
			
		||||
  height: 100%;
 | 
			
		||||
  opacity: 0;
 | 
			
		||||
  cursor: pointer;
 | 
			
		||||
  z-index: 3;
 | 
			
		||||
}
 | 
			
		||||
#popup .article ul li #mouse-style .button .knobs,
 | 
			
		||||
#popup .article ul li #mouse-style .button .layer {
 | 
			
		||||
  position: absolute;
 | 
			
		||||
  top: 0;
 | 
			
		||||
  right: 0;
 | 
			
		||||
  bottom: 0;
 | 
			
		||||
  left: 0;
 | 
			
		||||
}
 | 
			
		||||
#popup .article ul li #mouse-style .button .knobs {
 | 
			
		||||
  z-index: 2;
 | 
			
		||||
}
 | 
			
		||||
#popup .article ul li #mouse-style .button .layer {
 | 
			
		||||
  border-radius: 100px;
 | 
			
		||||
  width: 100%;
 | 
			
		||||
  background-color: #ebf7fc;
 | 
			
		||||
  z-index: 1;
 | 
			
		||||
}
 | 
			
		||||
#popup .article ul li #mouse-style .button .knobs::before {
 | 
			
		||||
  content: "YES";
 | 
			
		||||
  position: absolute;
 | 
			
		||||
  top: 2px;
 | 
			
		||||
  left: 34px;
 | 
			
		||||
  width: 20px;
 | 
			
		||||
  height: 10px;
 | 
			
		||||
  color: #fff;
 | 
			
		||||
  font-size: 10px;
 | 
			
		||||
  font-weight: bold;
 | 
			
		||||
  text-align: center;
 | 
			
		||||
  line-height: 1;
 | 
			
		||||
  padding: 9px 4px;
 | 
			
		||||
  background-color: #03a9f4;
 | 
			
		||||
  border-radius: 50%;
 | 
			
		||||
}
 | 
			
		||||
#popup .article ul li #mouse-style .button .checkbox:checked + .knobs:before {
 | 
			
		||||
  content: "NO";
 | 
			
		||||
  left: 3px;
 | 
			
		||||
  background-color: #f44336;
 | 
			
		||||
}
 | 
			
		||||
#popup .article ul li #mouse-style .button .checkbox:checked ~ .layer {
 | 
			
		||||
  background-color: #fcebeb;
 | 
			
		||||
}
 | 
			
		||||
#popup .article ul li #mouse-style .button .knobs,
 | 
			
		||||
#popup .article ul li #mouse-style .button .knobs:before,
 | 
			
		||||
#popup .article ul li #mouse-style .button .layer {
 | 
			
		||||
#popup #article .setting ul li .setting-item .button .knobs,
 | 
			
		||||
#popup #article .setting ul li .setting-item .button .knobs:before,
 | 
			
		||||
#popup #article .setting ul li .setting-item .button .layer {
 | 
			
		||||
  transition: 0.3s ease all;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -19,150 +19,184 @@ body {
 | 
			
		||||
    width: 300px;
 | 
			
		||||
    header{
 | 
			
		||||
        width: inherit;
 | 
			
		||||
        height: 30px;
 | 
			
		||||
        background: linear-gradient(to right, #f6d365 0%, #fda085 51%, #f6d365 100%);;
 | 
			
		||||
        img {
 | 
			
		||||
        height: 40px;
 | 
			
		||||
        background: #ffd13fcf;
 | 
			
		||||
        #logo {
 | 
			
		||||
            height: inherit;
 | 
			
		||||
        }
 | 
			
		||||
        #weather{
 | 
			
		||||
            float: right;
 | 
			
		||||
            height: 100%;
 | 
			
		||||
            line-height: 40px;
 | 
			
		||||
            margin-right: 10px;
 | 
			
		||||
            #weatherSiteSelet {
 | 
			
		||||
                border: none;
 | 
			
		||||
                appearance:none;
 | 
			
		||||
                background: transparent
 | 
			
		||||
            }
 | 
			
		||||
            // #weatherSite{
 | 
			
		||||
            //     font-size: 13px;
 | 
			
		||||
            //     margin-right: 5px;
 | 
			
		||||
            // }
 | 
			
		||||
            #svg_w{
 | 
			
		||||
                height: 15px;
 | 
			
		||||
                vertical-align: text-bottom;
 | 
			
		||||
            }
 | 
			
		||||
            #weatherText{
 | 
			
		||||
                font-size: 13px;
 | 
			
		||||
            }
 | 
			
		||||
            #weatherTemp{
 | 
			
		||||
                font-size: 13px;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    .article{
 | 
			
		||||
        ul{
 | 
			
		||||
            li{
 | 
			
		||||
                margin: 5px 0;
 | 
			
		||||
                height: 45px;
 | 
			
		||||
                background: linear-gradient(to right, #84fab0 0%, #8fd3f4 51%, #84fab0 100%);
 | 
			
		||||
                span{
 | 
			
		||||
                    font-size: 16px;
 | 
			
		||||
                    line-height: 45px;
 | 
			
		||||
                    margin-left: 5px;
 | 
			
		||||
                }
 | 
			
		||||
                #click-per{
 | 
			
		||||
                    .button {
 | 
			
		||||
                        position: relative;
 | 
			
		||||
                        float: right;
 | 
			
		||||
                        top: 6px;
 | 
			
		||||
                        right: 6px;
 | 
			
		||||
                        width: 66px;
 | 
			
		||||
                        height: 32px;
 | 
			
		||||
                        border-radius: 100px;
 | 
			
		||||
                        .checkbox {
 | 
			
		||||
                            position: relative;
 | 
			
		||||
                            width: 100%;
 | 
			
		||||
                            height: 100%;
 | 
			
		||||
                            opacity: 0;
 | 
			
		||||
                            cursor: pointer;
 | 
			
		||||
                            z-index: 3;
 | 
			
		||||
                        }
 | 
			
		||||
                        .knobs,
 | 
			
		||||
                        .layer {
 | 
			
		||||
                            position: absolute;
 | 
			
		||||
                            top: 0;
 | 
			
		||||
                            right: 0;
 | 
			
		||||
                            bottom: 0;
 | 
			
		||||
                            left: 0;
 | 
			
		||||
                        }
 | 
			
		||||
                        .knobs {
 | 
			
		||||
                            z-index: 2;
 | 
			
		||||
                        }
 | 
			
		||||
                        .layer{
 | 
			
		||||
                            border-radius: 100px;
 | 
			
		||||
                            width: 100%;
 | 
			
		||||
                            background-color: #ebf7fc;
 | 
			
		||||
                            z-index: 1;
 | 
			
		||||
                        }
 | 
			
		||||
                        .knobs::before {
 | 
			
		||||
                            content: "YES";
 | 
			
		||||
                            position: absolute;
 | 
			
		||||
                            top: 2px;
 | 
			
		||||
                            left: 34px;
 | 
			
		||||
                            width: 20px;
 | 
			
		||||
                            height: 10px;
 | 
			
		||||
                            color: #fff;
 | 
			
		||||
                            font-size: 10px;
 | 
			
		||||
                            font-weight: bold;
 | 
			
		||||
                            text-align: center;
 | 
			
		||||
                            line-height: 1;
 | 
			
		||||
                            padding: 9px 4px;
 | 
			
		||||
                            background-color: #03a9f4;
 | 
			
		||||
                            border-radius: 50%;
 | 
			
		||||
                        }
 | 
			
		||||
                        .checkbox:checked+.knobs:before {
 | 
			
		||||
                            content: "NO";
 | 
			
		||||
                            left: 3px;
 | 
			
		||||
                            background-color: #f44336;
 | 
			
		||||
                        }
 | 
			
		||||
                        .checkbox:checked~.layer {
 | 
			
		||||
                            background-color: #fcebeb;
 | 
			
		||||
                        }
 | 
			
		||||
                        .knobs,
 | 
			
		||||
                        .knobs:before,
 | 
			
		||||
                        .layer{
 | 
			
		||||
                            transition: 0.3s ease all;
 | 
			
		||||
                        }
 | 
			
		||||
    #back {
 | 
			
		||||
        display: none;
 | 
			
		||||
        position: absolute;
 | 
			
		||||
        top: 54px;
 | 
			
		||||
        left: 10px;
 | 
			
		||||
        width: 15px;
 | 
			
		||||
        height: 15px;
 | 
			
		||||
        background-color: transparent;
 | 
			
		||||
        border-top: 2px solid #fff;
 | 
			
		||||
        border-left: 2px solid #fff;
 | 
			
		||||
        transform: rotate(-45deg);
 | 
			
		||||
        cursor: pointer;
 | 
			
		||||
    }
 | 
			
		||||
    #article{
 | 
			
		||||
        #buttons{
 | 
			
		||||
            position: relative;
 | 
			
		||||
            margin-top: 12px;
 | 
			
		||||
            #btnScreenshot,
 | 
			
		||||
            #transform{
 | 
			
		||||
                float: left;
 | 
			
		||||
                top: 1px;
 | 
			
		||||
                right: 5px;
 | 
			
		||||
                width: 90px;
 | 
			
		||||
                height: 40px;
 | 
			
		||||
                color: #fff;
 | 
			
		||||
                font-weight: 500;
 | 
			
		||||
                cursor: pointer;
 | 
			
		||||
                background-color: #71b0f3;
 | 
			
		||||
                border: none;
 | 
			
		||||
                border-radius: 4px;
 | 
			
		||||
            }
 | 
			
		||||
            #btnScreenshot:hover{
 | 
			
		||||
                background-color: #6FC6FF;
 | 
			
		||||
            }
 | 
			
		||||
            #btnScreenshot:active{
 | 
			
		||||
                transform: translate(0px, 1px);
 | 
			
		||||
                box-shadow: 0px 1px 0px 0px;
 | 
			
		||||
            }
 | 
			
		||||
            #transform{
 | 
			
		||||
                margin-left: 10px;
 | 
			
		||||
                background-color: #71b0f3;
 | 
			
		||||
            }
 | 
			
		||||
            #transform:hover{
 | 
			
		||||
                background-color: #6FC6FF;
 | 
			
		||||
             }
 | 
			
		||||
             #transform:active{
 | 
			
		||||
                transform: translate(0px, 1px);
 | 
			
		||||
                box-shadow: 0px 1px 0px 0px;
 | 
			
		||||
             }
 | 
			
		||||
            #clock{
 | 
			
		||||
                float: left;
 | 
			
		||||
                margin-left: 30px;
 | 
			
		||||
                margin-right: 30px;
 | 
			
		||||
                width: 42px;
 | 
			
		||||
                height: 42px;
 | 
			
		||||
                background-color: #F7BAEF;
 | 
			
		||||
                border-radius: 50%;
 | 
			
		||||
                text-align: center;
 | 
			
		||||
                line-height: 40px;
 | 
			
		||||
                cursor: pointer;
 | 
			
		||||
                font-size: 12px;
 | 
			
		||||
            }
 | 
			
		||||
            #clock:active{
 | 
			
		||||
                transform: translate(0px, 1px);
 | 
			
		||||
                box-shadow: 0px 1px 0px 0px;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        .setting{
 | 
			
		||||
            float: left;
 | 
			
		||||
            width: 100%;
 | 
			
		||||
            margin-top: 12px;
 | 
			
		||||
            // opacity: 0.5;
 | 
			
		||||
            ul{
 | 
			
		||||
                li{
 | 
			
		||||
                    margin: 7px 5px;
 | 
			
		||||
                    height: 45px;
 | 
			
		||||
                    border-radius: 25px;
 | 
			
		||||
                    background: #ffffffc9;
 | 
			
		||||
                    padding: 0 1px 0 12px;
 | 
			
		||||
                    span{
 | 
			
		||||
                        font-size: 16px;
 | 
			
		||||
                        line-height: 45px;
 | 
			
		||||
                        margin-left: 5px;
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
                #mouse-style{
 | 
			
		||||
                    .button {
 | 
			
		||||
                        position: relative;
 | 
			
		||||
                        float: right;
 | 
			
		||||
                        top: 6px;
 | 
			
		||||
                        right: 6px;
 | 
			
		||||
                        width: 66px;
 | 
			
		||||
                        height: 32px;
 | 
			
		||||
                        border-radius: 100px;
 | 
			
		||||
                        .checkbox {
 | 
			
		||||
                    .setting-item {
 | 
			
		||||
                        .button {
 | 
			
		||||
                            position: relative;
 | 
			
		||||
                            width: 100%;
 | 
			
		||||
                            height: 100%;
 | 
			
		||||
                            opacity: 0;
 | 
			
		||||
                            cursor: pointer;
 | 
			
		||||
                            z-index: 3;
 | 
			
		||||
                        }
 | 
			
		||||
                        .knobs,
 | 
			
		||||
                        .layer {
 | 
			
		||||
                            position: absolute;
 | 
			
		||||
                            top: 0;
 | 
			
		||||
                            right: 0;
 | 
			
		||||
                            bottom: 0;
 | 
			
		||||
                            left: 0;
 | 
			
		||||
                        }
 | 
			
		||||
                        .knobs {
 | 
			
		||||
                            z-index: 2;
 | 
			
		||||
                        }
 | 
			
		||||
                        .layer{
 | 
			
		||||
                            float: right;
 | 
			
		||||
                            top: 6px;
 | 
			
		||||
                            right: 6px;
 | 
			
		||||
                            width: 66px;
 | 
			
		||||
                            height: 32px;
 | 
			
		||||
                            border-radius: 100px;
 | 
			
		||||
                            width: 100%;
 | 
			
		||||
                            background-color: #ebf7fc;
 | 
			
		||||
                            z-index: 1;
 | 
			
		||||
                        }
 | 
			
		||||
                        .knobs::before {
 | 
			
		||||
                            content: "YES";
 | 
			
		||||
                            position: absolute;
 | 
			
		||||
                            top: 2px;
 | 
			
		||||
                            left: 34px;
 | 
			
		||||
                            width: 20px;
 | 
			
		||||
                            height: 10px;
 | 
			
		||||
                            color: #fff;
 | 
			
		||||
                            font-size: 10px;
 | 
			
		||||
                            font-weight: bold;
 | 
			
		||||
                            text-align: center;
 | 
			
		||||
                            line-height: 1;
 | 
			
		||||
                            padding: 9px 4px;
 | 
			
		||||
                            background-color: #03a9f4;
 | 
			
		||||
                            border-radius: 50%;
 | 
			
		||||
                        }
 | 
			
		||||
                        .checkbox:checked+.knobs:before {
 | 
			
		||||
                            content: "NO";
 | 
			
		||||
                            left: 3px;
 | 
			
		||||
                            background-color: #f44336;
 | 
			
		||||
                        }
 | 
			
		||||
                        .checkbox:checked~.layer {
 | 
			
		||||
                            background-color: #fcebeb;
 | 
			
		||||
                        }
 | 
			
		||||
                        .knobs,
 | 
			
		||||
                        .knobs:before,
 | 
			
		||||
                        .layer{
 | 
			
		||||
                            transition: 0.3s ease all;
 | 
			
		||||
                            .checkbox {
 | 
			
		||||
                                position: relative;
 | 
			
		||||
                                width: 100%;
 | 
			
		||||
                                height: 100%;
 | 
			
		||||
                                opacity: 0;
 | 
			
		||||
                                cursor: pointer;
 | 
			
		||||
                                z-index: 3;
 | 
			
		||||
                            }
 | 
			
		||||
                            .knobs,
 | 
			
		||||
                            .layer {
 | 
			
		||||
                                position: absolute;
 | 
			
		||||
                                top: 0;
 | 
			
		||||
                                right: 0;
 | 
			
		||||
                                bottom: 0;
 | 
			
		||||
                                left: 0;
 | 
			
		||||
                            }
 | 
			
		||||
                            .knobs {
 | 
			
		||||
                                z-index: 2;
 | 
			
		||||
                            }
 | 
			
		||||
                            .layer{
 | 
			
		||||
                                border-radius: 100px;
 | 
			
		||||
                                width: 100%;
 | 
			
		||||
                                background-color: #ebf7fc;
 | 
			
		||||
                                z-index: 1;
 | 
			
		||||
                            }
 | 
			
		||||
                            .knobs::before {
 | 
			
		||||
                                content: "YES";
 | 
			
		||||
                                position: absolute;
 | 
			
		||||
                                top: 2px;
 | 
			
		||||
                                left: 34px;
 | 
			
		||||
                                width: 20px;
 | 
			
		||||
                                height: 10px;
 | 
			
		||||
                                color: #fff;
 | 
			
		||||
                                font-size: 10px;
 | 
			
		||||
                                font-weight: bold;
 | 
			
		||||
                                text-align: center;
 | 
			
		||||
                                line-height: 1;
 | 
			
		||||
                                padding: 9px 4px;
 | 
			
		||||
                                background-color: #03a9f4;
 | 
			
		||||
                                border-radius: 50%;
 | 
			
		||||
                            }
 | 
			
		||||
                            .checkbox:checked+.knobs:before {
 | 
			
		||||
                                content: "NO";
 | 
			
		||||
                                left: 3px;
 | 
			
		||||
                                background-color: #f44336;
 | 
			
		||||
                            }
 | 
			
		||||
                            .checkbox:checked~.layer {
 | 
			
		||||
                                background-color: #fcebeb;
 | 
			
		||||
                            }
 | 
			
		||||
                            .knobs,
 | 
			
		||||
                            .knobs:before,
 | 
			
		||||
                            .layer{
 | 
			
		||||
                                transition: 0.3s ease all;
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
 
 | 
			
		||||
@@ -1,15 +1,81 @@
 | 
			
		||||
#inputLang{
 | 
			
		||||
    width: 250px;
 | 
			
		||||
    height: 150px;
 | 
			
		||||
*{
 | 
			
		||||
    margin: 0;
 | 
			
		||||
    padding: 0;
 | 
			
		||||
  }
 | 
			
		||||
#trans{
 | 
			
		||||
  width: 280px;
 | 
			
		||||
  height: 540px;
 | 
			
		||||
  float: left;
 | 
			
		||||
  margin-left: 10px;
 | 
			
		||||
  background-color: rgb(251, 252, 250);
 | 
			
		||||
  border:2px solid rgb(251, 252, 250);
 | 
			
		||||
  border-radius:25px ;
 | 
			
		||||
}
 | 
			
		||||
#outPutRes{
 | 
			
		||||
    width: 250px;
 | 
			
		||||
    height: 150px;
 | 
			
		||||
    background-color: rgb(243, 243, 243);
 | 
			
		||||
#trans_header{
 | 
			
		||||
  width: 300px;
 | 
			
		||||
  height: 40px;
 | 
			
		||||
  background-color:#06abf8;
 | 
			
		||||
  margin-left: -14px;
 | 
			
		||||
  margin-top: -4px;
 | 
			
		||||
  border:2px solid #06abf8;
 | 
			
		||||
  border-radius:25px 25px 0px 0px;
 | 
			
		||||
  text-align: center;
 | 
			
		||||
  line-height: 40px;
 | 
			
		||||
  font-size: 20px;
 | 
			
		||||
  color: azure;
 | 
			
		||||
  font-weight:bold
 | 
			
		||||
}
 | 
			
		||||
#deleteTrans{
 | 
			
		||||
  width: 25px;
 | 
			
		||||
  height: 25px;
 | 
			
		||||
  background-color: azure;
 | 
			
		||||
  font-size: 15px;
 | 
			
		||||
  color: rgb(161, 165, 165);
 | 
			
		||||
  border:2px solid #06abf8;
 | 
			
		||||
  border-radius:25px;
 | 
			
		||||
  float: right;
 | 
			
		||||
  margin-top: 8px;
 | 
			
		||||
  margin-right: 10px;
 | 
			
		||||
}
 | 
			
		||||
.LangSelectCss{
 | 
			
		||||
width: 120px;
 | 
			
		||||
height: 30px;
 | 
			
		||||
text-align: center;
 | 
			
		||||
line-height: 40px;
 | 
			
		||||
border:none
 | 
			
		||||
}
 | 
			
		||||
.LangSelectCssOption{
 | 
			
		||||
  border: none;
 | 
			
		||||
}
 | 
			
		||||
#inputLang{
 | 
			
		||||
  margin-top:3px;
 | 
			
		||||
  width: 275px;
 | 
			
		||||
  height: 170px;
 | 
			
		||||
  margin-bottom: 10px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#middleTans{
 | 
			
		||||
  font-size: 15px;
 | 
			
		||||
  margin-bottom: 5px;
 | 
			
		||||
}
 | 
			
		||||
#LangType{
 | 
			
		||||
    display: inline-block
 | 
			
		||||
    display: inline-block;
 | 
			
		||||
    line-height: 30px;
 | 
			
		||||
}
 | 
			
		||||
#tranbtn{
 | 
			
		||||
    display: inline-block
 | 
			
		||||
}
 | 
			
		||||
    width: 70px;
 | 
			
		||||
    height: 30px;
 | 
			
		||||
    display: inline-block;
 | 
			
		||||
    float: right;
 | 
			
		||||
    margin-right:15px;
 | 
			
		||||
    background-color: #06abf8;
 | 
			
		||||
    font-size: 18px;
 | 
			
		||||
    border:2px solid #06abf8;
 | 
			
		||||
    border-radius:10px;
 | 
			
		||||
    color: azure;
 | 
			
		||||
}
 | 
			
		||||
#outPutRes{
 | 
			
		||||
    width: 280px;
 | 
			
		||||
    height: 230px;
 | 
			
		||||
    overflow:auto;
 | 
			
		||||
 }
 | 
			
		||||
 
 | 
			
		||||
@@ -1,12 +1,15 @@
 | 
			
		||||
@import url('https://fonts.googleapis.com/css2?family=Fira+Sans:wght@400;500&display=swap');
 | 
			
		||||
@import url('https://fonts.googleapis.com/css2?family=Source+Sans+Pro&display=swap');
 | 
			
		||||
 | 
			
		||||
html {
 | 
			
		||||
  height: 100%;
 | 
			
		||||
}
 | 
			
		||||
body {
 | 
			
		||||
    /* background-color: rgb(51, 11, 116); */
 | 
			
		||||
    background: url(../../images/pomo_green.jpeg) no-repeat;
 | 
			
		||||
    background-image: "../../";
 | 
			
		||||
    background-size: cover;
 | 
			
		||||
    /* background-image: "../../"; */
 | 
			
		||||
    /* color: white; */
 | 
			
		||||
    font-family: 'Source Sans Pro','Fira Sans', sans-serif;
 | 
			
		||||
    font-family: 'Source Sans Pro', 'Fira Sans', sans-serif;
 | 
			
		||||
    margin: 0;
 | 
			
		||||
    padding: 0;
 | 
			
		||||
    /* width: 280px; */
 | 
			
		||||
@@ -19,6 +22,63 @@ body {
 | 
			
		||||
    padding: 10px 0 20px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#left {
 | 
			
		||||
    position: absolute;
 | 
			
		||||
    width: 25px;
 | 
			
		||||
    height: 45px;
 | 
			
		||||
    top: 180px;
 | 
			
		||||
    left: 0;
 | 
			
		||||
    border-top-right-radius: 10px;
 | 
			
		||||
    border-bottom-right-radius: 10px;
 | 
			
		||||
    opacity: 0.5;
 | 
			
		||||
    cursor: pointer;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#left:hover {
 | 
			
		||||
    background-color: #b4b2b2;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#left::before {
 | 
			
		||||
    position: absolute;
 | 
			
		||||
    content: "";
 | 
			
		||||
    top: 12px;
 | 
			
		||||
    left: 5px;
 | 
			
		||||
    width: 15px;
 | 
			
		||||
    height: 15px;
 | 
			
		||||
    border-top: 2px solid #bbb9b7;
 | 
			
		||||
    border-left: 2px solid #bbb9b7;
 | 
			
		||||
    transform: rotate(-45deg);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#right {
 | 
			
		||||
    position: absolute;
 | 
			
		||||
    width: 25px;
 | 
			
		||||
    height: 45px;
 | 
			
		||||
    top: 180px;
 | 
			
		||||
    right: 0;
 | 
			
		||||
    border-top-left-radius: 10px;
 | 
			
		||||
    border-bottom-left-radius: 10px;
 | 
			
		||||
    opacity: 0.8;
 | 
			
		||||
    cursor: pointer;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#right:hover {
 | 
			
		||||
    background-color: #b4b2b2;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#right::after {
 | 
			
		||||
    z-index: 9999;
 | 
			
		||||
    position: absolute;
 | 
			
		||||
    content: "";
 | 
			
		||||
    top: 12px;
 | 
			
		||||
    right: 5px;
 | 
			
		||||
    width: 15px;
 | 
			
		||||
    height: 15px;
 | 
			
		||||
    border-top: 2px solid #585551;
 | 
			
		||||
    border-right: 2px solid #585551;
 | 
			
		||||
    transform: rotate(45deg);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.buttons {
 | 
			
		||||
    width: fit-content;
 | 
			
		||||
    margin: auto;
 | 
			
		||||
@@ -26,7 +86,7 @@ body {
 | 
			
		||||
    color: rgb(169, 172, 172);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.buttons .slider{
 | 
			
		||||
.buttons .slider {
 | 
			
		||||
    color: rgb(247, 226, 230);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -37,7 +97,9 @@ body {
 | 
			
		||||
    padding: 8px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*计数部分*/
 | 
			
		||||
 | 
			
		||||
#countdown {
 | 
			
		||||
    clear: both;
 | 
			
		||||
    width: fit-content;
 | 
			
		||||
@@ -48,12 +110,13 @@ body {
 | 
			
		||||
    color: aliceblue;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#countdown span{
 | 
			
		||||
#countdown span {
 | 
			
		||||
    opacity: 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#start-btn,#end-btn,#reset-btn {
 | 
			
		||||
#start-btn,
 | 
			
		||||
#end-btn,
 | 
			
		||||
#reset-btn {
 | 
			
		||||
    /* 文字颜色 */
 | 
			
		||||
    color: #f5e4b9;
 | 
			
		||||
    /* 清除背景色 */
 | 
			
		||||
@@ -71,24 +134,26 @@ body {
 | 
			
		||||
    /* width: 40px; */
 | 
			
		||||
    font-size: 16px;
 | 
			
		||||
    margin: 4px 2px;
 | 
			
		||||
    -webkit-transition-duration: 0.4s; /* Safari */
 | 
			
		||||
    -webkit-transition-duration: 0.4s;
 | 
			
		||||
    /* Safari */
 | 
			
		||||
    transition-duration: 0.4s;
 | 
			
		||||
    cursor: pointer;
 | 
			
		||||
    text-decoration: none;
 | 
			
		||||
    text-transform: uppercase;
 | 
			
		||||
 | 
			
		||||
    text-shadow: 1px 1px 1px rgba(255,255,255, .1);
 | 
			
		||||
     border-radius: 25px;
 | 
			
		||||
     box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    text-shadow: 1px 1px 1px rgba(255, 255, 255, .1);
 | 
			
		||||
    border-radius: 25px;
 | 
			
		||||
    box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#start-btn {
 | 
			
		||||
    background-color: white;
 | 
			
		||||
    color: black;
 | 
			
		||||
    border: 1px solid #f5e4b9;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/* 悬停样式 */
 | 
			
		||||
 | 
			
		||||
#start-btn:hover {
 | 
			
		||||
    background-color: #f5e4b9;
 | 
			
		||||
    color: white;
 | 
			
		||||
@@ -100,12 +165,16 @@ body {
 | 
			
		||||
    border: 1px solid #ECB390;
 | 
			
		||||
    display: none;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/* 悬停样式 */
 | 
			
		||||
 | 
			
		||||
#end-btn:hover {
 | 
			
		||||
    background-color: #ECB390;
 | 
			
		||||
    color: white;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/* #end-btn{
 | 
			
		||||
    width: 40px;
 | 
			
		||||
    margin: 10px auto 0;
 | 
			
		||||
@@ -115,6 +184,7 @@ body {
 | 
			
		||||
    cursor: pointer;
 | 
			
		||||
} */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/* #reset-btn {
 | 
			
		||||
    width: 40px;
 | 
			
		||||
    margin: 10px auto 0;
 | 
			
		||||
@@ -129,7 +199,10 @@ body {
 | 
			
		||||
    color: black;
 | 
			
		||||
    border: 1px solid #DD4A48;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/* 悬停样式 */
 | 
			
		||||
 | 
			
		||||
#reset-btn:hover {
 | 
			
		||||
    background-color: #DD4A48;
 | 
			
		||||
    color: white;
 | 
			
		||||
@@ -141,13 +214,13 @@ body {
 | 
			
		||||
    display: none;
 | 
			
		||||
} */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*选中的按钮*/
 | 
			
		||||
 | 
			
		||||
.selected {
 | 
			
		||||
    background-color: rgb(244, 242, 248);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
ul {
 | 
			
		||||
    padding: 0;
 | 
			
		||||
}
 | 
			
		||||
@@ -164,12 +237,11 @@ li {
 | 
			
		||||
    float: right;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
.hide {
 | 
			
		||||
    display: none;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
footer .settings{
 | 
			
		||||
footer .settings {
 | 
			
		||||
    position: absolute;
 | 
			
		||||
    bottom: 5px;
 | 
			
		||||
    right: 5px;
 | 
			
		||||
 
 | 
			
		||||
@@ -17,121 +17,117 @@ let pomodoro = "pomodoro";
 | 
			
		||||
 | 
			
		||||
//番茄钟按钮-绑定事件
 | 
			
		||||
document.addEventListener("click", (e) => {
 | 
			
		||||
  if (!e.target.matches(".button")) return;
 | 
			
		||||
    if (!e.target.matches(".button")) return;
 | 
			
		||||
 | 
			
		||||
  // reset when pomodoro button selected
 | 
			
		||||
  pause = true;
 | 
			
		||||
  seconds = 60;
 | 
			
		||||
  startBtn.innerHTML = "开始";
 | 
			
		||||
    // reset when pomodoro button selected
 | 
			
		||||
    pause = true;
 | 
			
		||||
    seconds = 60;
 | 
			
		||||
    startBtn.innerHTML = "开始";
 | 
			
		||||
 | 
			
		||||
  chrome.storage.sync.set({ pause: pause, seconds: seconds }, function () {
 | 
			
		||||
    if (!chrome.runtime.error) {
 | 
			
		||||
      alert("初始化pause、seconds");
 | 
			
		||||
    }
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  // 定时器初始化
 | 
			
		||||
  if (e.target.matches("#pomodoro-btn")) {
 | 
			
		||||
    countdownTimer.innerHTML = "25:00";
 | 
			
		||||
    pomodoro = "pomodoro";
 | 
			
		||||
    minutes = 25;
 | 
			
		||||
    chrome.storage.sync.set(
 | 
			
		||||
      { minutes: minutes, countdownTimer: "25:00" },
 | 
			
		||||
      function () {
 | 
			
		||||
    chrome.storage.sync.set({ pause: pause, seconds: seconds }, function() {
 | 
			
		||||
        if (!chrome.runtime.error) {
 | 
			
		||||
          alert("added target pomodoro!");
 | 
			
		||||
            alert("初始化pause、seconds");
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    // 定时器初始化
 | 
			
		||||
    if (e.target.matches("#pomodoro-btn")) {
 | 
			
		||||
        countdownTimer.innerHTML = "25:00";
 | 
			
		||||
        pomodoro = "pomodoro";
 | 
			
		||||
        minutes = 25;
 | 
			
		||||
        chrome.storage.sync.set({ minutes: minutes, countdownTimer: "25:00" },
 | 
			
		||||
            function() {
 | 
			
		||||
                if (!chrome.runtime.error) {
 | 
			
		||||
                    alert("added target pomodoro!");
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
// 开始按钮-绑定事件
 | 
			
		||||
startBtn.addEventListener("click", () => {
 | 
			
		||||
  // countdown(); 在后台运行,需要取出状态
 | 
			
		||||
  debounce(start(), 100);
 | 
			
		||||
    // countdown(); 在后台运行,需要取出状态
 | 
			
		||||
    debounce(start(), 100);
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
function start() {
 | 
			
		||||
  chrome.storage.sync.get("pomoData", ({ pomoData }) => {
 | 
			
		||||
    const { minutes, seconds, status } = pomoData;
 | 
			
		||||
    chrome.storage.sync.get("pomoData", ({ pomoData }) => {
 | 
			
		||||
        const { minutes, seconds, status } = pomoData;
 | 
			
		||||
 | 
			
		||||
    chrome.runtime.sendMessage(
 | 
			
		||||
      {
 | 
			
		||||
        status: "start",
 | 
			
		||||
        senderId: "pomo",
 | 
			
		||||
        content: {
 | 
			
		||||
          minutes,
 | 
			
		||||
          seconds,
 | 
			
		||||
        },
 | 
			
		||||
      },
 | 
			
		||||
      (response) => {
 | 
			
		||||
        console.log(response);
 | 
			
		||||
        chrome.runtime.sendMessage({
 | 
			
		||||
                status: "start",
 | 
			
		||||
                senderId: "pomo",
 | 
			
		||||
                content: {
 | 
			
		||||
                    minutes,
 | 
			
		||||
                    seconds,
 | 
			
		||||
                },
 | 
			
		||||
            },
 | 
			
		||||
            (response) => {
 | 
			
		||||
                console.log(response);
 | 
			
		||||
 | 
			
		||||
        startBtn.style.display = "none";
 | 
			
		||||
        endBtn.style.display = "block";
 | 
			
		||||
        getTimer();
 | 
			
		||||
      }
 | 
			
		||||
    );
 | 
			
		||||
  });
 | 
			
		||||
                startBtn.style.display = "none";
 | 
			
		||||
                endBtn.style.display = "block";
 | 
			
		||||
                getTimer();
 | 
			
		||||
            }
 | 
			
		||||
        );
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
endBtn.addEventListener("click", () => {
 | 
			
		||||
  setTimeout(end, 200);
 | 
			
		||||
    setTimeout(end, 200);
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
function end() {
 | 
			
		||||
  chrome.runtime.sendMessage(
 | 
			
		||||
    {
 | 
			
		||||
      status: "paused",
 | 
			
		||||
      senderId: "pomo",
 | 
			
		||||
    },
 | 
			
		||||
    (response) => {
 | 
			
		||||
      console.log(response);
 | 
			
		||||
 | 
			
		||||
      startBtn.style.display = "block";
 | 
			
		||||
      endBtn.style.display = "none";
 | 
			
		||||
      clearTimer();
 | 
			
		||||
    }
 | 
			
		||||
  );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function getTimer() {
 | 
			
		||||
  clearTimer();
 | 
			
		||||
  timer = setInterval(() => {
 | 
			
		||||
    chrome.storage.sync.get("pomoData", ({ pomoData }) => {
 | 
			
		||||
      // console.log("pomodata****",pomoData)
 | 
			
		||||
      // const{minutes,seconds,countdownTimer} = pomoData;
 | 
			
		||||
      countdownTimer.innerHTML = pomoData.countdownTimer;
 | 
			
		||||
 | 
			
		||||
      //更新后倒计时判断,如果结束则重新初始化界面
 | 
			
		||||
      if(pomoData.countdownTimer == "00:00"){
 | 
			
		||||
 | 
			
		||||
        audio.play();
 | 
			
		||||
        //不能放在页面上,要在后台进行
 | 
			
		||||
        chrome.runtime.sendMessage(
 | 
			
		||||
          {
 | 
			
		||||
            status: "playend",
 | 
			
		||||
    chrome.runtime.sendMessage({
 | 
			
		||||
            status: "paused",
 | 
			
		||||
            senderId: "pomo",
 | 
			
		||||
          },
 | 
			
		||||
          (response) => {
 | 
			
		||||
            console.log(response,"**************下面");
 | 
			
		||||
            countdownTimer.innerHTML = "25:00";
 | 
			
		||||
        },
 | 
			
		||||
        (response) => {
 | 
			
		||||
            console.log(response);
 | 
			
		||||
 | 
			
		||||
            startBtn.style.display = "block";
 | 
			
		||||
            endBtn.style.display = "none";
 | 
			
		||||
            clearTimer();
 | 
			
		||||
          }
 | 
			
		||||
        );
 | 
			
		||||
        }
 | 
			
		||||
    );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
      }
 | 
			
		||||
    });
 | 
			
		||||
  }, 200);
 | 
			
		||||
function getTimer() {
 | 
			
		||||
    clearTimer();
 | 
			
		||||
    timer = setInterval(() => {
 | 
			
		||||
        chrome.storage.sync.get("pomoData", ({ pomoData }) => {
 | 
			
		||||
            // console.log("pomodata****",pomoData)
 | 
			
		||||
            // const{minutes,seconds,countdownTimer} = pomoData;
 | 
			
		||||
            countdownTimer.innerHTML = pomoData.countdownTimer;
 | 
			
		||||
 | 
			
		||||
            //更新后倒计时判断,如果结束则重新初始化界面
 | 
			
		||||
            if (pomoData.countdownTimer == "00:00") {
 | 
			
		||||
 | 
			
		||||
                audio.play();
 | 
			
		||||
                //不能放在页面上,要在后台进行
 | 
			
		||||
                chrome.runtime.sendMessage({
 | 
			
		||||
                        status: "playend",
 | 
			
		||||
                        senderId: "pomo",
 | 
			
		||||
                    },
 | 
			
		||||
                    (response) => {
 | 
			
		||||
                        console.log(response, "**************下面");
 | 
			
		||||
                        countdownTimer.innerHTML = "25:00";
 | 
			
		||||
 | 
			
		||||
                        startBtn.style.display = "block";
 | 
			
		||||
                        endBtn.style.display = "none";
 | 
			
		||||
                        clearTimer();
 | 
			
		||||
                    }
 | 
			
		||||
                );
 | 
			
		||||
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
    }, 200);
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function clearTimer() {
 | 
			
		||||
  clearInterval(timer);
 | 
			
		||||
    clearInterval(timer);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
@@ -139,59 +135,104 @@ function clearTimer() {
 | 
			
		||||
 * delay [number] 毫秒,防抖期限值
 | 
			
		||||
 */
 | 
			
		||||
function debounce(fn, delay) {
 | 
			
		||||
  let timer = null; //借助闭包
 | 
			
		||||
  return function () {
 | 
			
		||||
    if (timer) {
 | 
			
		||||
      clearTimeout(timer); //进入该分支语句,说明当前正在一个计时过程中,并且又触发了相同事件。所以要取消当前的计时,重新开始计时
 | 
			
		||||
      timer = setTimeout(fn, delay);
 | 
			
		||||
    } else {
 | 
			
		||||
      timer = setTimeout(fn, delay); // 进入该分支说明当前并没有在计时,那么就开始一个计时
 | 
			
		||||
    }
 | 
			
		||||
  };
 | 
			
		||||
    let timer = null; //借助闭包
 | 
			
		||||
    return function() {
 | 
			
		||||
        if (timer) {
 | 
			
		||||
            clearTimeout(timer); //进入该分支语句,说明当前正在一个计时过程中,并且又触发了相同事件。所以要取消当前的计时,重新开始计时
 | 
			
		||||
            timer = setTimeout(fn, delay);
 | 
			
		||||
        } else {
 | 
			
		||||
            timer = setTimeout(fn, delay); // 进入该分支说明当前并没有在计时,那么就开始一个计时
 | 
			
		||||
        }
 | 
			
		||||
    };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 重置按钮-绑定事件
 | 
			
		||||
resetBtn.addEventListener("click", () => {
 | 
			
		||||
  setTimeout(() => {
 | 
			
		||||
    chrome.runtime.sendMessage(
 | 
			
		||||
      {
 | 
			
		||||
        status: "reset",
 | 
			
		||||
        senderId: "pomo",
 | 
			
		||||
      },
 | 
			
		||||
      (response) => {
 | 
			
		||||
        // console.log(response);
 | 
			
		||||
        countdownTimer.innerHTML = "25:00";
 | 
			
		||||
    setTimeout(() => {
 | 
			
		||||
        chrome.runtime.sendMessage({
 | 
			
		||||
                status: "reset",
 | 
			
		||||
                senderId: "pomo",
 | 
			
		||||
            },
 | 
			
		||||
            (response) => {
 | 
			
		||||
                // console.log(response);
 | 
			
		||||
                countdownTimer.innerHTML = "25:00";
 | 
			
		||||
 | 
			
		||||
        startBtn.style.display = "block";
 | 
			
		||||
        endBtn.style.display = "none";
 | 
			
		||||
        clearTimer();
 | 
			
		||||
      }
 | 
			
		||||
    );
 | 
			
		||||
  }, 100);
 | 
			
		||||
                startBtn.style.display = "block";
 | 
			
		||||
                endBtn.style.display = "none";
 | 
			
		||||
                clearTimer();
 | 
			
		||||
            }
 | 
			
		||||
        );
 | 
			
		||||
    }, 100);
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
//页面反复打开时页面初始化
 | 
			
		||||
chrome.storage.sync.get("pomoData", ({ pomoData }) => {
 | 
			
		||||
  console.log(pomoData);
 | 
			
		||||
  const { status } = pomoData;
 | 
			
		||||
    console.log(pomoData);
 | 
			
		||||
    const { status } = pomoData;
 | 
			
		||||
 | 
			
		||||
  if (status === "start") {
 | 
			
		||||
    startBtn.style.display = "none";
 | 
			
		||||
    endBtn.style.display = "block";
 | 
			
		||||
    getTimer();
 | 
			
		||||
  } else if (status === "paused") {
 | 
			
		||||
    startBtn.style.display = "block";
 | 
			
		||||
    endBtn.style.display = "none";
 | 
			
		||||
    chrome.storage.sync.get("pomoData", ({ pomoData }) => {
 | 
			
		||||
      countdownTimer.innerHTML = pomoData.countdownTimer;
 | 
			
		||||
    });
 | 
			
		||||
  } else if (status === "init") {
 | 
			
		||||
    chrome.runtime.sendMessage({
 | 
			
		||||
      status: "init",
 | 
			
		||||
      senderId: "pomo",
 | 
			
		||||
    });
 | 
			
		||||
    countdownTimer.innerHTML = "25:00";
 | 
			
		||||
  }else if(status === 'playend'){
 | 
			
		||||
    countdownTimer.innerHTML = "25:00";
 | 
			
		||||
  }
 | 
			
		||||
    if (status === "start") {
 | 
			
		||||
        startBtn.style.display = "none";
 | 
			
		||||
        endBtn.style.display = "block";
 | 
			
		||||
        getTimer();
 | 
			
		||||
    } else if (status === "paused") {
 | 
			
		||||
        startBtn.style.display = "block";
 | 
			
		||||
        endBtn.style.display = "none";
 | 
			
		||||
        chrome.storage.sync.get("pomoData", ({ pomoData }) => {
 | 
			
		||||
            countdownTimer.innerHTML = pomoData.countdownTimer;
 | 
			
		||||
        });
 | 
			
		||||
    } else if (status === "init") {
 | 
			
		||||
        chrome.runtime.sendMessage({
 | 
			
		||||
            status: "init",
 | 
			
		||||
            senderId: "pomo",
 | 
			
		||||
        });
 | 
			
		||||
        countdownTimer.innerHTML = "25:00";
 | 
			
		||||
    } else if (status === 'playend') {
 | 
			
		||||
        countdownTimer.innerHTML = "25:00";
 | 
			
		||||
    }
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
// 轮播图
 | 
			
		||||
let photos = ["../../image/background/pomo_green.jpeg",
 | 
			
		||||
    "../../image/background/pomo1.png",
 | 
			
		||||
    "../../image/background/pomo_waterfall.jpg",
 | 
			
		||||
    "../../image/background/pomo_ocean.jpg",
 | 
			
		||||
    "../../image/background/pomo_light.jpeg",
 | 
			
		||||
    "../../image/background/pomo_leaf.jpeg",
 | 
			
		||||
    "../../image/background/pomo_foresr.jpeg",
 | 
			
		||||
    "../../image/background/pomo_fire.jpeg",
 | 
			
		||||
    "../../image/background/pomo_crystal.jpg"
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
let len = photos.length;
 | 
			
		||||
// console.log(len);
 | 
			
		||||
let index = 0;
 | 
			
		||||
document.getElementById('right').addEventListener("click", function() {
 | 
			
		||||
    change_r();
 | 
			
		||||
});
 | 
			
		||||
document.getElementById('left').addEventListener("click", function() {
 | 
			
		||||
    change_l();
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
function change_l() {
 | 
			
		||||
    index--;
 | 
			
		||||
    if (index < 0) {
 | 
			
		||||
        index = len - 1;
 | 
			
		||||
    }
 | 
			
		||||
    change(index);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function change_r() {
 | 
			
		||||
    index++;
 | 
			
		||||
    if (index == len) {
 | 
			
		||||
        index = 0;
 | 
			
		||||
    }
 | 
			
		||||
    change(index);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function change(n) {
 | 
			
		||||
    document.body.style = "background: url(" + photos[n] + ") no-repeat; background-size: cover; background-position: center;";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
let t = setInterval(function() {
 | 
			
		||||
    change_r();
 | 
			
		||||
}, 40000);
 | 
			
		||||
 
 | 
			
		||||
@@ -2,13 +2,13 @@
 | 
			
		||||
chrome.runtime.onInstalled.addListener(() => {
 | 
			
		||||
  // 插件功能安装默认启用
 | 
			
		||||
  chrome.storage.sync.set({
 | 
			
		||||
    //初始化数据
 | 
			
		||||
    pomoData: {
 | 
			
		||||
      minutes: 24,
 | 
			
		||||
      seconds: 60,
 | 
			
		||||
      countdownTimer: "25:00",
 | 
			
		||||
      status: "init",
 | 
			
		||||
    },
 | 
			
		||||
      //初始化数据
 | 
			
		||||
      pomoData: {
 | 
			
		||||
          minutes: 24,
 | 
			
		||||
          seconds: 60,
 | 
			
		||||
          countdownTimer: "25:00",
 | 
			
		||||
          status: "init",
 | 
			
		||||
      },
 | 
			
		||||
  });
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
@@ -24,60 +24,64 @@ let timer = null;
 | 
			
		||||
chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
 | 
			
		||||
  console.log(`进入 assets\html\pomodoro\background.js 中的onMessage Listener`)
 | 
			
		||||
  if (message.senderId !== "pomo") {
 | 
			
		||||
    // 抛给下一个Listener
 | 
			
		||||
    sendResponse();
 | 
			
		||||
      // 抛给下一个Listener
 | 
			
		||||
      sendResponse();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  const { status, content } = message;
 | 
			
		||||
 | 
			
		||||
  if (status === "start") {
 | 
			
		||||
    // sendResponse({
 | 
			
		||||
    //   status:message.status
 | 
			
		||||
    // })
 | 
			
		||||
    countdown({ ...content, status });
 | 
			
		||||
      // sendResponse({
 | 
			
		||||
      //   status:message.status
 | 
			
		||||
      // })
 | 
			
		||||
      countdown({...content, status });
 | 
			
		||||
  } else if (status === "paused") {
 | 
			
		||||
    clearTimeout(timer);
 | 
			
		||||
    chrome.storage.sync.get("pomoData", ({ pomoData }) => {
 | 
			
		||||
      console.log(pomoData);
 | 
			
		||||
      chrome.storage.sync.set({ pomoData: { ...pomoData, status: "paused" } });
 | 
			
		||||
    });
 | 
			
		||||
      clearTimeout(timer);
 | 
			
		||||
      chrome.storage.sync.get("pomoData", ({ pomoData }) => {
 | 
			
		||||
          console.log(pomoData);
 | 
			
		||||
          chrome.storage.sync.set({ pomoData: {...pomoData, status: "paused" } });
 | 
			
		||||
      });
 | 
			
		||||
  } else if (status === "reset") {
 | 
			
		||||
    clearTimeout(timer);
 | 
			
		||||
    chrome.storage.sync.set({
 | 
			
		||||
      pomoData: {
 | 
			
		||||
        minutes: 24,
 | 
			
		||||
        seconds: 60,
 | 
			
		||||
        countdownTimer: "25:00",
 | 
			
		||||
        status: "init",
 | 
			
		||||
      },
 | 
			
		||||
    });
 | 
			
		||||
    chrome.browserAction.setBadgeText({ text: "" });
 | 
			
		||||
      clearTimeout(timer);
 | 
			
		||||
      chrome.storage.sync.set({
 | 
			
		||||
          pomoData: {
 | 
			
		||||
              minutes: 24,
 | 
			
		||||
              seconds: 60,
 | 
			
		||||
              countdownTimer: "25:00",
 | 
			
		||||
              status: "init",
 | 
			
		||||
          },
 | 
			
		||||
      });
 | 
			
		||||
      chrome.browserAction.setBadgeText({ text: "" });
 | 
			
		||||
  } else if (status === "init") {
 | 
			
		||||
    //init初始化
 | 
			
		||||
    chrome.storage.sync.set({
 | 
			
		||||
      pomoData: {
 | 
			
		||||
        minutes: 24,
 | 
			
		||||
        seconds: 60,
 | 
			
		||||
        countdownTimer: "25:00",
 | 
			
		||||
        status: "init"
 | 
			
		||||
      },
 | 
			
		||||
    });
 | 
			
		||||
      //init初始化
 | 
			
		||||
      chrome.storage.sync.set({
 | 
			
		||||
          pomoData: {
 | 
			
		||||
              minutes: 24,
 | 
			
		||||
              seconds: 60,
 | 
			
		||||
              countdownTimer: "25:00",
 | 
			
		||||
              status: "init",
 | 
			
		||||
          },
 | 
			
		||||
      });
 | 
			
		||||
  } else {
 | 
			
		||||
    //playend 初始化
 | 
			
		||||
    chrome.storage.sync.set({
 | 
			
		||||
      pomoData: {
 | 
			
		||||
        minutes: 24,
 | 
			
		||||
        seconds: 60,
 | 
			
		||||
        countdownTimer: "25:00",
 | 
			
		||||
        status: "playend",
 | 
			
		||||
      },
 | 
			
		||||
    });
 | 
			
		||||
      //playend 初始化
 | 
			
		||||
      chrome.storage.sync.set({
 | 
			
		||||
          pomoData: {
 | 
			
		||||
              minutes: 24,
 | 
			
		||||
              seconds: 60,
 | 
			
		||||
              countdownTimer: "25:00",
 | 
			
		||||
              status: "playend",
 | 
			
		||||
          },
 | 
			
		||||
      });
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  //创建结束通知:待完成
 | 
			
		||||
  chrome.storage.sync.set({
 | 
			
		||||
      status,
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  //后台播放完成提示音乐
 | 
			
		||||
  if (status === "playend") {
 | 
			
		||||
    // audio.play();
 | 
			
		||||
    console.log("playend***")
 | 
			
		||||
  if (message.action === "play") {
 | 
			
		||||
      // audio.play();
 | 
			
		||||
  }
 | 
			
		||||
  sendResponse();
 | 
			
		||||
  console.log(`离开 assets\html\pomodoro\background.js 中的onMessage Listener`)
 | 
			
		||||
@@ -90,33 +94,26 @@ function countdown({ minutes, seconds, status }) {
 | 
			
		||||
  // let currentMins = minutes - 1;
 | 
			
		||||
  seconds--;
 | 
			
		||||
  let currentTimer =
 | 
			
		||||
    (minutes < 10 ? "0" : "") +
 | 
			
		||||
    minutes +
 | 
			
		||||
    ":" +
 | 
			
		||||
    (seconds < 10 ? "0" : "") +
 | 
			
		||||
    seconds;
 | 
			
		||||
      (minutes < 10 ? "0" : "") +
 | 
			
		||||
      minutes +
 | 
			
		||||
      ":" +
 | 
			
		||||
      (seconds < 10 ? "0" : "") +
 | 
			
		||||
      seconds;
 | 
			
		||||
  // countdownTimer.innerHTML = currentTimer; 拿到
 | 
			
		||||
  console.log("分秒=============", minutes, seconds);
 | 
			
		||||
 | 
			
		||||
  //番茄钟结束桌面提醒
 | 
			
		||||
  if(currentTimer === "00:00"){
 | 
			
		||||
    showPomoNotification();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  chrome.storage.sync.set(
 | 
			
		||||
    {
 | 
			
		||||
      pomoData: {
 | 
			
		||||
        seconds: seconds,
 | 
			
		||||
        minutes: minutes,
 | 
			
		||||
        countdownTimer: currentTimer,
 | 
			
		||||
        status,
 | 
			
		||||
  chrome.storage.sync.set({
 | 
			
		||||
          pomoData: {
 | 
			
		||||
              seconds: seconds,
 | 
			
		||||
              minutes: minutes,
 | 
			
		||||
              countdownTimer: currentTimer,
 | 
			
		||||
              status,
 | 
			
		||||
          },
 | 
			
		||||
      },
 | 
			
		||||
    },
 | 
			
		||||
    function () {
 | 
			
		||||
      if (!chrome.runtime.error) {
 | 
			
		||||
        console.log("started");
 | 
			
		||||
      function() {
 | 
			
		||||
          if (!chrome.runtime.error) {
 | 
			
		||||
              // console.log("started");
 | 
			
		||||
          }
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  );
 | 
			
		||||
 | 
			
		||||
  //设置badge文本用来显示剩余分钟数
 | 
			
		||||
@@ -127,36 +124,35 @@ function countdown({ minutes, seconds, status }) {
 | 
			
		||||
        chrome.browserAction.setBadgeText({ text: "" });
 | 
			
		||||
      }, 2000)
 | 
			
		||||
    } else {
 | 
			
		||||
      chrome.browserAction.setBadgeText({ text: pomoData.minutes.toString() + ":" + pomoData.seconds.toString() });
 | 
			
		||||
      chrome.browserAction.setBadgeText({ text: currentTimer });
 | 
			
		||||
    }
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  console.log(currentTimer);
 | 
			
		||||
  // console.log(currentTimer);
 | 
			
		||||
  // count down every second, when a minute is up, countdown one minute
 | 
			
		||||
  // when time reaches 0:00, reset
 | 
			
		||||
  if (seconds > 0) {
 | 
			
		||||
    timer = setTimeout(() => {
 | 
			
		||||
      countdown({ minutes, seconds, status });
 | 
			
		||||
    }, 1000);
 | 
			
		||||
      timer = setTimeout(() => {
 | 
			
		||||
          countdown({ minutes, seconds, status });
 | 
			
		||||
      }, 1000);
 | 
			
		||||
  } else if (minutes > 0) {
 | 
			
		||||
    seconds = 60;
 | 
			
		||||
    minutes--;
 | 
			
		||||
    chrome.storage.sync.set(
 | 
			
		||||
      {
 | 
			
		||||
        pomoData: {
 | 
			
		||||
          seconds: seconds,
 | 
			
		||||
          minutes: minutes,
 | 
			
		||||
          countdownTimer: currentTimer,
 | 
			
		||||
          status,
 | 
			
		||||
        },
 | 
			
		||||
      },
 | 
			
		||||
      function () {
 | 
			
		||||
        if (!chrome.runtime.error) {
 | 
			
		||||
          console.log("started");
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    );
 | 
			
		||||
    countdown({ minutes, seconds, status });
 | 
			
		||||
      seconds = 60;
 | 
			
		||||
      minutes--;
 | 
			
		||||
      chrome.storage.sync.set({
 | 
			
		||||
              pomoData: {
 | 
			
		||||
                  seconds: seconds,
 | 
			
		||||
                  minutes: minutes,
 | 
			
		||||
                  countdownTimer: currentTimer,
 | 
			
		||||
                  status,
 | 
			
		||||
              },
 | 
			
		||||
          },
 | 
			
		||||
          function() {
 | 
			
		||||
              if (!chrome.runtime.error) {
 | 
			
		||||
                  // console.log("started");
 | 
			
		||||
              }
 | 
			
		||||
          }
 | 
			
		||||
      );
 | 
			
		||||
      countdown({ minutes, seconds, status });
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -165,7 +161,6 @@ chrome.browserAction.setBadgeBackgroundColor({ color: "#DD4A48" });
 | 
			
		||||
 | 
			
		||||
//桌面通知
 | 
			
		||||
function showPomoNotification(){
 | 
			
		||||
 | 
			
		||||
    new Notification("番茄钟🍅",{
 | 
			
		||||
      //图标暂时未设置
 | 
			
		||||
      icon:'48.png',
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,6 @@
 | 
			
		||||
<!DOCTYPE html>
 | 
			
		||||
<html lang="en">
 | 
			
		||||
 | 
			
		||||
<head>
 | 
			
		||||
    <meta charset="UTF-8">
 | 
			
		||||
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
 | 
			
		||||
@@ -10,34 +11,35 @@
 | 
			
		||||
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
 | 
			
		||||
    <link href="https://fonts.googleapis.com/css2?family=Lato:wght@300;400&display=swap" rel="stylesheet">
 | 
			
		||||
</head>
 | 
			
		||||
 | 
			
		||||
<body>
 | 
			
		||||
    <audio id="audio">
 | 
			
		||||
        <source src="./src/alarm.mp3" type="audio/mp3">
 | 
			
		||||
    </audio>
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    <!-- 计时部分 -->
 | 
			
		||||
    <div id="timer">
 | 
			
		||||
 | 
			
		||||
      <!-- 切换背景图片 -->
 | 
			
		||||
      <div class="slider">
 | 
			
		||||
        <span class="left"><</span>
 | 
			
		||||
        <span class="right">></span>
 | 
			
		||||
      </div>
 | 
			
		||||
        <!-- 切换背景图片 -->
 | 
			
		||||
        <div class="slider">
 | 
			
		||||
            <div id="left"></div>
 | 
			
		||||
            <div id="right"></div>
 | 
			
		||||
        </div>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
      
 | 
			
		||||
        <!-- <div class="button" id="pomodoro-btn"></div> -->
 | 
			
		||||
      
 | 
			
		||||
      <div id="countdown">
 | 
			
		||||
          <span>00:00</span>
 | 
			
		||||
      </div>
 | 
			
		||||
      <div class="buttons">
 | 
			
		||||
          <!-- 计时开始、重置 -->
 | 
			
		||||
      <button id="start-btn">开始</button>
 | 
			
		||||
      <button id="end-btn">暂停</button>
 | 
			
		||||
      <button id="reset-btn">重置</button>
 | 
			
		||||
      </div>
 | 
			
		||||
 | 
			
		||||
        <div id="countdown">
 | 
			
		||||
            <span>00:00</span>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="buttons">
 | 
			
		||||
            <!-- 计时开始、重置 -->
 | 
			
		||||
            <button id="start-btn">开始</button>
 | 
			
		||||
            <button id="end-btn">暂停</button>
 | 
			
		||||
            <button id="reset-btn">重置</button>
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    <!-- 后续——添加任务清单
 | 
			
		||||
    <div id="worklist">
 | 
			
		||||
      <div id="current-task-display">
 | 
			
		||||
@@ -58,14 +60,15 @@
 | 
			
		||||
        </form>
 | 
			
		||||
      </div>
 | 
			
		||||
    </div> -->
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    <!-- 页脚--设置 -->
 | 
			
		||||
    <footer>
 | 
			
		||||
      <div class="settings">
 | 
			
		||||
        <!-- <a href="./assets/html/options.html">settings</a> -->
 | 
			
		||||
      </div>
 | 
			
		||||
        <div class="settings">
 | 
			
		||||
            <!-- <a href="./assets/html/options.html">settings</a> -->
 | 
			
		||||
        </div>
 | 
			
		||||
    </footer>
 | 
			
		||||
 | 
			
		||||
    <script src="./assets/js/popup.js"></script>
 | 
			
		||||
</body>
 | 
			
		||||
 | 
			
		||||
</html>
 | 
			
		||||
@@ -61,10 +61,10 @@ var capture = (force) => {
 | 
			
		||||
        chrome.runtime.sendMessage({
 | 
			
		||||
          message: 'capture', senderId: "screenshot", area: selection, dpr: devicePixelRatio
 | 
			
		||||
        }, (res) => {
 | 
			
		||||
          console.log("capture回调结果:", res)
 | 
			
		||||
          return // 变通
 | 
			
		||||
          overlay(false)
 | 
			
		||||
          selection = null
 | 
			
		||||
          console.log("capture回调结果:", res)
 | 
			
		||||
          return // 变通
 | 
			
		||||
          save(res.image, config.format, config.save)
 | 
			
		||||
        })
 | 
			
		||||
      }, 50)
 | 
			
		||||
 
 | 
			
		||||
| 
		 Before Width: | Height: | Size: 239 KiB After Width: | Height: | Size: 239 KiB  | 
| 
		 Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB  | 
| 
		 Before Width: | Height: | Size: 380 KiB After Width: | Height: | Size: 380 KiB  | 
| 
		 Before Width: | Height: | Size: 211 KiB After Width: | Height: | Size: 211 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								packages/shell-chrome/assets/image/background/pomo_green.jpeg
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 142 KiB  | 
| 
		 Before Width: | Height: | Size: 59 KiB After Width: | Height: | Size: 59 KiB  | 
| 
		 Before Width: | Height: | Size: 128 KiB After Width: | Height: | Size: 128 KiB  | 
| 
		 Before Width: | Height: | Size: 41 KiB After Width: | Height: | Size: 41 KiB  | 
| 
		 Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 50 KiB  | 
| 
		 Before Width: | Height: | Size: 93 KiB After Width: | Height: | Size: 95 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								packages/shell-chrome/assets/image/mouse-effects/point.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 964 B  | 
| 
		 Before Width: | Height: | Size: 12 KiB  | 
| 
		 Before Width: | Height: | Size: 7.0 KiB  | 
@@ -406,17 +406,19 @@ var omniboxSearchModes = [
 | 
			
		||||
      // 如果前面已经有了 【[xx] 】,则先去掉
 | 
			
		||||
      text = text.replace(/^\[.*?\]\s*/, "");
 | 
			
		||||
      suggest([
 | 
			
		||||
        { content: "fanyi: [百度] " + text, description: "使用 <url>[百度翻译]</url> 翻译 <match>" + text + "</match>", deletable: false },
 | 
			
		||||
        { content: "fanyi: [有道翻译] " + text, description: "使用 <url>[有道翻译]</url> 翻译 <match>" + text + "</match>", deletable: false },
 | 
			
		||||
        { content: "fanyi: [必应] " + text, description: "使用 <url>[必应词典]</url> 查词 <match>" + text + "</match>", deletable: false },
 | 
			
		||||
        { content: "fanyi: [腾讯] " + text, description: "使用 <url>[腾讯翻译君]</url> 翻译 <match>" + text + "</match>", deletable: false },
 | 
			
		||||
        { content: "fanyi: [DeepL] " + text, description: "使用 <url>[DeepL翻译]</url> 翻译 <match>" + text + "</match>", deletable: false },
 | 
			
		||||
        { content: "fanyi: [金山词霸] " + text, description: "使用 <url>[金山词霸]</url> 查词 <match>" + text + "</match>", deletable: false },
 | 
			
		||||
        { content: "fanyi: [有道] " + text, description: "使用 <url>[有道]</url> 查词 <match>" + text + "</match>", deletable: false },
 | 
			
		||||
        { content: "fanyi: [360] " + text, description: "使用 <url>[360翻译]</url> 翻译 <match>" + text + "</match>", deletable: false },
 | 
			
		||||
        { content: "fanyi: [翻译狗] " + text, description: "使用 <url>[翻译狗]</url> 翻译 <match>" + text + "</match>", deletable: false },
 | 
			
		||||
        { content: "fanyi: [百度] " + text, description: "<url>翻译</url> | 使用 <url>[百度翻译]</url> 翻译 <match>" + text + "</match>", deletable: false },
 | 
			
		||||
        { content: "fanyi: [有道翻译] " + text, description: "<url>翻译</url> | 使用 <url>[有道翻译]</url> 翻译 <match>" + text + "</match>", deletable: false },
 | 
			
		||||
        { content: "fanyi: [腾讯] " + text, description: "<url>翻译</url> | 使用 <url>[腾讯翻译君]</url> 翻译 <match>" + text + "</match>", deletable: false },
 | 
			
		||||
        { content: "fanyi: [DeepL] " + text, description: "<url>翻译</url> | 使用 <url>[DeepL翻译]</url> 翻译 <match>" + text + "</match>", deletable: false },
 | 
			
		||||
        // 【需要注入自动翻译】 { content: "fanyi: [海词翻译] " + text, description: "<url>翻译</url> | 使用 <url>[海词翻译]</url> 翻译 <match>" + text + "</match>", deletable: false },
 | 
			
		||||
        { content: "fanyi: [必应] " + text, description: "<url>查词</url> | 使用 <url>[必应词典]</url> 查词 <match>" + text + "</match>", deletable: false },
 | 
			
		||||
        { content: "fanyi: [有道] " + text, description: "<url>查词</url> | 使用 <url>[有道]</url> 查词 <match>" + text + "</match>", deletable: false },
 | 
			
		||||
        { content: "fanyi: [海词] " + text, description: "<url>查词</url> | 使用 <url>[海词]</url> 查词 <match>" + text + "</match>", deletable: false },
 | 
			
		||||
        { content: "fanyi: [金山词霸] " + text, description: "<url>查词</url> | 使用 <url>[金山词霸]</url> 查词 <match>" + text + "</match>", deletable: false },
 | 
			
		||||
        // 以下内容超出9个不被显示
 | 
			
		||||
        { content: "fanyi: [Google] " + text, description: "使用 <url>[Google翻译]</url> 翻译 <match>" + text + "</match> (Google翻译在中国大陆无法使用)", deletable: false },
 | 
			
		||||
        { content: "fanyi: [360] " + text, description: "<url>翻译</url> | 使用 <url>[360翻译]</url> 翻译 <match>" + text + "</match>", deletable: false },
 | 
			
		||||
        { content: "fanyi: [翻译狗] " + text, description: "<url>翻译</url> | 使用 <url>[翻译狗]</url> 翻译 <match>" + text + "</match>", deletable: false },
 | 
			
		||||
        { content: "fanyi: [Google] " + text, description: "<url>翻译</url> | 使用 <url>[Google翻译]</url> 翻译 <match>" + text + "</match> (Google翻译在中国大陆无法使用)", deletable: false },
 | 
			
		||||
      ]);
 | 
			
		||||
      return;
 | 
			
		||||
    },
 | 
			
		||||
@@ -451,9 +453,15 @@ var omniboxSearchModes = [
 | 
			
		||||
          let hasChineseChar = /.*[\u4e00-\u9fa5]+.*$/.test(searchText)
 | 
			
		||||
          navigate("https://www.deepl.com/translator#" + (hasChineseChar ? "zh/en/" : "en/zh/") + encodeURIComponent(searchText), true);
 | 
			
		||||
          break;
 | 
			
		||||
        // case "[海词翻译]":
 | 
			
		||||
        //   navigate("http://fanyi.dict.cn/" + encodeURIComponent(searchText), true);
 | 
			
		||||
        //   break;
 | 
			
		||||
        case "[金山词霸]":
 | 
			
		||||
          navigate("https://www.iciba.com/word?w=" + encodeURIComponent(searchText), true);
 | 
			
		||||
          break;
 | 
			
		||||
        case "[海词]":
 | 
			
		||||
          navigate("https://dict.cn/" + encodeURIComponent(searchText), true);
 | 
			
		||||
          break;
 | 
			
		||||
        case "[有道]":
 | 
			
		||||
          navigate("https://www.youdao.com/w/" + encodeURIComponent(searchText), true);
 | 
			
		||||
          break;
 | 
			
		||||
@@ -863,7 +871,9 @@ var ajaxUrl = "https://www.baidu.com/s?wd=";
 | 
			
		||||
/**
 | 
			
		||||
 * 用户开始输入文本
 | 
			
		||||
 */
 | 
			
		||||
chrome.omnibox.onInputStarted.addListener(function () {
 | 
			
		||||
chrome.omnibox.onInputStarted.addListener(async function () {
 | 
			
		||||
  if (!await checkIsActived()) return;
 | 
			
		||||
 | 
			
		||||
  console.log("chrome.omnibox.onInputStarted");
 | 
			
		||||
  updateDefaultSuggestion('');
 | 
			
		||||
});
 | 
			
		||||
@@ -871,7 +881,9 @@ chrome.omnibox.onInputStarted.addListener(function () {
 | 
			
		||||
/**
 | 
			
		||||
 * 搜索框失去焦点
 | 
			
		||||
 */
 | 
			
		||||
chrome.omnibox.onInputCancelled.addListener(function () {
 | 
			
		||||
chrome.omnibox.onInputCancelled.addListener(async function () {
 | 
			
		||||
  if (!await checkIsActived()) return;
 | 
			
		||||
 | 
			
		||||
  console.log("chrome.omnibox.onInputCancelled");
 | 
			
		||||
  updateDefaultSuggestion('');
 | 
			
		||||
});
 | 
			
		||||
@@ -879,7 +891,9 @@ chrome.omnibox.onInputCancelled.addListener(function () {
 | 
			
		||||
/**
 | 
			
		||||
 * 输入框文本改变事件
 | 
			
		||||
 */
 | 
			
		||||
chrome.omnibox.onInputChanged.addListener(function (text, suggest) {
 | 
			
		||||
chrome.omnibox.onInputChanged.addListener(async function (text, suggest) {
 | 
			
		||||
  if (!await checkIsActived()) return;
 | 
			
		||||
 | 
			
		||||
  console.log("chrome.omnibox.onInputChanged", text);
 | 
			
		||||
 | 
			
		||||
  // 停止上一次搜索行为
 | 
			
		||||
@@ -904,7 +918,9 @@ chrome.omnibox.onInputChanged.addListener(function (text, suggest) {
 | 
			
		||||
/**
 | 
			
		||||
 * 用户输入完成,按下回车键
 | 
			
		||||
 */
 | 
			
		||||
chrome.omnibox.onInputEntered.addListener(function (text) {
 | 
			
		||||
chrome.omnibox.onInputEntered.addListener(async function (text) {
 | 
			
		||||
  if (!await checkIsActived()) return;
 | 
			
		||||
 | 
			
		||||
  console.log("chrome.omnibox.onInputEntered");
 | 
			
		||||
 | 
			
		||||
  // 更新输入框回显提示信息
 | 
			
		||||
@@ -928,6 +944,26 @@ chrome.omnibox.onInputEntered.addListener(function (text) {
 | 
			
		||||
 * ****************************************************************************************
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 读取功能开启状态,如果没有开启,则显示一个提示信息
 | 
			
		||||
 * @returns
 | 
			
		||||
 */
 | 
			
		||||
async function checkIsActived() {
 | 
			
		||||
  var isActived = await new Promise((resolve) => {
 | 
			
		||||
    chrome.storage.sync.get('State_SSSearch', function (State) {
 | 
			
		||||
      resolve(State.State_SSSearch);
 | 
			
		||||
    });
 | 
			
		||||
  });
 | 
			
		||||
  console.log("SS快捷搜索功能开启状态:" + isActived);
 | 
			
		||||
  if (!isActived) {
 | 
			
		||||
    chrome.omnibox.setDefaultSuggestion({
 | 
			
		||||
      description: "SS快捷搜索功能未开启,请在学生助手扩展设置中开启后再试"
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
  return isActived;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 将 & < > 等特殊字符转义,但保留中文不进行转义
 | 
			
		||||
 *
 | 
			
		||||
 
 | 
			
		||||
@@ -48,13 +48,3 @@ chrome.contextMenus.create({
 | 
			
		||||
    showNotification()
 | 
			
		||||
  }
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
function tranBit(){
 | 
			
		||||
  console.log("开始插入翻译页面")
 | 
			
		||||
    
 | 
			
		||||
  chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => {
 | 
			
		||||
  console.log(tabs)
 | 
			
		||||
  chrome.tabs.executeScript(tabs[0].id, { file:'./assets/js/translate/tran.js', runAt: 'document_start' })
 | 
			
		||||
  chrome.tabs.insertCSS(tabs[0].id, { file:'./assets/css/tran.css', runAt: 'document_start' })
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
@@ -1 +1,14 @@
 | 
			
		||||
console.log("[BitDance extension] 学生助手插件已启用")
 | 
			
		||||
 | 
			
		||||
// 每次改变开关状态时刷新页面使功能及时生效
 | 
			
		||||
chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
 | 
			
		||||
  console.log(`进入 assets\js\content.js 中的onMessage Listener`)
 | 
			
		||||
 | 
			
		||||
  if (request.action === 'refreshPage') {
 | 
			
		||||
    location.reload();
 | 
			
		||||
    sendResponse('Reload page because of ' + request.info);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  console.log(`离开 assets\js\content.js 中的onMessage Listener`)
 | 
			
		||||
  return true;
 | 
			
		||||
})
 | 
			
		||||
 
 | 
			
		||||
@@ -1,8 +1,8 @@
 | 
			
		||||
window.onload = function(){
 | 
			
		||||
  console.log("[BitDance extension] 学生助手插件 - 确认跳转页直接跳转模块加载成功");
 | 
			
		||||
 | 
			
		||||
    chrome.storage.sync.get("linkOpen", ({ linkOpen })=>{
 | 
			
		||||
        if(linkOpen){
 | 
			
		||||
    chrome.storage.sync.get("State_DirectUrl", ({ State_DirectUrl })=>{
 | 
			
		||||
        if(State_DirectUrl){
 | 
			
		||||
            let locHost = location.host,locHref = location.href;
 | 
			
		||||
 | 
			
		||||
        let methods = {
 | 
			
		||||
@@ -88,21 +88,21 @@ window.onload = function(){
 | 
			
		||||
 | 
			
		||||
        setTimeout(url(),200);
 | 
			
		||||
 | 
			
		||||
        function url(){
 | 
			
		||||
        function url() {
 | 
			
		||||
            let flag = false;
 | 
			
		||||
            if(locHref.includes(RedirectPage.sites[locHost].include)){
 | 
			
		||||
            if(locHref.includes(RedirectPage.sites[locHost].include)) {
 | 
			
		||||
                locHref = locHref.split(RedirectPage.sites[locHost].include);
 | 
			
		||||
                flag = true;
 | 
			
		||||
            }
 | 
			
		||||
        
 | 
			
		||||
            if(flag){
 | 
			
		||||
 | 
			
		||||
            if(flag) {
 | 
			
		||||
                location.replace(decodeURIComponent(locHref[1]));
 | 
			
		||||
            }else{
 | 
			
		||||
            } else {
 | 
			
		||||
                //改进
 | 
			
		||||
                if(RedirectPage.sites[locHost].selector){
 | 
			
		||||
                if(RedirectPage.sites[locHost].selector) {
 | 
			
		||||
                    let target = document.querySelector(RedirectPage.sites[locHost].selector);
 | 
			
		||||
                location.replace(target.href || target.innerText)
 | 
			
		||||
                } 
 | 
			
		||||
                    location.replace(target.href || target.innerText)
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,25 +1,53 @@
 | 
			
		||||
/**
 | 
			
		||||
 * TODO: 实现CSDN自动展开全文
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
$(function() {
 | 
			
		||||
    console.log("[BitDance extension] 学生助手插件 - CSDN阅读全文自动展开模块加载成功");
 | 
			
		||||
    // 全文自动展开
 | 
			
		||||
    (async function() {
 | 
			
		||||
    // 删除DOM
 | 
			
		||||
    function removeDOM(querySelector) {
 | 
			
		||||
        let element = document.querySelector(querySelector)
 | 
			
		||||
        if (element != null) {
 | 
			
		||||
            element.parentNode.removeChild(element);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    removeDOM(".hide-article-box");
 | 
			
		||||
    $(".article_content").removeAttr('style');
 | 
			
		||||
    window.onload = () => {
 | 
			
		||||
        // 代码块自动展开
 | 
			
		||||
        document.querySelectorAll("pre").forEach(targetNode => {
 | 
			
		||||
            removeDOM(".hide-preCode-box");
 | 
			
		||||
            if (targetNode.classList.contains("set-code-hide")) {
 | 
			
		||||
                targetNode.classList.remove("set-code-hide");
 | 
			
		||||
 | 
			
		||||
    // 插件刚开始加载时,先读取一次状态
 | 
			
		||||
    var isExpandFulltextActived = true;
 | 
			
		||||
    isExpandFulltextActived = await new Promise((resolve) => {
 | 
			
		||||
        chrome.storage.sync.get('State_ExpandFulltext', function (State) {
 | 
			
		||||
          resolve(State.State_ExpandFulltext);
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
    console.log(`isExpandFulltextActived: ${isExpandFulltextActived}`);
 | 
			
		||||
    if(!isExpandFulltextActived)
 | 
			
		||||
        return;
 | 
			
		||||
 | 
			
		||||
    console.log("[BitDance extension] 学生助手插件 - 阅读全文自动展开模块加载成功");
 | 
			
		||||
 | 
			
		||||
    switch (window.location.host) {
 | 
			
		||||
      default:
 | 
			
		||||
        break;
 | 
			
		||||
 | 
			
		||||
      case "blog.csdn.net": // CSDN博客
 | 
			
		||||
        $(function () {
 | 
			
		||||
            removeDOM(".hide-article-box");
 | 
			
		||||
            $(".article_content").removeAttr('style');
 | 
			
		||||
            window.onload = () => {
 | 
			
		||||
                // 代码块自动展开
 | 
			
		||||
                document.querySelectorAll("pre").forEach(targetNode => {
 | 
			
		||||
                    removeDOM(".hide-preCode-box");
 | 
			
		||||
                    if (targetNode.classList.contains("set-code-hide")) {
 | 
			
		||||
                        targetNode.classList.remove("set-code-hide");
 | 
			
		||||
                    }
 | 
			
		||||
                })
 | 
			
		||||
            }
 | 
			
		||||
        })
 | 
			
		||||
        break;
 | 
			
		||||
 | 
			
		||||
      case "www.it1352.com": // it1352
 | 
			
		||||
      console.log("[BitDance extension] 学生助手插件 - it1352");
 | 
			
		||||
        window.onload = () => {
 | 
			
		||||
            $('.arc-body-main').height("initial")
 | 
			
		||||
            $('.arc-body-main-more').remove()
 | 
			
		||||
        }
 | 
			
		||||
        break;
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
})
 | 
			
		||||
})();
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +0,0 @@
 | 
			
		||||
console.log("[BitDance extension] 学生助手插件 - it1352阅读全文自动展开模块加载成功");
 | 
			
		||||
window.onload = () => {
 | 
			
		||||
  $('.arc-body-main').height("initial")
 | 
			
		||||
  $('.arc-body-main-more').remove()
 | 
			
		||||
}
 | 
			
		||||
@@ -1,28 +1,14 @@
 | 
			
		||||
/**
 | 
			
		||||
 * TODO: 鼠标点击效果
 | 
			
		||||
 * 鼠标点击效果
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
$(function() {
 | 
			
		||||
    console.log("[BitDance extension] 学生助手插件 - 点击特效模块加载成功");
 | 
			
		||||
 | 
			
		||||
    // 每次改变开关状态时刷新页面使功能及时生效
 | 
			
		||||
    chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
 | 
			
		||||
      console.log(`进入 assets\js\mouse-effects\click.js 中的onMessage Listener`)
 | 
			
		||||
 | 
			
		||||
        if (request.info === 'click') {
 | 
			
		||||
            location.reload();
 | 
			
		||||
            sendResponse('Reload page');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        console.log(`离开 assets\js\mouse-effects\click.js 中的onMessage Listener`)
 | 
			
		||||
        return true;
 | 
			
		||||
    })
 | 
			
		||||
 | 
			
		||||
    // 控制功能是否开启
 | 
			
		||||
    chrome.storage.sync.get('clickState3', function(budget) {
 | 
			
		||||
    chrome.storage.sync.get('State_MouseEffect', function(budget) {
 | 
			
		||||
        // 得到按钮开关状态
 | 
			
		||||
        if (budget.clickState3 == false || budget.clickState3 == undefined) {
 | 
			
		||||
            // console.log('click功能启动');
 | 
			
		||||
        if (budget.State_MouseEffect == false || budget.State_MouseEffect == undefined) {
 | 
			
		||||
            console.log("[BitDance extension] 学生助手插件 - 点击特效模块加载成功");
 | 
			
		||||
 | 
			
		||||
            var hearts = [];
 | 
			
		||||
 | 
			
		||||
            walk();
 | 
			
		||||
@@ -30,7 +16,7 @@ $(function() {
 | 
			
		||||
            // 走起(初始化)
 | 
			
		||||
            function walk() {
 | 
			
		||||
                // 灵魂 css
 | 
			
		||||
                css(".heart{width: 10px;height: 10px;position: fixed;background: pink;transform: rotate(45deg);}.heart::after,.heart::before{position: absolute;content: '';width: inherit;height: inherit;background: inherit;border-radius: 50%;}.heart::after{top: -5px;}.heart::before{left: -5px;}");
 | 
			
		||||
                css("#heart{width: 10px;height: 10px;position: fixed;background: pink;transform: rotate(45deg);}#heart::after,#heart::before{position: absolute;content: '';width: inherit;height: inherit;background: inherit;border-radius: 50%;}#heart::after{top: -5px;}#heart::before{left: -5px;}");
 | 
			
		||||
                attachEvent();
 | 
			
		||||
                gameloop();
 | 
			
		||||
            }
 | 
			
		||||
@@ -62,7 +48,7 @@ $(function() {
 | 
			
		||||
            function createHeart(event) {
 | 
			
		||||
                // 创建一个 div 并指定类名为 heart
 | 
			
		||||
                var d = document.createElement("div");
 | 
			
		||||
                d.className = "heart";
 | 
			
		||||
                d.id = "heart";
 | 
			
		||||
                /**
 | 
			
		||||
                 * @param el: 每个 div 的标识
 | 
			
		||||
                 * @param x,y: 当前鼠标位置信息
 | 
			
		||||
@@ -73,7 +59,7 @@ $(function() {
 | 
			
		||||
                hearts.push({
 | 
			
		||||
                    el: d,
 | 
			
		||||
                    x: event.clientX,
 | 
			
		||||
                    y: event.clientY,
 | 
			
		||||
                    y: event.clientY - 12,
 | 
			
		||||
                    scale: 1,
 | 
			
		||||
                    alpha: 1,
 | 
			
		||||
                    color: randomColor()
 | 
			
		||||
 
 | 
			
		||||
@@ -1,33 +1,22 @@
 | 
			
		||||
/**
 | 
			
		||||
 * TODO: 鼠标样式
 | 
			
		||||
 * 鼠标样式
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
$(function() {
 | 
			
		||||
    console.log("[BitDance extension] 学生助手插件 - 鼠标样式模块加载成功");
 | 
			
		||||
    // 每次改变开关状态时刷新页面使功能及时生效
 | 
			
		||||
    chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
 | 
			
		||||
        console.log(`进入 assets\js\mouse-effects\mouse-style.js 中的onMessage Listener`)
 | 
			
		||||
 | 
			
		||||
        if (request.info === 'mouse') {
 | 
			
		||||
            location.reload();
 | 
			
		||||
            sendResponse('Reload page');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        console.log(`离开 assets\js\mouse-effects\mouse-style.js 中的onMessage Listener`)
 | 
			
		||||
        return true;
 | 
			
		||||
    })
 | 
			
		||||
 | 
			
		||||
    // 控制功能是否开启
 | 
			
		||||
    chrome.storage.sync.get('clickState2', function(budget) {
 | 
			
		||||
    chrome.storage.sync.get('State_MouseStyle', function(budget) {
 | 
			
		||||
        // 得到按钮开关状态
 | 
			
		||||
        if (budget.clickState2 == false || budget.clickState2 == undefined) {
 | 
			
		||||
            $('*').hover(function() {
 | 
			
		||||
                $(this).css("cursor", "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c%0A6QAABPxJREFUWEe9lltIalkYx9feak1hDBonIvVM0ZyKLmAM3YyIqB6KCgrK%0Abj710G1gKooJJrCYiB4q6qHefIgoKoaChpiieojQJIWiy0GygzaO0RVhSDTb%0Ae+1hOSlb3d56aL+Iur/1/db3/77/Whj4/6kGAOgAAPq37x/2gQEAyrRa7V9s%0ANhuTSqXk5eXlGUVRTR8FgwC+HB0dfc3JyWG7tq3RaAiZTAY/AgYBgNTU1Bed%0AThfBVHcE09DQQFxfX1+EUJkoAMAnAMDfoWroBMAwTAsh/ClYUACYIQzDfkeg%0ACQkJ5Pz8PG6xWB4oihIEW9MJwCRDsECVSoUqQ97c3BgrKioSNzc3I+kxZrMZ%0AikQinKIoVw7GJd1/BpLBH8zr6ysVHx9Pra2tUS0tLS9CoRBfW1vjJCQksFDM%0Azs4OUV1dPffy8vKLvzXcAKHKQF9ILpeTVVVVFL2B9/f3SQSTlJSEraysRAiF%0AQlagKtDL4zMNwWSoqakhNzY2nLtlehBMSUkJAtgDAKDRfvB+z0OfcGUYHx9/%0ALS4uxgoKCtwj7J0Ax3EAIQR7e3tEc3MzcX9/r6TDeAC8RwYulwufn59xpgos%0ALi46Li4u8LGxMQ9ABINM7+npSeTdoWHLMDIyQqhUKmp7e5tDhzg9PSXFYjEG%0AIWSEQw0cExMz5TMiiYmJNoPB8F0w/en/Ly0tvba2tnIKCgpIkUhEra6u4vn5%0A+VClUjFKgyojk8msFEXxfQDeIwMdBu2Mw+Ewzr5WqyXz8vIICOGPAIB/nCbI%0AsNMvSqXyq0Qi8dtYTNVBLri6usoYY7FYkCkRVqu1CtkDPZ6RVCAQ2A0GQ8To%0A6Cg8Pj4GEokEDg4OemjsDVFbW0vy+XxSoVC4zxRUjeTkZIfJZPoVADDDBM4I%0AgGGYjsfjfdna2oLIZA4PD4ny8nJ8YGAAyuXyoCOHEvX19dlnZ2f/dDgcDYH6%0AiQlgqLKycmh4eJhFdzi0SFlZmaO9vZ2qr6/38H2RSARvb28JkiQj5ubmHB0d%0AHc4qZGdn205OTlJceodUAQzDKGQcaWlpdp1O5zMNLmPp6uoiULPNzMyw0G96%0AvZ64uroCubm5OI/Hc49eMAjvCkRJpdJ/l5eX2fn5+Xa1Wu0DUFhYSCqVSqf9%0ASiQSQq1Ws6Ojo6FCoYBSqZRRnjeIH4JaMQDgc29v7+XU1FSk0WgkHx4ePA4a%0AlLSxsZFYWFhg0UetqamJnJiYwAQCAaPp0OTwgfDpAdTJT09PzoWYZMBxHPpz%0At2DmlZWVZTs/P/eAYDIis8lkike7KSoqsh0cHKBrlvNB9trW1gY0Go37BOzp%0A6bFNT0+73wkXwt8YIm8nMjIyMLPZ7JThzT7Z9N2jOedyuX+kp6dXHR8fvwvC%0A73UpMjJyxuFw/AwAcMoxODhIeJ9qSUlJdqPRiBILxWLxZTgQKSkpdr1eHxXw%0AvvZWzl2Kokq9S4vslc/n99EcLiyIycnJ1/7+/u9DAfi8u7v7rbS01GPEuFyu%0Aw2q1ehgSupKLxeLrYJVYX1931NXVyQEA46EAgLi4ONvd3Z3bE9CplpOTU+F9%0AsLxVKSAEPbm/05CpkT1kYLFYLxDCQHeGT5mZmddnZ2cejemdPBwAtwxoGlpb%0AW5MD+burEnQIpuThAIDY2Fj74+NjJI7jFnSTCTbvdIjOzk68u7t7GGnuHRdS%0AD7gWw3H8NwhhT4jJ6a8hKWxMcf8BWQiA/lSw+WUAAAAASUVORK5CYII=), crosshair");
 | 
			
		||||
            });
 | 
			
		||||
        } else {
 | 
			
		||||
            ('*').hover(function() {
 | 
			
		||||
                $(this).css("cursor", "auto");
 | 
			
		||||
            });
 | 
			
		||||
        if (budget.State_MouseStyle == false || budget.State_MouseStyle == undefined) {
 | 
			
		||||
            let style = document.getElementsByTagName('style');
 | 
			
		||||
            // console.log(style[0]);
 | 
			
		||||
            let css = "* {cursor: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c%0A6QAABPxJREFUWEe9lltIalkYx9feak1hDBonIvVM0ZyKLmAM3YyIqB6KCgrK%0Abj710G1gKooJJrCYiB4q6qHefIgoKoaChpiieojQJIWiy0GygzaO0RVhSDTb%0Ae+1hOSlb3d56aL+Iur/1/db3/77/Whj4/6kGAOgAAPq37x/2gQEAyrRa7V9s%0ANhuTSqXk5eXlGUVRTR8FgwC+HB0dfc3JyWG7tq3RaAiZTAY/AgYBgNTU1Bed%0AThfBVHcE09DQQFxfX1+EUJkoAMAnAMDfoWroBMAwTAsh/ClYUACYIQzDfkeg%0ACQkJ5Pz8PG6xWB4oihIEW9MJwCRDsECVSoUqQ97c3BgrKioSNzc3I+kxZrMZ%0AikQinKIoVw7GJd1/BpLBH8zr6ysVHx9Pra2tUS0tLS9CoRBfW1vjJCQksFDM%0Azs4OUV1dPffy8vKLvzXcAKHKQF9ILpeTVVVVFL2B9/f3SQSTlJSEraysRAiF%0AQlagKtDL4zMNwWSoqakhNzY2nLtlehBMSUkJAtgDAKDRfvB+z0OfcGUYHx9/%0ALS4uxgoKCtwj7J0Ax3EAIQR7e3tEc3MzcX9/r6TDeAC8RwYulwufn59xpgos%0ALi46Li4u8LGxMQ9ABINM7+npSeTdoWHLMDIyQqhUKmp7e5tDhzg9PSXFYjEG%0AIWSEQw0cExMz5TMiiYmJNoPB8F0w/en/Ly0tvba2tnIKCgpIkUhEra6u4vn5%0A+VClUjFKgyojk8msFEXxfQDeIwMdBu2Mw+Ewzr5WqyXz8vIICOGPAIB/nCbI%0AsNMvSqXyq0Qi8dtYTNVBLri6usoYY7FYkCkRVqu1CtkDPZ6RVCAQ2A0GQ8To%0A6Cg8Pj4GEokEDg4OemjsDVFbW0vy+XxSoVC4zxRUjeTkZIfJZPoVADDDBM4I%0AgGGYjsfjfdna2oLIZA4PD4ny8nJ8YGAAyuXyoCOHEvX19dlnZ2f/dDgcDYH6%0AiQlgqLKycmh4eJhFdzi0SFlZmaO9vZ2qr6/38H2RSARvb28JkiQj5ubmHB0d%0AHc4qZGdn205OTlJceodUAQzDKGQcaWlpdp1O5zMNLmPp6uoiULPNzMyw0G96%0AvZ64uroCubm5OI/Hc49eMAjvCkRJpdJ/l5eX2fn5+Xa1Wu0DUFhYSCqVSqf9%0ASiQSQq1Ws6Ojo6FCoYBSqZRRnjeIH4JaMQDgc29v7+XU1FSk0WgkHx4ePA4a%0AlLSxsZFYWFhg0UetqamJnJiYwAQCAaPp0OTwgfDpAdTJT09PzoWYZMBxHPpz%0At2DmlZWVZTs/P/eAYDIis8lkike7KSoqsh0cHKBrlvNB9trW1gY0Go37BOzp%0A6bFNT0+73wkXwt8YIm8nMjIyMLPZ7JThzT7Z9N2jOedyuX+kp6dXHR8fvwvC%0A73UpMjJyxuFw/AwAcMoxODhIeJ9qSUlJdqPRiBILxWLxZTgQKSkpdr1eHxXw%0AvvZWzl2Kokq9S4vslc/n99EcLiyIycnJ1/7+/u9DAfi8u7v7rbS01GPEuFyu%0Aw2q1ehgSupKLxeLrYJVYX1931NXVyQEA46EAgLi4ONvd3Z3bE9CplpOTU+F9%0AsLxVKSAEPbm/05CpkT1kYLFYLxDCQHeGT5mZmddnZ2cejemdPBwAtwxoGlpb%0AW5MD+burEnQIpuThAIDY2Fj74+NjJI7jFnSTCTbvdIjOzk68u7t7GGnuHRdS%0AD7gWw3H8NwhhT4jJ6a8hKWxMcf8BWQiA/lSw+WUAAAAASUVORK5CYII=), auto}"
 | 
			
		||||
            let css1 = "a {cursor: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeCAYAAAA7MK6iAAAAAXNSR0IArs4c%0A6QAAA35JREFUSEvtVk1IG1EQnv1PNhEhVEloRa22gXqw3jyU5qAUQWk9iKjQ%0Ag7SIpIfmnJMHxaNQsYJUkLQSqAcP1VPFS6EeqwepFqOCaQ8x/kRo3N3se1tm%0AYdM02dhtrvVBEt6+b+abmffNbBhwvqpZlv0MADddLtf7bDY74ty0FMk4MRYE%0A4X4ikfhSV1dnwgkh4PF4FFVV3U7s7TCOiDs6Ouja2tofWEopyLL8UlXVV5WQ%0AOyI2DMModo6P3G63pqqqdE3spALXpbat0rW4sCz/Xzth1ufn5yWa0DQNtra2%0AoLu7W6GUjhBC3lY8Mu3E5aRX8Tpqa2shnU7jTFcKbSruYyfEFmZhYYEODw/f%0ABYCE9SxPLEnSo5qamtVwOMzPzc0ZyWTyga7r+BpEIZXM6n8hRmw0GjUmJyd5%0AAKC4N4klSbqTTqe/eb3evL9kMgn19fUvKKWv7Yjx1chxXFl+u3Oe53OEEDFP%0AzPM8yeVybLGXk5MTCAQCzzVNe4Mk6MxauD8+Pgafz1dCvrOzAy0tLaDrOjAM%0AA5lMxsSdnZ1BdXW1maz5FYlEjKmpKdvoLy8v8fVnZpfL5YBlWTMAURRNVVdV%0AVZXY7e3tQTAYzBNns1kTh/aiKL4jhDw1iVmW1QghQrm6WUQWMf4JEAQhH0ix%0AHbYUBmvhC/eCIPyklHotcXEbGxt6e3u7LbdFbJVuenraiEQijLW3M8IKra+v%0AQygUgqOjI2hoaDArxXGcTikVCtvJv7S09KOvr8+2xdBRZ2cnzM/Po+hgcXHR%0A6O/vZ5qbm439/X0GhY/3KUkSKIoCY2NjMD4+DqiTUChkHBwcMBcXF0iMg8Vd%0ATHJ7dnY2MTo6WpKEJRA86OrqgtXVVXNe8zwPeIeyLFsZmb941traSre3t03R%0AYjCIdblc3zVNu2WX3Y1oNJqamJiwzRzvFwVmrUAgAKlUCjY3N6GtrY3GYjF2%0AaGgof454rAR+MBiWZT0AkC07uQYGBmg8Hnc02VZWVoyenh4mHo/D4OBg2d5u%0AbGyEw8PD3+1UBlkVDoczMzMzjsj/Nsmwh30+3z0A+Jrv4yuM5N7e3szy8jKO%0AuooXlliW5U+Kojy0nDjJhgsGgzpOo0qWqqrg9Xo/6Lr+uNDeCbGJb2pqMnZ3%0Ad6+cz5ZjVPXp6Sn4/X5CKbWtlmNidCoIwjNK6ZOrMhdFMaNp2kdCSOwq3C/H%0Acfgu+27rfgAAAABJRU5ErkJggg==), crosshair}"
 | 
			
		||||
            style[0].appendChild(document.createTextNode(css+css1));
 | 
			
		||||
            console.log(style[0]);
 | 
			
		||||
            // $('a').hover(function() {
 | 
			
		||||
            //     $(this).css("cursor", "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeCAYAAAA7MK6iAAAAAXNSR0IArs4c%0A6QAAA35JREFUSEvtVk1IG1EQnv1PNhEhVEloRa22gXqw3jyU5qAUQWk9iKjQ%0Ag7SIpIfmnJMHxaNQsYJUkLQSqAcP1VPFS6EeqwepFqOCaQ8x/kRo3N3se1tm%0AYdM02dhtrvVBEt6+b+abmffNbBhwvqpZlv0MADddLtf7bDY74ty0FMk4MRYE%0A4X4ikfhSV1dnwgkh4PF4FFVV3U7s7TCOiDs6Ouja2tofWEopyLL8UlXVV5WQ%0AOyI2DMModo6P3G63pqqqdE3spALXpbat0rW4sCz/Xzth1ufn5yWa0DQNtra2%0AoLu7W6GUjhBC3lY8Mu3E5aRX8Tpqa2shnU7jTFcKbSruYyfEFmZhYYEODw/f%0ABYCE9SxPLEnSo5qamtVwOMzPzc0ZyWTyga7r+BpEIZXM6n8hRmw0GjUmJyd5%0AAKC4N4klSbqTTqe/eb3evL9kMgn19fUvKKWv7Yjx1chxXFl+u3Oe53OEEDFP%0AzPM8yeVybLGXk5MTCAQCzzVNe4Mk6MxauD8+Pgafz1dCvrOzAy0tLaDrOjAM%0AA5lMxsSdnZ1BdXW1maz5FYlEjKmpKdvoLy8v8fVnZpfL5YBlWTMAURRNVVdV%0AVZXY7e3tQTAYzBNns1kTh/aiKL4jhDw1iVmW1QghQrm6WUQWMf4JEAQhH0ix%0AHbYUBmvhC/eCIPyklHotcXEbGxt6e3u7LbdFbJVuenraiEQijLW3M8IKra+v%0AQygUgqOjI2hoaDArxXGcTikVCtvJv7S09KOvr8+2xdBRZ2cnzM/Po+hgcXHR%0A6O/vZ5qbm439/X0GhY/3KUkSKIoCY2NjMD4+DqiTUChkHBwcMBcXF0iMg8Vd%0ATHJ7dnY2MTo6WpKEJRA86OrqgtXVVXNe8zwPeIeyLFsZmb941traSre3t03R%0AYjCIdblc3zVNu2WX3Y1oNJqamJiwzRzvFwVmrUAgAKlUCjY3N6GtrY3GYjF2%0AaGgof454rAR+MBiWZT0AkC07uQYGBmg8Hnc02VZWVoyenh4mHo/D4OBg2d5u%0AbGyEw8PD3+1UBlkVDoczMzMzjsj/Nsmwh30+3z0A+Jrv4yuM5N7e3szy8jKO%0AuooXlliW5U+Kojy0nDjJhgsGgzpOo0qWqqrg9Xo/6Lr+uNDeCbGJb2pqMnZ3%0Ad6+cz5ZjVPXp6Sn4/X5CKbWtlmNidCoIwjNK6ZOrMhdFMaNp2kdCSOwq3C/H%0Acfgu+27rfgAAAABJRU5ErkJggg==), crosshair");
 | 
			
		||||
            // });
 | 
			
		||||
        }
 | 
			
		||||
    })
 | 
			
		||||
})
 | 
			
		||||
 
 | 
			
		||||
@@ -1,81 +1,186 @@
 | 
			
		||||
$(function() {
 | 
			
		||||
    // 获取开关状态
 | 
			
		||||
    chrome.storage.sync.get('clickState2', function(budget) {
 | 
			
		||||
        // console.log(budget.clickState);
 | 
			
		||||
        // 获取页面节点
 | 
			
		||||
        let input = document.querySelector("#button-2");
 | 
			
		||||
        // 改变开关状态(保持与上次设置时一致)
 | 
			
		||||
        input.checked = budget.clickState2;
 | 
			
		||||
    });
 | 
			
		||||
    // 获取开关状态
 | 
			
		||||
    chrome.storage.sync.get('clickState3', function(budget) {
 | 
			
		||||
        // console.log(budget.clickState);
 | 
			
		||||
        // 获取页面节点
 | 
			
		||||
        let input = document.querySelector("#button-3");
 | 
			
		||||
        // 改变开关状态(保持与上次设置时一致)
 | 
			
		||||
        input.checked = budget.clickState3;
 | 
			
		||||
    /**
 | 
			
		||||
     * 鼠标样式
 | 
			
		||||
     */
 | 
			
		||||
    // 页面加载时,更新界面开关状态
 | 
			
		||||
    chrome.storage.sync.get('State_MouseStyle', function(budget) {
 | 
			
		||||
        document.querySelector("#btnMouseStyle").checked = budget.State_MouseStyle;
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    // 点击开关时改变按钮状态
 | 
			
		||||
    $("#button-2").click(function() {
 | 
			
		||||
        // 获取开关
 | 
			
		||||
        let checked = $("#button-2");
 | 
			
		||||
        // 持久化存储开关状态
 | 
			
		||||
        chrome.storage.sync.set({ 'clickState2': checked[0].checked });
 | 
			
		||||
        console.log('mouse success');
 | 
			
		||||
 | 
			
		||||
        // 自动刷新页面
 | 
			
		||||
        chrome.tabs.query({
 | 
			
		||||
            active: true,
 | 
			
		||||
            currentWindow: true
 | 
			
		||||
        }, (tabs) => {
 | 
			
		||||
            console.log(tabs);
 | 
			
		||||
            let message = {
 | 
			
		||||
                info: 'reload'
 | 
			
		||||
            }
 | 
			
		||||
            chrome.tabs.sendMessage(tabs[0].id, message, res => {
 | 
			
		||||
                console.log(res);
 | 
			
		||||
            })
 | 
			
		||||
        })
 | 
			
		||||
    // 点击开关时存储按钮状态并刷新页面
 | 
			
		||||
    $("#btnMouseStyle").click(function() {
 | 
			
		||||
        chrome.storage.sync.set({ 'State_MouseStyle': $("#btnMouseStyle")[0].checked });
 | 
			
		||||
        refreshPage('Mouse Style');
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    // 点击开关时改变按钮状态
 | 
			
		||||
    $("#button-3").click(function() {
 | 
			
		||||
        // 获取开关
 | 
			
		||||
        let checked = $("#button-3");
 | 
			
		||||
        // 持久化存储开关状态
 | 
			
		||||
        chrome.storage.sync.set({ 'clickState3': checked[0].checked });
 | 
			
		||||
        console.log('click success');
 | 
			
		||||
 | 
			
		||||
        // 自动刷新页面
 | 
			
		||||
        chrome.tabs.query({
 | 
			
		||||
            active: true,
 | 
			
		||||
            currentWindow: true
 | 
			
		||||
        }, (tabs) => {
 | 
			
		||||
            console.log(tabs);
 | 
			
		||||
            let message = {
 | 
			
		||||
                info: 'reload'
 | 
			
		||||
            }
 | 
			
		||||
            chrome.tabs.sendMessage(tabs[0].id, message, res => {
 | 
			
		||||
                console.log(res);
 | 
			
		||||
            })
 | 
			
		||||
        })
 | 
			
		||||
    /**
 | 
			
		||||
     * 鼠标特效
 | 
			
		||||
     */
 | 
			
		||||
    // 页面加载时,更新界面开关状态
 | 
			
		||||
    chrome.storage.sync.get('State_MouseEffect', function(budget) {
 | 
			
		||||
        document.querySelector("#btnMouseEffect").checked = budget.State_MouseEffect;
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    // 点击开关时存储按钮状态并刷新页面
 | 
			
		||||
    $("#btnMouseEffect").click(function() {
 | 
			
		||||
        chrome.storage.sync.set({ 'State_MouseEffect': $("#btnMouseEffect")[0].checked });
 | 
			
		||||
        refreshPage('Mouse Effect');
 | 
			
		||||
    })
 | 
			
		||||
 | 
			
		||||
    // Direct Url
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Direct Url
 | 
			
		||||
     */
 | 
			
		||||
    const btnDirectUrl = document.querySelector("#btnDirectUrl");
 | 
			
		||||
    chrome.storage.sync.get("linkOpen", ({ linkOpen }) => {
 | 
			
		||||
      btnDirectUrl.checked = !linkOpen;
 | 
			
		||||
    // 页面加载时,更新界面开关状态
 | 
			
		||||
    chrome.storage.sync.get("State_DirectUrl", ({ State_DirectUrl }) => {
 | 
			
		||||
        btnDirectUrl.checked = !State_DirectUrl;
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    // 点击开关时存储按钮状态并刷新页面
 | 
			
		||||
    btnDirectUrl.addEventListener("change", () => {
 | 
			
		||||
        chrome.storage.sync.set({ linkOpen: !btnDirectUrl.checked });
 | 
			
		||||
        chrome.storage.sync.set({ State_DirectUrl: !btnDirectUrl.checked });
 | 
			
		||||
        refreshPage('Direct Url');
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    // 截图
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Expand Fulltext
 | 
			
		||||
     */
 | 
			
		||||
    const btnExpandFulltext = document.querySelector("#btnExpandFulltext");
 | 
			
		||||
    // 页面加载时,更新界面开关状态
 | 
			
		||||
    chrome.storage.sync.get("State_ExpandFulltext", ({ State_ExpandFulltext }) => {
 | 
			
		||||
      btnExpandFulltext.checked = !State_ExpandFulltext;
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    // 点击开关时存储按钮状态并刷新页面
 | 
			
		||||
    btnExpandFulltext.addEventListener("change", () => {
 | 
			
		||||
        chrome.storage.sync.set({ State_ExpandFulltext: !btnExpandFulltext.checked });
 | 
			
		||||
        refreshPage('Expand Fulltext');
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Google广告拦截
 | 
			
		||||
     */
 | 
			
		||||
    const btnGoogleAds = document.querySelector("#btnAdsBlock");
 | 
			
		||||
    // 页面加载时,更新界面开关状态
 | 
			
		||||
    chrome.storage.sync.get('State_AdsBlock', function(budget) {
 | 
			
		||||
        btnGoogleAds.checked = !budget.State_AdsBlock;
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    // 点击开关时存储按钮状态并刷新页面
 | 
			
		||||
    $("#btnAdsBlock").click(function() {
 | 
			
		||||
        chrome.storage.sync.set({ 'State_AdsBlock': !btnGoogleAds.checked });
 | 
			
		||||
        chrome.extension.getBackgroundPage().updateAdsBlockStatus(!btnGoogleAds.checked);
 | 
			
		||||
        refreshPage('Ads Block');
 | 
			
		||||
    })
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * SS 快捷搜索
 | 
			
		||||
     */
 | 
			
		||||
    const btnSSSearch = document.querySelector("#btnSSSearch");
 | 
			
		||||
    // 页面加载时,更新界面开关状态
 | 
			
		||||
    chrome.storage.sync.get('State_SSSearch', function(budget) {
 | 
			
		||||
      btnSSSearch.checked = !budget.State_SSSearch;
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    // 点击开关时存储按钮状态并刷新页面
 | 
			
		||||
    $("#btnSSSearch").click(function() {
 | 
			
		||||
        chrome.storage.sync.set({ 'State_SSSearch': !btnSSSearch.checked });
 | 
			
		||||
        // refreshPage('SS Search');
 | 
			
		||||
    })
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 截图
 | 
			
		||||
     */
 | 
			
		||||
    document.getElementById("btnScreenshot").addEventListener("click", () => {
 | 
			
		||||
        chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => {
 | 
			
		||||
            chrome.extension.getBackgroundPage().takeScreenshot(tabs[0]);
 | 
			
		||||
            if(isChromeSettingPage(tabs[0].url)) {
 | 
			
		||||
                alert("抱歉,由于浏览器限制,“chrome://”开头的网页不支持截图");
 | 
			
		||||
            } else {
 | 
			
		||||
                chrome.extension.getBackgroundPage().takeScreenshot(tabs[0]);
 | 
			
		||||
                window.close();
 | 
			
		||||
            }
 | 
			
		||||
        })
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 翻译
 | 
			
		||||
     */
 | 
			
		||||
    document.getElementById("transform").onclick = function () {
 | 
			
		||||
        chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => {
 | 
			
		||||
            if(isChromeSettingPage(tabs[0].url)) {
 | 
			
		||||
                alert("抱歉,由于浏览器限制,“chrome://”开头的网页不支持翻译");
 | 
			
		||||
            } else {
 | 
			
		||||
                chrome.extension.getBackgroundPage().showTranslationWindow()
 | 
			
		||||
                window.close();
 | 
			
		||||
            }
 | 
			
		||||
        })
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 番茄钟
 | 
			
		||||
     */
 | 
			
		||||
    // 获取番茄钟页面状态
 | 
			
		||||
    chrome.storage.sync.get('clockState', function(budget) {
 | 
			
		||||
        console.log(budget.clockState);
 | 
			
		||||
        if (budget.clockState === "block") {
 | 
			
		||||
            $('#back').css("display", "block");
 | 
			
		||||
            $('#article').css("display", "none");
 | 
			
		||||
            $('#pomodoro').css("display", "block");
 | 
			
		||||
        } else if (budget.clockState === "none") {
 | 
			
		||||
            $('#article').css("display", "block");
 | 
			
		||||
            $('#pomodoro').css("display", "none");
 | 
			
		||||
        }
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    $('#clock').click(function() {
 | 
			
		||||
        $('#pomodoro').fadeIn(500);
 | 
			
		||||
        $('#article').fadeOut(0);
 | 
			
		||||
        $('#back').css("display", "block");
 | 
			
		||||
        chrome.storage.sync.set({ "clockState": "block" });
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    $('#back').click(function() {
 | 
			
		||||
        $('#pomodoro').fadeOut(0);
 | 
			
		||||
        $('#article').fadeIn(200);
 | 
			
		||||
        $('#back').css("display", "none");
 | 
			
		||||
        chrome.storage.sync.set({ "clockState": "none" });
 | 
			
		||||
    })
 | 
			
		||||
 | 
			
		||||
    // ****************************************************************************************************************
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 判断是否是 chrome:// 开头的链接
 | 
			
		||||
     * @param {} url
 | 
			
		||||
     * @returns
 | 
			
		||||
     */
 | 
			
		||||
    function isChromeSettingPage(url) {
 | 
			
		||||
        return /^chrome:\/\/.*$/.test(url);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 改变开关自动刷新页面
 | 
			
		||||
     */
 | 
			
		||||
    function refreshPage(messageInfo) {
 | 
			
		||||
        chrome.tabs.query({
 | 
			
		||||
            active: true,
 | 
			
		||||
            currentWindow: true
 | 
			
		||||
        }, (tabs) => {
 | 
			
		||||
            console.log(tabs);
 | 
			
		||||
            let message = {
 | 
			
		||||
                info: messageInfo,
 | 
			
		||||
                action: "refreshPage"
 | 
			
		||||
            }
 | 
			
		||||
            chrome.tabs.sendMessage(tabs[0].id, message, res => {
 | 
			
		||||
                console.log(res);
 | 
			
		||||
            })
 | 
			
		||||
        })
 | 
			
		||||
    }
 | 
			
		||||
})
 | 
			
		||||
 
 | 
			
		||||
@@ -1,97 +1,62 @@
 | 
			
		||||
//天气 
 | 
			
		||||
//天气
 | 
			
		||||
let key_w = "314285a761da4025bd4c09339dca5f0f"
 | 
			
		||||
var longitude = 116.40
 | 
			
		||||
var latitude = 39.90
 | 
			
		||||
var BitDanceSite = '北京'
 | 
			
		||||
 | 
			
		||||
var searchWeatherfn = async function () {
 | 
			
		||||
  // 用经纬度获取
 | 
			
		||||
  let url_jw = longitude + ',' + latitude
 | 
			
		||||
  console.log("url_jw: " + url_jw)
 | 
			
		||||
  let httpUrl = `https://geoapi.qweather.com/v2/city/lookup?location=${url_jw}&key=${key_w}`
 | 
			
		||||
  //获取城市的ID
 | 
			
		||||
  // let httpUrl = `https://geoapi.qweather.com/v2/city/lookup?location=黔江区&adm=重庆&key=${key}`
 | 
			
		||||
  let res1 = await fetch(httpUrl) // 不能res,会冲突
 | 
			
		||||
  let result = await res1.json()
 | 
			
		||||
  console.log("下面是result")
 | 
			
		||||
  console.log(result)
 | 
			
		||||
  document.getElementById("weatherSite").innerHTML = result.location[0].adm1
 | 
			
		||||
  let id = result.location[0].id
 | 
			
		||||
  console.log(id)
 | 
			
		||||
  //根据城市id获取具体的天气
 | 
			
		||||
  let httpUrl1 = `https://devapi.qweather.com/v7/weather/now?location=${id}&key=${key_w}`
 | 
			
		||||
  let res2 = await fetch(httpUrl1)
 | 
			
		||||
  let result1 = await res2.json()
 | 
			
		||||
var searchWeatherfn = async function() {
 | 
			
		||||
    // 用位置获取
 | 
			
		||||
    let url_jw = BitDanceSite
 | 
			
		||||
    let httpUrl = `https://geoapi.qweather.com/v2/city/lookup?location=${url_jw}&key=${key_w}`;
 | 
			
		||||
    //获取城市的ID
 | 
			
		||||
    // let httpUrl = `https://geoapi.qweather.com/v2/city/lookup?location=黔江区&adm=重庆&key=${key}`
 | 
			
		||||
    let res1 = await fetch(httpUrl); // 不能res,会冲突
 | 
			
		||||
    let result = await res1.json();
 | 
			
		||||
    let id = result.location[0].id;
 | 
			
		||||
    //根据城市id获取具体的天气
 | 
			
		||||
    let httpUrl1 = `https://devapi.qweather.com/v7/weather/now?location=${id}&key=${key_w}`
 | 
			
		||||
    let res2 = await fetch(httpUrl1);
 | 
			
		||||
    let result1 = await res2.json();
 | 
			
		||||
    //显示天气情况
 | 
			
		||||
    let now = result1.now.text;
 | 
			
		||||
    document.getElementById("weatherText").innerHTML = now;
 | 
			
		||||
    //显示温度
 | 
			
		||||
    let nowTemp = result1.now.temp
 | 
			
		||||
    document.getElementById("weatherTemp").innerHTML = nowTemp + '°';
 | 
			
		||||
    //显示图标
 | 
			
		||||
    let svg_icon = result1.now.icon;
 | 
			
		||||
    document.getElementById("svg_w").src = "./assets/image/weather/icons/" + svg_icon + ".svg";
 | 
			
		||||
    //切换背景色
 | 
			
		||||
    var bobyEI = document.body;
 | 
			
		||||
    // var bobyEI = document.getElementById("weather")
 | 
			
		||||
    svg_icon = parseInt(svg_icon);
 | 
			
		||||
    if (100 <= svg_icon && svg_icon < 101) {
 | 
			
		||||
        bobyEI.style = "background: url(./assets/image/weather/sun.webp) no-repeat; background-size: cover;"
 | 
			
		||||
    } else if (101 <= svg_icon && svg_icon < 104) {
 | 
			
		||||
        bobyEI.style = "background: url(./assets/image/weather/yun.webp) no-repeat; background-size: cover;"
 | 
			
		||||
    } else if (104 <= svg_icon && svg_icon < 150) {
 | 
			
		||||
        bobyEI.style = "background: url(./assets/image/weather/yin.webp) no-repeat; background-size: cover;"
 | 
			
		||||
    } else if (150 <= svg_icon && svg_icon < 300) {
 | 
			
		||||
        bobyEI.style = "background: url(./assets/image/weather/night.webp) no-repeat; background-size: cover;"
 | 
			
		||||
    } else if (300 <= svg_icon && svg_icon < 400) {
 | 
			
		||||
        bobyEI.style = "background: url(./assets/image/weather/yu.webp) no-repeat; background-size: cover;"
 | 
			
		||||
    } else if (400 <= svg_icon && svg_icon < 500) {
 | 
			
		||||
        bobyEI.style = "background: url(./assets/image/weather/xue.webp) no-repeat; background-size: cover;"
 | 
			
		||||
    } else {
 | 
			
		||||
        bobyEI.style = "background: url(./assets/image/weather/yun.webp) no-repeat; background-size: cover;"
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
  console.log(result1)
 | 
			
		||||
  console.log(result1.now)
 | 
			
		||||
  //显示天气情况
 | 
			
		||||
  let now = result1.now.text
 | 
			
		||||
  document.getElementById("weatherText").innerHTML = now
 | 
			
		||||
  //显示温度
 | 
			
		||||
  let nowTemp = result1.now.temp
 | 
			
		||||
  document.getElementById("weatherTemp").innerHTML = nowTemp + '°'
 | 
			
		||||
  //显示图标
 | 
			
		||||
  let svg_icon = result1.now.icon
 | 
			
		||||
  document.getElementById("svg_w").src = "./assets/image/weather/icons/" + svg_icon + ".svg"
 | 
			
		||||
  //切换背景色
 | 
			
		||||
  var bobyEI = document.body
 | 
			
		||||
  svg_icon = parseInt(svg_icon)
 | 
			
		||||
  if (100 <= svg_icon && svg_icon < 101) {
 | 
			
		||||
    bobyEI.style.backgroundImage = "url(./assets/image/weather/sun.webp)"
 | 
			
		||||
  } else if (101 <= svg_icon && svg_icon < 104) {
 | 
			
		||||
    bobyEI.style.backgroundImage = "url(./assets/image/weather/yun.webp)"
 | 
			
		||||
  } else if (104 <= svg_icon && svg_icon < 150) {
 | 
			
		||||
    bobyEI.style.backgroundImage = "url(./assets/image/weather/yin.webp)"
 | 
			
		||||
  } else if (150 <= svg_icon && svg_icon < 300) {
 | 
			
		||||
    bobyEI.style.backgroundImage = "url(./assets/image/weather/night.webp)"
 | 
			
		||||
  } else if (300 <= svg_icon && svg_icon < 400) {
 | 
			
		||||
    bobyEI.style.backgroundImage = "url(./assets/image/weather/yu.webp)"
 | 
			
		||||
  } else if (400 <= svg_icon && svg_icon < 500) {
 | 
			
		||||
    bobyEI.style.backgroundImage = "url(./assets/image/weather/xue.webp)"
 | 
			
		||||
  } else {
 | 
			
		||||
    bobyEI.style.backgroundImage = "url(./assets/image/weather/yun.webp)"
 | 
			
		||||
if(localStorage.getItem('weatherSiteSelet_Local')){//有缓存的时候
 | 
			
		||||
    document.getElementById("weatherSiteSelet").value = localStorage.getItem('weatherSiteSelet_Local')
 | 
			
		||||
    BitDanceSite = localStorage.getItem('weatherSiteSelet_Local')
 | 
			
		||||
    searchWeatherfn()
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function find_site() { //获取浏览器的经纬度
 | 
			
		||||
  console.log("开始定位浏览器位置")
 | 
			
		||||
  localStorage.removeItem('BitD_longitude')
 | 
			
		||||
  localStorage.removeItem('BitD_latitude')
 | 
			
		||||
  navigator.geolocation.getCurrentPosition(onSuccess); // 获取经纬度
 | 
			
		||||
  function onSuccess(position) {
 | 
			
		||||
    //经度
 | 
			
		||||
    longitude = position.coords.longitude;
 | 
			
		||||
    localStorage.setItem('BitD_longitude', longitude)
 | 
			
		||||
    console.log("longitude:" + longitude)
 | 
			
		||||
 | 
			
		||||
    //纬度
 | 
			
		||||
    latitude = position.coords.latitude;
 | 
			
		||||
    localStorage.setItem('BitD_latitude', latitude)
 | 
			
		||||
    console.log("latitude:" + latitude)
 | 
			
		||||
    console.log("获得浏览器经纬度而且写入localstorage end")
 | 
			
		||||
  
 | 
			
		||||
  document.getElementById("weatherSiteSelet").onchange = function(){
 | 
			
		||||
      localStorage.removeItem('weatherSiteSelet_Local')
 | 
			
		||||
      let res3 = document.getElementById("weatherSiteSelet").value
 | 
			
		||||
      localStorage.setItem('weatherSiteSelet_Local',res3)
 | 
			
		||||
      BitDanceSite = res3
 | 
			
		||||
      searchWeatherfn()
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
if (localStorage.getItem('BitD_longitude')) { //没有缓存
 | 
			
		||||
  longitude = localStorage.getItem('BitD_longitude')
 | 
			
		||||
  latitude = localStorage.getItem('BitD_latitude')
 | 
			
		||||
  searchWeatherfn()
 | 
			
		||||
} else { // 没有缓存的时候 或者 需要更新的时候
 | 
			
		||||
  console.log("没有找到")
 | 
			
		||||
  find_site()
 | 
			
		||||
  searchWeatherfn()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
document.getElementById("weatherSite").onclick = function () {
 | 
			
		||||
  find_site()
 | 
			
		||||
  searchWeatherfn()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// //天气end
 | 
			
		||||
//翻译
 | 
			
		||||
document.getElementById("ToTans").onclick = function () {
 | 
			
		||||
  console.log(chrome.extension.getBackgroundPage())
 | 
			
		||||
  chrome.extension.getBackgroundPage().tranBit()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//翻译end   
 | 
			
		||||
  
 | 
			
		||||
//天气end
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,14 @@
 | 
			
		||||
var AdsBlockStatus = true;
 | 
			
		||||
// refer: https://www.it1352.com/1996113.html
 | 
			
		||||
chrome.webRequest.onBeforeRequest.addListener(
 | 
			
		||||
  function (details) {
 | 
			
		||||
 | 
			
		||||
    if (!AdsBlockStatus)
 | 
			
		||||
      return { cancel: false }; // 如果没有开启此功能,不处理
 | 
			
		||||
 | 
			
		||||
    if (!details || !details.initiator || !details.url)
 | 
			
		||||
      return { cancel: false }; // 如果没有请求信息,则可能是chrome://开头的页面,不处理
 | 
			
		||||
 | 
			
		||||
    let isBlock = false
 | 
			
		||||
      || details.initiator === "https://googleads.g.doubleclick.net"
 | 
			
		||||
      || details.initiator.indexOf("googleads.g.doubleclick.net") != -1
 | 
			
		||||
@@ -11,10 +19,23 @@ chrome.webRequest.onBeforeRequest.addListener(
 | 
			
		||||
      || details.url.indexOf("adservice.google.com") != -1
 | 
			
		||||
      || details.url.indexOf("googleads") != -1
 | 
			
		||||
      || details.url.indexOf("adsbygoogle") != -1
 | 
			
		||||
 | 
			
		||||
    if (isBlock) // 拦截后打印到控制台显示
 | 
			
		||||
      console.log(isBlock ? "block" : "allow", details)
 | 
			
		||||
 | 
			
		||||
    return { cancel: isBlock };
 | 
			
		||||
  },
 | 
			
		||||
  { urls: ["<all_urls>"] },
 | 
			
		||||
  ["blocking"]
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
// 由于上方拦截函数不可以是异步函数,所以设置变更后需要及时调用此函数
 | 
			
		||||
var updateAdsBlockStatus = (status) => {
 | 
			
		||||
  AdsBlockStatus = !!status;
 | 
			
		||||
  console.log("AdsBlock Status: ", AdsBlockStatus);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 插件刚开始加载时,先读取一次状态
 | 
			
		||||
chrome.storage.sync.get('State_AdsBlock', function (State) {
 | 
			
		||||
  updateAdsBlockStatus(State.State_AdsBlock);
 | 
			
		||||
});
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										7
									
								
								packages/shell-chrome/assets/js/translate/background.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,7 @@
 | 
			
		||||
// 翻译功能
 | 
			
		||||
function showTranslationWindow() {
 | 
			
		||||
  chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => {
 | 
			
		||||
    chrome.tabs.executeScript(tabs[0].id, { file: './assets/js/translate/tran.js', runAt: 'document_start' })
 | 
			
		||||
    chrome.tabs.insertCSS(tabs[0].id, { file: './assets/css/tran.css', runAt: 'document_start' })
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
@@ -5,33 +5,44 @@ if (typeof (BitTarnsDiv) !== "undefined") {
 | 
			
		||||
var BitTarnsDiv = document.createElement("div")
 | 
			
		||||
BitTarnsDiv.id = "BitTarnsDivId"
 | 
			
		||||
document.body.appendChild(BitTarnsDiv)
 | 
			
		||||
BitTarnsDiv.style.backgroundColor = "red"
 | 
			
		||||
BitTarnsDiv.style.height = "450px"
 | 
			
		||||
BitTarnsDiv.style.backgroundColor = "RGB(238,237,237)"
 | 
			
		||||
BitTarnsDiv.style.height = "550px"
 | 
			
		||||
BitTarnsDiv.style.width = "300px"
 | 
			
		||||
BitTarnsDiv.style.zIndex = 99999
 | 
			
		||||
BitTarnsDiv.style.position = "fixed"
 | 
			
		||||
BitTarnsDiv.style.right = '10px'
 | 
			
		||||
BitTarnsDiv.style.top = '50px'
 | 
			
		||||
BitTarnsDiv.style.float = 'right'
 | 
			
		||||
BitTarnsDiv.style.border = '2px solid RGB(238,237,237)'
 | 
			
		||||
BitTarnsDiv.style.borderRadius = '25px'
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
BitTarnsDiv.innerHTML = `
 | 
			
		||||
 <div id = 'trans'>
 | 
			
		||||
            <select id="inputLangSelect">
 | 
			
		||||
            <option value="auto">自动检测语言</option>
 | 
			
		||||
            <option value="zh">简体中文</option>
 | 
			
		||||
            <option value="en">English</option>
 | 
			
		||||
            </select>
 | 
			
		||||
          <select id="outLangSelect">
 | 
			
		||||
            <option value="zh">简体中文</option>
 | 
			
		||||
            <option value="en">English</option>
 | 
			
		||||
            </select>
 | 
			
		||||
            <button id="deleteTrans">关闭</button>
 | 
			
		||||
          <input type="text" id="inputLang" value="" placeholder="请输入翻译内容"  >
 | 
			
		||||
          <br>
 | 
			
		||||
            自动检测语言:<p id="LangType"></p><button id="tranbtn">翻译</button>
 | 
			
		||||
          <hr>
 | 
			
		||||
        <p id="outPutRes"></p>
 | 
			
		||||
<div id='trans'>
 | 
			
		||||
<div id="trans_header">
 | 
			
		||||
  学生助手--翻译小帮手
 | 
			
		||||
  <button id="deleteTrans">X</button>
 | 
			
		||||
</div>
 | 
			
		||||
<select id="inputLangSelect" class="LangSelectCss"> 
 | 
			
		||||
  <option class="LangSelectCssOption" value="auto">自动检测语言</option>
 | 
			
		||||
  <option class="LangSelectCssOption" value="zh">简体中文</option>
 | 
			
		||||
  <option class="LangSelectCssOption" value="en">English</option>
 | 
			
		||||
</select>
 | 
			
		||||
=>
 | 
			
		||||
<select id="outLangSelect" class="LangSelectCss">
 | 
			
		||||
  <option class="LangSelectCssOption" value="zh">简体中文</option>
 | 
			
		||||
  <option class="LangSelectCssOption" value="en">English</option>
 | 
			
		||||
</select>
 | 
			
		||||
 | 
			
		||||
<textarea cols="39" rows="15" id="inputLang" placeholder="请输入翻译内容"></textarea>
 | 
			
		||||
 | 
			
		||||
<br>
 | 
			
		||||
<div id="middleTans">
 | 
			
		||||
  自动检测语言:<p id="LangType">English</p><button id="tranbtn">翻译</button>
 | 
			
		||||
  
 | 
			
		||||
</div>
 | 
			
		||||
<hr>
 | 
			
		||||
<div id="outPutRes"></div>
 | 
			
		||||
</div>
 | 
			
		||||
 `
 | 
			
		||||
 | 
			
		||||
@@ -39,8 +50,6 @@ var from = 'auto';
 | 
			
		||||
var to = 'auto';
 | 
			
		||||
 | 
			
		||||
var postMsg = async function () {
 | 
			
		||||
    from = document.getElementById("inputLangSelect").value
 | 
			
		||||
    to = document.getElementById("outLangSelect").value
 | 
			
		||||
    var msgq = document.getElementById("inputLang").value
 | 
			
		||||
    // 翻译api
 | 
			
		||||
    msgq = encodeURIComponent(msgq)
 | 
			
		||||
@@ -50,7 +59,6 @@ var postMsg = async function () {
 | 
			
		||||
    let res1 = await fetch(httpUrl1)
 | 
			
		||||
    let result1 = await res1.json()
 | 
			
		||||
    let res2 = result1.trans_result[0].dst
 | 
			
		||||
 | 
			
		||||
    document.getElementById("outPutRes").innerHTML = res2
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -63,13 +71,21 @@ var onInputChange = async function () {
 | 
			
		||||
    let result1 = await res1.json()
 | 
			
		||||
    let res2 = result1.data.src
 | 
			
		||||
    if (res2 == 'en') {
 | 
			
		||||
        document.getElementById("LangType").innerHTML = '英文'
 | 
			
		||||
        document.getElementById("LangType").innerHTML = 'English'
 | 
			
		||||
        from = 'en';
 | 
			
		||||
        to = 'zh';
 | 
			
		||||
        postMsg()
 | 
			
		||||
    } else if (res2 == 'zh') {
 | 
			
		||||
        document.getElementById("LangType").innerHTML = '简体中文'
 | 
			
		||||
        from = 'zh';
 | 
			
		||||
        to = 'en';
 | 
			
		||||
        postMsg()
 | 
			
		||||
    } else {
 | 
			
		||||
        document.getElementById("LangType").innerHTML = res
 | 
			
		||||
        document.getElementById("LangType").innerHTML = res2
 | 
			
		||||
        to = 'zh';
 | 
			
		||||
        postMsg()
 | 
			
		||||
    }
 | 
			
		||||
    postMsg()
 | 
			
		||||
    
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//触发识别语言,再翻译
 | 
			
		||||
@@ -78,6 +94,8 @@ document.getElementById("inputLang").onchange = function () {
 | 
			
		||||
}
 | 
			
		||||
//直接翻译
 | 
			
		||||
document.getElementById("tranbtn").onclick = function () {
 | 
			
		||||
    from = document.getElementById("inputLangSelect").value
 | 
			
		||||
    to = document.getElementById("outLangSelect").value
 | 
			
		||||
    postMsg()
 | 
			
		||||
}
 | 
			
		||||
//关闭翻译模块
 | 
			
		||||
 
 | 
			
		||||
@@ -16,6 +16,7 @@
 | 
			
		||||
    "scripts": [
 | 
			
		||||
      "assets/js/lib/jquery.min.js",
 | 
			
		||||
      "assets/js/background.js",
 | 
			
		||||
      "assets/js/translate/background.js",
 | 
			
		||||
      "assets/js/remove-google-ads/background_preventAdsScript.js",
 | 
			
		||||
      "assets/html/pomodoro/background.js",
 | 
			
		||||
      "assets/js/advanced-search/background.js",
 | 
			
		||||
@@ -51,7 +52,8 @@
 | 
			
		||||
    {
 | 
			
		||||
      "_______commit": "自动展开模块",
 | 
			
		||||
      "matches": [
 | 
			
		||||
        "*://blog.csdn.net/*"
 | 
			
		||||
        "*://blog.csdn.net/*",
 | 
			
		||||
        "*://www.it1352.com/*"
 | 
			
		||||
      ],
 | 
			
		||||
      "js": [
 | 
			
		||||
        "assets/js/lib/jquery.min.js",
 | 
			
		||||
@@ -59,16 +61,6 @@
 | 
			
		||||
      ],
 | 
			
		||||
      "run_at": "document_start"
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      "_______commit": "自动展开模块",
 | 
			
		||||
      "matches": [
 | 
			
		||||
        "*://www.it1352.com/*"
 | 
			
		||||
      ],
 | 
			
		||||
      "js": [
 | 
			
		||||
        "assets/js/expand-full-text/www.it1352.com.js"
 | 
			
		||||
      ],
 | 
			
		||||
      "run_at": "document_start"
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      "_______commit": "自动搜索模块",
 | 
			
		||||
      "matches": [
 | 
			
		||||
 
 | 
			
		||||
@@ -10,56 +10,123 @@
 | 
			
		||||
<body>
 | 
			
		||||
    <div id="popup">
 | 
			
		||||
        <header>
 | 
			
		||||
            <img src="assets/image/logo.png" alt="Logo">
 | 
			
		||||
               <!-- 天气模块 -->
 | 
			
		||||
             <div id='weather'>
 | 
			
		||||
                <p id="weatherSite">北京</p>
 | 
			
		||||
                <img id = "svg_w" src="./assets/image/weather/icons/100.svg">
 | 
			
		||||
                <p id='weatherText'></p>
 | 
			
		||||
                <p id="weatherTemp"></p>
 | 
			
		||||
            <img src="assets/image/logo.png" alt="Logo" id="logo">
 | 
			
		||||
            <div id="weather">
 | 
			
		||||
                <select id="weatherSiteSelet">
 | 
			
		||||
                    <option value="北京" selected >北京</option>
 | 
			
		||||
                    <option value="浙江">浙江</option>
 | 
			
		||||
                    <option value="天津">天津</option>
 | 
			
		||||
                    <option value="安徽">安徽</option>
 | 
			
		||||
                    <option value="上海">上海</option>
 | 
			
		||||
                    <option value="福建">福建</option>
 | 
			
		||||
                    <option value="重庆">重庆</option>
 | 
			
		||||
                    <option value="江西">江西</option>
 | 
			
		||||
                    <option value="山东">山东</option>
 | 
			
		||||
                    <option value="河南">河南</option>
 | 
			
		||||
                    <option value="湖北">湖北</option>
 | 
			
		||||
                    <option value="湖南">湖南</option>
 | 
			
		||||
                    <option value="广东">广东</option>
 | 
			
		||||
                    <option value="海南">海南</option>
 | 
			
		||||
                    <option value="山西">山西</option>
 | 
			
		||||
                    <option value="青海">青海</option>
 | 
			
		||||
                    <option value="江苏">江苏</option>
 | 
			
		||||
                    <option value="辽宁">辽宁</option>
 | 
			
		||||
                    <option value="吉林">吉林</option>
 | 
			
		||||
                    <option value="台湾">台湾</option>
 | 
			
		||||
                    <option value="河北">河北</option>
 | 
			
		||||
                    <option value="贵州">贵州</option>
 | 
			
		||||
                    <option value="四川">四川</option>
 | 
			
		||||
                    <option value="云南">云南</option>
 | 
			
		||||
                    <option value="陕西">陕西</option>
 | 
			
		||||
                    <option value="甘肃">甘肃</option>
 | 
			
		||||
                    <option value="黑龙江">黑龙江</option>
 | 
			
		||||
                    <option value="香港">香港</option>
 | 
			
		||||
                    <option value="澳门">澳门</option>
 | 
			
		||||
                    <option value="广西">广西</option>
 | 
			
		||||
                    <option value="宁夏">宁夏</option>
 | 
			
		||||
                    <option value="新疆">新疆</option>
 | 
			
		||||
                    <option value="内蒙">内蒙</option>
 | 
			
		||||
                    <option value="西藏">西藏</option>
 | 
			
		||||
                  </select>
 | 
			
		||||
                <img id="svg_w" src="./assets/image/weather/icons/100.svg">
 | 
			
		||||
                <span id='weatherText'></span>
 | 
			
		||||
                <span id="weatherTemp"></span>
 | 
			
		||||
            </div>
 | 
			
		||||
        </header>
 | 
			
		||||
        <div class="article">
 | 
			
		||||
            <ul>
 | 
			
		||||
                <li>
 | 
			
		||||
                    <div id="expand">
 | 
			
		||||
                    </div>
 | 
			
		||||
                </li>
 | 
			
		||||
                <li>
 | 
			
		||||
                    <div id="mouse-style">
 | 
			
		||||
                        <span>鼠标样式</span>
 | 
			
		||||
                        <div class="button">
 | 
			
		||||
                            <input type="checkbox" id="button-2" class="checkbox" />
 | 
			
		||||
                            <div class="knobs"></div>
 | 
			
		||||
                            <div class="layer"></div>
 | 
			
		||||
        <div id="back"></div>
 | 
			
		||||
        <div id="article">
 | 
			
		||||
            <div id="buttons">
 | 
			
		||||
                <button id="transform">翻译</button>
 | 
			
		||||
                <div id="clock">番茄钟</div>
 | 
			
		||||
                <button id="btnScreenshot">截图</button>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="setting">
 | 
			
		||||
                <ul>
 | 
			
		||||
                    <li>
 | 
			
		||||
                        <div class="setting-item">
 | 
			
		||||
                            <span>SS快捷搜索</span>
 | 
			
		||||
                            <div class="button">
 | 
			
		||||
                                <input type="checkbox" id="btnSSSearch" class="checkbox" />
 | 
			
		||||
                                <div class="knobs"></div>
 | 
			
		||||
                                <div class="layer"></div>
 | 
			
		||||
                            </div>
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                </li>
 | 
			
		||||
                <li>
 | 
			
		||||
                    <div id="click-per">
 | 
			
		||||
                        <span>点击特效</span>
 | 
			
		||||
                        <div class="button">
 | 
			
		||||
                            <input type="checkbox" id="button-3" class="checkbox" />
 | 
			
		||||
                            <div class="knobs"></div>
 | 
			
		||||
                            <div class="layer"></div>
 | 
			
		||||
                    </li>
 | 
			
		||||
                    <li>
 | 
			
		||||
                        <div class="setting-item">
 | 
			
		||||
                            <span>确认访问页自动跳转</span>
 | 
			
		||||
                            <div class="button">
 | 
			
		||||
                                <input type="checkbox" id="btnDirectUrl" class="checkbox" />
 | 
			
		||||
                                <div class="knobs"></div>
 | 
			
		||||
                                <div class="layer"></div>
 | 
			
		||||
                            </div>
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                </li>
 | 
			
		||||
                <li>
 | 
			
		||||
                    <div id="click-per">
 | 
			
		||||
                        <span>确认访问页自动跳转</span>
 | 
			
		||||
                        <div class="button">
 | 
			
		||||
                            <input type="checkbox" id="btnDirectUrl" class="checkbox" />
 | 
			
		||||
                            <div class="knobs"></div>
 | 
			
		||||
                            <div class="layer"></div>
 | 
			
		||||
                    </li>
 | 
			
		||||
                    <li>
 | 
			
		||||
                        <div class="setting-item">
 | 
			
		||||
                            <span>Google广告屏蔽</span>
 | 
			
		||||
                            <div class="button">
 | 
			
		||||
                                <input type="checkbox" id="btnAdsBlock" class="checkbox" />
 | 
			
		||||
                                <div class="knobs"></div>
 | 
			
		||||
                                <div class="layer"></div>
 | 
			
		||||
                            </div>
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                </li>
 | 
			
		||||
            </ul>
 | 
			
		||||
                    </li>
 | 
			
		||||
                    <li>
 | 
			
		||||
                        <div class="setting-item">
 | 
			
		||||
                            <span>阅读原文自动展开</span>
 | 
			
		||||
                            <div class="button">
 | 
			
		||||
                                <input type="checkbox" id="btnExpandFulltext" class="checkbox" />
 | 
			
		||||
                                <div class="knobs"></div>
 | 
			
		||||
                                <div class="layer"></div>
 | 
			
		||||
                            </div>
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </li>
 | 
			
		||||
                    <li>
 | 
			
		||||
                        <div class="setting-item">
 | 
			
		||||
                            <span>鼠标样式</span>
 | 
			
		||||
                            <div class="button">
 | 
			
		||||
                                <input type="checkbox" id="btnMouseStyle" class="checkbox" />
 | 
			
		||||
                                <div class="knobs"></div>
 | 
			
		||||
                                <div class="layer"></div>
 | 
			
		||||
                            </div>
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </li>
 | 
			
		||||
                    <li>
 | 
			
		||||
                        <div class="setting-item">
 | 
			
		||||
                            <span>鼠标点击特效</span>
 | 
			
		||||
                            <div class="button">
 | 
			
		||||
                                <input type="checkbox" id="btnMouseEffect" class="checkbox" />
 | 
			
		||||
                                <div class="knobs"></div>
 | 
			
		||||
                                <div class="layer"></div>
 | 
			
		||||
                            </div>
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </li>
 | 
			
		||||
 | 
			
		||||
                </ul>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <button id="btnScreenshot">截图</button>
 | 
			
		||||
        <button id="ToTans">翻译</button>
 | 
			
		||||
        <iframe src="assets/html/pomodoro/popup.html" id="pomodoro" style="border: 0; height: 400px;"></iframe>
 | 
			
		||||
        <iframe src="assets/html/pomodoro/popup.html" id="pomodoro" style="border: 0; height: 450px; display: none;"></iframe>
 | 
			
		||||
    </div>
 | 
			
		||||
    <script src="assets/js/lib/jquery.min.js"></script>
 | 
			
		||||
    <script src="assets/js/popup.js"></script>
 | 
			
		||||
 
 | 
			
		||||