Skip to content
This repository has been archived by the owner on Mar 5, 2023. It is now read-only.

Commit

Permalink
1、支持分享导出导出HTML、Markdown、JSON
Browse files Browse the repository at this point in the history
2、修复无权限访问最近访客是代码异常问题
3、获取评论进度提示优化

Signed-off-by: lvshuncai <lvshuncai@gmail.com>
  • Loading branch information
ShunCai committed Nov 21, 2020
1 parent 07d3a4b commit 9734d2a
Show file tree
Hide file tree
Showing 24 changed files with 1,236 additions and 608 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# QQ空间导出助手

> QQ空间导出助手,用于备份QQ空间的说说、日志、私密日记、相册、视频、留言板、QQ好友、收藏夹为文件,便于迁移与保存。
> QQ空间导出助手,用于备份QQ空间的说说、日志、私密日记、相册、视频、留言板、QQ好友、收藏夹、分享为文件,便于迁移与保存。
## 简介

Expand Down Expand Up @@ -36,7 +36,7 @@
4. 勾选开发者模式
5. 点击[加载已解压的扩展程序]按钮
6. 选择ZIP包解压文件夹
7. 更多问题点击[这里](https://baidu.lvshuncai.com/?q=Q2hyb21lIOWuieijhSDnprvnur/lronoo4Ug5omp5bGVIENSWA==)
7. 更多问题点击[这里](https://baidu.lvshuncai.com/?q=Q2hyb21lIOWuieijhSDnprvnur/lronoo4Ug5omp5bGVIFpJUA==)

##### 方式②:CRX安装
1. [下载CRX包](https://github.com/ShunCai/QZoneExport/releases/latest)
Expand All @@ -46,7 +46,7 @@

#### 版本要求
未测试,建议Chromium内核版本在70以上。
理论上基于Chromium内核版本均可正常使用,但不保证均可使用。
理论上基于Chromium内核版本的浏览器均可正常使用,但不保证均可使用。
点击这里进行[浏览器内核版本检测](https://liulanmi.com/labs/core.html)


Expand Down Expand Up @@ -94,6 +94,8 @@
![QQ空间备份-留言板](https://s1.ax1x.com/2020/05/16/YcZSkq.png)
#### 收藏夹
![QQ空间备份-收藏夹](https://s1.ax1x.com/2020/05/16/YcZpt0.png)
#### 分享
![QQ空间备份-分享](https://i.loli.net/2020/11/21/TLDtf5IGAMqYk3l.png)

## 依赖
- [Blob.js](https://note.youdao.com/)
Expand Down
26 changes: 1 addition & 25 deletions src/export/js/boards.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,31 +73,7 @@ const YEAR_ITEMS = `
$(function () {

// 那年今日
// 时间分组
const yearMaps = API.Utils.groupedByTime(dataList, "pubtime", 'all');
const date = new Date();
// 当前年份跳过
const currentYear = date.getFullYear();
const currentMonthDay = date.format('-MM-dd');
const _yearMaps = new Map();
if(yearMaps){
// 移除今年数据
yearMaps.delete(currentYear);
}
for (const [year, yearItemMaps] of yearMaps) {
for (const [month, monthItems] of yearItemMaps) {
const monthDayItems = [];
for (const item of monthItems) {
const pubtime = API.Utils.formatDate(item.pubtime);
if(pubtime.indexOf(currentMonthDay) > -1){
monthDayItems.push(item);
}
}
if(monthDayItems.length > 0){
_yearMaps.set(year, monthDayItems);
}
}
}
const _yearMaps = API.Common.getOldYearData(dataList, "pubtime");

// 那年今日HTML
const items_html = template(YEAR_ITEMS, { yearMaps: _yearMaps });
Expand Down
76 changes: 73 additions & 3 deletions src/export/js/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ API.Utils = {
}
return ret;
},

/**
* 通过参数构建URL
* @param {string} url
Expand Down Expand Up @@ -452,12 +452,22 @@ API.Common = {
if (typeof contet === 'object') {
return format(contet);
}
return contet = contet.replace(/@\{uin:([^\}]*),nick:([^\}]*?)(?:,who:([^\}]*))?(?:,auto:([^\}]*))?\}/g, function (str, uin, name) {

// 先处理一遍正常的@的内容
contet = contet.replace(/@\{uin:([^\}]*),nick:([^\}]*?)(?:,who:([^\}]*))?(?:,auto:([^\}]*))?\}/g, function (str, uin, name) {
return format({
uin: uin,
name: name
});
})

// 如果处理后,仍包含uin、nick、who,则表示是特殊情况(即nick存的是内容),再处理一遍
if (contet.indexOf('uin') > -1 && contet.indexOf('nick') > -1 && contet.indexOf('who') > -1) {
contet = contet.replace(/\{uin:([^\}]*),nick:([^\}]*?)(?:,who:([^\}]*))\}/g, function (str, uin, name) {
return name;
})
}
return contet;
},

/**
Expand Down Expand Up @@ -742,6 +752,41 @@ API.Common = {

// 显示窗口
$('#comments_win').modal('show');
},

/**
* 获取那年今日的数据
* @param {Array} dataList 数组
* @param {string} field 时间字段
*/
getOldYearData(dataList, field) {
// 时间分组
// 时间分组
const yearMaps = API.Utils.groupedByTime(dataList, field, 'all');
const date = new Date();
// 当前年份跳过
const currentYear = date.getFullYear();
const currentMonthDay = date.format('-MM-dd');
const _yearMaps = new Map();
if (yearMaps) {
// 移除今年数据
yearMaps.delete(currentYear);
}
for (const [year, yearItemMaps] of yearMaps) {
for (const [month, monthItems] of yearItemMaps) {
const monthDayItems = [];
for (const item of monthItems) {
const targetTime = API.Utils.formatDate(item[field]);
if (targetTime.indexOf(currentMonthDay) > -1) {
monthDayItems.push(item);
}
}
if (monthDayItems.length > 0) {
_yearMaps.set(year, monthDayItems);
}
}
}
return _yearMaps;
}
}

Expand Down Expand Up @@ -794,6 +839,31 @@ API.Messages = {
}
}

/**
* 分享模块API
*/
API.Shares = {

/**
* 获取类型
*/
getDisplayType(innerType) {
const Share_Types = {
1: '日志',
2: '相册',
3: "照片",
4: "网页",
5: '视频',
10: '商品',
13: '新闻',
17: '微博',
18: "音乐"
}
return Share_Types[innerType] || "其它";
}
}


/**
* 视频模块API
*/
Expand Down Expand Up @@ -934,7 +1004,7 @@ const TPL = {
<%}%>
</div>
`,

/**
* 最近访问
*/
Expand Down
1 change: 1 addition & 0 deletions src/export/js/friends.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ $(function () {
title: '头像',
align: 'center',
formatter: (value, row) => {
value = value || API.Common.getUserLogoUrl(row.uin);
return API.Utils.getImageHTML(API.Common.getMediaPath(value, row.custom_avatar, "Friends_HTML"));
}
}, {
Expand Down
Loading

0 comments on commit 9734d2a

Please sign in to comment.