├── images
└── travel.png
├── css
├── content.css
└── options.css
├── README.md
├── package.json
├── options.html
├── manifest.json
├── doc
└── storageStructure.md
└── js
├── cs.js
└── background.js
/images/travel.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JimSunJing/NoBan/HEAD/images/travel.png
--------------------------------------------------------------------------------
/css/content.css:
--------------------------------------------------------------------------------
1 | .NoBanBtn {
2 | background-color: black;
3 | color: white;
4 | margin-top: 10px;
5 | border-radius: 15px;
6 | padding: 4px;
7 | }
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # No(tion)(Dou)Ban
2 |
3 | 一个豆瓣跑路(备份) notion 的chrome拓展应用
4 | 可能后期会开发一些新功能比如:
5 | - 小组批量拉黑
6 | - 其他网站内容导入Notion
7 |
8 | ## 说明
9 | 本拓展将会使用 [Notabase](https://github.com/mayneyao/notabase)
--------------------------------------------------------------------------------
/css/options.css:
--------------------------------------------------------------------------------
1 | body {
2 | background-color: black;
3 | }
4 |
5 | h1, label {
6 | color: white;
7 | }
8 |
9 | label {
10 | margin: 0 5px;
11 | }
12 |
13 | input {
14 | width: 150px;
15 | }
16 |
17 | .Line {
18 | margin-top: 10px;
19 | }
20 |
21 | .main{
22 | text-align: center; /*让div内部文字居中*/
23 | background-color: rgb(36, 38, 138);
24 | border-radius: 20px;
25 | width: 300px;
26 | height: 350px;
27 | margin: auto;
28 | position: absolute;
29 | top: 0;
30 | left: 0;
31 | right: 0;
32 | bottom: 0;
33 | }
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "noban",
3 | "version": "0.0.1",
4 | "description": "a chrome extension for Douban and Notion Communicate",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "repository": {
10 | "type": "git",
11 | "url": "git+https://github.com/JimSunJing/NoBan.git"
12 | },
13 | "author": "JimSun",
14 | "license": "ISC",
15 | "bugs": {
16 | "url": "https://github.com/JimSunJing/NoBan/issues"
17 | },
18 | "homepage": "https://github.com/JimSunJing/NoBan#readme"
19 | }
20 |
--------------------------------------------------------------------------------
/options.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
NoBan
10 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "manifest_version": 2,
3 | "name": "NoBan",
4 | "description": "A Douban to Notion Escape. 一个备份豆瓣到 Notion 的工具",
5 | "version": "0.1",
6 | "permissions": ["storage"],
7 | "options_page": "options.html",
8 | "content_scripts": [
9 | {
10 | "matches": [
11 | "*://*.notion.so/*",
12 | "https://*.douban.com/*"
13 | ],
14 | "js": [
15 | "js/cs.js"
16 | ],
17 | "css": ["css/content.css"],
18 | "run_at": "document_end"
19 | }
20 | ],
21 | "background": {
22 | "scripts": ["js/background.js"]
23 | },
24 | "icons": {
25 | "16": "images/travel.png",
26 | "32": "images/travel.png",
27 | "48": "images/travel.png",
28 | "128": "images/travel.png"
29 | }
30 | }
--------------------------------------------------------------------------------
/doc/storageStructure.md:
--------------------------------------------------------------------------------
1 | ## storage 内的存储结构
2 |
3 | 记一下我这个项目中存储到 `chrome.storage` 中的数据的结构。
4 |
5 | ### 豆瓣书影音条目数据的存储
6 |
7 | - `doubanUser_douId` [Object]
8 | - douId [String: "douban_user_ID"]
9 | - movieCounts
10 | - "done": 123
11 | - "wish": 123
12 | - "ing": 123
13 | - bookCounts
14 | - "done": 123
15 | - "wish": 123
16 | - "ing": 123
17 | - musicCounts
18 | - "done": 123
19 | - "wish": 123
20 | - "ing": 123
21 | - movies
22 | - done: [Array of {subjectid:xxx, marks: rating,comment...}]
23 | - wish: [Array of {subjectid:xxx, marks: rating,comment...}]
24 | - ing: [Array of {subjectid:xxx, marks: rating,comment...}]
25 | - books
26 | - done: [Array of {subjectid:xxx, marks: rating,comment...}]
27 | - wish: [Array of {subjectid:xxx, marks: rating,comment...}]
28 | - ing: [Array of {subjectid:xxx, marks: rating,comment...}]
29 | - musics
30 | - done: [Array of {subjectid:xxx, marks: rating,comment...}]
31 | - wish: [Array of {subjectid:xxx, marks: rating,comment...}]
32 | - ing: [Array of {subjectid:xxx, marks: rating,comment...}]
33 | - `MovieMap` [Map]
34 | - key:subjectId
35 | - val:movieItem
36 | - `BookMap` [Map]
37 | - key:subjectId
38 | - val:bookItem
39 | - `MusicMap` [Map]
40 | - key:subjectId
41 | - val:musicItem
--------------------------------------------------------------------------------
/js/cs.js:
--------------------------------------------------------------------------------
1 | console.log("content script running...")
2 |
3 | const doubanBtn = document.createElement('button')
4 | doubanBtn.className = 'NoBanBtn'
5 | doubanBtn.textContent = "备份电影到 NoBan"
6 |
7 | const ItemCount = (counts) => {
8 | return Array.from(counts)
9 | .map((x)=>{
10 | let i = parseInt(x.innerText.split("部")[0])
11 | if (x.innerText.indexOf("在") !== -1){
12 | return {"ing": i}
13 | }else if (x.innerText.indexOf("想") !== -1){
14 | return {"wish": i}
15 | }
16 | return {"done": i}
17 | })
18 | .reduce((acc,curr)=>{
19 | return {...acc, ...curr}
20 | })
21 | }
22 |
23 | doubanBtn.onclick = () => {
24 | console.log("可以开始爬了")
25 | // 获取豆瓣用户的 ID
26 | const DouId = document.querySelector(".user-info .pl")
27 | .innerHTML.split("