Commit 35a03bd1 authored by Liang Ding's avatar Liang Ding

🎨 调整后台首页推荐贴

parent 4a9f5721
......@@ -32,71 +32,54 @@
<script type="text/javascript">
plugins.symphonyInterest = {
init: function () {
$("#loadMsg").text("${loadingLabel}");
$('#loadMsg').text("${loadingLabel}")
$("#symphonyInterest").css("background",
"url(${staticServePath}/images/loader.gif) no-repeat scroll center center transparent");
$('#symphonyInterest').css('background',
"url(${staticServePath}/images/loader.gif) no-repeat scroll center center transparent")
$.ajax({
url: "${servePath}/blog/interest-tags",
type: "GET",
dataType: "json",
url: 'https://hacpai.com/apis/articles?',
type: 'GET',
dataType: 'jsonp',
jsonp: 'callback',
error: function () {
$("#symphonyInterest").html("Loading Interest failed :-(").css("background", "none");
},
success: function (result, textStatus) {
var tags = result.data;
if (0 === tags.length) {
return;
}
$.ajax({
url: "https://hacpai.com/apis/articles?p=1&size=7&tags=" + tags.join(),
type: "GET",
dataType: "jsonp",
jsonp: "callback",
error: function () {
$("#symphonyInterest").html("Loading Interest failed :-(").css("background", "none");
$('#symphonyInterest').html('Loading Interest failed :-(').css('background', 'none')
},
success: function (data, textStatus) {
var articles = data.articles;
var articles = data.articles
if (0 === articles.length) {
return;
return
}
var listHTML = "<ul>";
var listHTML = '<ul>'
for (var i = 0; i < articles.length; i++) {
var article = articles[i];
var article = articles[i]
var articleLiHtml = "<li>"
+ "<a target='_blank' href='" + article.articlePermalink + "'>"
+ article.articleTitle + "</a>&nbsp; <span class='date'>" + $.bowknot.getDate(article.articleCreateTime, 1);
+"</span></li>"
var articleLiHtml = '<li>'
+ '<a target=\'_blank\' href=\'' + article.articlePermalink + '\'>'
+ article.articleTitle + '</a>&nbsp; <span class=\'date\'>' + $.bowknot.getDate(article.articleCreateTime, 1);
+'</span></li>'
listHTML += articleLiHtml
}
listHTML += "</ul>";
listHTML += '</ul>'
$("#symphonyInterest").html(listHTML).css("background", "none");
$('#symphonyInterest').html(listHTML).css('background', 'none')
}
});
}
});
})
$("#loadMsg").text("");
$('#loadMsg').text('')
}
}
};
/*
* 添加插件
*/
admin.plugin.add({
"id": "symphonyInterest",
"path": "/main/panel1",
"content": $("#symphonyInterestPanel").html()
});
'id': 'symphonyInterest',
'path': '/main/panel1',
'content': $('#symphonyInterestPanel').html()
})
// 移除现有内容
$("#symphonyInterestPanel").remove();
$('#symphonyInterestPanel').remove()
</script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment