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

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
ShunCai committed May 9, 2021
2 parents 60e52c6 + b633950 commit f28d340
Show file tree
Hide file tree
Showing 54 changed files with 3,278 additions and 3,159 deletions.
4 changes: 4 additions & 0 deletions src/css/options.css
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,8 @@ table td {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}

#about .list-group-item{
padding: .5rem!important
}
7 changes: 6 additions & 1 deletion src/css/popup.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ body {
}

#export_albums_div .dropdown-header {
background-color: beige;
background-color: #dae0e5;
color: black;
font-size: medium;
text-align: center;
Expand All @@ -13,4 +13,9 @@ body {
#export_albums_div .dropdown-item {
font-size: small;
color: #333538;
}

.download_tool {
color: red !important;
cursor: pointer;
}
7 changes: 7 additions & 0 deletions src/export/css/common.css
Original file line number Diff line number Diff line change
Expand Up @@ -968,4 +968,11 @@ pre {
width: 185px;
height: 185px;
overflow: hidden;
}

.lg-outer .lg-video .lg-object {
left: 50%;
width: auto!important;
height: 100%!important;
transform: translate(-50%, 0) !important;
}
6 changes: 3 additions & 3 deletions src/export/js/albums.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
$(function () {
// 查看赞
$('.viewlikes').on('click', function () {
API.Common.showLikeWin(this, dataList);
API.Common.showLikeWin(this, albums);
});

// 查看评论
$('.viewcomments').on('click', function () {
API.Common.showCommentsWin(this, dataList);
API.Common.showCommentsWin(this, albums);
});

// 最近访问
$('.viewVisitors').on('click', function () {
API.Common.showVisitorsWin(this, dataList);
API.Common.showVisitorsWin(this, albums);
});

});
8 changes: 4 additions & 4 deletions src/export/js/bloginfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ $(function () {
let blogId = API.Utils.getUrlParam('blogId');

// 获取指定ID的日志
const blogIndex = dataList.getIndex(blogId * 1, 'blogid');
const blog = dataList[blogIndex];
const blogIndex = blogs.getIndex(blogId * 1, 'blogid');
const blog = blogs[blogIndex];

// 渲染日志标题
document.title = 'QQ空间备份-' + blog.custom_title;
Expand All @@ -22,12 +22,12 @@ $(function () {

// 查看赞
$('.viewlikes').on('click', function () {
API.Common.showLikeWin(this, dataList);
API.Common.showLikeWin(this, blogs);
});

// 最近访问
$('.viewVisitors').on('click', function () {
API.Common.showVisitorsWin(this, dataList);
API.Common.showVisitorsWin(this, blogs);
});

});
2 changes: 1 addition & 1 deletion src/export/js/blogs.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,6 @@ $(function () {
align: 'center',
width: "20",
sortable: true
}], dataList);
}], blogs);

});
139 changes: 110 additions & 29 deletions src/export/js/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// 例子:
// (new Date()).Format("yyyy-MM-dd hh:mm:ss.S") ==> 2006-07-02 08:09:04.423
// (new Date()).Format("yyyy-M-d h:m:s.S") ==> 2006-7-2 8:9:4.18
Date.prototype.format = function (fmt) {
Date.prototype.format = function(fmt) {
var o = {
"M+": this.getMonth() + 1, //月份
"d+": this.getDate(), //日
Expand All @@ -28,7 +28,7 @@ Date.prototype.format = function (fmt) {
* var result1=template1.format("loogn",22);
* var result2=template2.format({name:"loogn",age:22});
*/
String.prototype.format = function (args) {
String.prototype.format = function(args) {
var result = this;
if (arguments.length <= 0) {
return result;
Expand All @@ -40,7 +40,7 @@ String.prototype.format = function (args) {
result = result.replace(reg, args[i]);
}
}
} else if (arguments.length == 1 && typeof (args) == "object") {
} else if (arguments.length == 1 && typeof(args) == "object") {
// 支持属性多层嵌套替换
const getValueByPath = (obj, path) => {
const arr = path.split('.')
Expand Down Expand Up @@ -74,14 +74,14 @@ String.prototype.format = function (args) {
* @param {String} search 搜索字符
* @param {String} target 替换字符
*/
String.prototype.replaceAll = function (search, target) {
String.prototype.replaceAll = function(search, target) {
return this.replace(new RegExp(search, "gm"), target);
}

/**
* 数组查找索引
*/
Array.prototype.getIndex = function (val, field) {
Array.prototype.getIndex = function(val, field) {
if (field) {
return this.findIndex((obj) => {
if (obj[field] == val) {
Expand All @@ -96,7 +96,7 @@ Array.prototype.getIndex = function (val, field) {
/**
* 删除元素
*/
Array.prototype.remove = function (val, field) {
Array.prototype.remove = function(val, field) {
var index = this.getIndex(val, field);
if (index > -1) {
this.splice(index, 1);
Expand Down Expand Up @@ -169,17 +169,18 @@ const parseEmoji = (content) => {
}

const API = {
Utils: {}, // 工具类
Utils: {}, // 工具类
Common: {}, // 公共模块
Blogs: {}, // 日志模块
Diaries: {},// 日记模块
Friends: {},// 好友模块
Messages: {},// 说说模块
Boards: {},// 留言模块
Photos: {},// 相册模块
Videos: {},// 视频模块
Shares: {},// 分享模块
Visitors: {}// 访客模块
Blogs: {}, // 日志模块
Diaries: {}, // 日记模块
Friends: {}, // 好友模块
Messages: {}, // 说说模块
Boards: {}, // 留言模块
Photos: {}, // 相册模块
Videos: {}, // 视频模块
Favorites: {}, // 收藏夹模块
Shares: {}, // 分享模块
Visitors: {} // 访客模块
};

/**
Expand All @@ -194,7 +195,10 @@ API.Utils = {
getUrlParam(name) {
const reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
const r = window.location.search.substr(1).match(reg);
if (r != null) return decodeURI(r[2]); return null;
if (r != null) {
return decodeURI(r[2]);
}
return null;
},

/**
Expand All @@ -207,7 +211,8 @@ API.Utils = {
arr_url = reg_url.exec(url),
ret = {};
if (arr_url && arr_url[1]) {
var str_para = arr_url[1], result;
var str_para = arr_url[1],
result;
while ((result = reg_para.exec(str_para)) != null) {
ret[result[1]] = result[2];
}
Expand Down Expand Up @@ -358,7 +363,7 @@ API.Utils = {
}
}
let date = null;
if (typeof (time) === 'string') {
if (typeof(time) === 'string') {
date = new Date(time);
} else {
date = new Date(time * 1000);
Expand Down Expand Up @@ -396,7 +401,6 @@ API.Utils = {

}


/**
* QQ空间公共模块
*/
Expand Down Expand Up @@ -447,13 +451,13 @@ API.Common = {
content = (content || "") + "";
var t = content.split(/(#(?:.|<br\/>)+?#)/g);
var o = false;
var n = ""
, res = "";
var n = "",
res = "";
for (var a = 0; a < t.length; a++) {
tag = t[a];
o = false;
n = "";
n = tag.replace(/#((?:.|<br\/>)+?)#/g, function (e, t, n) {
n = tag.replace(/#((?:.|<br\/>)+?)#/g, function(e, t, n) {
o = true;
let url = 'http://rc.qzone.qq.com/qzonesoso/?search=' + encodeURIComponent(t);
var a = API.Utils.getLink(url, '#{0}#'.format(t));
Expand Down Expand Up @@ -488,7 +492,7 @@ API.Common = {
contet = contet.replace(/src=\"\/qzone\/em/g, 'src=\"http://qzonestyle.gtimg.cn/qzone/em');

// 转换emoji表情链接
contet = contet.replace(/\[em\]e(\d+)\[\/em\]/gi, function (emoji, eid) {
contet = contet.replace(/\[em\]e(\d+)\[\/em\]/gi, function(emoji, eid) {
let url = 'http://qzonestyle.gtimg.cn/qzone/em/e{0}.gif'.format(eid);
// 默认返回HMTL格式
let res = "<img src='{0}' >".format(url);
Expand Down Expand Up @@ -526,7 +530,7 @@ API.Common = {
}

// 先处理一遍正常的@的内容
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
Expand All @@ -535,7 +539,7 @@ API.Common = {

// 如果处理后,仍包含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) {
contet = contet.replace(/\{uin:([^\}]*),nick:([^\}]*?)(?:,who:([^\}]*))\}/g, function(str, uin, name) {
return name;
})
}
Expand Down Expand Up @@ -914,6 +918,51 @@ API.Common = {
}
}
return result.join('');
},

/**
* 预加载前后预览图图片
* @param {integer} index 当前幻灯片位置
* @param {integer} loadSize 加载个数
*/
renderPreviews(index, loadSize) {

// 加载当前位置
const renderPreview = function(index) {
const $img = $('.lightbox img').eq(index);
let src = $img.attr('src') || '';
if (!src.endsWith('loading.gif')) {
return;
}
src = $img.attr('data-src');
$('.lg-thumb-item img').eq(index).attr('src', src);
}

// 加载前后位置
for (var i = 0; i < loadSize; i++) {
renderPreview(index + i);
renderPreview(index - i);
}

},

/**
* 自动加载画廊预览图
* @param {object} gallery 画廊相册
*/
autoLoadPreview(gallery) {
// 画廊切换图片后
gallery.on('onAfterSlide.lg', function(event, prevIndex, index) {
API.Common.renderPreviews(index, 20);
});

// 画廊打开后
gallery.on('onAfterOpen.lg', function() {
$('.lg-thumb-item').mousedown(function() {
const index = $(this).index();
API.Common.renderPreviews(index, 20);
})
});
}
}

Expand All @@ -934,7 +983,16 @@ API.Blogs = {
},

getBlogLabel(e) {
var t = [["8", "审核不通过"], ["22", "审核中"], ["4", "顶"], ["21", "荐"], ["3", "转"], ["28", "转"], ["35", "转"], ["36", "转"]];
var t = [
["8", "审核不通过"],
["22", "审核中"],
["4", "顶"],
["21", "荐"],
["3", "转"],
["28", "转"],
["35", "转"],
["36", "转"]
];
var a = '';
for (var o = 0; o < t.length; o++) {
var n = t[o][0];
Expand Down Expand Up @@ -966,6 +1024,31 @@ API.Messages = {
}
}

/**
* 收藏夹模块API
*/
API.Favorites = {

/**
* 获取收藏夹分享的URL
* @param {object} share_info 收藏夹分享信息
*/
getShareUrl(share_info) {
if (!share_info) {
return "#";
}
if (share_info.music_list && share_info.music_list.length > 0) {
// 音乐分享
return share_info.music_list[0].music_info.play_url;
}
if (share_info.video_list && share_info.video_list.length > 0) {
// 视频分享
return share_info.video_list[0].video_info.play_url;
}
return share_info.share_url;
}
}

/**
* 分享模块API
*/
Expand All @@ -990,7 +1073,6 @@ API.Shares = {
}
}


/**
* 访客模块API
*/
Expand Down Expand Up @@ -1042,7 +1124,6 @@ API.Visitors = {
}
}


/**
* 视频模块API
*/
Expand Down
2 changes: 1 addition & 1 deletion src/export/js/diaries.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ $(function () {
formatter: (value) => {
return API.Utils.formatDate(value);
}
}], dataList);
}], diaries);

});
Loading

0 comments on commit f28d340

Please sign in to comment.