Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

refactor home.js

  • Loading branch information...
commit 8a1810a9451ef2aab76b856cb488df6c1a8e98f6 1 parent 9d1ab43
@zolunx10 authored
View
53 _/css/main.css
@@ -153,10 +153,6 @@ body {
_height:400px;
margin-left:100px;
}
-#imagebox img {
- width:50px;
- height:50px;
-}
.home-nav {
margin-top:15px;
@@ -228,13 +224,18 @@ li.current_page_item a {
margin-top:8px;
}
+.category header h2 {
+ display:inline;
+}
+.category header .meta {
+ display:inline;
+ margin-left:5px;
+}
/* book
*/
-.category-book .post {
+.category article.category-book {
margin-left:10px;
margin-right:10px;
-}
-.category-book .post {
display:inline;
float:left;
position:relative;
@@ -243,28 +244,56 @@ li.current_page_item a {
height:120px;
overflow:hidden;
}
-.category-book .cover {
+.category .category-book .cover {
position:absolute;
top:0; left:0;
width:100px;
}
-.category-book .cover img {
+.category .category-book .cover img {
width:100%;
height:auto;
margin:0 5px 5px 0;
}
-.category-book .post header {
+.category .category-book .post header {
margin-bottom:10px;
}
-.category-book .entry img {
+.category .category-book .entry img {
display:none;
}
-.category-book .entry p {
+.category .category-book .entry p {
text-indent:0;
}
+/* postgraduate
+*/
+.category .category-postgraduate {
+
+}
+/* TODO */
+.category article.category-postgraduate {
+ display:inline;
+ float:left;
+ margin:10px 20px;
+}
+
+
/* home
*/
+#stage {
+ display: none;
+}
+#imagebox .label {
+ position: absolute;
+ height:15px;
+ bottom:0;
+ left:0;
+}
+#imagebox .label span {
+ position:absolute;
+ top:0;
+ text-align:center;
+ display:inline-block;
+}
#imagebox li {
}
View
18 _/js/functions.js
@@ -2,6 +2,9 @@
var exports= window;
(function($){
var RE_URICMP=/[?&](\w+)=([^&=]*)/ig;
+/****
+ * 单击首页小图标时用fancybox显示相册
+ */
exports.makeGallery= function(settings) {
var opts= {
jsonUrl: "/"
@@ -25,6 +28,7 @@ exports.makeGallery= function(settings) {
}
$('body').delegate('.ngg-thumbnail a.ngg-link', 'click', function() {
var t, params={},
+ $this= $(this),
href= opts.getHref ? opts.getHref(this) : this.href;
$.fancybox.showLoading();
RE_URICMP.lastIndex= 0;
@@ -35,14 +39,20 @@ exports.makeGallery= function(settings) {
if (galleryCache[gid]) {
openFancy(galleryCache[gid]);
} else {
- $.getJSON(opts.jsonUrl+"?callback=json&format=json&method=gallery&id="+gid, function(json) {
+ $.getJSON(opts.jsonUrl+"?callback=json&format=json&method=gallery&api_key=studio12F&id="+gid, function(json) {
+ if (! json.images) {
+ $.fancybox.hideLoading();
+ return false;
+ }
var imgs= json.images,
objs=[];
+ var title= $this.attr('title');
for (var i=0, ii=imgs.length; i<ii; i++) {
objs.push({
- href: imgs[i].imageURL
- , src: imgs[i].thumbURL
- , title: imgs[i].description
+ href: imgs[i].imageURL,
+ src: imgs[i].thumbURL,
+ title: title
+ //, title: imgs[i].description
});
}
galleryCache[gid]= objs;
View
402 _/js/home.js
@@ -1,270 +1,128 @@
-$(document).ready(function()
- {
- //$(".project").hide();
- $("#filter").hide();
- $("#stage").hide();
- var $item = $(".item");
- var $ele = $(".item a");
- var $info = $("#info a");
- var imageboxtype = $("#imagebox li.type").clone();
- var imageboxtime = $("#imagebox li.time").clone();
+$(document).ready(function(){
+ $("#filter").hide();
+ $("#stage").hide();
+ var $nav = $(".home-nav .item");
+ var $ele = $("a", $nav);
+ var $info = $("#info a");
+ var imageboxtype = $("#imagebox li.type").clone();
+ var imageboxtime = $("#imagebox li.time").clone();
- var items = $('#stage li'),
- itemsByTags = {};
- // Looping though all the li items:
-
- items.each(function(i){
- var elem = $(this),
- tags = elem.data('tags').split(',');
- // Adding a data-id attribute. Required by the Quicksand plugin:
- elem.attr('data-id',i);
- $.each(tags,function(key,value){
-
- // Removing extra whitespace:
- value = $.trim(value);
- if($.isNumeric(value)){
- if(value <= 2002)
- value = 2002;
- else if(value <= 2004)
- value = 2004;
- else if(value <= 2006)
- value = 2006;
- else if(value <= 2009)
- value =2009;
- }
- if(!(value in itemsByTags)){
- // Create an empty array to hold this item:
- itemsByTags[value] = [];
- }
- itemsByTags[value].push(elem);
- });
-
- });
-
- var textbox = $('<div>');
- var col={}, //每个tag对应的列数
- colStart={}, //每个tag的起始列数
- tagList={
+ var $items = $('#stage li').clone(),
+ tagList= {
time: [],
type: []
- };
- function colcount(text,items) {
- if(text !='Time' && text != 'Type'){
- var c = items.length;
- col[text] = Math.floor(c/5.5)+1;
- if (parseInt(text) >1900) {
- tagList.time.push(text);
+ },
+ cols= {
+ time: {},
+ type: {}
+ },
+ colCount={};
+ /* 计算每张图片在特定tag下的对应坐标 */
+ var $imgBox= $('<ul>').hide().append($items).appendTo($('#imagebox'));
+ var $labelBox= $('<div class="label">').appendTo($('#imagebox'));
+ // step 1. 统计每个tag对应的图片
+ $items.each(function(index) {
+ var $this=$(this),
+ tags= $this.data('tags').split(',');
+ // 只考虑time, type
+ for (var ii=tags.length, i=Math.floor(ii/2); i<ii; i++) {
+ var v=$.trim(tags[i]),
+ className;
+ if(v>1900){
+ v= parseInt(v);
+ if(v <= 2002)
+ v = 2002;
+ else if(v <= 2004)
+ v = 2004;
+ else if(v <= 2006)
+ v = 2006;
+ else if(v <= 2009)
+ v =2009;
+ className="time";
} else {
- tagList.type.push(text);
+ className="type";
+ }
+ if (cols[className][v]==null) {
+ tagList[className].push(v);
+ cols[className][v]= [this];
+ } else {
+ cols[className][v].push(this);
}
- }
- }
- $.each(itemsByTags, colcount);
- tagList.time.sort();
- $.each(tagList, function(k, v) {
- start=0;
- for (var i=0, ii=v.length; i<ii; i++) {
- colStart[v[i]]=start;
- start+=col[v[i]];
}
});
- // Looping though the arrays in itemsByTags:
- $.each(itemsByTags,function(k,v){
- createList(k,v);
+ tagList.time.sort();
+ tagList.type.sort(function(l, r) {
+ if (l=='other') {
+ return 1;
+ } else if (r=='other') {
+ return -1;
+ } else {
+ return 0;
+ }
});
- textbox.appendTo('#imagebox');
- function showTime(){
- //$("#imagebox li.type").removeClass("vesibilityclass").addClass("unvesibilityclass");
-
- //$("#imagebox li.time").removeClass("unvesibilityclass").addClass("vesibilityclass");
-
- var preitems=$("#imagebox li.type").clone();
- if(!$("#imagebox li").is(":animated")){
- $("#imagebox li.type").each(function(){
- var $ele=$(this);
- $ele.animate({
- left:$("#imagebox li.time").filter(function(){
- return $ele.attr("data-id")==$(this).attr("data-id")
- }).css('left'),
- bottom:$("#imagebox li.time").filter(function(){
- return $ele.attr("data-id")==$(this).attr("data-id")
- }).css('bottom')
- },400,function(){
- $("#imagebox li.type").hide();
- $("#imagebox li.time").show();
- });
- });
-
- //$("#imagebox li.type").hide(0);
- //$("#imagebox li.time").show();
-
- $("#imagebox li.type").each(function(index){
- var $ele=$(this);
- $ele.animate({
- left:preitems.eq(index).css('left'),
- bottom:preitems.eq(index).css('bottom')},400);
- });
- //$("#imagebox li.time").removeClass("vesibilityclass").addClass("unvesibilityclass");
-
- //$("#imagebox li.type").removeClass("unvesibilityclass").addClass("vesibilityclass");
-
- $("#imagebox span.type").removeClass("vesibilityclass").addClass("unvesibilityclass");
- $("#imagebox span.time").removeClass("unvesibilityclass").addClass("vesibilityclass");
- }
- return false;
+ // step 2. 通过tagList 确定坐标
+ var opts= {
+ numPerCol: 5,
+ padding: 20,
+ width: 66,
+ height: 72
+ };
+ var TYPE_NAME= {
+ "urban": "Urban Design",
+ "arch": "Architecture Design",
+ "village": "Village Planning",
+ "other": "Other"
};
-
- function showType(){
- var preitems=$("#imagebox li.time").clone();
- if(!$("#imagebox li").is(":animated")){
- $("#imagebox li.time").each(function(index){
- var $ele=$(this);
- $ele.animate({
- left:$("#imagebox li.type").filter(function(){
- return $ele.attr("data-id")==$(this).attr("data-id")
- }).css('left')
- ,bottom:$("#imagebox li.type").filter(function(){
- return $ele.attr("data-id")==$(this).attr("data-id")
- }).css('bottom')},400,function(){
- $("#imagebox li.time").hide();
- $("#imagebox li.type").show();
- });
- });
- //$("#imagebox li.time").hide(0);
- //$("#imagebox li.type").show(0);
- $("#imagebox li.time").each(function(index){
- var $ele=$(this);
- $ele.animate({
- left:preitems.eq(index).css('left'),
- bottom:preitems.eq(index).css('bottom')},400);
- });
-
- //$("#imagebox li.time").removeClass("vesibilityclass").addClass("unvesibilityclass");
-
- //$("#imagebox li.type").removeClass("unvesibilityclass").addClass("vesibilityclass");
+ $.each(tagList, function(className, tags) {
+ // className为time或type
+ var colNum=0; //暂存当前tag起始列
+ for (var i=0, ii=tags.length; i<ii; i++) {
+ var col= cols[className][tags[i]];
+ for (var j=0, jj=col.length; j<jj; j++) {
+ var el= col[j];
+ //计算并暂存坐标
+ var t= {
+ bottom: opts.padding+ (j%opts.numPerCol)*opts.height,
+ left: i*opts.padding+ Math.floor(j/5+colNum)*opts.width
+ };
+ $(el).data('pos-'+className, t);
+ }
+ //顺便创建下方的label
+ var cnt= colCount[tags[i]]= Math.floor(col.length/5.1)+1;
+ var labeName= tags[i]>1900 ? tags[i] : (TYPE_NAME[tags[i]] || tags[i]);
+ var $label= $('<span class="'+className+'">')
+ .hide()
+ .html(labeName)
+ .css({
+ left:i*opts.padding+ colNum*opts.width +5,
+ width: cnt*opts.width
+ })
+ .appendTo($labelBox);
- $("#imagebox span.time").removeClass("vesibilityclass").addClass("unvesibilityclass");
- $("#imagebox span.type").removeClass("unvesibilityclass").addClass("vesibilityclass");
- }
- return false;
- };
-
- function createList(text,items){
-
- // This is a helper function that takes the
- // text of a menu button and array of li items
-
- // Creating an empty unordered list:
- if(text != 'Type' && text != 'Time'){
- var ul = $('<ul>');
- var j,k;//k for the opacity
- /*
- switch(text){
- case('2002'):
- j=0;
- k=1;
- break;
- case('2004'):
- j=col['2002'];
- k=1;
- break;
- case('2006'):
- j=col['2002']+col['2004'];
- k=1;
- break;
- case('urban'):
- j=0;
- k=0;
- break;
- case('2009'):
- j=col['2002']+col['2004']+col['2006'];
- k=1;
- break;
- case('country'):
- j=col['urban'];
- k=0;
- break;
- case('building'):
- j=col['urban']+col['country'];
- k=0;
- break;
- case('2010'):
- j=col['2002']+col['2004']+col['2006']+col['2009'];
- k=1;
- break;
- case('landscape'):
- j=col['urban']+col['country']+col['building'];
- k=0;
- break;
- case('2011'):
- j=col['2002']+col['2004']+col['2006']+col['2009']+col['2010'];
- k=1;
- break;
- case('other'):
- j=col['urban']+col['country']+col['building']+col['landscape'];
- k=0;
- break;
- default:
- j=0;
- k=1;
- }*/
- j= colStart[text];
- if (parseInt(text) >1900) {
- k=1;
- } else {
- k=0;
+ colNum+=cnt;
}
- var c=0;
- $.each(items,function(index,value){
- // Creating a copy of each li item
- // and adding it to the list:
- var element = $(this);
- c=c+1;
- // if(index>4){
- element.css({'position':'absolute','bottom':12+(index%5)*72,'left':j*90+66*Math.floor(index/5),'height':'auto'});
- //}
- //else{
- // element.css({'position':'absolute','bottom':12+index*72,'left':j*132,'height':'auto'});
- //}
- if(k==0){
- //element.removeClass("vesibilityclass").addClass("unvesibilityclass");
- element.hide();
- element.removeClass("time").addClass("type");
- }
- else{
- //element.removeClass("unvesibilityclass").addClass("vesibilityclass");
- element.show();
- element.removeClass("type").addClass("time");
- }
- element.clone().appendTo(ul);
- });
- ul.appendTo('#imagebox');
- var tex = $('<span>',{
- html:text
+ });
+ $items.each(function() {
+ $(this).css('position',"absolute");
+ });
+ /****
+ * 按相应tag排列
+ * @param className 为 time | type
+ */
+ function show(className) {
+ $items.each(function() {
+ var t= $(this).data('pos-'+className);
+ $(this).animate(t);
});
- tex.css({'position':'absolute','bottom':'0px','left':j*90+66*(Math.floor(c/5.0001)+1)/2});
- if(k==0){
- tex.removeClass("vesibilityclass").addClass("unvesibilityclass");
- tex.removeClass("time").addClass("type");
- }
- else{
- tex.removeClass("unvesibilityclass").addClass("vesibilityclass");
- tex.removeClass("type").addClass("time");
- }
- tex.appendTo(textbox);
- }
- else{
- // Creating a menu item. The unordered list is added
- // as a data parameter (available via .data('list'):
- /*
- var a = $('<a>',{
- html: text,
- href:'#',
- data: {list:ul}
- }).appendTo('#filter');
- */
- }
+ $labelBox.children().hide();
+ $('.'+className, $labelBox).show();
+ return false;
}
+ show('time');
+ $imgBox.show();
+ /****
+ * 创建下方选择按钮
+ */
function makeFilter() {
var tpl=$('#tpl-nav-li').html();
var $pageNav= $('#items li').not('.info, .more, .filter-item'),
@@ -281,8 +139,14 @@ $(document).ready(function()
, href: "#"
, 'class': "filter-item"
}));
- $filter.eq(0).click(showTime);
- $filter.eq(1).click(showType);
+ $filter.eq(0).click(function() {
+ show('time');
+ return false;
+ });
+ $filter.eq(1).click(function() {
+ show('type');
+ return false;
+ });
$('#items').append($filter);
var isFilter= true;
$pageNav.hide();
@@ -299,28 +163,4 @@ $(document).ready(function()
});
}
makeFilter();
-});
-
-// 处理more相关及按钮
-$(document).ready(function() {
- /*
- $ele.eq(0).click(function()
- {
- $info.hide("slide",{direction:"left"},400);
- $ele.eq(0).clone().appendTo("div#info");
- $item.hide();
- $(".project").show("slide",{direction:"left"},400);
- $("#filter").show("slide",{direction:"left"},400);
- });
-
- $("#back a").click(function()
- {
- $info.show("slide",{direction:"left"},400);
- $("#info a").eq(1).remove();
- $item.show("slide",{direction:"left"},400);
-
- $(".project").hide(1000,"easeOutBounce");
- $("#filter").hide(1000,"easeOutBounce");
- });
- */
-})
+});
View
240 _/js/home.js.bak
@@ -0,0 +1,240 @@
+$(document).ready(function()
+ {
+ //$(".project").hide();
+ $("#filter").hide();
+ $("#stage").hide();
+ var $item = $(".item");
+ var $ele = $(".item a");
+ var $info = $("#info a");
+ var imageboxtype = $("#imagebox li.type").clone();
+ var imageboxtime = $("#imagebox li.time").clone();
+
+ var items = $('#stage li'),
+ itemsByTags = {};
+ // Looping though all the li items:
+
+ items.each(function(i){
+ var elem = $(this),
+ tags = elem.data('tags').split(',');
+ // Adding a data-id attribute. Required by the Quicksand plugin:
+ elem.attr('data-id',i);
+ $.each(tags,function(key,value){
+
+ // Removing extra whitespace:
+ value = $.trim(value);
+ if($.isNumeric(value)){
+ if(value <= 2002)
+ value = 2002;
+ else if(value <= 2004)
+ value = 2004;
+ else if(value <= 2006)
+ value = 2006;
+ else if(value <= 2009)
+ value =2009;
+ }
+ if(!(value in itemsByTags)){
+ // Create an empty array to hold this item:
+ itemsByTags[value] = [];
+ }
+ itemsByTags[value].push(elem);
+ });
+
+ });
+
+ var textbox = $('<div class="label">');
+ var col={}, //每个tag对应的列数
+ colStart={}, //每个tag的起始列数
+ tagList={
+ time: [],
+ type: []
+ };
+ function colcount(text,items) {
+ if(text !='Time' && text != 'Type'){
+ var c = items.length;
+ col[text] = Math.floor(c/5.5)+1;
+ if (parseInt(text) >1900) {
+ tagList.time.push(text);
+ } else {
+ tagList.type.push(text);
+ }
+ }
+ }
+ $.each(itemsByTags, colcount);
+ tagList.time.sort();
+ $.each(tagList, function(k, v) {
+ start=0;
+ for (var i=0, ii=v.length; i<ii; i++) {
+ colStart[v[i]]=start;
+ start+=col[v[i]];
+ }
+ });
+ // Looping though the arrays in itemsByTags:
+ $.each(itemsByTags,function(k,v){
+ createList(k,v);
+ });
+ textbox.appendTo('#imagebox');
+ function showTime(){
+ //$("#imagebox li.type").removeClass("vesibilityclass").addClass("unvesibilityclass");
+
+ //$("#imagebox li.time").removeClass("unvesibilityclass").addClass("vesibilityclass");
+
+ var preitems=$("#imagebox li.type").clone();
+ if(!$("#imagebox li").is(":animated")){
+ $("#imagebox li.type").each(function(){
+ var $ele=$(this);
+ $ele.animate({
+ left:$("#imagebox li.time").filter(function(){
+ return $ele.attr("data-id")==$(this).attr("data-id")
+ }).css('left'),
+ bottom:$("#imagebox li.time").filter(function(){
+ return $ele.attr("data-id")==$(this).attr("data-id")
+ }).css('bottom')
+ },400,function(){
+ $("#imagebox li.type").hide();
+ $("#imagebox li.time").show();
+ });
+ });
+
+ //$("#imagebox li.type").hide(0);
+ //$("#imagebox li.time").show();
+
+ $("#imagebox li.type").each(function(index){
+ var $ele=$(this);
+ $ele.animate({
+ left:preitems.eq(index).css('left'),
+ bottom:preitems.eq(index).css('bottom')},400);
+ });
+ //$("#imagebox li.time").removeClass("vesibilityclass").addClass("unvesibilityclass");
+
+ //$("#imagebox li.type").removeClass("unvesibilityclass").addClass("vesibilityclass");
+
+ $("#imagebox span.type").removeClass("vesibilityclass").addClass("unvesibilityclass");
+ $("#imagebox span.time").removeClass("unvesibilityclass").addClass("vesibilityclass");
+ }
+ return false;
+ };
+
+ function showType(){
+ var preitems=$("#imagebox li.time").clone();
+ if(!$("#imagebox li").is(":animated")){
+ $("#imagebox li.time").each(function(index){
+ var $ele=$(this);
+ $ele.animate({
+ left:$("#imagebox li.type").filter(function(){
+ return $ele.attr("data-id")==$(this).attr("data-id")
+ }).css('left')
+ ,bottom:$("#imagebox li.type").filter(function(){
+ return $ele.attr("data-id")==$(this).attr("data-id")
+ }).css('bottom')},400,function(){
+ $("#imagebox li.time").hide();
+ $("#imagebox li.type").show();
+ });
+ });
+ //$("#imagebox li.time").hide(0);
+ //$("#imagebox li.type").show(0);
+ $("#imagebox li.time").each(function(index){
+ var $ele=$(this);
+ $ele.animate({
+ left:preitems.eq(index).css('left'),
+ bottom:preitems.eq(index).css('bottom')},400);
+ });
+
+ //$("#imagebox li.time").removeClass("vesibilityclass").addClass("unvesibilityclass");
+
+ //$("#imagebox li.type").removeClass("unvesibilityclass").addClass("vesibilityclass");
+
+ $("#imagebox span.time").removeClass("vesibilityclass").addClass("unvesibilityclass");
+ $("#imagebox span.type").removeClass("unvesibilityclass").addClass("vesibilityclass");
+ }
+ return false;
+ };
+
+ function createList(text,items){
+
+ // This is a helper function that takes the
+ // text of a menu button and array of li items
+
+ if(text == 'Type'|| text == 'Time'){
+ return;
+ }
+ // Creating an empty unordered list:
+ var ul = $('<ul>');
+ var j,k; //k for the opacity
+ j= colStart[text];
+ if (parseInt(text) >1900) {
+ k=1;
+ } else {
+ k=0;
+ }
+ $.each(items,function(index,value){
+ // Creating a copy of each li item
+ // and adding it to the list:
+ var element = $(this);
+ // if(index>4){
+ element.css({'position':'absolute','bottom':12+(index%5)*72,'left':j*90+66*Math.floor(index/5),'height':'auto'});
+ //}
+ //else{
+ // element.css({'position':'absolute','bottom':12+index*72,'left':j*132,'height':'auto'});
+ //}
+ if(k==0){
+ //element.removeClass("vesibilityclass").addClass("unvesibilityclass");
+ element.hide();
+ element.removeClass("time").addClass("type");
+ }
+ else{
+ //element.removeClass("unvesibilityclass").addClass("vesibilityclass");
+ element.show();
+ element.removeClass("type").addClass("time");
+ }
+ element.clone().appendTo(ul);
+ });
+ ul.appendTo('#imagebox');
+ var tex = $('<span>',{
+ html:text
+ });
+ tex.css({'position':'absolute','bottom':'0px','left':j*90, width:Math.floor((items.length/5.1)+1)*66});
+ if(k==0){
+ tex.removeClass("vesibilityclass").addClass("unvesibilityclass");
+ tex.removeClass("time").addClass("type");
+ }
+ else{
+ tex.removeClass("unvesibilityclass").addClass("vesibilityclass");
+ tex.removeClass("type").addClass("time");
+ }
+ tex.appendTo(textbox);
+ }
+ function makeFilter() {
+ var tpl=$('#tpl-nav-li').html();
+ var $pageNav= $('#items li').not('.info, .more, .filter-item'),
+ $more= $('#items .more a'),
+ $filter= $(Mustache.to_html(tpl, {
+ name: "TIME"
+ , nameZh: "时间"
+ , href: "#"
+ , 'class': "filter-item"
+ }))
+ .add(Mustache.to_html(tpl, {
+ name: "TYPE"
+ , nameZh: "类型"
+ , href: "#"
+ , 'class': "filter-item"
+ }));
+ $filter.eq(0).click(showTime);
+ $filter.eq(1).click(showType);
+ $('#items').append($filter);
+ var isFilter= true;
+ $pageNav.hide();
+ $more.click(function() {
+ if (isFilter) {
+ $filter.hide();
+ $pageNav.show();
+ } else {
+ $pageNav.hide();
+ $filter.show();
+ }
+ isFilter= !isFilter;
+ return false;
+ });
+ }
+ makeFilter();
+});
View
49 _/js/jquery.localzoom.js
@@ -27,6 +27,7 @@
, speed: 200
, border: 0
, topMin: 120
+ , show: function() {}
};
if (settings) {
$.extend(opts, settings);
@@ -36,7 +37,7 @@
reset();
}
$el= $this.clone().css({
- position: "static"
+ position: "relative"
});
var sc= {
top: $this.offset().top
@@ -44,40 +45,48 @@
, width: $this.width()
, height: $this.height()
};
- $viewer.hide().empty().append($el).css($.extend(sc, {
+ $viewer.hide().empty().append($el).css({
"-moz-box-shadow": "0px 0px 12px black"
,"-webkit-box-shadow": "0px 0px 12px black"
- })).show();
+ ,'top': sc.top
+ ,'left': sc.left
+ }).show();
sc.top+=sc.height*(1-opts.ratio)/2,
sc.left+=sc.width*(1-opts.ratio)/2,
sc.width*=opts.ratio,
sc.height*=opts.ratio;
- $viewer.stop().animate(sc, opts.speed);
- $('img', $el).each(function(){
- var t= {
- width: Math.round( $(this).width()*opts.ratio)
- , height: Math.round( $(this).height()*opts.ratio )
- };
- if (t.width==0 || t.height==0) {
- //TODO
- t.width=sc.width*0.85;
- t.height=sc.height*0.85;
- }
- $(this).animate({
- width: t.width
- , height: t.height
+ $viewer.stop().animate({
+ top: sc.top
+ ,left: sc.left
+ }, opts.speed, opts.show);
+ $el.animate({
+ width:sc.width
+ , height: sc.height
+ }, opts.speed);
+ // handle img in el (only the first one)
+ var $img= $('img', $el).eq(0),
+ imgSc= {
+ width: $img.width()
+ , height: $img.height()
+ };
+ $('img', $viewer).eq(0).css(imgSc).stop()
+ .animate({
+ width: imgSc.width*opts.ratio
+ , height: imgSc.height*opts.ratio
}, opts.speed);
- });
};
$.localzoom= function(selector, settings) {
+ var opts= $.extend({
+ delay: 200
+ }, settings);
var tmr;
$('body').delegate(selector, 'mouseenter', function() {
clearTimeout(tmr); tmr= null;
var el= this;
tmr =setTimeout(function() {
- $(el).localzoom(settings);
- }, settings.delay ||200);
+ $(el).localzoom(opts);
+ }, opts.delay);
}).delegate(selector, 'mouseleave', function() {
clearTimeout(tmr);
})
View
8 archive.php
@@ -1 +1,7 @@
-<?php include (TEMPLATEPATH . '/single.php' ); ?>
+<?php
+ if (in_category('blog')) {
+ include (TEMPLATEPATH . '/single.php' );
+ } else {
+ include (TEMPLATEPATH . '/category.php');
+ }
+?>
View
2  category-blog.php
@@ -1 +1 @@
-<?php include (TEMPLATEPATH . '/single.php' ); ?>
+<?php include (TEMPLATEPATH . '/page.php' ); ?>
View
28 category.php
@@ -1,10 +1,6 @@
<?php
$name= get_query_var('category_name');
- if ($name==="blog") {
- get_header();
- } else {
- get_header('public');
- }
+ get_header('public');
?>
<div class="content page-wrap grid-m0 clearfix">
<div class="col-main">
@@ -13,15 +9,15 @@
if (have_posts()) :
while (have_posts()) : the_post();
$content= get_the_content();
- if ($name==="book") {
+ if ($name==="book" || $name==="postgraduate") {
// 著作, 提取img作为封面
$RE_SRC= '/<img[^>]*src="?([^ ">]*)"?[ >]/i';
preg_match($RE_SRC, $content, $t);
//$content= str_replace($t[0], "", $content);
}
$link= null;
- if (has_post_format('link') || $name==="paper") {
- // 论文, 提取a作为链接
+ if (has_post_format('link') || $name==="paper" || stristr($name, 'undergraduate')) {
+ // 论文, 直接提取a作为链接
$RE_DOWN= '/<a[^>]*href="([^ ">]*)"[ >][^<]*<\/a>/i';
preg_match($RE_DOWN, $content, $link);
$content= str_replace($link[0], "", $content);
@@ -36,11 +32,19 @@
<article <?php post_class("clearfix") ?>>
<?php if ($name==="book") { ?>
<div class="cover">
- <img src="<?php echo $t?$t[1]:'' ?>" alt="" />
+ <img src="<?php echo $t?$t[1]:'' ?>" width="100" alt="" />
</div>
<?php } ?>
<header>
- <h2 class="entry-title" id="post-<?php the_ID(); ?>"><a href="<?php echo $link ?>"><?php the_title();?></a></h2>
+ <h2 class="entry-title" id="post-<?php the_ID(); ?>"><a href="<?php echo $link ?>">
+ <?php if ($name==="postgraduate") { ?>
+ <div class="photo">
+ <img src="<?php echo $t?$t[1]:'' ?>" width="100" alt="" />
+ </div>
+ <?php $content= "";
+ } ?>
+ <?php the_title();?>
+ </a></h2>
<div class="meta">
<?php edit_post_link(__("编辑", 'tbdata'), '<span class="edit-link">', '</span>') ?>
</div>
@@ -57,9 +61,5 @@
</div>
</div>
<?php
- if ($name==="blog") {
- get_footer();
- } else {
get_footer('public');
- }
?>
View
10 footer-public.php
@@ -33,12 +33,12 @@
</a>
</li>
<li class="undergraduate item page_item entry-title <?php if ($name=="work") {echo "active";} ?>">
- <a href="<?php echo bloginfo('url') ?>/work">本科生作品<br/>
+ <a href="<?php echo bloginfo('url') ?>/archives/category/undergraduate">本科生作品<br/>
<span class="name">UNDERGRADUATE<br/>STUDENTS' WORKS</span>
</a>
</li>
<li class="postgraduate item page_item entry-title <?php if ($name=="postgraduate") {echo "active";} ?>">
- <a href="#">研究生作品<br/>
+ <a href="<?php echo bloginfo('url') ?>/archives/category/postgraduate">研究生作品<br/>
<span class="name">POSTGRADUATE<br/>STUDENTS' THESIS</span>
</a>
</li>
@@ -58,6 +58,12 @@
<span class="name">MORE</span>
</a>
</li>
+ <?php } else if (is_single()) { ?>
+ <li id="back" class="more page_item entry-title">
+ <a href="javascript:history.back();">返回<br/>
+ <span class="name">BACK</span>
+ </a>
+ </li>
<?php } else { ?>
<li id="back" class="back page_item entry-title">
<a href="<?php bloginfo('url') ?>">返回首页<br/>
View
52 header.php
@@ -21,42 +21,42 @@
<title>
<?php
- if (function_exists('is_tag') && is_tag()) {
- single_tag_title("Tag Archive for &quot;"); echo '&quot; - '; }
- elseif (is_archive()) {
- wp_title(''); echo ' Archive - '; }
- elseif (is_search()) {
- echo 'Search for &quot;'.wp_specialchars($s).'&quot; - '; }
- elseif (!(is_404()) && (is_single()) || (is_page())) {
- wp_title(''); echo ' - '; }
- elseif (is_404()) {
- echo 'Not Found - '; }
- if (is_home()) {
- bloginfo('name'); echo ' - '; bloginfo('description'); }
+ if (is_home() || is_front_page()) {
+ bloginfo('name'); echo ' - '; bloginfo('description'); }
else {
+ if (function_exists('is_tag') && is_tag()) {
+ single_tag_title("Tag Archive for &quot;"); echo '&quot; - '; }
+ elseif (is_archive()) {
+ wp_title(''); echo ' Archive - '; }
+ elseif (is_search()) {
+ echo 'Search for &quot;'.wp_specialchars($s).'&quot; - '; }
+ elseif (!(is_404()) && (is_single()) || (is_page())) {
+ wp_title(); echo ' - '; }
+ elseif (is_404()) {
+ echo 'Not Found - '; }
bloginfo('name'); }
if ($paged>1) {
- echo ' - page '. $paged; }
+ echo ' - page '. $paged; }
?>
</title>
<meta name="title" content="<?php
- if (function_exists('is_tag') && is_tag()) {
- single_tag_title("Tag Archive for &quot;"); echo '&quot; - '; }
- elseif (is_archive()) {
- wp_title(''); echo ' Archive - '; }
- elseif (is_search()) {
- echo 'Search for &quot;'.wp_specialchars($s).'&quot; - '; }
- elseif (!(is_404()) && (is_single()) || (is_page())) {
- wp_title(''); echo ' - '; }
- elseif (is_404()) {
- echo 'Not Found - '; }
- if (is_home()) {
- bloginfo('name'); echo ' - '; bloginfo('description'); }
+ if (is_home() || is_front_page()) {
+ bloginfo('name'); echo ' - '; bloginfo('description'); }
else {
+ if (function_exists('is_tag') && is_tag()) {
+ single_tag_title("Tag Archive for &quot;"); echo '&quot; - '; }
+ elseif (is_archive()) {
+ wp_title(''); echo ' Archive - '; }
+ elseif (is_search()) {
+ echo 'Search for &quot;'.wp_specialchars($s).'&quot; - '; }
+ elseif (!(is_404()) && (is_single()) || (is_page())) {
+ wp_title(); echo ' - '; }
+ elseif (is_404()) {
+ echo 'Not Found - '; }
bloginfo('name'); }
if ($paged>1) {
- echo ' - page '. $paged; }
+ echo ' - page '. $paged; }
?>">
<meta name="description" content="<?php bloginfo('description'); ?>">
View
2  home.php
@@ -26,9 +26,11 @@
<script type="text/javascript">
var $= window.jQuery;
$(document).ready(function() {
+
$.localzoom('#imagebox .ngg-thumbnail', {
ratio: 2.0
});
+ //*/
makeGallery({
jsonUrl: "<?php echo bloginfo('url') ?>/"
});
View
12 nggallery.css
@@ -16,14 +16,14 @@ it's only a template design
margin: 10px auto 0 auto;
width: 700px;
clear:both;
- display:block !important;
}
.ngg-album {
- margin-bottom: 5px;
- border: 1px solid #fff;
+ margin-bottom: 5px;
+ border: 1px solid #fff;
overflow: hidden;
margin-bottom: 15px;
+ width: 60px;
}
.ngg-albumtitle {
@@ -37,6 +37,8 @@ it's only a template design
.ngg-thumbnail {
max-width:180px;
+ border:1px solid #A9A9A9;
+ padding:4px;
}
.ngg-row .ngg-thumbnail {
float:right;
@@ -48,9 +50,6 @@ it's only a template design
.ngg-thumbnail img {
background-color:#FFFFFF;
- border:1px solid #A9A9A9;
- margin:4px 0px 4px 5px;
- padding:4px;
position:relative;
}
@@ -110,7 +109,6 @@ it's only a template design
margin-top: 10px;
width: 100%;
clear:both;
- display:block !important;
}
.ngg-galleryoverview .desc {
View
4 nggallery/album-home.php
@@ -20,8 +20,8 @@
<?php foreach ($galleries as $gallery) : ?>
<li class="clearfix ngg-album" data-tags="Time,Type, <?php echo $gallery->galdesc; ?>">
<div class="ngg-thumbnail" >
- <a href="<?php echo $gallery->pagelink; ?>" class="shutterset_<?php echo $gallery->name ?>' }) ngg-link" >
- <img src="<?php echo $gallery->previewurl ?>" alt="<?php echo $gallery->title ?>" />
+ <a href="<?php echo $gallery->pagelink; ?>" class="shutterset_<?php echo $gallery->name ?>' }) ngg-link" title="<?php echo $gallery->title ?>">
+ <img src="<?php echo $gallery->previewurl ?>" alt="<?php echo $gallery->title ?>" width="50" height="50"/>
</a>
</div>
</li>
View
7 page-cated.php
@@ -1,7 +0,0 @@
-<?php
-/*
-Template Name: Blog
-Destription: 左侧显示父级树状图
-*/
-?>
-<?php include(TEMPLATEPATH.'/single.php') ?>
View
63 page.php
@@ -1,24 +1,39 @@
-
-<?php get_header('public'); ?>
-
- <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
-
- <article class="post" id="post-<?php the_ID(); ?>">
-
- <div class="entry">
-
- <?php the_content(); ?>
-
- <?php wp_link_pages(array('before' => 'Pages: ', 'next_or_number' => 'number')); ?>
-
- </div>
-
- <?php edit_post_link('编辑', '<p>', '</p>'); ?>
-
- </article>
-
- <?php //comments_template(); ?>
-
- <?php endwhile; endif; ?>
-
-<?php get_footer(); ?>
+<?php
+/*
+Template Name: Blog
+Destription: 左侧显示父级树状图
+*/
+?>
+<?php get_header(); ?>
+
+<div class="page-wrap content grid-s4m0 clearfix">
+ <div class="col-main">
+ <div class="main-wrap post">
+<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
+ <article <?php post_class("clearfix") ?>>
+ <header>
+ <?php if (is_single()) { ?>
+ <h1 class="entry-title" id="post-<?php the_ID(); ?>"><?php the_title();?></h1>
+ <?php } else { ?>
+ <h2 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title();?></a></h2>
+ <?php } ?>
+ <div class="meta"><?php include (TEMPLATEPATH . '/_/inc/meta.php' ); ?></div>
+ </header>
+ <div class="entry">
+ <?php
+ //add_filter('the_content', 'wpautop'); //the_content()会自动将空换行替换为<p>, get_the_content()则不会
+ the_content();
+ ?>
+ </div>
+ </article>
+ <?php endwhile;
+ include (TEMPLATEPATH. '/_/inc/nav.php');
+ ?>
+<?php endif; ?>
+ </div>
+ </div>
+ <div class="col-sub">
+ <?php get_sidebar(); ?>
+ </div>
+</div>
+<?php get_footer(); ?>
View
42 single.php
@@ -1,33 +1,9 @@
-<?php get_header(); ?>
-
-<div class="page-wrap content grid-s4m0 clearfix">
- <div class="col-main">
- <div class="main-wrap post">
-<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
- <article <?php post_class("clearfix") ?>>
- <header>
- <?php if (is_single()) { ?>
- <h1 class="entry-title" id="post-<?php the_ID(); ?>"><?php the_title();?></h1>
- <?php } else { ?>
- <h2 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title();?></a></h2>
- <?php } ?>
- <div class="meta"><?php include (TEMPLATEPATH . '/_/inc/meta.php' ); ?></div>
- </header>
- <div class="entry">
- <?php
- //add_filter('the_content', 'wpautop'); //the_content()会自动将空换行替换为<p>, get_the_content()则不会
- the_content();
- ?>
- </div>
- </article>
- <?php endwhile;
- include (TEMPLATEPATH. '/_/inc/nav.php');
- ?>
-<?php endif; ?>
- </div>
- </div>
- <div class="col-sub">
- <?php get_sidebar(); ?>
- </div>
-</div>
-<?php get_footer(); ?>
+<?php if (have_posts()) {
+ $post = $wp_query->post;
+ if (in_category('blog')) {
+ include (TEMPLATEPATH . '/page.php' );
+ } else {
+ include (TEMPLATEPATH . '/category.php');
+ }
+}
+?>
View
4 style.css
@@ -124,11 +124,11 @@ a img {
.vesibilityclass{
- opacity:1;
+ display:block;
}
.unvesibilityclass{
- opacity:0;
+ display:none;
}
#imagebox li{
Please sign in to comment.
Something went wrong with that request. Please try again.