first commit

This commit is contained in:
编码猿
2025-02-04 19:16:43 +08:00
commit 53ce1dfa30
17 changed files with 415 additions and 0 deletions

23
.gitignore vendored Normal file
View File

@@ -0,0 +1,23 @@
.DS_Store
node_modules
/dist
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

1
.pydio Normal file
View File

@@ -0,0 +1 @@
54e4188a-2736-43f2-91ff-98b8dd7797c1

BIN
book.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

1
css/.pydio Normal file
View File

@@ -0,0 +1 @@
7f60b74b-4c15-43d6-a59c-a010009eb840

12
css/clear.css Normal file
View File

@@ -0,0 +1,12 @@
body,h1,h2,h3,h4,h5,h6,p,ul,li{
margin: 0;
padding: 0;
list-style: none;
}
a {
text-decoration: none;
}
input {
outline: none;
border: none;
}

112
css/index.css Normal file
View File

@@ -0,0 +1,112 @@
.night {
background: rgb(24, 26, 27);
}
.night .search input{
background: rgb(24, 26, 27);
border-color: rgb(56, 61, 63);
color: rgba(232, 230, 227, 0.87);
}
.themeChange {
position: fixed;
right: 30px;
top: 30px;
}
.themeChange img {
width: 30px;
height: 30px;
}
.bmy_tab {
width: 100vw;
}
.logo {
margin: 0 auto;
margin-top: 14%;
display: block;
}
.search {
margin: 0 auto;
width: 584px;
height: 50px;
border-radius: 24px;
position: relative;
}
.search .icon {
color: #80868b;
position: absolute;
fill: currentColor;
display: inline-block;
width: 20px;
height: 20px;
top: 50%;
right: 15px;
transform: translateY(-50%);
}
.icon svg {
width: 100%;
height: 100%;
}
.search .icon:first-child {
left: 15px;
}
.search input {
border: 1px solid #dfe1e5;
border-radius: 24px;
height: 100%;
width: 100%;
padding: 0 44px;
box-sizing: border-box;
color: rgba(0,0,0,.87);
font-size: 16px;
}
.clear {
cursor: pointer;
}
.search:hover {
background-color: #fff;
box-shadow: 0 1px 6px rgb(32 33 36 / 28%);
border-color: rgba(223,225,229,0);
}
.history {
margin: 0 15px;
display: flex;
justify-content: space-between;
flex-wrap: wrap;
margin-top: 50px;
overflow-x: scroll;
}
.history li {
width: 24%;
border: 1px solid #dadce0;
border-radius: 8px;
padding: 24px;
box-sizing: border-box;
margin-bottom: 10px;
}
.history li h2 {
font-family: 'Google Sans',Roboto,Arial,sans-serif;
font-size: 22px;
font-weight: 400;
letter-spacing: 0;
hyphens: auto;
word-break: break-word;
word-wrap: break-word;
color: #202124;
}
.history li .url {
font-family: Roboto,Arial,sans-serif;
font-size: 14px;
font-weight: 400;
hyphens: auto;
word-break: break-word;
word-wrap: break-word;
color: #5f6368;
padding: 8px 0 0 0;
}

1
img/.pydio Normal file
View File

@@ -0,0 +1 @@
c8b9aa36-6ebc-4a04-9831-36b7080e09ef

BIN
img/bmylogo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

2
img/day.svg Normal file
View File

@@ -0,0 +1,2 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1614699522379" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="10661" data-darkreader-inline-fill="" width="1024" height="1024" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><style type="text/css">[data-darkreader-inline-fill] { fill: var(--darkreader-inline-fill) !important; }
</style></defs><path d="M512 512m-256 0a256 256 0 1 0 512 0 256 256 0 1 0-512 0Z" fill="#EFAC25" p-id="10662" data-darkreader-inline-fill="" style="--darkreader-inline-fill:#b27c0d;"></path><path d="M524.8 166.4m-12.8 0l0 0q-12.8 0-12.8-12.8l0-128q0-12.8 12.8-12.8l0 0q12.8 0 12.8 12.8l0 128q0 12.8-12.8 12.8Z" fill="#EFAC25" p-id="10663" data-darkreader-inline-fill="" style="--darkreader-inline-fill:#f0b337;"></path><path d="M524.8 1011.2m-12.8 0l0 0q-12.8 0-12.8-12.8l0-128q0-12.8 12.8-12.8l0 0q12.8 0 12.8 12.8l0 128q0 12.8-12.8 12.8Z" fill="#EFAC25" p-id="10664" data-darkreader-inline-fill="" style="--darkreader-inline-fill:#f0b337;"></path><path d="M856.956768 877.254834m-9.050967 9.050967l0 0q-9.050967 9.050967-18.101934 0l-90.509668-90.509668q-9.050967-9.050967 0-18.101934l0 0q9.050967-9.050967 18.101934 0l90.509668 90.509668q9.050967 9.050967 0 18.101934Z" fill="#EFAC25" p-id="10665" data-darkreader-inline-fill="" style="--darkreader-inline-fill:#f0b337;"></path><path d="M1011.2 499.2m0 12.8l0 0q0 12.8-12.8 12.8l-128 0q-12.8 0-12.8-12.8l0 0q0-12.8 12.8-12.8l128 0q12.8 0 12.8 12.8Z" fill="#EFAC25" p-id="10666" data-darkreader-inline-fill="" style="--darkreader-inline-fill:#f0b337;"></path><path d="M851.585532 141.456942m9.050967 9.050967l0 0q9.050967 9.050967 0 18.101933l-90.509668 90.509668q-9.050967 9.050967-18.101934 0l0 0q-9.050967-9.050967 0-18.101933l90.509668-90.509668q9.050967-9.050967 18.101934 0Z" fill="#EFAC25" p-id="10667" data-darkreader-inline-fill="" style="--darkreader-inline-fill:#f0b337;"></path><path d="M166.4 499.2m0 12.8l0 0q0 12.8-12.8 12.8l-128 0q-12.8 0-12.8-12.8l0 0q0-12.8 12.8-12.8l128 0q12.8 0 12.8 12.8Z" fill="#EFAC25" p-id="10668" data-darkreader-inline-fill="" style="--darkreader-inline-fill:#f0b337;"></path><path d="M268.22607 262.774928m-9.050967 9.050967l0 0q-9.050967 9.050967-18.101934 0l-90.509668-90.509668q-9.050967-9.050967 0-18.101934l0 0q9.050967-9.050967 18.101934 0l90.509668 90.509668q9.050967 9.050967 0 18.101934Z" fill="#EFAC25" p-id="10669" data-darkreader-inline-fill="" style="--darkreader-inline-fill:#f0b337;"></path><path d="M262.939132 755.793319m9.050967 9.050967l0 0q9.050967 9.050967 0 18.101933l-90.509668 90.509668q-9.050967 9.050967-18.101934 0l0 0q-9.050967-9.050967 0-18.101933l90.509668-90.509668q9.050967-9.050967 18.101934 0Z" fill="#EFAC25" p-id="10670" data-darkreader-inline-fill="" style="--darkreader-inline-fill:#f0b337;"></path></svg>

After

Width:  |  Height:  |  Size: 2.8 KiB

2
img/night.svg Normal file
View File

@@ -0,0 +1,2 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1614699547522" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="10858" data-darkreader-inline-fill="" width="1024" height="1024" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><style type="text/css">[data-darkreader-inline-fill] { fill: var(--darkreader-inline-fill) !important; }
</style></defs><path d="M761.2 703.6c-181.9 0-329.4-147.5-329.4-329.4 0-84.8 32.3-161.8 84.9-220.2-187.6 10.6-336.4 166-336.4 356.2 0 197 159.7 356.8 356.8 356.8 130.3 0 244.2-69.9 306.5-174.2-26.4 6.8-53.9 10.8-82.4 10.8z" fill="#FFE02C" p-id="10859" data-darkreader-inline-fill="" style="--darkreader-inline-fill:#b29800;"></path></svg>

After

Width:  |  Height:  |  Size: 808 B

0
img/search.svg Normal file
View File

114
index.html Normal file

File diff suppressed because one or more lines are too long

1
js/.pydio Normal file
View File

@@ -0,0 +1 @@
c28add94-9a74-4b12-863a-833671d85ca6

76
js/newTab.js Normal file
View File

@@ -0,0 +1,76 @@
class NewTab {
constructor() {
// chrome.history.search({
// text: ''
// }, function (results) {
// console.log(results);
// })
this.input = document.querySelector(".search input");
this.input.focus();
this.ThemeClickChange();
this.SearchInput();
this.clearSearch();
}
clearSearch () {
var clear = document.querySelector(".clear");
console.log(clear);
clear.onclick = () => {
this.input.value = "";
}
}
/**
* 主题切换
*/
ThemeClickChange () {
var body = document.querySelector("body"),
theme = document.querySelector(".themeChange img");
// 当前为黑夜
if (localStorage.getItem("status") != null) {
body.className = "night";
theme.setAttribute("src", "./img/day.svg")
localStorage.setItem("status", "night")
}
theme.onclick = () => {
// 如果当前白天,切换为黑夜
if (body.classList.length == 0) {
body.className = "night";
theme.setAttribute("src", "./img/day.svg")
localStorage.setItem("status", "night")
} else {
body.className = "";
theme.setAttribute("src", "./img/night.svg");
localStorage.removeItem("status")
}
}
}
SearchInput() {
this.input.onkeydown = (event) => {
if (event.keyCode == 13) {
if (this.input.value.length != 0) {
window.open(`https://www.google.com/search?q=${this.input.value}`)
}
}
}
}
}
new NewTab()
// chrome.bookmarks.getTree(function (result) {
// console.log(result);
// })
// chrome.system.cpu.getInfo(function (res) {
// console.log(res);
// });

21
manifest.json Normal file
View File

@@ -0,0 +1,21 @@
{
"manifest_version": 2,
"name": "书签管理器",
"description": "一款比谷歌浏览器原生更简洁好用的书签管理器",
"version": "1.0",
"permissions": [
"bookmarks",
"history",
"tabs",
"system.cpu",
"http://*/*",
"https://*/*"
],
"chrome_url_overrides": {
"newtab": "newTab.html"
},
"browser_action": {
"default_icon": "book.png",
"default_popup": "popup.html"
}
}

37
newTab.html Normal file
View File

@@ -0,0 +1,37 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *;script-src * 'unsafe-inline'">
<link rel="stylesheet" href="./css/clear.css">
<link rel="stylesheet" href="./css/index.css">
<title>新标签页</title>
</head>
<body>
<div class="bmy_tab">
<img class="logo" src="./img/bmylogo.png" alt="">
<div class="search">
<span class="icon">
<svg focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15.5 14h-.79l-.28-.27A6.471 6.471 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"></path></svg>
</span>
<input type="text">
<span class="icon clear" title="清除">
<svg focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"></path></svg>
</span>
</div>
</div>
<div class="themeChange">
<img src="./img/night.svg" alt="">
</div>
</body>
<script type="text/javascript" src="js/newTab.js"></script>
</html>

12
popup.html Normal file
View File

@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
测试
</body>
</html>