-
Notifications
You must be signed in to change notification settings - Fork 1
/
gitee_handsome4_5_1.php
166 lines (145 loc) · 9.67 KB
/
gitee_handsome4_5_1.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
<?php
/**
* gitee项目列表
*
* @package custom
*/
/*
* @Email: [email protected]
* @Author: rumosky
* @Github: https://github.com/rumosky
* @Date: 2020-01-15 17:54:27
* @Description: handsome主题gitee独立页面4.5.1版本
*/
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
?>
<?php $this->need('component/header.php'); ?>
<!-- aside -->
<?php $this->need('component/aside.php'); ?>
<!-- / aside -->
<!-- <div id="content" class="app-content"> -->
<a class="off-screen-toggle hide"></a>
<main class="app-content-body <?php echo Content::returnPageAnimateClass($this); ?>">
<div class="hbox hbox-auto-xs hbox-auto-sm">
<!--文章-->
<div class="col center-part">
<!--标题下的一排功能信息图标:作者/时间/浏览次数/评论数/分类-->
<?php echo Content::exportPostPageHeader($this,$this->user->hasLogin()); ?>
<div class="wrapper-md" id="post-panel">
<?php Content::BreadcrumbNavigation($this, $this->options->rootUrl); ?>
<!--博客文章样式 begin with .blog-post-->
<div id="postpage" class="blog-post">
<article class="panel">
<!--文章页面的头图-->
<?php echo Content::exportHeaderImg($this); ?>
<!--文章内容-->
<div id="post-content" class="wrapper-lg">
<div class="entry-content l-h-2x">
<small class="text-muted letterspacing gitee_tips"></small>
<!--gitee--->
<div class="repo-list">
<div class="blankslate"><h3><?php _me("载入中...") ?></h3></div>
</div>
</div>
</div>
</article>
</div>
<!--评论-->
<?php $this->need('component/comments.php') ?>
</div>
</div>
<!--文章右侧边栏开始-->
<?php $this->need('component/sidebar.php'); ?>
<!--文章右侧边栏结束-->
</div>
<!--Gitee项模版-->
<script type="text/template" id="list-template">
<li class="collection-card">
<a href="{%=html_url%}.git" class="card text-center" target="_blank">
<div class="thumbnail" style="margin-bottom:0px">
<div class="card-image geopattern" data-pattern-id="{%=name%}">
<div class="card-image-cell">
<h3 class="card-title">
{%=name%}
</h3>
</div>
</div>
<div class="caption">
<div class="card-description">
<p class="card-text">{%=description%}</p>
</div>
<div class="card-text">
<span class="meta-info tooltipped tooltipped-n" aria-label="{%=stargazers_count%} stars">
<i class="iconfont icon-star"></i> {%=stargazers_count%}</span> <span class="meta-info tooltipped tooltipped-n" aria-label="{%=forks_count%} forks">
<i class="iconfont icon-fork"></i> {%=forks_count%}</span> <span class="meta-info tooltipped tooltipped-n" aria-label="最后更新时间:{%=updated_at%}">
<span class="octicon octicon-clock"></span>
<time datetime="{%=updated_at%}">{%=updated_at%}</time>
</span>
</div>
</div>
</div>
</a>
</li>
</script>
<!--获取失败模版-->
<script type="text/template" id="error-template">
<div class="blankslate"><h3>加载失败</h3><p>请刷新或稍后再试...</p>></div>
</script>
<?php
$giteeUser = $this->fields->gitee;
if ($giteeUser == "" || $giteeUser == null){
echo '<script>$(".gitee_tips").text("请填写正确的gitee用户名,主题检查gitee用户为空或者错误,已经切换rumosky用户仓库项目。");</script>';
$giteeUser = 'rumosky_admin';
}
?>
<script src="<?php echo STATIC_PATH;?>js/function/geopattern.js" type="text/javascript"></script>
<script type="text/javascript">
(function(window){var baidu=typeof module==="undefined"?(window.baidu=window.baidu||{}):module.exports;baidu.template=function(str,data){var fn=(function(){if(!window.document){return bt._compile(str)}var element=document.getElementById(str);if(element){if(bt.cache[str]){return bt.cache[str]}var html=/^(textarea|input)$/i.test(element.nodeName)?element.value:element.innerHTML;return bt._compile(html)}else{return bt._compile(str)}})();var result=bt._isObject(data)?fn(data):fn;fn=null;return result};var bt=baidu.template;bt.versions=bt.versions||[];bt.versions.push("1.0.6");bt.cache={};bt.LEFT_DELIMITER=bt.LEFT_DELIMITER||"{%";bt.RIGHT_DELIMITER=bt.RIGHT_DELIMITER||"%}";bt.ESCAPE=true;bt._encodeHTML=function(source){return String(source).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/\\/g,"\").replace(/"/g,""").replace(/'/g,"'")};bt._encodeReg=function(source){return String(source).replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")};bt._encodeEventHTML=function(source){return String(source).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\\\\/g,"\\").replace(/\\\//g,"/").replace(/\\n/g,"\n").replace(/\\r/g,"\r")};bt._compile=function(str){var funBody="var _template_fun_array=[];\nvar fn=(function(__data__){\nvar _template_varName='';\nfor(name in __data__){\n_template_varName+=('var '+name+'=__data__[\"'+name+'\"];');\n};\neval(_template_varName);\n_template_fun_array.push('"+bt._analysisStr(str)+"');\n_template_varName=null;\n})(_template_object);\nfn = null;\nreturn _template_fun_array.join('');\n";return new Function("_template_object",funBody)};bt._isObject=function(source){return"function"===typeof source||!!(source&&"object"===typeof source)};bt._analysisStr=function(str){var _left_=bt.LEFT_DELIMITER;var _right_=bt.RIGHT_DELIMITER;var _left=bt._encodeReg(_left_);var _right=bt._encodeReg(_right_);str=String(str).replace(new RegExp("("+_left+"[^"+_right+"]*)//.*\n","g"),"$1").replace(new RegExp("<!--.*?-->","g"),"").replace(new RegExp(_left+"\\*.*?\\*"+_right,"g"),"").replace(new RegExp("[\\r\\t\\n]","g"),"").replace(new RegExp(_left+"(?:(?!"+_right+")[\\s\\S])*"+_right+"|((?:(?!"+_left+")[\\s\\S])+)","g"),function(item,$1){var str="";if($1){str=$1.replace(/\\/g,"\").replace(/'/g,"'");while(/<[^<]*?'[^<]*?>/g.test(str)){str=str.replace(/(<[^<]*?)'([^<]*?>)/g,"$1\r$2")}}else{str=item}return str});str=str.replace(new RegExp("("+_left+"[\\s]*?var[\\s]*?.*?[\\s]*?[^;])[\\s]*?"+_right,"g"),"$1;"+_right_).replace(new RegExp("("+_left+":?[hvu]?[\\s]*?=[\\s]*?[^;|"+_right+"]*?);[\\s]*?"+_right,"g"),"$1"+_right_).split(_left_).join("\t");if(bt.ESCAPE){str=str.replace(new RegExp("\\t=(.*?)"+_right,"g"),"',typeof($1) === 'undefined'?'':baidu.template._encodeHTML($1),'")}else{str=str.replace(new RegExp("\\t=(.*?)"+_right,"g"),"',typeof($1) === 'undefined'?'':$1,'")}str=str.replace(new RegExp("\\t:h=(.*?)"+_right,"g"),"',typeof($1) === 'undefined'?'':baidu.template._encodeHTML($1),'").replace(new RegExp("\\t(?::=|-)(.*?)"+_right,"g"),"',typeof($1)==='undefined'?'':$1,'").replace(new RegExp("\\t:u=(.*?)"+_right,"g"),"',typeof($1)==='undefined'?'':encodeURIComponent($1),'").replace(new RegExp("\\t:v=(.*?)"+_right,"g"),"',typeof($1)==='undefined'?'':baidu.template._encodeEventHTML($1),'").split("\t").join("');").split(_right_).join("_template_fun_array.push('").split("\r").join("\\'");return str}})(window);
</script>
<script type="text/javascript">
var open = function(){
var baiduTpl = new Object();
var handleTpl = function(){
baiduTpl.list = baidu.template("list-template");
baiduTpl.error = baidu.template("error-template");
};
var handlegitee = function(){
var repoContainer = $('.repo-list');
var errorContainer = repoContainer.find(".blankslate")
var countContainer = $(".gitee_tips");
$.get("https://gitee.com/api/v5/users/<?php echo $giteeUser; ?>/repos",function(result){
if(result){
//alert("ok1");
errorContainer.remove();
//countContainer.text(result.length); //设置项目个数
var ul = $("<ul class='collection-listing clearfix'></ul>");
for(var i in result){
var repo = result[i];
repo.updated_at = repo.updated_at.substring(0,repo.updated_at.lastIndexOf("T"));
var html = baiduTpl.list(repo);
ul.append(html);
}
repoContainer.append(ul);
$(".geopattern").each(function(){
$(this).geopattern($(this).data('pattern-id'));
});
}else{
//alert("ok2");
errorContainer.remove();
countContainer.append(baiduTpl.error());
}
});
};
return {
init : function(){
handleTpl();
handlegitee();
}
}
};
$(open().init);
</script>
</main>
<!-- footer -->
<?php $this->need('component/footer.php'); ?>
<!-- / footer -->