add blogs & tpl

This commit is contained in:
unknown
2014-06-22 01:04:36 +08:00
parent 8fef69507c
commit 03a9bda500
9 changed files with 259 additions and 77 deletions
+11
View File
@@ -0,0 +1,11 @@
var blog_2014_06_21_凌晨1点 = {
title: '大学这四年',
blog_tags: ['大学四年', '总结' , '展望'],
blog_time: '2014-06-21',
blog_p:[
{
title: '四年前的事儿',
content: '四年前,高考结束'
}
]
};
+2
View File
@@ -0,0 +1,2 @@
var blogs = [];
blogs.push(blog_2014_06_21_凌晨1点);
+83 -6
View File
@@ -4,8 +4,8 @@
*/
*{
font-size:14px;
font-family: 'Lucida Console', 'Monaco', 'monospace','consolas','宋体','微软雅黑' ,'Arial','Times New Roman', Times, serif;
font-size:13px;
font-family: 'Lucida Console','黑体', 'Monaco', 'monospace','consolas','宋体','微软雅黑' ,'Arial','Times New Roman', Times, serif;
text-decoration: none;
}
@@ -66,7 +66,7 @@ body{
.menu{
width:160px;
height: 300px;
height: 230px;
background-color: #D0D0D0;
position: fixed;
right: 0;
@@ -78,7 +78,7 @@ body{
.main_section{
width: 950px;
margin: 0 auto;
height: 1000px;
min-height: 1000px;
background-color: #FFF;
box-shadow: 3px 0 5px #A5A6A4;
border: 1px solid #DDDDDD;
@@ -86,16 +86,93 @@ body{
}
.menu_table{
margin-top: 15px;
width: 130px;
height: 300px;
margin-left: 30px;
height: 200px;
margin-left: 20px;
}
.menu_table_tr{
height: 30px;
color: #0088D3;
text-align: center;
}
.menu_table_tr td:hover{
cursor: pointer;
background-color: blue;
color: #FFF;
border-radius: 3px;
font-weight: bold;
}
.blog{
width: 900px;
margin: 0 auto;
margin-top: 15px;
}
.blog_title{
color: #2F9BD7;
font-size: 23px;
font-weight: bold;
margin-bottom: 10px;
cursor: pointer;
}
.blog_tags{
display: inline;
}
.blog_time{
display: inline;
margin-left: 5px;
}
.blog_tags_item{
display: inline;
cursor: pointer;
font-size: 14px;
}
.blog_tags_time{
color: #DDDDDD;
}
.blog_article{
margin-top: 20px;
color: #555555;
}
.blog_p{
margin-top: 3px;
margin-bottom:3px;
font-size: 14px;
line-height: 23px;
}
.blog_lt{
font-size: 19px;
margin-top: 18px;
font-weight: bold;
}
.page{
margin:0 auto;
width: 130px;
height: 40px;
}
.page_item{
display: inline-block;
height: 22px;
line-height: 22px;
margin-left: 3px;
background-color: #3879D9;
border-radius: 3px;
color: #FFF;
}
.page_item:hover{
cursor: pointer;
};
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 206 B

+102
View File
@@ -0,0 +1,102 @@
<!DOCTYPE html>
<html>
<head>
<title>vczero的博客</title>
<meta http-equiv="Content-Type" content="text/html;charset=UTF8"/>
<link rel='stylesheet' href='css/main.css' />
<script type="text/javascript" src="js/jquery2.1.1.js"></script>
<script type="text/javascript" src="js/hightcharts/highcharts.js"></script>
<script type="text/javascript" src="js/sea2.3.js"></script>
<script type="text/javascript" src="js/underscore.js"></script>
<script type="text/javascript" src="blog/2014-06-21.js"></script>
<script type="text/javascript" src="blog/blogs.js"></script>
<script type="text/javascript" src="js/main.js"></script>
</head>
<body>
<!--页眉-->
<header class="header">
<div class="header_bar">
<div class="title">iBlog</div>
</div>
</header>
<!--菜单-->
<section class="menu">
<table class="menu_table">
<tr class="menu_table_tr">
<td>Web前端</td>
<td>Web后端</td>
</tr>
<tr class="menu_table_tr">
<td>NoSQL</td>
<td>SQL</td>
</tr>
<tr class="menu_table_tr">
<td>JS</td>
<td>HTML5</td>
</tr>
<tr class="menu_table_tr">
<td>Node</td>
<td>LBS</td>
</tr>
<tr class="menu_table_tr">
<td>小事</td>
<td>关于我</td>
</tr>
</table>
</section>
<!--主体-->
<section class="main_section">
<div id="showblog"></div>
<script type="text/template" id="tpl_blog">
<%
for(var i = 0; i < list.length; i++)
{
var item = list[i]
%>
<!--一篇博客-->
<section class="blog">
<header class="blog_title">
<%=item.title%>
</header>
<!--标签&时间-->
<div class="blog_tags_time">
<div class="blog_tags">
<%
for(var j = 0; j < item.blog_tags.length; j++){
%>
<div class="blog_tags_item"><%=item.blog_tags[j]%></div>
<%}%>
</div>
<div class="blog_time">
<%=item.blog_time%>
</div>
</div>
<!--正文-->
<article class="blog_article">
<%
for(var k = 0; k < item.blog_p.length; k++){
%>
<div class="blog_lt"><%=item.blog_p[k].title%></div>
<div class="blog_p">
<%=item.blog_p[k].content%>
</div>
<%}%>
</article>
</section>
<%}%>
</script>
<!-- <div class="page">
<div class="page_item">上一页</div>
<div class="page_item">下一页</div>
</div> -->
</section>
<!--页脚-->
<footer class = "footer">
<div class="footer_info"></div>
<div>
<div class="footer_text">wlhmyit@126.com</div>
<div class="footer_text">create by vczero</div>
</div>
</footer>
</body>
</html>
+30 -1
View File
@@ -43,7 +43,36 @@
</table>
</section>
<!--主体-->
<section class="main_section"></section>
<section class="main_section">
<!--一篇博客-->
<section class="blog">
<header class="blog_title">
LBS在APP中的应用
</header>
<!--标签&时间-->
<div class="blog_tags_time">
<div class="blog_tags">
<div class="blog_tags_item">LBS开发</div>
<div class="blog_tags_item">GEO开发</div>
</div>
<div class="blog_time">
2014-06-21
</div>
</div>
<!--正文-->
<article class="blog_article">
<div class="blog_lt">引言</div>
<div class="blog_p">
2月21日,慈济菲律宾分会前往巴石市的社福发展部(Department of Social Welfare and Development (DSWD))进行爱洒活动,发送大米、环保毛毯等结缘品,以感恩社福人员于凯莎娜台风赈灾期间为灾民的付出,及给予慈济人救灾的协助。
</div>
<div class="blog_lt">引言</div>
<div class="blog_p">
2月21日,慈济菲律宾分会前往巴石市的社福发展部(Department of Social Welfare and Development (DSWD))进行爱洒活动,发送大米、环保毛毯等结缘品,以感恩社福人员于凯莎娜台风赈灾期间为灾民的付出,及给予慈济人救灾的协助。
</div>
</article>
</section>
</section>
<!--页脚-->
<footer class = "footer">
-70
View File
@@ -1,70 +0,0 @@
/*
i bolg API
*/
var ibolg = function(options){
var defOptions ={
logo: '../imgs/logo.png',
name: '我的博客',
menu: {
show: true,
color: '#D0D0D0',
width: '160px',
height: '300px',
menu_item:[
{
item_name: '菜单1',
background: ''
},
{
item_name: '菜单2',
background: ''
},
{
item_name: '菜单3',
background: ''
},
{
item_name: '菜单4',
background: ''
},
{
item_name: '菜单5',
background: ''
},
]
}
footer: true
};
this.options = {};
if(options){
this.options.logo = options.logo || defOptions.logo;
this.options.name = options.name || defOptions.name;
this.options.menu = options.menu || defOptions.menu;
this.options.footer = options.footer || defOptions.footer;
}else{
this.options = defOptions;
}
};
//初始化配置,需要哪些功能
ibolg.prototype.init = function(){
if(this.options.menu){
this.addMenu();
}
if(this.options.footer){
this.addFooter();
}
}
ibolg.prototype.addMenu = function(){
}
ibolg.prototype.addFooter = function(){
}
+25
View File
@@ -0,0 +1,25 @@
$(function(){
createBlogs(blogs, 100);
function createBlogs(blogs, n){
var blogs = blogs;
var num = n > blogs.length ? blogs.length : n;
var element = $('#showblog');
var tpl = $('#tpl_blog').html();
var myBlogs = [];
for(var i = 0; i < num; i++){
myBlogs.push(blogs[i]);
}
var data = {
list: myBlogs
}
var html = _.template(tpl, data);
element.html(html);
}
});
File diff suppressed because one or more lines are too long