Skip to content

Commit

Permalink
Site updated: 2020-02-15 17:08:54
Browse files Browse the repository at this point in the history
  • Loading branch information
liyuechao committed Feb 15, 2020
1 parent fe6d0ad commit 9ba2479
Show file tree
Hide file tree
Showing 277 changed files with 1,723 additions and 1,818 deletions.
12 changes: 6 additions & 6 deletions 404.html

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions about/index.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions album/index.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions algorithm/leetcode-1-Two-Sum.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions algorithm/leetcode-2-Add-Two-Numbers.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions algorithm/二分查找法模板的基本思想-leetcode35.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions algorithm/动态规划DP算法详解.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions algorithm/算法成长之路leetcode1-4.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions algorithm/算法成长之路leetcode11-12.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions algorithm/算法成长之路leetcode13-14.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions algorithm/算法成长之路leetcode15-16.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions algorithm/算法成长之路leetcode17-18.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions algorithm/算法成长之路leetcode19-20.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions algorithm/算法成长之路leetcode21-22.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions algorithm/算法成长之路leetcode5-6.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions algorithm/算法成长之路leetcode7-8.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions algorithm/算法成长之路leetcode9-10.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions algorithm/贪心算法解析示例.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions archives/2018/11/index.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions archives/2018/11/page/2/index.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions archives/2018/12/index.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions archives/2018/index.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions archives/2018/page/2/index.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions archives/2019/01/index.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions archives/2019/02/index.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions archives/2019/04/index.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions archives/2019/05/index.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions archives/2019/06/index.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions archives/2019/07/index.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions archives/2019/08/index.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions archives/2019/08/page/2/index.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions archives/2019/09/index.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions archives/2019/10/index.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions archives/2019/11/index.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions archives/2019/12/index.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions archives/2019/12/page/2/index.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions archives/2019/index.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions archives/2019/page/2/index.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions archives/2019/page/3/index.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions archives/2019/page/4/index.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions archives/2019/page/5/index.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions archives/2019/page/6/index.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions archives/2019/page/7/index.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions archives/2020/01/index.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions archives/2020/02/index.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions archives/2020/index.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions archives/2020/page/2/index.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions archives/index.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions archives/page/10/index.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions archives/page/2/index.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions archives/page/3/index.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions archives/page/4/index.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions archives/page/5/index.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions archives/page/6/index.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions archives/page/7/index.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions archives/page/8/index.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions archives/page/9/index.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions breaking-news/2019年国庆70周年阅兵完整图文解说.html

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions categories/algorithm/index.html

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions categories/algorithm/page/2/index.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions categories/develop/index.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions categories/health/index.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions categories/index.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions categories/ios/index.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions categories/java/JVM/index.html

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions categories/java/elasticsearch6/index.html

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions categories/java/index.html

Large diffs are not rendered by default.

26 changes: 13 additions & 13 deletions categories/java/java基础/index.html

Large diffs are not rendered by default.

28 changes: 14 additions & 14 deletions categories/java/page/2/index.html

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions categories/java/page/3/index.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions categories/java/spring/index.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions categories/java/springboot/index.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions categories/java/并发/index.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions categories/java/框架/index.html

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions categories/java/设计模式/index.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions categories/java/读书笔记/index.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions categories/marathon/index.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions categories/private/index.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions categories/python3/index.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions categories/think/index.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions categories/travel/index.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions categories/前端技术/index.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions categories/基础工具类/Git/index.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions categories/基础工具类/Vim/index.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions categories/基础工具类/docker/index.html

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions categories/基础工具类/index.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions categories/基础工具类/正则/index.html

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions categories/工具教程/index.html

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions categories/工具教程/主题工具/index.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions categories/工具教程/博客统计插件/index.html

Large diffs are not rendered by default.

26 changes: 13 additions & 13 deletions categories/数据库/index.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions categories/数据库/mybatis/index.html

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions categories/数据库/mysql/index.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions categories/数据库/redis/index.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions categories/数据结构/index.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions categories/架构/Kafka/index.html

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions categories/架构/index.html

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions categories/架构/设计/index.html

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions categories/法律/index.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions categories/科普/index.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions categories/经验成长/index.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion content.json

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions data-structure/用栈实现队列-用队列实现栈.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions database/mysql/MyBatis二级缓存.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions database/mysql/mysql-b-Tree索引.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions database/mysql/mysql数据库索引解析.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions database/mysql/mysql索引优化方案.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions database/mysql/mysql高性能优化规范方法.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions database/mysql/一千行-MySQL-学习笔记-转载.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions database/mysql/一次数据库的死锁问题排查过程.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions database/redis/Redis的内存淘汰策略问题.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions database/redis/redis分布式锁Redlock的实现.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions database/常见sql错误写法.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions design-architecture/Kafka基本架构及原理.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions design-architecture/并发扣款相关问题.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions design-architecture/支付系统设计-转载.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions design-architecture/秒杀系统如何支撑百万QPS.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions develop/Git-rebase-用法示例小结.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions develop/Git如何优雅地回退代码.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions develop/Vim基本入门操作.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions develop/intellj-idea-详细调试代码debug.html

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions friend/index.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions front/替代web-cookie存储方案实现.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions health/常见隔夜菜谨慎食用.html

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions index.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions ios/苹果6s-ios12-nfc-模拟门禁.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions java/basic/Immutable-Object-不可变对象-模式.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions java/basic/Java-BIO-NIO-AIO区别与使用.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions java/basic/Java-垃圾回收.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions java/basic/Java容器集合.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions java/basic/Java并发相关知识点.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions java/basic/Java日志的正确使用方法.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions java/basic/Java版常用正则表达式说明.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions java/basic/hash冲突开放地址法rehash.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions java/basic/java-8部分读书笔记.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions java/basic/java基础-final关键字.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions java/basic/java基础-static关键字.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions java/basic/java注解Annotation说明实例.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions java/basic/原码补码异或与位运算移位知识点.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions java/design-mode/Java设计模式之代理模式.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions java/design-mode/Java设计模式之单例模式.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions java/design-mode/Java设计模式之命令模式.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions java/design-mode/Java设计模式之工厂模式.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions java/design-mode/Java设计模式之装饰者模式.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions java/design-mode/Java设计模式之观察者模式.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions java/design-mode/Java设计模式之适配器模式.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions java/elasticsearch/Elasticsearch常用工具api.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions java/elasticsearch/elasticsearch6-x倒排索引和分词.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions java/frame/Spring-cloud-feign重试问题排查.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions java/frame/Spring-如何解决循环依赖.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions java/frame/Spring的Bean生命周期.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions java/frame/springboot-restful-swagger实战.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions java/frame/springboot优雅的停止服务.html

Large diffs are not rendered by default.

19 changes: 2 additions & 17 deletions js/about-me.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,9 @@
// });

$(function () {
$.ajax({
type: "get",
url: "https://api.github.com/repos/removeif/issue_database/issues/5/comments?per_page=100",
headers: { //请求头
Accept: "application/json; charset=utf-8",
Authorization: "" + authorizationToken //这是获取的token
},
data: "",
contentType: "application/json", //推荐写这个
dataType: "json",
error: function () {
console.log('req error');
},
success: function (data) {
loadRecord(data);
}
ajaxReqForGitHub("https://api.github.com/repos/removeif/issue_database/issues/5/comments?per_page=100",function (data) {
loadRecord(data);
});

});

function loadRecord(source) {
Expand Down
112 changes: 28 additions & 84 deletions js/comment-issue-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,13 @@ var COMMENT_CACHE_KEY = "commentKey";
var ADMIN_NAME = "removeif";

function writeHtmlCommentCountValueById(id) {
$.ajax({
type: "get",
url: reqCommentCountUrl + id,
headers: { //请求头
Accept: "application/json; charset=utf-8",
Authorization: "" + authorizationToken //这是获取的token
},
data: "",
contentType: "application/json", //推荐写这个
dataType: "json",
error: function () {
console.log('req error');
},
success: function (result) {
try {
if(result.length>0){
$("#" + id).html(result[0].comments);
}
} catch (e) {
console.error(e);
ajaxReqForGitHub(reqCommentCountUrl + id, function (result) {
try {
if (result.length > 0) {
$("#" + id).html(result[0].comments);
}
} catch (e) {
console.error(e);
}
});
}
Expand Down Expand Up @@ -91,22 +77,8 @@ function fillComments(result){

}

$.ajax({
type: "get",
url: item.issue_url,
headers: { //请求头
Accept: "application/json; charset=utf-8",
Authorization: "" + authorizationToken //这是获取的token
},
data: "",
contentType: "application/json", //推荐写这个
dataType: "json",
error: function () {
console.log('req error');
},
success: function (data) {
addCommentInfo(data,resultArr,item,endIndex,i,contentStr);
}
ajaxReqForGitHub(item.issue_url,function (data) {
addCommentInfo(data,resultArr,item,endIndex,i,contentStr);
});
});
}
Expand Down Expand Up @@ -150,22 +122,8 @@ function loadCommentDataAndRender() {
// sort=comments可以按评论数排序,此处更适合按更新时间排序,可以根据updated排序,但是0条评论的也会出来,所以此处还是全部查出来,内存排序
// per_page 每页数量,根据需求配置
// req(repoIssuesUrl + "/comments?sort=created&direction=desc&per_page=7&page=1",fillComments())
$.ajax({ // !!!!!!!此处ajax请求本该提出来作为一个方法,但是我实在不知道怎么提取,麻烦考到此处知道的网友告知一下,蟹蟹
type: "get",
url: repoIssuesUrl + "/comments?sort=created&direction=desc&per_page=8&page=1",
headers: { //请求头
Accept: "application/json; charset=utf-8",
Authorization: "" + authorizationToken //这是获取的token
},
data: "",
contentType: "application/json", //推荐写这个
dataType: "json",
error: function () {
console.log('req error');
},
success: function (data) {
fillComments(data);
}
ajaxReqForGitHub(repoIssuesUrl + "/comments?sort=created&direction=desc&per_page=7&page=1",function (data) {
fillComments(data);
});
}

Expand Down Expand Up @@ -195,39 +153,26 @@ function loadIndexHotData() {
var hotContent = "";
if ($("#index_hot_div").length > 0) {
var hotDiv = $("#index_hot_div");
$.ajax({
type: "get",
url: repoIssuesUrl + "?per_page=10&sort=comments",
headers: { //请求头
Accept: "application/json; charset=utf-8",
Authorization: "" + authorizationToken //这是获取的token
},
data: "",
contentType: "application/json", //推荐写这个
dataType: "json",
error: function () {
console.log('req error');
},
success: function (result) {
$.each(result, function (i, item) {
// 标签配色
if (i >= 0 & i < 4) {
classDiv = "class=\"item level3\"";
} else if (i >= 4 & i < 7) {
classDiv = "class=\"item level2\"";
} else if (i >= 7 & i < 9) {
classDiv = "class=\"item level1\"";
} else {
classDiv = "class=\"item level0\"";
}
hotContent += "<a href =\"" + item.body.substr(0, item.body.indexOf("\n") - 1) + "\"target=\"_blank\"" + classDiv + ">" + item.title.substr(0, item.title.indexOf("-") - 1) + "&nbsp;🔥" + (item.comments * 101) + "</a>&nbsp;&nbsp;"
})
hotDiv.html("");
if (hotContent == "") {
hotDiv.append("无数据记录!");
ajaxReqForGitHub(repoIssuesUrl + "?per_page=10&sort=comments",function (result) {

$.each(result, function (i, item) {
// 标签配色
if (i >= 0 & i < 4) {
classDiv = "class=\"item level3\"";
} else if (i >= 4 & i < 7) {
classDiv = "class=\"item level2\"";
} else if (i >= 7 & i < 9) {
classDiv = "class=\"item level1\"";
} else {
hotDiv.append(hotContent);
classDiv = "class=\"item level0\"";
}
hotContent += "<a href =\"" + item.body.substr(0, item.body.indexOf("\n") - 1) + "\"target=\"_blank\"" + classDiv + ">" + item.title.substr(0, item.title.indexOf("-") - 1) + "&nbsp;🔥" + (item.comments * 101) + "</a>&nbsp;&nbsp;"
})
hotDiv.html("");
if (hotContent == "") {
hotDiv.append("无数据记录!");
} else {
hotDiv.append(hotContent);
}
});
}
Expand All @@ -251,7 +196,6 @@ $(document).ready(setTimeout(function () { // 延迟1s执行,保证其余的


if (COMMENT_CACHE == '' || COMMENT_CACHE == null || new Date().getTime() - COMMENT["date"] > 60 * 1000) { // request per 10 minutes
console.log("req data..."+authorizationToken);
loadCommentDataAndRender();
} else {
console.log("load cache data...");
Expand Down
18 changes: 2 additions & 16 deletions js/friend.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,8 @@
// author by removef
// https://removeif.github.io/
$(function () { //获取处理友链数据
$.ajax({
type: "get",
url: "https://api.github.com/repos/removeif/issue_database/issues/2/comments?per_page=100",
headers: { //请求头
Accept: "application/json; charset=utf-8",
Authorization: "" + authorizationToken //这是获取的token
},
data: "",
contentType: "application/json", //推荐写这个
dataType: "json",
error: function () {
console.log('req error');
},
success: function (data) {
loadFriends(data);
}
ajaxReqForGitHub("https://api.github.com/repos/removeif/issue_database/issues/2/comments?per_page=100",function (data) {
loadFriends(data);
});
});

Expand Down
22 changes: 21 additions & 1 deletion js/globalUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,24 @@ var btoa = (typeof window !== 'undefined' && window.btoa && window.btoa.bind(win
// 对应仓库 clientId、clientSecret 关于这两个参数的安全问题,查看 https://removeif.github.io/2019/09/19/博客源码分享.html#1-热门推荐,最新评论:
var clientId = "46a9f3481b46ea0129d8";
var clientSecret = "79c7c9cb847e141757d7864453bcbf89f0655b24";
var authorizationToken = 'Basic ' + btoa(clientId + ':' + clientSecret);
var authorizationToken = 'Basic ' + btoa(clientId + ':' + clientSecret);

function ajaxReqForGitHub(url, call) {
$.ajax({
type: "get",
url: url,
headers: { //请求头
Accept: "application/json; charset=utf-8",
Authorization: "" + authorizationToken //这是获取的token
},
data: "",
contentType: "application/json", //推荐写这个
dataType: "json",
error: function () {
console.log('req error:url=' + url);
},
success: function (data) {
call(data);
}
});
}
38 changes: 4 additions & 34 deletions js/music.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,9 @@
var lastIndex;
var musicJsons;
$(function () {
$.ajax({
type: "get",
url: "https://api.github.com/repos/removeif/issue_database/issues/3/comments?per_page=100",
headers: { //请求头
Accept: "application/json; charset=utf-8",
Authorization: "" + authorizationToken //这是获取的token
},
data: "",
contentType: "application/json", //推荐写这个
dataType: "json",
error: function () {
console.log('req error');
},
success: function (data) {
loadMusic(data);
}
ajaxReqForGitHub("https://api.github.com/repos/removeif/issue_database/issues/3/comments?per_page=100",function (data) {
loadMusic(data);
});

});

function loadMusic(source){
Expand Down Expand Up @@ -88,24 +73,9 @@ function playMusic(data, playendcallback) {
// 视频处理
var lastVideoIndex;
$(function () {
$.ajax({
type: "get",
url: "https://api.github.com/repos/removeif/issue_database/issues/4/comments?per_page=100",
headers: { //请求头
Accept: "application/json; charset=utf-8",
Authorization: "" + authorizationToken //这是获取的token
},
data: "",
contentType: "application/json", //推荐写这个
dataType: "json",
error: function () {
console.log('req error');
},
success: function (data) {
loadVideo(data);
}
ajaxReqForGitHub("https://api.github.com/repos/removeif/issue_database/issues/4/comments?per_page=100",function (data) {
loadVideo(data);
});

});

function loadVideo(source) {
Expand Down
Loading

0 comments on commit 9ba2479

Please sign in to comment.