Commits

shiningray  committed 06d8567

split lib2nd.js
allow anonymous vote and anonymous reply

Signed-off-by: shiningray <shiningray.nirvana@gmail.com>

  • Participants
  • Parent commits 42475c0

Comments (0)

Files changed (16)

File javascripts/ajaxlogin.js

+/* after logged in, the document will receive 'after_logged_in' event */
+function showLogin(){	
+  if($.browser.msie){
+    document.styleSheets[0].addRule('.login', 'display:block !important');
+  }else{
+    document.styleSheets[0].insertRule('.login{display:block !important;}',0);
+  }
+  showLogout('none');
+  $(document).trigger('login_loaded');
+}
+
+function showSuggest(){
+  if($.browser.msie){
+    document.styleSheets[0].addRule('.suggest-form', 'display:inline !important');
+  }else{
+    document.styleSheets[0].insertRule('.suggest-form{display:inline !important;}',0);
+  }
+}
+
+function showLogout(type){
+  type = type || 'inherited';
+  if($.browser.msie){
+    document.styleSheets[0].addRule('.logout', 'display:'+type+' !important');
+  }else{
+    document.styleSheets[0].insertRule('.logout {display:'+type+' !important;}',0);
+  }
+}
+
+function loadLoginCookie(){
+  var user = $.readCookie('user');
+  if(user){
+    try{
+      //user = '{"unread_messages_count": 0, "user": {"login": "'+_Base64.decode(user)+'"}}';
+      user = eval('('+user+')');
+      loadLogin(user);
+      return user;
+    }catch(e){
+      alert(e);
+    }
+  }
+  if($.readCookie('auth_token') || $.readCookie('_session_id'))
+    return $.getJSON('/session.js?'+(new Date().getTime()), loadLogin);
+  else
+    return '{}'
+}
+
+function loadLogin(data){
+  if(data){
+    currentUser = data;
+    $('.username').text(currentUser.login);
+    //$('.login').toggleClass( "hidden" );
+    showLogout('none');
+    if(data.unread_messages_count > 0){
+      $('#unread_messages_count').text(data.unread_messages_count);
+      document.title = '您收到'+data.unread_messages_count+'个小纸条 | '+document.title;
+      $('#unread_messages_count').css('display','');
+    }
+    else{
+      $('#unread_messages_count').hide();
+    }
+    if(data.unread_notifications_count && data.unread_notifications_count > 0){
+      $('#unread_notifications_count').text(data.unread_notifications_count);
+    }
+    showLogin();
+    VoteHistory.updateArticleStates();
+    queryNewMessage();
+  } else {
+    currentUser=null;
+    showLogout();
+  }
+}
+$(loadLoginCookie);
+
+function showLoginForm(){
+  $('#login-form').lightbox_me({
+    centered: true,
+    onLoad: function() {
+      $('#login').focus()
+    }
+  });
+}

File javascripts/base64.js

+var _Base64 = {
+
+	// private property
+_keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
+
+	 // private method for UTF-8 encoding
+_utf8_encode : function (string) {
+		       string = string.replace(/\r\n/g,"\n");
+		       var utftext = "";
+
+		       for (var n = 0; n < string.length; n++) {
+
+			       var c = string.charCodeAt(n);
+
+			       if (c < 128) {
+				       utftext += String.fromCharCode(c);
+			       }
+			       else if((c > 127) && (c < 2048)) {
+				       utftext += String.fromCharCode((c >> 6) | 192);
+				       utftext += String.fromCharCode((c & 63) | 128);
+			       }
+			       else {
+				       utftext += String.fromCharCode((c >> 12) | 224);
+				       utftext += String.fromCharCode(((c >> 6) & 63) | 128);
+				       utftext += String.fromCharCode((c & 63) | 128);
+			       }
+
+		       }
+
+		       return utftext;
+	       },
+        // private method for UTF-8 decoding
+        _utf8_decode : function (utftext) {
+                var string = [];
+        var i = 0, l = utftext.length;
+                var c = 0, c1 = 0, c2 = 0, c3 = 0;
+                while(i < l) {
+                        c = utftext.charCodeAt(i);
+                        if (c < 128) {
+                                string.push(String.fromCharCode(c));
+                                i++;
+                        }else if((c > 191) && (c < 224)) {
+                                c2 = utftext.charCodeAt(i+1);
+                                string.push(String.fromCharCode(((c & 31) << 6) | (c2 & 63)));
+                                i += 2;
+                        }else{
+                                c2 = utftext.charCodeAt(i+1);
+                                c3 = utftext.charCodeAt(i+2);
+                                string.push(String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)));
+                                i += 3;
+                        }
+
+                }
+
+                return string.join('');
+        },
+	  // public method for encoding
+	  encode : function (input) {
+		  var output = "";
+		  var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
+		  var i = 0;
+
+		  input = _Base64._utf8_encode(input);
+
+		  while (i < input.length) {
+
+			  chr1 = input.charCodeAt(i++);
+			  chr2 = input.charCodeAt(i++);
+			  chr3 = input.charCodeAt(i++);
+
+			  enc1 = chr1 >> 2;
+			  enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
+			  enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
+			  enc4 = chr3 & 63;
+
+			  if (isNaN(chr2)) {
+				  enc3 = enc4 = 64;
+			  } else if (isNaN(chr3)) {
+				  enc4 = 64;
+			  }
+
+			  output = output +
+				  this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +
+				  this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);
+
+		  }
+
+		  return output;
+	  },
+	  // public method for decoding
+        decode : function (input) {
+                var output = [];
+                var chr1, chr2, chr3;
+                var enc1, enc2, enc3, enc4;
+                var i = 0;
+
+                input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
+        var l = input.length;
+                while (i < l) {
+                        enc1 = this._keyStr.indexOf(input.charAt(i++));
+                        enc2 = this._keyStr.indexOf(input.charAt(i++));
+                        enc3 = this._keyStr.indexOf(input.charAt(i++));
+                        enc4 = this._keyStr.indexOf(input.charAt(i++));
+
+                        chr1 = (enc1 << 2) | (enc2 >> 4);
+                        chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
+                        chr3 = ((enc3 & 3) << 6) | enc4;
+
+                        output.push(String.fromCharCode(chr1));
+
+                        if (enc3 != 64) {
+                                output.push(String.fromCharCode(chr2));
+                        }
+                        if (enc4 != 64) {
+                                output.push(String.fromCharCode(chr3));
+                        }
+                }
+
+                return this._utf8_decode(output.join(''));
+
+        }
+}

File javascripts/comment.js

-
 function article_comments_path(id){
   return '/articles/'+id+'/comments';
 }
   id=id[0];
   var comments_el = $('#qiushi_comments_'+id);
   if(comments_el.size() == 0){
-      var xx = l.html();
-      l.text('...');
-      $.get(article_comments_path(id), null, function(data){
-
-        $('#qiushi_counts_'+id).after(data).toggleClass('qiushi_counts_afterclick');
-    $("#l"+id).height( $('#r'+id).height() ) ;
-          comments_el.show();
-          l.html(xx).trigger('loaded');
-          // l.html(xx);
-          if(typeof decrypt == 'function'){l.ready(decrypt)}
-          l.ready(floorLink);
-      });
+    var xx = l.html();
+    l.text('...');
+    $.get(article_comments_path(id), null, function(data){
+      $('#qiushi_counts_'+id).after(data).toggleClass('qiushi_counts_afterclick');
+      $("#l"+id).height( $('#r'+id).height() ) ;
+      comments_el.show();
+      l.html(xx).trigger('loaded');
+      // l.html(xx);
+      if(typeof decrypt == 'function'){
+        l.ready(decrypt)
+      }
+      if(currentUser){
+        l.ready(function(){
+          $('.comments .current_user-name').text(currentUser.login);
+        })        
+      }
+      l.ready(floorLink);
+    });
   }else{
-      comments_el.toggle();
-  $('#qiushi_counts_'+id).toggleClass('qiushi_counts_afterclick');
+    comments_el.toggle();
+    $('#qiushi_counts_'+id).toggleClass('qiushi_counts_afterclick');
   }
-//  window.location.hash = l.attr('id');
+  //  window.location.hash = l.attr('id');
   l.blur();
   e.preventDefault();
 }
   $('#qiushi_comments_'+id).toggle() ;
   window.location.hash = '#qiushi_counts_'+id;
 }
+
+$(document).keypress(function(e){
+  if(e.ctrlKey && e.which == 13 || e.which == 10) {
+    var o=e.target;
+    if(o.form){
+      var f=$(o.form).find('input.comment_submit');
+      postComment.call(f[0]);
+    }
+  }
+});
+
+$(function(){
+  $(document).bind("login_loaded", function(){
+    $('.comments .current_user-name').text(currentUser.login);
+  });
+})

File javascripts/cookie.js

+(function($){$.setCookie=function(name,value,options){if(typeof name==='undefined'||typeof value==='undefined')
+return false;var str=name+'='+encodeURIComponent(value);if(options.domain)str+='; domain='+options.domain;if(options.path)str+='; path='+options.path;if(options.duration){var date=new Date();date.setTime(date.getTime()+options.duration*24*60*60*1000);str+='; expires='+date.toGMTString();}
+if(options.secure)str+='; secure';return document.cookie=str;};$.delCookie=function(name){return $.setCookie(name,'',{duration:-1});};$.readCookie=function(name){var value=document.cookie.match('(?:^|;)\\s*'+name.replace(/([-.*+?^${}()|[\]\/\\])/g,'\\$1')+'=([^;]*)');return(value)?decodeURIComponent(value[1]):null;};$.CooQueryVersion='v 2.0';})(jQuery);

File javascripts/cursor.js

+new function($) {
+  $.fn.setCursorPosition = function(pos) {
+    if ($(this).get(0).setSelectionRange) {
+      $(this).get(0).setSelectionRange(pos, pos);
+    } else if ($(this).get(0).createTextRange) {
+      var range = $(this).get(0).createTextRange();
+      range.collapse(true);
+      range.moveEnd('character', pos);
+      range.moveStart('character', pos);
+      range.select();
+    }
+  }
+}(jQuery);

File javascripts/floorlink.js

+
+//floorlink support
+function gotofloor(id,fl){
+  var comment=$('#comment-'+id),f=comment.siblings('.floor-'+fl);
+  if(f.size() > 0){
+    $.scrollTo(f, 1000)
+  }
+}
+
+var createFloorLink=function (id, fi){
+  $('#fl-'+id+'-'+fi).click(function(e){
+    var a = $(this).attr('id').split('-');
+    gotofloor(parseInt(a[1]),parseInt(a[2]));
+    e.preventDefault();
+  }).poshytip({
+    className: 'tip-twitter',
+    alignX: 'center',
+    showTimeout: 1,
+    allowTipHover: false,
+    fade: false,
+    slide: false,
+    //	hideTimeout: 50000,
+    content: function(){
+      var htmlc = $('#comment-'+id).parents('div').contents('.floor-'+fi).html() ;
+      return htmlc;
+    }
+  })
+}
+
+function floorLink(){
+  $('.comment-block').each(function(i,e){
+    e = $(e);
+    lz = $(this.parentNode.parentNode.parentNode).find('.author>a');
+    lx = e.find(".userlogin>a")
+    if (lz.length>0 && lx.length>0)
+      if(lx[0].href==lz[0].href){
+        e.find(".userlogin").attr('class','userlogin hostname')
+      }
+      
+    var b = e.find('.body');
+    var content = b.html();
+    var id = parseInt(e.attr('id').replace('comment-',''));
+    content=content.replace(/(\d+)(f|F|L|l|楼)/g, function(o,i){
+      if($.browser.msie){
+        setTimeout("createFloorLink("+id+", "+i+")", 200);
+      }else{
+        setTimeout(createFloorLink, 200, id, i);
+      }
+      return "<a href='#comment-"+id+"' id='fl-"+id+"-"+i+"'>"+o+"</a>";
+    });
+
+    b.html(content);
+  });
+}

File javascripts/lib2nd.js

 
 var l = window.location.href;
 var currentUser;
-var VoteHistory = {
-	_Historys : null,
-	_IsValid  : null,
-	// set/get state for article
-	// return 1,0,-1 for state up, normal, down
-	voteState : function (article_id,state){
-	
-		if (!this.isValid()) return 0;
-		if(state == null){
-			return this._Historys[article_id];
-		}else{
-			this._Historys[article_id] = state;	//TODO: state 0(currently not available)
-			this.saveHistory();
-		}
-	},
-
-	isValid : function(){
-		if(this._IsValid == null)
-			this._IsValid = window.localStorage ? true : false;
-		return this._IsValid;
-	},
-
-	// only read once
-	readHistory : function(){
-		this._Historys = window.localStorage.getItem('vote_history')
-		this._Historys = JSON.parse(this._Historys)
-		if(this._Historys == null) this._Historys ={}
-	},
-
-	saveHistory : function(){
-		if ( this._Historys == null) return
-		var maxItems = 500;
-		var getKeys = function(obj){
-		   var keys = [];
-		   for(var key in obj){
-		      keys.push(key);
-		   }
-		   return keys;
-		}
-		var keys = getKeys(this._Historys);
-		if(keys.length > maxItems){
-			var removes = keys.length - maxItems;
-			for(i =0;i<removes;i++)
-				delete this._Historys[keys[i]];
-		}
-		var data = JSON.stringify(this._Historys);
-		window.localStorage.setItem('vote_history',data);
-	},
-
-	_init : function(){
-		if(this.isValid() ) this.readHistory();
-	},
-
-	updateArticleStates : function(){
-		if(! this.isValid() ) return;
-		articles = [];
-		$.each($('div[id^=qiushi_counts_]'),function(){articles.push(+this.id.replace('qiushi_counts_',''))});
-		$.each(articles, function(i){
-			var id = articles[i];
-			var v = VoteHistory.voteState(id);
-			if (v != undefined ){
-				  var posscore = parseInt($('#up-'+id).text()),
-			          negscore = parseInt($('#dn-'+id).text()),
-			          d = (v>0?'up':'dn');
-			      v>0 ? posscore++ : negscore--;
-			      hidevotelink(id, d, posscore, negscore);
-			}
-
-		});
-	}
-};
-
-VoteHistory._init();
 //$(document).ready(function(){ VoteHistory._init(); VoteHistory.updateArticleStates();});
 
 // application.js
-(function($){$.setCookie=function(name,value,options){if(typeof name==='undefined'||typeof value==='undefined')
-return false;var str=name+'='+encodeURIComponent(value);if(options.domain)str+='; domain='+options.domain;if(options.path)str+='; path='+options.path;if(options.duration){var date=new Date();date.setTime(date.getTime()+options.duration*24*60*60*1000);str+='; expires='+date.toGMTString();}
-if(options.secure)str+='; secure';return document.cookie=str;};$.delCookie=function(name){return $.setCookie(name,'',{duration:-1});};$.readCookie=function(name){var value=document.cookie.match('(?:^|;)\\s*'+name.replace(/([-.*+?^${}()|[\]\/\\])/g,'\\$1')+'=([^;]*)');return(value)?decodeURIComponent(value[1]):null;};$.CooQueryVersion='v 2.0';})(jQuery);
 function shareToSina(id){
   var s=screen,d=document,e=encodeURIComponent,a=$('#article'+id),u=$('.permlink', '#qiushi_counts_'+id).attr('href');
   var f='http://v.t.sina.com.cn/share/share.php?',p=['url=',e(u),'&title=',e('糗事'+id),'&appkey=2924220432'].join('');
   };
   if(/Firefox/.test(navigator.userAgent)){setTimeout(a,0)}else{a()}
 }
-new function($) {
-  $.fn.setCursorPosition = function(pos) {
-    if ($(this).get(0).setSelectionRange) {
-      $(this).get(0).setSelectionRange(pos, pos);
-    } else if ($(this).get(0).createTextRange) {
-      var range = $(this).get(0).createTextRange();
-      range.collapse(true);
-      range.moveEnd('character', pos);
-      range.moveStart('character', pos);
-      range.select();
-    }
-  }
-}(jQuery);
-
 
 function showAnimation(containerId, actionValue){
     var obj = $('#'+containerId),
     return arrayPageScroll;
 }
 
-var _Base64 = {
-
-	// private property
-_keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
-
-	 // private method for UTF-8 encoding
-_utf8_encode : function (string) {
-		       string = string.replace(/\r\n/g,"\n");
-		       var utftext = "";
-
-		       for (var n = 0; n < string.length; n++) {
-
-			       var c = string.charCodeAt(n);
-
-			       if (c < 128) {
-				       utftext += String.fromCharCode(c);
-			       }
-			       else if((c > 127) && (c < 2048)) {
-				       utftext += String.fromCharCode((c >> 6) | 192);
-				       utftext += String.fromCharCode((c & 63) | 128);
-			       }
-			       else {
-				       utftext += String.fromCharCode((c >> 12) | 224);
-				       utftext += String.fromCharCode(((c >> 6) & 63) | 128);
-				       utftext += String.fromCharCode((c & 63) | 128);
-			       }
-
-		       }
-
-		       return utftext;
-	       },
-        // private method for UTF-8 decoding
-        _utf8_decode : function (utftext) {
-                var string = [];
-        var i = 0, l = utftext.length;
-                var c = 0, c1 = 0, c2 = 0, c3 = 0;
-                while(i < l) {
-                        c = utftext.charCodeAt(i);
-                        if (c < 128) {
-                                string.push(String.fromCharCode(c));
-                                i++;
-                        }else if((c > 191) && (c < 224)) {
-                                c2 = utftext.charCodeAt(i+1);
-                                string.push(String.fromCharCode(((c & 31) << 6) | (c2 & 63)));
-                                i += 2;
-                        }else{
-                                c2 = utftext.charCodeAt(i+1);
-                                c3 = utftext.charCodeAt(i+2);
-                                string.push(String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)));
-                                i += 3;
-                        }
-
-                }
-
-                return string.join('');
-        },
-	  // public method for encoding
-	  encode : function (input) {
-		  var output = "";
-		  var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
-		  var i = 0;
-
-		  input = _Base64._utf8_encode(input);
-
-		  while (i < input.length) {
-
-			  chr1 = input.charCodeAt(i++);
-			  chr2 = input.charCodeAt(i++);
-			  chr3 = input.charCodeAt(i++);
-
-			  enc1 = chr1 >> 2;
-			  enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
-			  enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
-			  enc4 = chr3 & 63;
-
-			  if (isNaN(chr2)) {
-				  enc3 = enc4 = 64;
-			  } else if (isNaN(chr3)) {
-				  enc4 = 64;
-			  }
-
-			  output = output +
-				  this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +
-				  this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);
-
-		  }
-
-		  return output;
-	  },
-	  // public method for decoding
-        decode : function (input) {
-                var output = [];
-                var chr1, chr2, chr3;
-                var enc1, enc2, enc3, enc4;
-                var i = 0;
-
-                input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
-        var l = input.length;
-                while (i < l) {
-                        enc1 = this._keyStr.indexOf(input.charAt(i++));
-                        enc2 = this._keyStr.indexOf(input.charAt(i++));
-                        enc3 = this._keyStr.indexOf(input.charAt(i++));
-                        enc4 = this._keyStr.indexOf(input.charAt(i++));
-
-                        chr1 = (enc1 << 2) | (enc2 >> 4);
-                        chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
-                        chr3 = ((enc3 & 3) << 6) | enc4;
-
-                        output.push(String.fromCharCode(chr1));
-
-                        if (enc3 != 64) {
-                                output.push(String.fromCharCode(chr2));
-                        }
-                        if (enc4 != 64) {
-                                output.push(String.fromCharCode(chr3));
-                        }
-                }
-
-                return this._utf8_decode(output.join(''));
-
-        }
-}
 
 /**
  *  速度标记
 }
 
 
-function hidevotelink(id, d, p, n){
-    var posscore,negscore;
-    if(typeof p === 'undefined'){
-        posscore = parseInt($('#up-'+id).text());
-    }else{
-        posscore = p;
-    }
-    if(typeof n === 'undefined'){
-        negscore = parseInt($('#dn-'+id).text());
-    }else{
-        negscore = n;
-    }
-
-	$('#up-'+id).html(posscore) ;
-	$('#dn-'+id).html(negscore) ;
-	if( d == 'up')
-		$('#vote-up-'+id).find('a').addClass('voted');
-	else
-		$('#vote-dn-'+id).find('a').addClass('voted');
-	$('#vote-up-'+id).find('a').addClass('disable');
-	$('#vote-dn-'+id).find('a').addClass('disable');
-}
-
-var voteQueue=[];
-function vote2(id, v){
-    if($('#up-'+id).hasClass('disable') || $('#dn-'+id).hasClass('disable') )  return;
-    if(currentUser){
-      var posscore = parseInt($('#up-'+id).text()),
-          negscore = parseInt($('#dn-'+id).text()),
-          d = (v>0?'up':'dn');
-      showAnimation('vote-'+d+'-'+id, v);
-      $.getJSON('/articles/' + id + '/' + d);
-      v>0 ? posscore++ : negscore--;
-      hidevotelink(id, d,posscore, negscore);
-      VoteHistory.voteState(id,v);
-    }else{
-      //voteQueue.push(v>0?id:-id);
-      showLoginForm();
-      $(document).bind('after_logged_in', function(){
-        vote2(id, v);
-      })
-    }
-}
-
-
-function getCurUsr( data )
-{
-
-  if(data && data.user)
-    currentUser=data.user;
-  else
-	currentUser = null;
-  vote2m( curId, curV );
-}
-function mkvotestr( aid, uid , v )
-{
-	return v>0?_Base64.encode(aid+'+'+uid) : _Base64.encode(aid+'-'+uid);
-}
-
-var	curId;
-var	curV;
-function vote2m(id, v){
-     	if( !currentUser )
-    	{
-		if( $.readCookie('auth_token') )
-		{
-			curId = id;
-			curV = v;
-			$.getJSON('/session.js?'+(new Date().getTime()), getCurUsr);
-		}
-		else
-			window.location.href = '/login';
-	}
-      else{
-	var posscore = parseInt($('#pos-score-'+id).text()),
-       negscore = parseInt($('#neg-score-'+id).text()),
-          d = (v>0?'up':'dn');
-      showAnimation(d+'-'+id, v);
-    //  $.get('/articles/'+id+'/'+d);
-      v>0 ? posscore++ : negscore--;
-      hidevotelink(id, posscore, negscore);
-	$.get( '/new3/vote/='+mkvotestr(id,currentUser.id,v) ) ;
-	}
-
-      //voteQueue.push(v>0?id:-id);
-}
 
 var COMMENT_WARNING=    '请不要发表与本内容无关的评论,您有了账号就是有身份的人了,我们可认识您。';
 function clear_warning(e){
     }
 });
 
-$(document).keypress(function(e){
-  if(e.ctrlKey && e.which == 13 || e.which == 10) {
-    var o=e.target;
-    if(o.form){
-        var f=$(o.form).find('input.comment_submit');
-        postComment.call(f[0]);
-    }
-  }
-});
 
 
 function loadScores(){
   t.setCursorPosition(nv.length);
 }
 
-//floorlink support
-function gotofloor(id,fl){
-  var comment=$('#comment-'+id),f=comment.siblings('.floor-'+fl);
-  if(f.size() > 0){ $.scrollTo(f, 1000) }
-}
-
-var createFloorLink=function (id, fi){
- $('#fl-'+id+'-'+fi).click(function(e){
-   var a = $(this).attr('id').split('-');
-   gotofloor(parseInt(a[1]),parseInt(a[2]));
-   e.preventDefault();
- }).poshytip({
-   className: 'tip-twitter',
- 	alignX: 'center',
-	showTimeout: 1,
-	allowTipHover: false,
-	fade: false,
-	slide: false,
-//	hideTimeout: 50000,
-    content: function(){
-       var htmlc = $('#comment-'+id).parents('div').contents('.floor-'+fi).html() ;
-	return htmlc;
-   }
- })
-}
-
-function floorLink(){
-    $('.comment-block').each(function(i,e){
-      e = $(e);
-      lz = $(this.parentNode.parentNode.parentNode).find('.author>a');
-      lx = e.find(".userlogin>a")
-      if (lz.length>0 && lx.length>0)
-	if(lx[0].href==lz[0].href){
-		e.find(".userlogin").attr('class','userlogin hostname')
-	}
-      
-      var b = e.find('.body');
-      var content = b.html();
- 	  var id = parseInt(e.attr('id').replace('comment-',''));
-      content=content.replace(/(\d+)(f|F|L|l|楼)/g, function(o,i){
-        if($.browser.msie){
-        setTimeout("createFloorLink("+id+", "+i+")", 200);
-        }else{
-        setTimeout(createFloorLink, 200, id, i);
-        }
-        return "<a href='#comment-"+id+"' id='fl-"+id+"-"+i+"'>"+o+"</a>";
-      });
-
-      b.html(content);
-    });
-}
 
 //$(floorLink);
 
 
 
 //ajax login
-/* after logged in, the document will receive 'after_logged_in' event */
-function showLogin(){
-	
-  if($.browser.msie){
-    document.styleSheets[0].addRule('.login', 'display:block !important');
-  }else{
-    document.styleSheets[0].insertRule('.login{display:block !important;}',0);
-  }
-  
-  showLogout('none');
-}
-
-function showSuggest(){
-  if($.browser.msie){
-    document.styleSheets[0].addRule('.suggest-form', 'display:inline !important');
-  }else{
-    document.styleSheets[0].insertRule('.suggest-form{display:inline !important;}',0);
-  }
-}
-
-function showLogout(type){
-  type = type || 'inherited';
-  if($.browser.msie){
-    document.styleSheets[0].addRule('.logout', 'display:'+type+' !important');
-  }else{
-    document.styleSheets[0].insertRule('.logout {display:'+type+' !important;}',0);
-  }
-}
-
-function loadLoginCookie(){
-    var user = $.readCookie('user');
-    if(user){
-        try{
-          //user = '{"unread_messages_count": 0, "user": {"login": "'+_Base64.decode(user)+'"}}';
-          user = eval('('+user+')');
-          loadLogin(user);
-          return user;
-        }catch(e){
-
-        }
-    }
-    if($.readCookie('auth_token') || $.readCookie('_session_id'))
-        return $.getJSON('/session.js?'+(new Date().getTime()), loadLogin);
-    else
-        return '{}'
-}
-function loadLogin(data){
-  if(data){
-    currentUser = data;
-    $('.username').text(currentUser.login);
-    //$('.login').toggleClass( "hidden" );
-    showLogout('none');
-    if(data.unread_messages_count > 0){
-	$('#unread_messages_count').text(data.unread_messages_count);
-	document.title = '您收到'+data.unread_messages_count+'个小纸条 | '+document.title;
-	$('#unread_messages_count').css('display','');
-    }
-    else{
-	$('#unread_messages_count').hide();
-    }
-    if(data.unread_notifications_count && data.unread_notifications_count > 0){
-      $('#unread_notifications_count').text(data.unread_notifications_count);
-    }
-    showLogin();
-    VoteHistory.updateArticleStates();
-    queryNewMessage();
-  }else{
-    currentUser=null;
-    showLogout();
-  }
-}
-$(loadLoginCookie);
-
-function showLoginForm(){
-  $('#login-form').lightbox_me({
-  centered: true,
-  onLoad: function() {
-      $('#login').focus()
-      }
-  });
-}
 function showSuggestForm(){
   $('#suggest-form').lightbox_me({
   centered: true,
     }, 'json')
     return false;
   })
-});
-
-/*
- * Poshy Tip jQuery plugin v1.1
- * http://vadikom.com/tools/poshy-tip-jquery-plugin-for-stylish-tooltips/
- * Copyright 2010-2011, Vasil Dinkov, http://vadikom.com/
- */
-
-(function(e){var a=[],d=/^url\(["']?([^"'\)]*)["']?\);?$/i,c=/\.png$/i,b=e.browser.msie&&e.browser.version==6;function f(){e.each(a,function(){this.refresh(true)})}e(window).resize(f);e.Poshytip=function(h,g){this.$elm=e(h);this.opts=e.extend({},e.fn.poshytip.defaults,g);this.$tip=e(['<div class="',this.opts.className,'">','<div class="tip-inner tip-bg-image"></div>','<div class="tip-arrow tip-arrow-top tip-arrow-right tip-arrow-bottom tip-arrow-left"></div>',"</div>"].join("")).appendTo(document.body);this.$arrow=this.$tip.find("div.tip-arrow");this.$inner=this.$tip.find("div.tip-inner");this.disabled=false;this.content=null;this.init()};e.Poshytip.prototype={init:function(){a.push(this);var g=this.$elm.attr("title");this.$elm.data("title.poshytip",g!==undefined?g:null).data("poshytip",this);if(this.opts.showOn!="none"){this.$elm.bind({"mouseenter.poshytip":e.proxy(this.mouseenter,this),"mouseleave.poshytip":e.proxy(this.mouseleave,this)});switch(this.opts.showOn){case"hover":if(this.opts.alignTo=="cursor"){this.$elm.bind("mousemove.poshytip",e.proxy(this.mousemove,this))}if(this.opts.allowTipHover){this.$tip.hover(e.proxy(this.clearTimeouts,this),e.proxy(this.mouseleave,this))}break;case"focus":this.$elm.bind({"focus.poshytip":e.proxy(this.show,this),"blur.poshytip":e.proxy(this.hide,this)});break}}},mouseenter:function(g){if(this.disabled){return true}this.$elm.attr("title","");if(this.opts.showOn=="focus"){return true}this.clearTimeouts();this.showTimeout=setTimeout(e.proxy(this.show,this),this.opts.showTimeout)},mouseleave:function(g){if(this.disabled||this.asyncAnimating&&(this.$tip[0]===g.relatedTarget||jQuery.contains(this.$tip[0],g.relatedTarget))){return true}var h=this.$elm.data("title.poshytip");if(h!==null){this.$elm.attr("title",h)}if(this.opts.showOn=="focus"){return true}this.clearTimeouts();this.hideTimeout=setTimeout(e.proxy(this.hide,this),this.opts.hideTimeout)},mousemove:function(g){if(this.disabled){return true}this.eventX=g.pageX;this.eventY=g.pageY;if(this.opts.followCursor&&this.$tip.data("active")){this.calcPos();this.$tip.css({left:this.pos.l,top:this.pos.t});if(this.pos.arrow){this.$arrow[0].className="tip-arrow tip-arrow-"+this.pos.arrow}}},show:function(){if(this.disabled||this.$tip.data("active")){return}this.reset();this.update();this.display();if(this.opts.timeOnScreen){setTimeout(e.proxy(this.hide,this),this.opts.timeOnScreen)}},hide:function(){if(this.disabled||!this.$tip.data("active")){return}this.display(true)},reset:function(){this.$tip.queue([]).detach().css("visibility","hidden").data("active",false);this.$inner.find("*").poshytip("hide");if(this.opts.fade){this.$tip.css("opacity",this.opacity)}this.$arrow[0].className="tip-arrow tip-arrow-top tip-arrow-right tip-arrow-bottom tip-arrow-left";this.asyncAnimating=false},update:function(j,k){if(this.disabled){return}var i=j!==undefined;if(i){if(!k){this.opts.content=j}if(!this.$tip.data("active")){return}}else{j=this.opts.content}var h=this,g=typeof j=="function"?j.call(this.$elm[0],function(l){h.update(l)}):j=="[title]"?this.$elm.data("title.poshytip"):j;if(this.content!==g){this.$inner.empty().append(g);this.content=g}this.refresh(i)},refresh:function(h){if(this.disabled){return}if(h){if(!this.$tip.data("active")){return}var k={left:this.$tip.css("left"),top:this.$tip.css("top")}}this.$tip.css({left:0,top:0}).appendTo(document.body);if(this.opacity===undefined){this.opacity=this.$tip.css("opacity")}var l=this.$tip.css("background-image").match(d),m=this.$arrow.css("background-image").match(d);if(l){var i=c.test(l[1]);if(b&&i){this.$tip.css("background-image","none");this.$inner.css({margin:0,border:0,padding:0});l=i=false}else{this.$tip.prepend('<table border="0" cellpadding="0" cellspacing="0"><tr><td class="tip-top tip-bg-image" colspan="2"><span></span></td><td class="tip-right tip-bg-image" rowspan="2"><span></span></td></tr><tr><td class="tip-left tip-bg-image" rowspan="2"><span></span></td><td></td></tr><tr><td class="tip-bottom tip-bg-image" colspan="2"><span></span></td></tr></table>').css({border:0,padding:0,"background-image":"none","background-color":"transparent"}).find(".tip-bg-image").css("background-image",'url("'+l[1]+'")').end().find("td").eq(3).append(this.$inner)}if(i&&!e.support.opacity){this.opts.fade=false}}if(m&&!e.support.opacity){if(b&&c.test(m[1])){m=false;this.$arrow.css("background-image","none")}this.opts.fade=false}var o=this.$tip.find("table");if(b){this.$tip[0].style.width="";o.width("auto").find("td").eq(3).width("auto");var n=this.$tip.width(),j=parseInt(this.$tip.css("min-width")),g=parseInt(this.$tip.css("max-width"));if(!isNaN(j)&&n<j){n=j}else{if(!isNaN(g)&&n>g){n=g}}this.$tip.add(o).width(n).eq(0).find("td").eq(3).width("100%")}else{if(o[0]){o.width("auto").find("td").eq(3).width("auto").end().end().width(document.defaultView&&document.defaultView.getComputedStyle&&parseFloat(document.defaultView.getComputedStyle(this.$tip[0],null).width)||this.$tip.width()).find("td").eq(3).width("100%")}}this.tipOuterW=this.$tip.outerWidth();this.tipOuterH=this.$tip.outerHeight();this.calcPos();if(m&&this.pos.arrow){this.$arrow[0].className="tip-arrow tip-arrow-"+this.pos.arrow;this.$arrow.css("visibility","inherit")}if(h){this.asyncAnimating=true;var p=this;this.$tip.css(k).animate({left:this.pos.l,top:this.pos.t},200,function(){p.asyncAnimating=false})}else{this.$tip.css({left:this.pos.l,top:this.pos.t})}},display:function(h){var i=this.$tip.data("active");if(i&&!h||!i&&h){return}this.$tip.stop();if((this.opts.slide&&this.pos.arrow||this.opts.fade)&&(h&&this.opts.hideAniDuration||!h&&this.opts.showAniDuration)){var m={},l={};if(this.opts.slide&&this.pos.arrow){var k,g;if(this.pos.arrow=="bottom"||this.pos.arrow=="top"){k="top";g="bottom"}else{k="left";g="right"}var j=parseInt(this.$tip.css(k));m[k]=j+(h?0:(this.pos.arrow==g?-this.opts.slideOffset:this.opts.slideOffset));l[k]=j+(h?(this.pos.arrow==g?this.opts.slideOffset:-this.opts.slideOffset):0)+"px"}if(this.opts.fade){m.opacity=h?this.$tip.css("opacity"):0;l.opacity=h?0:this.opacity}this.$tip.css(m).animate(l,this.opts[h?"hideAniDuration":"showAniDuration"])}h?this.$tip.queue(e.proxy(this.reset,this)):this.$tip.css("visibility","inherit");this.$tip.data("active",!i)},disable:function(){this.reset();this.disabled=true},enable:function(){this.disabled=false},destroy:function(){this.reset();this.$tip.remove();delete this.$tip;this.content=null;this.$elm.unbind(".poshytip").removeData("title.poshytip").removeData("poshytip");a.splice(e.inArray(this,a),1)},clearTimeouts:function(){if(this.showTimeout){clearTimeout(this.showTimeout);this.showTimeout=0}if(this.hideTimeout){clearTimeout(this.hideTimeout);this.hideTimeout=0}},calcPos:function(){var n={l:0,t:0,arrow:""},h=e(window),k={l:h.scrollLeft(),t:h.scrollTop(),w:h.width(),h:h.height()},p,j,m,i,q,g;if(this.opts.alignTo=="cursor"){p=j=m=this.eventX;i=q=g=this.eventY}else{var o=this.$elm.offset(),l={l:o.left,t:o.top,w:this.$elm.outerWidth(),h:this.$elm.outerHeight()};p=l.l+(this.opts.alignX!="inner-right"?0:l.w);j=p+Math.floor(l.w/2);m=p+(this.opts.alignX!="inner-left"?l.w:0);i=l.t+(this.opts.alignY!="inner-bottom"?0:l.h);q=i+Math.floor(l.h/2);g=i+(this.opts.alignY!="inner-top"?l.h:0)}switch(this.opts.alignX){case"right":case"inner-left":n.l=m+this.opts.offsetX;if(n.l+this.tipOuterW>k.l+k.w){n.l=k.l+k.w-this.tipOuterW}if(this.opts.alignX=="right"||this.opts.alignY=="center"){n.arrow="left"}break;case"center":n.l=j-Math.floor(this.tipOuterW/2);if(n.l+this.tipOuterW>k.l+k.w){n.l=k.l+k.w-this.tipOuterW}else{if(n.l<k.l){n.l=k.l}}break;default:n.l=p-this.tipOuterW-this.opts.offsetX;if(n.l<k.l){n.l=k.l}if(this.opts.alignX=="left"||this.opts.alignY=="center"){n.arrow="right"}}switch(this.opts.alignY){case"bottom":case"inner-top":n.t=g+this.opts.offsetY;if(!n.arrow||this.opts.alignTo=="cursor"){n.arrow="top"}if(n.t+this.tipOuterH>k.t+k.h){n.t=i-this.tipOuterH-this.opts.offsetY;if(n.arrow=="top"){n.arrow="bottom"}}break;case"center":n.t=q-Math.floor(this.tipOuterH/2);if(n.t+this.tipOuterH>k.t+k.h){n.t=k.t+k.h-this.tipOuterH}else{if(n.t<k.t){n.t=k.t}}break;default:n.t=i-this.tipOuterH-this.opts.offsetY;if(!n.arrow||this.opts.alignTo=="cursor"){n.arrow="bottom"}if(n.t<k.t){n.t=g+this.opts.offsetY;if(n.arrow=="bottom"){n.arrow="top"}}}this.pos=n}};e.fn.poshytip=function(h){if(typeof h=="string"){var g=arguments,k=h;Array.prototype.shift.call(g);if(k=="destroy"){this.die("mouseenter.poshytip").die("focus.poshytip")}return this.each(function(){var l=e(this).data("poshytip");if(l&&l[k]){l[k].apply(l,g)}})}var i=e.extend({},e.fn.poshytip.defaults,h);if(!e("#poshytip-css-"+i.className)[0]){e(['<style id="poshytip-css-',i.className,'" type="text/css">',"div.",i.className,"{visibility:hidden;position:absolute;top:0;left:0;}","div.",i.className," table, div.",i.className," td{margin:0;font-family:inherit;font-size:inherit;font-weight:inherit;font-style:inherit;font-variant:inherit;}","div.",i.className," td.tip-bg-image span{display:block;font:1px/1px sans-serif;height:",i.bgImageFrameSize,"px;width:",i.bgImageFrameSize,"px;overflow:hidden;}","div.",i.className," td.tip-right{background-position:100% 0;}","div.",i.className," td.tip-bottom{background-position:100% 100%;}","div.",i.className," td.tip-left{background-position:0 100%;}","div.",i.className," div.tip-inner{background-position:-",i.bgImageFrameSize,"px -",i.bgImageFrameSize,"px;}","div.",i.className," div.tip-arrow{visibility:hidden;position:absolute;overflow:hidden;font:1px/1px sans-serif;}","</style>"].join("")).appendTo("head")}if(i.liveEvents&&i.showOn!="none"){var j=e.extend({},i,{liveEvents:false});switch(i.showOn){case"hover":this.live("mouseenter.poshytip",function(){var l=e(this);if(!l.data("poshytip")){l.poshytip(j).poshytip("mouseenter")}});break;case"focus":this.live("focus.poshytip",function(){var l=e(this);if(!l.data("poshytip")){l.poshytip(j).poshytip("show")}});break}return this}return this.each(function(){new e.Poshytip(this,i)})};e.fn.poshytip.defaults={content:"[title]",className:"tip-yellow",bgImageFrameSize:10,showTimeout:500,hideTimeout:100,timeOnScreen:0,showOn:"hover",liveEvents:false,alignTo:"cursor",alignX:"right",alignY:"top",offsetX:-22,offsetY:18,allowTipHover:true,followCursor:false,fade:true,slide:true,slideOffset:8,showAniDuration:300,hideAniDuration:300}})(jQuery);
+});

File javascripts/lightbox_me.js

-(function($){$.fn.lightbox_me=function(options){return this.each(function(){var opts=$.extend({},$.fn.lightbox_me.defaults,options),$overlay=$('div.'+opts.classPrefix+'_overlay'),$self=$(this),$iframe=$('iframe#lb_iframe'),ie6=($.browser.msie&&$.browser.version<7);if($overlay.length>0){$overlay[0].removeModal()}else{$overlay=$('<div class="'+opts.classPrefix+'_overlay" style="display:none;"/>')}$iframe=($iframe.length>0)?$iframe:$iframe=$('<iframe id="lb_iframe" style="z-index: '+(opts.zIndex+1)+'; display: none; border: none; margin: 0; padding: 0; position: absolute; width: 100%; height: 100%; top: 0; left: 0;"/>');if(ie6){var src=/^https/i.test(window.location.href||'')?'javascript:false':'about:blank';$iframe.attr('src',src);$('body').append($iframe)}$('body').append($self).append($overlay);setSelfPosition();$self.css({left:'50%',marginLeft:($self.outerWidth()/2)*-1,zIndex:(opts.zIndex+3)});setOverlayHeight();$overlay.css({position:'absolute',width:'100%',top:0,left:0,right:0,bottom:0,zIndex:(opts.zIndex+2)}).css(opts.overlayCSS);if($overlay.is(":hidden")){$overlay.fadeIn(opts.overlaySpeed,function(){$self[opts.appearEffect](opts.lightboxSpeed,function(){setOverlayHeight();opts.onLoad()})})}else{$self[opts.appearEffect](opts.lightboxSpeed,function(){setOverlayHeight();opts.onLoad()})}$(window).resize(setOverlayHeight).resize(setSelfPosition).scroll(setSelfPosition).keydown(observeEscapePress);$self.find(opts.closeSelector).click(function(){removeModal(true);return false});$overlay.click(function(){if(opts.closeClick){removeModal(true);return false}});$self.bind('close',function(){removeModal(true)});$self.bind('resize',setSelfPosition);$overlay[0].removeModal=removeModal;function removeModal(removeO){$self[opts.disappearEffect](opts.lightboxDisappearSpeed,function(){if(removeO){removeOverlay()}opts.destroyOnClose?$self.remove():$self.hide()$self.find(opts.closeSelector).unbind('click');$self.unbind('close');$self.unbind('resize');$(window).unbind('scroll',setSelfPosition);$(window).unbind('resize',setSelfPosition)})}function removeOverlay(){$overlay.fadeOut(opts.overlayDisappearSpeed,function(){$(window).unbind('resize',setOverlayHeight);$overlay.remove();$overlay.unbind('click');opts.onClose()})}function observeEscapePress(e){if((e.keyCode==27||(e.DOM_VK_ESCAPE==27&&e.which==0))&&opts.closeEsc)removeModal(true)}function setOverlayHeight(){if($(window).height()<$(document).height()){$overlay.css({height:$(document).height()+'px'})}else{$overlay.css({height:'100%'});if(ie6){$('html,body').css('height','100%')}}}function setSelfPosition(){var s=$self[0].style;if(($self.height()+80>=$(window).height())&&($self.css('position')!='absolute'||ie6)){var topOffset=$(document).scrollTop()+40;$self.css({position:'absolute',top:topOffset+'px',marginTop:0})if(ie6){s.removeExpression('top')}}else if($self.height()+80<$(window).height()){if(ie6){s.position='absolute';if(opts.centered){s.setExpression('top','(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"')s.marginTop=0}else{var top=(opts.modalCSS&&opts.modalCSS.top)?parseInt(opts.modalCSS.top):0;s.setExpression('top','((blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + '+top+') + "px"')}}else{if(opts.centered){$self.css({position:'fixed',top:'50%',marginTop:($self.outerHeight()/2)*-1})}else{$self.css({position:'fixed'}).css(opts.modalCSS)}}}}})};$.fn.lightbox_me.defaults={appearEffect:"fadeIn",overlaySpeed:300,lightboxSpeed:"fast",disappearEffect:"fadeOut",overlayDisappearSpeed:300,lightboxDisappearSpeed:"fast",closeSelector:".close",closeClick:true,closeEsc:true,destroyOnClose:false,onLoad:function(){},onClose:function(){},classPrefix:'lb',zIndex:999,centered:false,modalCSS:{top:'40px'},overlayCSS:{background:'black',opacity:.6}}})(jQuery);
+/*
+* $ lightbox_me
+* By: Buck Wilson
+* Version : 2.3
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+(function($) {
+
+    $.fn.lightbox_me = function(options) {
+
+        return this.each(function() {
+
+            var
+                opts = $.extend({}, $.fn.lightbox_me.defaults, options),
+                $overlay = $(),
+                $self = $(this),
+                $iframe = $('<iframe id="foo" style="z-index: ' + (opts.zIndex + 1) + ';border: none; margin: 0; padding: 0; position: absolute; width: 100%; height: 100%; top: 0; left: 0; filter: mask();"/>'),
+                ie6 = ($.browser.msie && $.browser.version < 7);
+
+            if (opts.showOverlay) {
+                //check if there's an existing overlay, if so, make subequent ones clear
+               var $currentOverlays = $(".js_lb_overlay:visible");
+                if ($currentOverlays.length > 0){
+                    $overlay = $('<div class="lb_overlay_clear js_lb_overlay"/>');
+                } else {
+                    $overlay = $('<div class="' + opts.classPrefix + '_overlay js_lb_overlay"/>');
+                }
+            }
+
+            /*----------------------------------------------------
+               DOM Building
+            ---------------------------------------------------- */
+            if (ie6) {
+                var src = /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank';
+                $iframe.attr('src', src);
+                $('body').append($iframe);
+            } // iframe shim for ie6, to hide select elements
+            $('body').append($self.hide()).append($overlay);
+
+
+            /*----------------------------------------------------
+               Overlay CSS stuffs
+            ---------------------------------------------------- */
+
+            // set css of the overlay
+            if (opts.showOverlay) {
+                setOverlayHeight(); // pulled this into a function because it is called on window resize.
+                $overlay.css({ position: 'absolute', width: '100%', top: 0, left: 0, right: 0, bottom: 0, zIndex: (opts.zIndex + 2), display: 'none' });
+				if (!$overlay.hasClass('lb_overlay_clear')){
+                	$overlay.css(opts.overlayCSS);
+                }
+            }
+
+            /*----------------------------------------------------
+               Animate it in.
+            ---------------------------------------------------- */
+               //
+            if (opts.showOverlay) {
+                $overlay.fadeIn(opts.overlaySpeed, function() {
+                    setSelfPosition();
+                    $self[opts.appearEffect](opts.lightboxSpeed, function() { setOverlayHeight(); setSelfPosition(); opts.onLoad()});
+                });
+            } else {
+                setSelfPosition();
+                $self[opts.appearEffect](opts.lightboxSpeed, function() { opts.onLoad()});
+            }
+
+            /*----------------------------------------------------
+               Hide parent if parent specified (parentLightbox should be jquery reference to any parent lightbox)
+            ---------------------------------------------------- */
+            if (opts.parentLightbox) {
+                opts.parentLightbox.fadeOut(200);
+            }
+
+
+            /*----------------------------------------------------
+               Bind Events
+            ---------------------------------------------------- */
+
+            $(window).resize(setOverlayHeight)
+                     .resize(setSelfPosition)
+                     .scroll(setSelfPosition);
+                     
+            $(window).bind('keyup.lightbox_me', observeKeyPress);
+                     
+            if (opts.closeClick) {
+                $overlay.click(function(e) { closeLightbox(); e.preventDefault; });
+            }
+            $self.delegate(opts.closeSelector, "click", function(e) {
+                closeLightbox(); e.preventDefault();
+            });
+            $self.bind('close', closeLightbox);
+            $self.bind('reposition', setSelfPosition);
+
+            
+
+            /*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+              -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
+
+
+            /*----------------------------------------------------
+               Private Functions
+            ---------------------------------------------------- */
+
+            /* Remove or hide all elements */
+            function closeLightbox() {
+                var s = $self[0].style;
+                if (opts.destroyOnClose) {
+                    $self.add($overlay).remove();
+                } else {
+                    $self.add($overlay).hide();
+                }
+
+                //show the hidden parent lightbox
+                if (opts.parentLightbox) {
+                    opts.parentLightbox.fadeIn(200);
+                }
+
+                $iframe.remove();
+                
+				// clean up events.
+                $self.undelegate(opts.closeSelector, "click");
+
+                $(window).unbind('reposition', setOverlayHeight);
+                $(window).unbind('reposition', setSelfPosition);
+                $(window).unbind('scroll', setSelfPosition);
+                $(window).unbind('keyup.lightbox_me');
+                if (ie6)
+                    s.removeExpression('top');
+                opts.onClose();
+            }
+
+
+            /* Function to bind to the window to observe the escape/enter key press */
+            function observeKeyPress(e) {
+                if((e.keyCode == 27 || (e.DOM_VK_ESCAPE == 27 && e.which==0)) && opts.closeEsc) closeLightbox();
+            }
+
+
+            /* Set the height of the overlay
+                    : if the document height is taller than the window, then set the overlay height to the document height.
+                    : otherwise, just set overlay height: 100%
+            */
+            function setOverlayHeight() {
+                if ($(window).height() < $(document).height()) {
+                    $overlay.css({height: $(document).height() + 'px'});
+                     $iframe.css({height: $(document).height() + 'px'}); 
+                } else {
+                    $overlay.css({height: '100%'});
+                    if (ie6) {
+                        $('html,body').css('height','100%');
+                        $iframe.css('height', '100%');
+                    } // ie6 hack for height: 100%; TODO: handle this in IE7
+                }
+            }
+
+
+            /* Set the position of the modal'd window ($self)
+                    : if $self is taller than the window, then make it absolutely positioned
+                    : otherwise fixed
+            */
+            function setSelfPosition() {
+                var s = $self[0].style;
+
+                // reset CSS so width is re-calculated for margin-left CSS
+                $self.css({left: '50%', marginLeft: ($self.outerWidth() / 2) * -1,  zIndex: (opts.zIndex + 3) });
+
+
+                /* we have to get a little fancy when dealing with height, because lightbox_me
+                    is just so fancy.
+                 */
+
+                // if the height of $self is bigger than the window and self isn't already position absolute
+                if (($self.height() + 80  >= $(window).height()) && ($self.css('position') != 'absolute' || ie6)) {
+
+                    // we are going to make it positioned where the user can see it, but they can still scroll
+                    // so the top offset is based on the user's scroll position.
+                    var topOffset = $(document).scrollTop() + 40;
+                    $self.css({position: 'absolute', top: topOffset + 'px', marginTop: 0})
+                    if (ie6) {
+                        s.removeExpression('top');
+                    }
+                } else if ($self.height()+ 80  < $(window).height()) {
+                    //if the height is less than the window height, then we're gonna make this thing position: fixed.
+                    // in ie6 we're gonna fake it.
+                    if (ie6) {
+                        s.position = 'absolute';
+                        if (opts.centered) {
+                            s.setExpression('top', '(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"')
+                            s.marginTop = 0;
+                        } else {
+                            var top = (opts.modalCSS && opts.modalCSS.top) ? parseInt(opts.modalCSS.top) : 0;
+                            s.setExpression('top', '((blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + '+top+') + "px"')
+                        }
+                    } else {
+                        if (opts.centered) {
+                            $self.css({ position: 'fixed', top: '50%', marginTop: ($self.outerHeight() / 2) * -1})
+                        } else {
+                            $self.css({ position: 'fixed'}).css(opts.modalCSS);
+                        }
+
+                    }
+                }
+            }
+
+        });
+
+
+
+    };
+
+    $.fn.lightbox_me.defaults = {
+
+        // animation
+        appearEffect: "fadeIn",
+        appearEase: "",
+        overlaySpeed: 250,
+        lightboxSpeed: 300,
+
+        // close
+        closeSelector: ".close",
+        closeClick: true,
+        closeEsc: true,
+
+        // behavior
+        destroyOnClose: false,
+        showOverlay: true,
+        parentLightbox: false,
+
+        // callbacks
+        onLoad: function() {},
+        onClose: function() {},
+
+        // style
+        classPrefix: 'lb',
+        zIndex: 999,
+        centered: false,
+        modalCSS: {top: '40px'},
+        overlayCSS: {background: 'black', opacity: 0.3}
+    }
+})(jQuery);

File javascripts/poshytip.js

+
+/*
+ * Poshy Tip jQuery plugin v1.1
+ * http://vadikom.com/tools/poshy-tip-jquery-plugin-for-stylish-tooltips/
+ * Copyright 2010-2011, Vasil Dinkov, http://vadikom.com/
+ */
+
+(function(e){var a=[],d=/^url\(["']?([^"'\)]*)["']?\);?$/i,c=/\.png$/i,b=e.browser.msie&&e.browser.version==6;function f(){e.each(a,function(){this.refresh(true)})}e(window).resize(f);e.Poshytip=function(h,g){this.$elm=e(h);this.opts=e.extend({},e.fn.poshytip.defaults,g);this.$tip=e(['<div class="',this.opts.className,'">','<div class="tip-inner tip-bg-image"></div>','<div class="tip-arrow tip-arrow-top tip-arrow-right tip-arrow-bottom tip-arrow-left"></div>',"</div>"].join("")).appendTo(document.body);this.$arrow=this.$tip.find("div.tip-arrow");this.$inner=this.$tip.find("div.tip-inner");this.disabled=false;this.content=null;this.init()};e.Poshytip.prototype={init:function(){a.push(this);var g=this.$elm.attr("title");this.$elm.data("title.poshytip",g!==undefined?g:null).data("poshytip",this);if(this.opts.showOn!="none"){this.$elm.bind({"mouseenter.poshytip":e.proxy(this.mouseenter,this),"mouseleave.poshytip":e.proxy(this.mouseleave,this)});switch(this.opts.showOn){case"hover":if(this.opts.alignTo=="cursor"){this.$elm.bind("mousemove.poshytip",e.proxy(this.mousemove,this))}if(this.opts.allowTipHover){this.$tip.hover(e.proxy(this.clearTimeouts,this),e.proxy(this.mouseleave,this))}break;case"focus":this.$elm.bind({"focus.poshytip":e.proxy(this.show,this),"blur.poshytip":e.proxy(this.hide,this)});break}}},mouseenter:function(g){if(this.disabled){return true}this.$elm.attr("title","");if(this.opts.showOn=="focus"){return true}this.clearTimeouts();this.showTimeout=setTimeout(e.proxy(this.show,this),this.opts.showTimeout)},mouseleave:function(g){if(this.disabled||this.asyncAnimating&&(this.$tip[0]===g.relatedTarget||jQuery.contains(this.$tip[0],g.relatedTarget))){return true}var h=this.$elm.data("title.poshytip");if(h!==null){this.$elm.attr("title",h)}if(this.opts.showOn=="focus"){return true}this.clearTimeouts();this.hideTimeout=setTimeout(e.proxy(this.hide,this),this.opts.hideTimeout)},mousemove:function(g){if(this.disabled){return true}this.eventX=g.pageX;this.eventY=g.pageY;if(this.opts.followCursor&&this.$tip.data("active")){this.calcPos();this.$tip.css({left:this.pos.l,top:this.pos.t});if(this.pos.arrow){this.$arrow[0].className="tip-arrow tip-arrow-"+this.pos.arrow}}},show:function(){if(this.disabled||this.$tip.data("active")){return}this.reset();this.update();this.display();if(this.opts.timeOnScreen){setTimeout(e.proxy(this.hide,this),this.opts.timeOnScreen)}},hide:function(){if(this.disabled||!this.$tip.data("active")){return}this.display(true)},reset:function(){this.$tip.queue([]).detach().css("visibility","hidden").data("active",false);this.$inner.find("*").poshytip("hide");if(this.opts.fade){this.$tip.css("opacity",this.opacity)}this.$arrow[0].className="tip-arrow tip-arrow-top tip-arrow-right tip-arrow-bottom tip-arrow-left";this.asyncAnimating=false},update:function(j,k){if(this.disabled){return}var i=j!==undefined;if(i){if(!k){this.opts.content=j}if(!this.$tip.data("active")){return}}else{j=this.opts.content}var h=this,g=typeof j=="function"?j.call(this.$elm[0],function(l){h.update(l)}):j=="[title]"?this.$elm.data("title.poshytip"):j;if(this.content!==g){this.$inner.empty().append(g);this.content=g}this.refresh(i)},refresh:function(h){if(this.disabled){return}if(h){if(!this.$tip.data("active")){return}var k={left:this.$tip.css("left"),top:this.$tip.css("top")}}this.$tip.css({left:0,top:0}).appendTo(document.body);if(this.opacity===undefined){this.opacity=this.$tip.css("opacity")}var l=this.$tip.css("background-image").match(d),m=this.$arrow.css("background-image").match(d);if(l){var i=c.test(l[1]);if(b&&i){this.$tip.css("background-image","none");this.$inner.css({margin:0,border:0,padding:0});l=i=false}else{this.$tip.prepend('<table border="0" cellpadding="0" cellspacing="0"><tr><td class="tip-top tip-bg-image" colspan="2"><span></span></td><td class="tip-right tip-bg-image" rowspan="2"><span></span></td></tr><tr><td class="tip-left tip-bg-image" rowspan="2"><span></span></td><td></td></tr><tr><td class="tip-bottom tip-bg-image" colspan="2"><span></span></td></tr></table>').css({border:0,padding:0,"background-image":"none","background-color":"transparent"}).find(".tip-bg-image").css("background-image",'url("'+l[1]+'")').end().find("td").eq(3).append(this.$inner)}if(i&&!e.support.opacity){this.opts.fade=false}}if(m&&!e.support.opacity){if(b&&c.test(m[1])){m=false;this.$arrow.css("background-image","none")}this.opts.fade=false}var o=this.$tip.find("table");if(b){this.$tip[0].style.width="";o.width("auto").find("td").eq(3).width("auto");var n=this.$tip.width(),j=parseInt(this.$tip.css("min-width")),g=parseInt(this.$tip.css("max-width"));if(!isNaN(j)&&n<j){n=j}else{if(!isNaN(g)&&n>g){n=g}}this.$tip.add(o).width(n).eq(0).find("td").eq(3).width("100%")}else{if(o[0]){o.width("auto").find("td").eq(3).width("auto").end().end().width(document.defaultView&&document.defaultView.getComputedStyle&&parseFloat(document.defaultView.getComputedStyle(this.$tip[0],null).width)||this.$tip.width()).find("td").eq(3).width("100%")}}this.tipOuterW=this.$tip.outerWidth();this.tipOuterH=this.$tip.outerHeight();this.calcPos();if(m&&this.pos.arrow){this.$arrow[0].className="tip-arrow tip-arrow-"+this.pos.arrow;this.$arrow.css("visibility","inherit")}if(h){this.asyncAnimating=true;var p=this;this.$tip.css(k).animate({left:this.pos.l,top:this.pos.t},200,function(){p.asyncAnimating=false})}else{this.$tip.css({left:this.pos.l,top:this.pos.t})}},display:function(h){var i=this.$tip.data("active");if(i&&!h||!i&&h){return}this.$tip.stop();if((this.opts.slide&&this.pos.arrow||this.opts.fade)&&(h&&this.opts.hideAniDuration||!h&&this.opts.showAniDuration)){var m={},l={};if(this.opts.slide&&this.pos.arrow){var k,g;if(this.pos.arrow=="bottom"||this.pos.arrow=="top"){k="top";g="bottom"}else{k="left";g="right"}var j=parseInt(this.$tip.css(k));m[k]=j+(h?0:(this.pos.arrow==g?-this.opts.slideOffset:this.opts.slideOffset));l[k]=j+(h?(this.pos.arrow==g?this.opts.slideOffset:-this.opts.slideOffset):0)+"px"}if(this.opts.fade){m.opacity=h?this.$tip.css("opacity"):0;l.opacity=h?0:this.opacity}this.$tip.css(m).animate(l,this.opts[h?"hideAniDuration":"showAniDuration"])}h?this.$tip.queue(e.proxy(this.reset,this)):this.$tip.css("visibility","inherit");this.$tip.data("active",!i)},disable:function(){this.reset();this.disabled=true},enable:function(){this.disabled=false},destroy:function(){this.reset();this.$tip.remove();delete this.$tip;this.content=null;this.$elm.unbind(".poshytip").removeData("title.poshytip").removeData("poshytip");a.splice(e.inArray(this,a),1)},clearTimeouts:function(){if(this.showTimeout){clearTimeout(this.showTimeout);this.showTimeout=0}if(this.hideTimeout){clearTimeout(this.hideTimeout);this.hideTimeout=0}},calcPos:function(){var n={l:0,t:0,arrow:""},h=e(window),k={l:h.scrollLeft(),t:h.scrollTop(),w:h.width(),h:h.height()},p,j,m,i,q,g;if(this.opts.alignTo=="cursor"){p=j=m=this.eventX;i=q=g=this.eventY}else{var o=this.$elm.offset(),l={l:o.left,t:o.top,w:this.$elm.outerWidth(),h:this.$elm.outerHeight()};p=l.l+(this.opts.alignX!="inner-right"?0:l.w);j=p+Math.floor(l.w/2);m=p+(this.opts.alignX!="inner-left"?l.w:0);i=l.t+(this.opts.alignY!="inner-bottom"?0:l.h);q=i+Math.floor(l.h/2);g=i+(this.opts.alignY!="inner-top"?l.h:0)}switch(this.opts.alignX){case"right":case"inner-left":n.l=m+this.opts.offsetX;if(n.l+this.tipOuterW>k.l+k.w){n.l=k.l+k.w-this.tipOuterW}if(this.opts.alignX=="right"||this.opts.alignY=="center"){n.arrow="left"}break;case"center":n.l=j-Math.floor(this.tipOuterW/2);if(n.l+this.tipOuterW>k.l+k.w){n.l=k.l+k.w-this.tipOuterW}else{if(n.l<k.l){n.l=k.l}}break;default:n.l=p-this.tipOuterW-this.opts.offsetX;if(n.l<k.l){n.l=k.l}if(this.opts.alignX=="left"||this.opts.alignY=="center"){n.arrow="right"}}switch(this.opts.alignY){case"bottom":case"inner-top":n.t=g+this.opts.offsetY;if(!n.arrow||this.opts.alignTo=="cursor"){n.arrow="top"}if(n.t+this.tipOuterH>k.t+k.h){n.t=i-this.tipOuterH-this.opts.offsetY;if(n.arrow=="top"){n.arrow="bottom"}}break;case"center":n.t=q-Math.floor(this.tipOuterH/2);if(n.t+this.tipOuterH>k.t+k.h){n.t=k.t+k.h-this.tipOuterH}else{if(n.t<k.t){n.t=k.t}}break;default:n.t=i-this.tipOuterH-this.opts.offsetY;if(!n.arrow||this.opts.alignTo=="cursor"){n.arrow="bottom"}if(n.t<k.t){n.t=g+this.opts.offsetY;if(n.arrow=="bottom"){n.arrow="top"}}}this.pos=n}};e.fn.poshytip=function(h){if(typeof h=="string"){var g=arguments,k=h;Array.prototype.shift.call(g);if(k=="destroy"){this.die("mouseenter.poshytip").die("focus.poshytip")}return this.each(function(){var l=e(this).data("poshytip");if(l&&l[k]){l[k].apply(l,g)}})}var i=e.extend({},e.fn.poshytip.defaults,h);if(!e("#poshytip-css-"+i.className)[0]){e(['<style id="poshytip-css-',i.className,'" type="text/css">',"div.",i.className,"{visibility:hidden;position:absolute;top:0;left:0;}","div.",i.className," table, div.",i.className," td{margin:0;font-family:inherit;font-size:inherit;font-weight:inherit;font-style:inherit;font-variant:inherit;}","div.",i.className," td.tip-bg-image span{display:block;font:1px/1px sans-serif;height:",i.bgImageFrameSize,"px;width:",i.bgImageFrameSize,"px;overflow:hidden;}","div.",i.className," td.tip-right{background-position:100% 0;}","div.",i.className," td.tip-bottom{background-position:100% 100%;}","div.",i.className," td.tip-left{background-position:0 100%;}","div.",i.className," div.tip-inner{background-position:-",i.bgImageFrameSize,"px -",i.bgImageFrameSize,"px;}","div.",i.className," div.tip-arrow{visibility:hidden;position:absolute;overflow:hidden;font:1px/1px sans-serif;}","</style>"].join("")).appendTo("head")}if(i.liveEvents&&i.showOn!="none"){var j=e.extend({},i,{liveEvents:false});switch(i.showOn){case"hover":this.live("mouseenter.poshytip",function(){var l=e(this);if(!l.data("poshytip")){l.poshytip(j).poshytip("mouseenter")}});break;case"focus":this.live("focus.poshytip",function(){var l=e(this);if(!l.data("poshytip")){l.poshytip(j).poshytip("show")}});break}return this}return this.each(function(){new e.Poshytip(this,i)})};e.fn.poshytip.defaults={content:"[title]",className:"tip-yellow",bgImageFrameSize:10,showTimeout:500,hideTimeout:100,timeOnScreen:0,showOn:"hover",liveEvents:false,alignTo:"cursor",alignX:"right",alignY:"top",offsetX:-22,offsetY:18,allowTipHover:true,followCursor:false,fade:true,slide:true,slideOffset:8,showAniDuration:300,hideAniDuration:300}})(jQuery);

File javascripts/vote.js

+function hidevotelink(id, d, p, n){
+  var posscore,negscore;
+  if(typeof p === 'undefined'){
+    posscore = parseInt($('#up-'+id).text());
+  }else{
+    posscore = p;
+  }
+  if(typeof n === 'undefined'){
+    negscore = parseInt($('#dn-'+id).text());
+  }else{
+    negscore = n;
+  }
+
+  $('#up-'+id).html(posscore) ;
+  $('#dn-'+id).html(negscore) ;
+  if( d == 'up')
+    $('#vote-up-'+id).find('a').addClass('voted');
+  else
+    $('#vote-dn-'+id).find('a').addClass('voted');
+  $('#vote-up-'+id).find('a').addClass('disable');
+  $('#vote-dn-'+id).find('a').addClass('disable');
+}
+
+var voteQueue=[];
+function vote2(id, v){
+  if($('#up-'+id).hasClass('disable') || $('#dn-'+id).hasClass('disable') )  return;
+  if(currentUser||currentGroup.options.allow_anonymous_vote){
+    var posscore = parseInt($('#up-'+id).text()),
+    negscore = parseInt($('#dn-'+id).text()),
+    d = (v>0?'up':'dn');
+    showAnimation('vote-'+d+'-'+id, v);
+    $.getJSON('/articles/' + id + '/' + d);
+    v>0 ? posscore++ : negscore--;
+    hidevotelink(id, d,posscore, negscore);
+    VoteHistory.voteState(id,v);
+  }else{
+    //voteQueue.push(v>0?id:-id);
+    showLoginForm();
+    $(document).bind('after_logged_in', function(){
+      vote2(id, v);
+    })
+  }
+}
+
+function getCurUsr( data )
+{
+  if(data && data.user)
+    currentUser=data.user;
+  else
+    currentUser = null;
+  vote2m( curId, curV );
+}
+function mkvotestr( aid, uid , v )
+{
+  return v>0?_Base64.encode(aid+'+'+uid) : _Base64.encode(aid+'-'+uid);
+}
+
+var	curId;
+var	curV;
+function vote2m(id, v){
+  if( !currentUser )
+  {
+    if( $.readCookie('auth_token') )
+    {
+      curId = id;
+      curV = v;
+      $.getJSON('/session.js?'+(new Date().getTime()), getCurUsr);
+    }
+    else
+      window.location.href = '/login';
+  }
+  else{
+    var posscore = parseInt($('#pos-score-'+id).text()),
+    negscore = parseInt($('#neg-score-'+id).text()),
+    d = (v>0?'up':'dn');
+    showAnimation(d+'-'+id, v);
+    //  $.get('/articles/'+id+'/'+d);
+    v>0 ? posscore++ : negscore--;
+    hidevotelink(id, posscore, negscore);
+    $.get( '/new3/vote/='+mkvotestr(id,currentUser.id,v) ) ;
+  }
+
+//voteQueue.push(v>0?id:-id);
+}

File javascripts/vote_history.js

+var VoteHistory = {
+	_Historys : null,
+	_IsValid  : null,
+	// set/get state for article
+	// return 1,0,-1 for state up, normal, down
+	voteState : function (article_id,state){
+	
+		if (!this.isValid()) return 0;
+		if(state == null){
+			return this._Historys[article_id];
+		}else{
+			this._Historys[article_id] = state;	//TODO: state 0(currently not available)
+			this.saveHistory();
+		}
+	},
+
+	isValid : function(){
+		if(this._IsValid == null)
+			this._IsValid = window.localStorage ? true : false;
+		return this._IsValid;
+	},
+
+	// only read once
+	readHistory : function(){
+		this._Historys = window.localStorage.getItem('vote_history')
+		this._Historys = JSON.parse(this._Historys)
+		if(this._Historys == null) this._Historys ={}
+	},
+
+	saveHistory : function(){
+		if ( this._Historys == null) return
+		var maxItems = 500;
+		var getKeys = function(obj){
+		   var keys = [];
+		   for(var key in obj){
+		      keys.push(key);
+		   }
+		   return keys;
+		}
+		var keys = getKeys(this._Historys);
+		if(keys.length > maxItems){
+			var removes = keys.length - maxItems;
+			for(i =0;i<removes;i++)
+				delete this._Historys[keys[i]];
+		}
+		var data = JSON.stringify(this._Historys);
+		window.localStorage.setItem('vote_history',data);
+	},
+
+	_init : function(){
+		if(this.isValid() ) this.readHistory();
+	},
+
+	updateArticleStates : function(){
+		if(! this.isValid() ) return;
+		articles = [];
+		$.each($('div[id^=qiushi_counts_]'),function(){articles.push(+this.id.replace('qiushi_counts_',''))});
+		$.each(articles, function(i){
+			var id = articles[i];
+			var v = VoteHistory.voteState(id);
+			if (v != undefined ){
+				  var posscore = parseInt($('#up-'+id).text()),
+			          negscore = parseInt($('#dn-'+id).text()),
+			          d = (v>0?'up':'dn');
+			      v>0 ? posscore++ : negscore--;
+			      hidevotelink(id, d, posscore, negscore);
+			}
+
+		});
+	}
+};
+
+VoteHistory._init();

File views/articles/_article.html.erb

-<% id = article.id %>
-<% url = article_url(article) %>
-<% group = @group || article.group %>
+<% 
+id = article.id 
+url = article_url(article)
+group = @group || article.group -%>
 <div class="block untagged article" id="qiushi_tag_<%= id %>">
   <div class="author">
     <% unless article.anonymous? %>
     <%= link_to article.user.login, article.user %>
     <% end %>
   </div>
-
   <p class="content entry-content" id="BSHARE_TEXT" title="<%= article.created_at.strftime('%Y-%m-%d')%>">
-    <%= format_content article, group %>
+    <%= format_content article, group -%>
   </p>
-
   <% if article.picture.file? %>
     <div class="thumb">
-
-      <% if article.picture.content_type =~ /gif/i %>
+      <%# if article.picture.content_type =~ /gif/i %>
         <%= image_tag(article.picture(:original), :alt => (article.title || article.content.mb_chars[0,10])) %>
-      <% else %>
-        <%= link_to image_tag(article.picture(:medium), :alt => (article.title || article.content.mb_chars[0,10])), article.picture(:original),
+      <%# else %>
+        <%#= link_to image_tag(article.picture(:medium), :alt => (article.title || article.content.mb_chars[0,10])), article.picture(:original),
           :class => 'picture', :id => "picture-#{id}", :title => (article.title || article.content.mb_chars[0,10]) %>
-      <% end %>
-    </div>    
-
+      <%# end %>
+    </div>
   <% end %>
   <% unless article.tag_line.blank? %>
     <div class="tags"><span class="bti"></span><%= show_tags(article) %></div>
       </a>
     </div>
     <div class="share">
-      
+
     </div>
     <div class="comment">
       <a href="<%= url %>#qiushi_comments_<%= id %>" class="qiushi_comments" id="c-<%= id %>">

File views/articles/new.html.erb

 最后:搞笑不一定要与性有关,我们是一群纯洁的孩纸,我们需要更纯粹的健康精神娱乐文化<br/>
         </p>
         <p style="margin: 1em 0">
-        <%# f.text_field :title, :class => 'input-xlarge', :placeholder => '标题,可选'%>
+        <%= f.text_field :title, :class => 'input-xlarge', :placeholder => '标题,可选', :style => 'height: 24px; line-height: 24px; padding: 2px'%>
         <p>
         <textarea onpropertychange="if(this.scrollHeight&gt;180){this.style.height=this.scrollHeight+'px';}" oninput="if(this.scrollHeight&gt;180){this.style.height=this.scrollHeight+'px';}checkContentLength();" id="qiushi_text" class="original" name="article[content]">
         </textarea>

File views/comments/_index.html.erb

 <% group = @group || @article.group %>
 <% aid = @article.id %>
+<% not_allow_guest = group.options[:only_member_can_reply] %>
 <div id="qiushi_comments_<%= aid %>" class="comments">
-  <%= render :partial => "common/bshare2" unless controller_name == 'comments' and action_name == 'index'%>
-  
-<div id="r<%=aid%>">
-  
-  <% if @comments and @comments.size > 0 %>
-    <% @offset ||= 0 %>
-    <% for c in @comments %>
-      <%= render :partial => c, :locals => {:comment_counter => @offset} %>
-      <% @offset += 1 %>
+  <div id="r<%=aid%>">
+    <% if @comments and @comments.size > 0 %>
+      <% @offset ||= 0 %>
+      <% for c in @comments %>
+        <%= render :partial => c, :locals => {:comment_counter => @offset} %>
+        <% @offset += 1 %>
+      <% end %>
     <% end %>
-  <% end %>
-</div>
-<div class="input-block">
-  <form method="post" style="display:none;" action="<%= article_comments_path(@article) %>" class="login" data-article_id="<%= aid%>">
-    <input type="hidden" name="comment[parent_id]">
-    <input type="hidden" value="<%=aid%>" name="comment[article_id]" id="comment_article_id">
-    <textarea class="comment_input original" name="comment[content]">请不要发表与本内容无关的评论,您有了账号就是有身份的人了,我们可认识您。</textarea>
-    <div class="row">
-      <input type="hidden" value="0" name="comment[anonymous]">
-      <button type="submit" id="comment_submit">发表</button>
-      <!--<input type="submit" name="commit" class="comment_submit">-->
-      <label for="comment_anonymous"><input id="comment_anonymous" type="checkbox" value="1" name="comment[anonymous]"> 匿名评论</label>
-    </div>
-  </form>
-  <div class="logout login-block"><a href="javascript:showLoginForm()">登录</a>后才能发表评论</div>
-</div>
-  </div>
+  </div>
+  <div class="input-block">
+    <% 
+    opt = {:method => 'post', 'data-article_id' => aid}  
+    if not_allow_guest
+      opt['style'] = 'display:none;'
+      opt['class'] = 'login'
+    end
+    %>
+    
+    <% form_tag article_comments_path(@article), opt do %>
+      <span class="current_user-name">游客 <a href="javascript:showLoginForm()">登录</a></span>
+      <input type="hidden" name="comment[parent_id]">
+      <input type="hidden" value="<%=aid%>" name="comment[article_id]" id="comment_article_id">
+      <textarea class="comment_input original" name="comment[content]">请不要发表与本内容无关的评论,您有了账号就是有身份的人了,我们可认识您。</textarea>
+      <div class="row">
+        <input type="hidden" value="0" name="comment[anonymous]">
+        <button type="submit" id="comment_submit">发表</button>
+        <!--<input type="submit" name="commit" class="comment_submit">-->
+        <label for="comment_anonymous"><input id="comment_anonymous" type="checkbox" value="1" name="comment[anonymous]"> 匿名评论</label>
+      </div>
+    <% end %>
+    <% if not_allow_guest %>
+    <div class="logout login-block"><a href="javascript:showLoginForm()">登录</a>后才能发表评论</div>
+    <% end %>
+  </div>
+</div>

File views/layouts/application.html.erb

     <div class="foot">
       <%# render :partial => 'common/footer_ad' %>
       <div class="copyright">
-        内容版权所有 &copy;2012 gouxueriji.com &nbsp;<a href="http://www.miibeian.gov.cn/">ICP备09002713号</a>
+        内容版权所有 &copy;2012 www.qutubaike.com  &nbsp;<a href="http://www.miibeian.gov.cn/">ICP备11026753号-3</a>
       </div>
     </div>
     <div id="login-form">
       </div>
     </div>
     <!--[if IE]><script src="http://www.qiushibaike.com/static/js/other_libs/excanvas/excanvas.compiled.js" type="text/javascript" charset="utf-8"></script><![endif]-->
-    <%= theme_javascript_include_tag 'jquery.bgiframe.min.js', 'lightbox_me' 'fancybox', 'lib2nd','app', :cache => current_theme %>
+    <%= theme_javascript_include_tag %w(jquery.bgiframe.min.js lightbox_me fancybox
+              cookie cursor base64 poshytip
+              lib2nd vote_history vote floorlink comment
+              ajaxlogin
+              app), :cache => current_theme %>
     <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js" type="text/javascript"></script>
+    <% if @group 
+      j = @group.as_json(:only => [:id, :name, :description])
+      j['options'] = @group.options.as_json(:only => [:allow_anonymous_vote])
+    %>
+    <script type="text/javascript">
+      var currentGroup=window.currentGroup=<%= j.to_json %>;
+    </script>
+    <% end %>
   </body>
 </html>

File views/layouts/sessions.html.erb

   </head>
   <body>
     <div class="sign">
-      <div class="logo"></div>
+      <div class="logo">
+        <%= link_to ' ', home_path, :title => "返回首页" %>
+        </div>
       <div class="block">
         <%= yield %>
       </div>
     </div>
     
     <!--[if IE]><script src="http://www.qiushibaike.com/static/js/other_libs/excanvas/excanvas.compiled.js" type="text/javascript" charset="utf-8"></script><![endif]-->
-<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js" type="text/javascript"></script>    
-<%= theme_javascript_include_tag 'lib', 'lib2nd', 'jquery.placeholder.min.js', 'signin_up' %>    
-    
+    <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js" type="text/javascript"></script>    
+    <%= theme_javascript_include_tag 'jquery.bgiframe.min.js', 'lightbox_me' 'fancybox', 'lib2nd', 'app', 'jquery.placeholder.min.js', 'signin_up' %>    
 <script>
 $('input[placeholder], textarea[placeholder]').placeholder();
 </script>