From 0c9fb0081239bbec72b95e7e103a6e0f9c458ca9 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 24 Jun 2014 17:43:39 +0800 Subject: [PATCH] add --- iblog/blog/2014-06-21.js | 7 +++++-- iblog/blog/2014-06-24.js | 4 +++- iblog/blog/blogs_link.js | 9 +++++---- iblog/blog/type.js | 17 +++++++++++++---- iblog/css/main.css | 2 +- iblog/index.html | 4 +++- iblog/js/article.js | 1 + iblog/js/list.js | 38 ++++++++++++++++++++++++++++++++++++++ iblog/list.html | 37 ++++++++++++++++++------------------- 9 files changed, 87 insertions(+), 32 deletions(-) diff --git a/iblog/blog/2014-06-21.js b/iblog/blog/2014-06-21.js index 8ed5cb6..3ad6f5b 100644 --- a/iblog/blog/2014-06-21.js +++ b/iblog/blog/2014-06-21.js @@ -1,9 +1,12 @@ define(function(require, exports, module){ + var types = require('./type.js'); + var blog_2014_06_21 = { id:'blog_2014_06_21', - title: '大学这四年', + title: '大学这四年', blog_tags: ['大学四年', '总结' , '展望'], - blog_time: '2014-06-21 1:10', + blog_time: '2014-06-21 01:10', + type: types.type.story, blog_p:[ { title: '四年前的事儿', diff --git a/iblog/blog/2014-06-24.js b/iblog/blog/2014-06-24.js index 2d93f6f..60bf709 100644 --- a/iblog/blog/2014-06-24.js +++ b/iblog/blog/2014-06-24.js @@ -1,10 +1,12 @@ define(function(require, exports, module){ + var types = require('./type.js'); + var blog_2014_06_24 = { id:'blog_2014_06_24', - type: '', title: '关于git和svn', blog_tags: ['git', 'svn' , '版本控制'], blog_time: '2014-06-24 09:38', + type: types.type.versionControl, blog_p:[ { title: 'git or svn', diff --git a/iblog/blog/blogs_link.js b/iblog/blog/blogs_link.js index 0867ef6..93d20ae 100644 --- a/iblog/blog/blogs_link.js +++ b/iblog/blog/blogs_link.js @@ -8,15 +8,16 @@ define(function(require, exports, module){ var blog_1 = require('./2014-06-21.js'); - blogs.push(createObj(blog_2.blog_2014_06_24)); - blogs.push(createObj(blog_1.blog_2014_06_21)); + blogs.push(createNewObj(blog_2.blog_2014_06_24)); + blogs.push(createNewObj(blog_1.blog_2014_06_21)); - function createNewObj = function(obj){ + function createNewObj(obj){ return { id: obj.id, title: obj.title, blog_tags: obj.blog_tags, - blog_time: obj.blog_time + blog_time: obj.blog_time, + type: obj.type }; } diff --git a/iblog/blog/type.js b/iblog/blog/type.js index 165a305..0d3177a 100644 --- a/iblog/blog/type.js +++ b/iblog/blog/type.js @@ -1,4 +1,13 @@ -var type = { - stroy: 1, - versionControl: 0 -}; \ No newline at end of file + + +define(function(require, exports, module){ + + var type = { + versionControl: 0, + story: 1 + }; + + + exports.type = type; + +}); diff --git a/iblog/css/main.css b/iblog/css/main.css index 2e17158..eb8742b 100644 --- a/iblog/css/main.css +++ b/iblog/css/main.css @@ -35,7 +35,7 @@ body{ color: #EEEEEE; } -.title_a{ +.blog_title a{ color: #2F9BD7; font-size: 23px; font-weight: bold; diff --git a/iblog/index.html b/iblog/index.html index 0aa479d..3aaac78 100644 --- a/iblog/index.html +++ b/iblog/index.html @@ -37,7 +37,9 @@ LBS - 小事 + + 小事 + 关于我 diff --git a/iblog/js/article.js b/iblog/js/article.js index 33762d4..bcdab08 100644 --- a/iblog/js/article.js +++ b/iblog/js/article.js @@ -16,6 +16,7 @@ $(function(){ function createBlog(blogs, n){ var blogs = blogs; var num = n > blogs.length ? blogs.length:n; + var element = $('#showblog'); var tpl = $('#tpl_blog').html(); var myBlogs = []; diff --git a/iblog/js/list.js b/iblog/js/list.js index e69de29..743fefc 100644 --- a/iblog/js/list.js +++ b/iblog/js/list.js @@ -0,0 +1,38 @@ +/* + list +*/ + +$(function(){ + seajs.use('./blog/blogs_link.js', function(exports){ + var url = window.location.search; + var type = url.split('type=')[1]; + var links = exports.blogs; + + var linksArr = []; + for(var i = 0; i < links.length; i++){ + if(links[i].type == type){ + linksArr.push(links[i]); + } + } + createList(linksArr, 100); + }); + + function createList(links, n){ + var num = n > links.length ? links.length:n; + var element = $('#showlinklist'); + var tpl = $('#tpl_links').html(); + var mylinks = []; + for(var i = 0; i < num; i++){ + mylinks.push(links[i]); + } + var data = { + list: mylinks + } + + console.log(data); + var html = _.template(tpl, data); + element.html(html); + + } + +}); \ No newline at end of file diff --git a/iblog/list.html b/iblog/list.html index 6801f09..69ab5b5 100644 --- a/iblog/list.html +++ b/iblog/list.html @@ -45,26 +45,25 @@
-
-
-
文章列表
- - - - - - +
+
文章列表
+ +