Skip to content

Commit af807c4

Browse files
committed
Site updated: 2019-01-04 19:39:47
1 parent e948a2c commit af807c4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+7119
-9375
lines changed

2019/01/04/安卓注解处理器-processor/index.html

+370-964
Large diffs are not rendered by default.

about/index.html

+342-833
Large diffs are not rendered by default.

apple-touch-icon.png

25.3 KB

archives/2019/01/index.html

+305-875
Large diffs are not rendered by default.

archives/2019/index.html

+305-875
Large diffs are not rendered by default.

archives/index.html

+305-875
Large diffs are not rendered by default.

background/backup/bg-1.jpg

21.6 KB

background/backup/bg-2.jpg

18.5 KB

background/backup/bg-3.jpg

26.6 KB

background/backup/bg-4.jpg

54.9 KB

background/bg-1.jpg

39.7 KB

background/bg-2.jpg

20.4 KB

background/bg-3.jpg

9.52 KB

background/bg-4.jpg

59.2 KB

background/bg-5.jpg

70.9 KB

background/bg-6.jpg

77.6 KB

categories/index.html

+342-833
Large diffs are not rendered by default.

categories/注解/index.html

+306-857
Large diffs are not rendered by default.

css/style.css

+2,825-631
Large diffs are not rendered by default.

img/AcFun.png

6.16 KB

img/CSDN.png

312 Bytes

img/Coding.png

2.94 KB

img/LOFTER.png

302 Bytes

img/Plunker.png

423 Bytes

img/Quora.png

2.95 KB

img/SegmentFault.png

490 Bytes

img/TiddlyWiki.png

1.03 KB

img/V2EX.png

970 Bytes

img/avatar.png

7.58 KB

img/bilibili.png

5.6 KB

img/niconico.png

1.82 KB

img/scrollbar_arrow.png

303 Bytes

img/博客园.png

832 Bytes

img/新浪微博.png

1.85 KB

img/知乎.png

250 Bytes

img/简书.png

1.45 KB

img/网易云音乐.png

403 Bytes

img/虾米音乐.png

268 Bytes

img/豆瓣.png

199 Bytes

index.html

+311-946
Large diffs are not rendered by default.

js/GithubRepoWidget.js

+96
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
/*!
2+
GitHub-Repo-Widget.js - Not depend on jQuery or Other Framework.
3+
License: MIT
4+
*/
5+
(function() {
6+
var rendered = 'github-widget-rendered',
7+
cssStr = '.path-divider{margin:0 .25em}.github-box *{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;}.github-box{font-family:helvetica,arial,sans-serif;font-size:13px;line-height:18px;background:#fafafa;border:1px solid #ddd;color:#666;border-radius:3px}.github-box a{color:#4183c4;border:0;text-decoration:none}.github-box .github-box-title{position:relative;border-bottom:1px solid #ddd;border-radius:3px 3px 0 0;background:#fcfcfc;background:-moz-linear-gradient(#fcfcfc,#ebebeb);background:-webkit-linear-gradient(#fcfcfc,#ebebeb);}.github-box .github-box-title h3{word-wrap:break-word;font-family:helvetica,arial,sans-serif;font-weight:normal;font-size:16px;color:gray;margin:0;padding:10px 10px 10px 30px;background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAAXBAMAAAD0LQLXAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAASUExURQAAAL29vc3NzcLCwsjIyNbW1pvTNOEAAAABdFJOUwBA5thmAAAATElEQVQI12MIFoQAEQZFYwcGEGBkUDRUQLCcsYjRXhbqKkEGZQYGqJgSnKXCwGgsAGYpqyobG4WGhioyhBhDgClI3EQAqpaZwQBEAQARmA4G2o55nQAAAABJRU5ErkJggg==) 7px center no-repeat; width: auto;}.github-box .github-box-title h3 .repo{font-weight:bold}.github-box .github-box-title .github-stats{float:right;position:absolute;top:8px;right:10px;font-size:11px;font-weight:bold;line-height:21px;height:auto;min-height:21px}.github-box .github-box-title .github-stats a{display:inline-block;height:21px;color:#666;border:1px solid #ddd;border-radius:3px;padding:0 5px 0 18px;background: white url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAqBAMAAABB12bjAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAYUExURf///5mZmdbW1u/v7/r6+rGxscXFxaSkpHLccIMAAABsSURBVBjTY2CgBmBODTOAsFgSi9TFHMBMc1Fmk8BiEItJUMhQWFFQAZXJoC7q7FJYhNBmgG7YQAIWMYTvEExXIbh8oAJWQQe4IGsIlKmowAZVwaKowgxlMgkKmwtCjRAUYBSEqnVkYBAm39EALMwNXwql3eYAAAAASUVORK5CYII=) no-repeat}.github-box .github-box-title .github-stats .watchers{border-right:1px solid #ddd}.github-box .github-box-title .github-stats .forks{background-position:-4px -21px;padding-left:15px}.github-box .github-box-content{padding:10px;font-weight:300}.github-box .github-box-content p{margin:0}.github-box .github-box-content .link{font-weight:bold}.github-box .github-box-download{position:relative;border-top:1px solid #ddd;background:white;border-radius:0 0 3px 3px;padding:10px;height:auto;min-height:24px;}.github-box .github-box-download .updated{word-wrap:break-word;margin:0;font-size:11px;color:#666;line-height:24px;font-weight:300;width:auto}.github-box .github-box-download .updated strong{font-weight:bold;color:#000}.github-box .github-box-download .download{float:right;position:absolute;top:10px;right:10px;height:24px;line-height:24px;font-size:12px;color:#666;font-weight:bold;text-shadow:0 1px 0 rgba(255,255,255,0.9);padding:0 10px;border:1px solid #ddd;border-bottom-color:#bbb;border-radius:3px;background:#f5f5f5;background:-moz-linear-gradient(#f5f5f5,#e5e5e5);background:-webkit-linear-gradient(#f5f5f5,#e5e5e5);}.github-box .github-box-download .download:hover{color:#527894;border-color:#cfe3ed;border-bottom-color:#9fc7db;background:#f1f7fa;background:-moz-linear-gradient(#f1f7fa,#dbeaf1);background:-webkit-linear-gradient(#f1f7fa,#dbeaf1);}@media (max-width: 767px) {.github-box .github-box-title{height:auto;min-height:60px}.github-box .github-box-title h3 .repo{display:block}.github-box .github-box-title .github-stats a{display:block;clear:right;float:right;}.github-box .github-box-download{height:auto;min-height:46px;}.github-box .github-box-download .download{top:32px;}}';
8+
function _getAttribute(node, name, defaultValue) {
9+
return node.getAttribute(name) || defaultValue;
10+
}
11+
function _querySelector(dom, sel) {
12+
return dom.querySelector(sel);
13+
}
14+
function _setHtml(dom, h) {
15+
dom.innerHTML = h;
16+
}
17+
function _appendCss() {
18+
var x = document.createElement('div');
19+
x.innerHTML = 'x<style>'+cssStr+'</style>';
20+
document.getElementsByTagName('head')[0].appendChild(x.lastChild);
21+
}
22+
function _renderGitHubWidget(repoEle, repo) {
23+
repo = JSON.parse(repo);
24+
_setHtml(_querySelector(repoEle, '.watchers'), repo.watchers);
25+
_setHtml(_querySelector(repoEle, '.forks'), repo.forks);
26+
_setHtml(_querySelector(repoEle, '.description span'), repo.description);
27+
_setHtml(_querySelector(repoEle, '.updated'), 'Latest commit to the <strong>' + repo.default_branch+ '</strong> branch on <strong>' + repo.pushed_at.substring(0, 10) + '</strong>');
28+
29+
if(repo.homepage !== null) {
30+
_setHtml(_querySelector(repoEle, '.link'), '<a href="'+ repo.homepage +'">'+ repo.homepage +'</a>');
31+
}
32+
repoEle.setAttribute(rendered, '1');
33+
}
34+
function _ajaxReq(repoEle, repo) {
35+
var xmlhttp;
36+
if (window.XMLHttpRequest) {
37+
//code for IE7,firefox chrome and above
38+
xmlhttp = new XMLHttpRequest();
39+
} else {
40+
//code for Internet Explorer
41+
xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');
42+
}
43+
xmlhttp.onreadystatechange = function() {
44+
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
45+
_renderGitHubWidget(repoEle, xmlhttp.responseText);
46+
} else {
47+
}
48+
};
49+
xmlhttp.open('GET', 'https://api.github.com/repos/' + repo, true);
50+
xmlhttp.send();
51+
}
52+
function _init() {
53+
var github_eles = document.querySelectorAll('.github-widget'), repoEle, repo, vendorName, repoName, vendorUrl, repoUrl, widget;
54+
for (var i = 0; i < github_eles.length; i++) {
55+
repoEle = github_eles[i];
56+
if (! _getAttribute(repoEle, rendered, '')) {
57+
repo = _getAttribute(repoEle, 'data-repo', ''),
58+
vendorName = repo.split('/')[0],
59+
repoName = repo.split('/')[1],
60+
vendorUrl = 'http://github.com/' + vendorName,
61+
repoUrl = 'http://github.com/' + vendorName + '/' + repoName;
62+
63+
widget = '<div class="github-box repo">'+
64+
'<div class="github-box-title">'+
65+
'<h3>'+
66+
'<a class="owner" href="' + vendorUrl + '" title="' + vendorUrl + '">' + vendorName + '</a>'+
67+
'<span class="path-divider">/</span>'+
68+
'<a class="repo" href="' + repoUrl + '" title="' + repoUrl + '">' + repoName + '</a>'+
69+
'</h3>'+
70+
'<div class="github-stats">'+
71+
'<span class="github-text">Star </span>'+
72+
'<a class="watchers" href="' + repoUrl + '/watchers" title="See watchers">?</a>'+
73+
'<span class="github-text"> Fork </span>'+
74+
'<a class="forks" href="' + repoUrl + '/network/members" title="See forkers">?</a>'+
75+
'</div>'+
76+
'</div>'+
77+
'<div class="github-box-content">'+
78+
'<p class="description"><span></span> &mdash; <a href="' + repoUrl + '#readme">Read More</a></p>'+
79+
'<p class="link"></p>'+
80+
'</div>'+
81+
'<div class="github-box-download">'+
82+
'<div class="updated"></div>'+
83+
'<a class="download" href="' + repoUrl + '/zipball/master" title="Get repository">Download as zip</a>'+
84+
'</div>'+
85+
'</div>';
86+
_setHtml(repoEle, widget);
87+
_ajaxReq(repoEle, repo);
88+
}
89+
}
90+
}
91+
_appendCss();
92+
_init();
93+
window.GithubRepoWidget = {
94+
init: _init
95+
};
96+
})();

js/instagram.js

+138
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
var Instagram = (function(){
2+
3+
var _collection = [];
4+
5+
var preLoad = function(data){
6+
for(var em in data){
7+
for(var i=0,len=data[em].srclist.length;i<len;i++){
8+
var src = data[em].bigSrclist[i];
9+
var img = new Image();
10+
img.src = src;
11+
}
12+
}
13+
}
14+
15+
var render = function(data){
16+
for(var em in data){
17+
var liTmpl = "";
18+
for(var i=0,len=data[em].srclist.length;i<len;i++){
19+
liTmpl += '<li>\
20+
<div class="img-box">\
21+
<a class="img-bg" rel="example_group" href="'+data[em].bigSrclist[i]+'" title="'+data[em].text[i]+'"></a>\
22+
<img lazy-src="'+data[em].srclist[i]+'" alt="">\
23+
</div>\
24+
</li>';
25+
}
26+
$('<section class="archives album"><h1 class="year">'+data[em].year+'<em>'+data[em].month+'月</em></h1>\
27+
<ul class="img-box-ul">'+liTmpl+'</ul>\
28+
</section>').appendTo($(".instagram"));
29+
}
30+
31+
$(".instagram").lazyload();
32+
changeSize();
33+
34+
setTimeout(function(){
35+
preLoad(data);
36+
},3000);
37+
38+
$("a[rel=example_group]").fancybox();
39+
}
40+
41+
var replacer = function(str){
42+
if(str.indexOf("outbound-distilleryimage") >= 0 ){
43+
var cdnNum = str.match(/outbound-distilleryimage([\s\S]*?)\//)[1];
44+
var arr = str.split("/");
45+
return "http://distilleryimage"+cdnNum+".ak.instagram.com/"+arr[arr.length-1];
46+
}else{
47+
var url = "http://photos-g.ak.instagram.com/hphotos-ak-xpf1/";
48+
var arr = str.split("/");
49+
return url+arr[arr.length-1];
50+
}
51+
}
52+
53+
var ctrler = function(data){
54+
var imgObj = {};
55+
for(var i=0,len=data.length;i<len;i++){
56+
var d = new Date(data[i].created_time*1000);
57+
var y = d.getFullYear();
58+
var m = d.getMonth()+1;
59+
var src = replacer(data[i].images.low_resolution.url);
60+
var bigSrc = replacer(data[i].images.standard_resolution.url);
61+
var text = data[i].caption ? data[i].caption.text : ''; // data[i].caption 有可能为 null
62+
var key = y+"-"+m;
63+
if(imgObj[key]){
64+
imgObj[key].srclist.push(src);
65+
imgObj[key].bigSrclist.push(bigSrc);
66+
imgObj[key].text.push(text);
67+
}else{
68+
imgObj[key] = {
69+
year:y,
70+
month:m,
71+
srclist:[bigSrc],
72+
bigSrclist:[bigSrc],
73+
text:[text]
74+
}
75+
}
76+
}
77+
render(imgObj);
78+
}
79+
80+
var getList = function(url){
81+
$(".open-ins").html("图片来自instagram,正在加载中…");
82+
$.ajax({
83+
url: url,
84+
type:"GET",
85+
dataType:"jsonp",
86+
success:function(re){
87+
if(re.meta.code == 200){
88+
_collection = _collection.concat(re.data);
89+
var next = re.pagination.next_url;
90+
if(next){
91+
getList(next);
92+
}else{
93+
$(".open-ins").html("图片来自instagram,点此访问");
94+
ctrler(_collection);
95+
}
96+
}else{
97+
alert("access_token timeout!");
98+
}
99+
}
100+
});
101+
}
102+
103+
104+
var changeSize = function(){
105+
if($(document).width() <= 600){
106+
$(".img-box").css({"width":"auto", "height":"auto"});
107+
}else{
108+
var width = $(".img-box-ul").width();
109+
var size = Math.max(width*0.26, 157);
110+
$(".img-box").width(size).height(size);
111+
}
112+
}
113+
114+
var bind = function(){
115+
$(window).resize(function(){
116+
changeSize();
117+
});
118+
}
119+
120+
return {
121+
init:function(){
122+
//getList("https://api.instagram.com/v1/users/438522285/media/recent/?access_token=438522285.2082eef.ead70f432f444a2e8b1b341617637bf6&count=100");
123+
var insid = $(".instagram").attr("data-client-id");
124+
var userId = $(".instagram").attr("data-user-id");
125+
126+
if(!insid){
127+
alert("Didn't set your instagram client_id.\nPlease see the info on the console of your brower.");
128+
console.log("Please open 'http://instagram.com/developer/clients/manage/' to get your client-id.");
129+
return;
130+
}
131+
getList("https://api.instagram.com/v1/users/"+ userId +"/media/recent/?client_id="+insid+"&count=100");
132+
bind();
133+
}
134+
}
135+
})();
136+
$(function(){
137+
Instagram.init();
138+
})

0 commit comments

Comments
 (0)