Commit e3088d67 authored by Vanessa's avatar Vanessa

fixed #129, fixed #130

parent c53b3170
...@@ -41,8 +41,7 @@ admin.editors.CodeMirror = { ...@@ -41,8 +41,7 @@ admin.editors.CodeMirror = {
"<div class='clear'></div>" + "<div class='clear'></div>" +
"<div class='markdown-preview-main none'></div>" + "<div class='markdown-preview-main none'></div>" +
"<div class='markdown-help-main'>" + Label.markdownHelpLabel + "</div>" "<div class='markdown-help-main'>" + Label.markdownHelpLabel + "</div>"
"</div>" + + "</div><div class='clear'></div>";
"<div class='clear'></div>";
} }
$("#" + conf.id).after(previewHTML); $("#" + conf.id).after(previewHTML);
......
...@@ -39,7 +39,7 @@ admin.editors.KindEditor = { ...@@ -39,7 +39,7 @@ admin.editors.KindEditor = {
langType : language, langType : language,
resizeType: 0, resizeType: 0,
items: ["bold", "italic", "underline", "strikethrough", "|", "undo", "redo", "|", items: ["bold", "italic", "underline", "strikethrough", "|", "undo", "redo", "|",
"insertunorderedlist", "insertorderedlist", "insertunorderedlist", "insertorderedlist", "|", "source"
] ]
}); });
} catch (e) { } catch (e) {
......
...@@ -99,7 +99,7 @@ $.extend(Page.prototype, { ...@@ -99,7 +99,7 @@ $.extend(Page.prototype, {
} else if (2 > commenterContent.length || commenterContent.length > 500) { } else if (2 > commenterContent.length || commenterContent.length > 500) {
$("#commentErrorTip" + state).html(this.tips.commentContentCannotEmptyLabel); $("#commentErrorTip" + state).html(this.tips.commentContentCannotEmptyLabel);
$("#comment" + state).focus(); $("#comment" + state).focus();
} else if ($("#commentValidate" + state).val().replace(/\s/g, "") === "") { } else if (!$("#admin").data("login") && $("#commentValidate" + state).val().replace(/\s/g, "") === "") {
$("#commentErrorTip" + state).html(this.tips.captchaCannotEmptyLabel); $("#commentErrorTip" + state).html(this.tips.captchaCannotEmptyLabel);
$("#commentValidate" + state).focus(); $("#commentValidate" + state).focus();
} else { } else {
...@@ -369,6 +369,11 @@ $.extend(Page.prototype, { ...@@ -369,6 +369,11 @@ $.extend(Page.prototype, {
*/ */
load: function (obj) { load: function (obj) {
var that = this; var that = this;
// if login, remove captcha
if ($("#admin").data("login")) {
$("#commentValidate").parent().parent().hide();
}
// emotions // emotions
that.insertEmotions(); that.insertEmotions();
......
...@@ -16,33 +16,54 @@ if ( window.top != window.self ) { ...@@ -16,33 +16,54 @@ if ( window.top != window.self ) {
} }
$wpt.fn.wptouchFadeToggle = function( speed, easing, callback ) { $wpt.fn.wptouchFadeToggle = function( speed, easing, callback ) {
return this.animate( {opacity: 'toggle'}, speed, easing, callback ); return this.animate( {
opacity: 'toggle'
}, speed, easing, callback );
}; };
/**
* @description Cookie 相关操作
* @static
*/
var Cookie = { var Cookie = {
/**
* @description 读取 cookie
* @param {String} name cookie key
* @returns {String} 对应 key 的值,如 key 不存在则返回 ""
*/
readCookie: function (name) { readCookie: function (name) {
var nameEQ = name + "="; var nameEQ = name + "=";
var ca = document.cookie.split(';'); var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) { for(var i=0;i < ca.length;i++) {
var c = ca[i]; var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length); while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); if (c.indexOf(nameEQ) == 0) return decodeURIComponent(c.substring(nameEQ.length,c.length));
} }
return ""; return "";
}, },
/**
* @description 清除 Cookie
* @param {String} name 清除 key 为 name 的该条 Cookie
*/
eraseCookie: function (name) { eraseCookie: function (name) {
this.createCookie(name,"",-1); this.createCookie(name,"",-1);
}, },
createCookie: function (name,value,days) { /**
* @description 创建 Cookie
* @param {String} name 每条 Cookie 唯一的 key
* @param {String} value 每条 Cookie 对应的值,将被 UTF-8 编码
* @param {Int} days Cookie 保存时间
*/
createCookie: function (name, value, days) {
var expires = ""; var expires = "";
if (days) { if (days) {
var date = new Date(); var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000)); date.setTime(date.getTime()+(days*24*60*60*1000));
expires = "; expires="+date.toGMTString(); expires = "; expires="+date.toGMTString();
} }
document.cookie = name+"="+value+expires+"; path=/"; document.cookie = name+"="+encodeURIComponent(value)+expires+"; path=/";
} }
}; };
function wptouch_switch_confirmation(skin, e ) { function wptouch_switch_confirmation(skin, e ) {
...@@ -65,10 +86,14 @@ function wptouch_switch_confirmation(skin, e ) { ...@@ -65,10 +86,14 @@ function wptouch_switch_confirmation(skin, e ) {
} }
if ( $wpt( '#prowl-success' ).length ) { if ( $wpt( '#prowl-success' ).length ) {
setTimeout( function() { $wpt( '#prowl-success' ).fadeOut( 350 ); }, 5250 ); setTimeout( function() {
$wpt( '#prowl-success' ).fadeOut( 350 );
}, 5250 );
} }
if ( $wpt( '#prowl-fail' ).length ) { if ( $wpt( '#prowl-fail' ).length ) {
setTimeout( function() { $wpt( '#prowl-fail' ).fadeOut( 350 ); }, 5250 ); setTimeout( function() {
$wpt( '#prowl-fail' ).fadeOut( 350 );
}, 5250 );
} }
$wpt(function() { $wpt(function() {
...@@ -132,7 +157,9 @@ function doWPtouchReady() { ...@@ -132,7 +157,9 @@ function doWPtouchReady() {
} }
$wpt( document ).ready( function() { doWPtouchReady(); } ); $wpt( document ).ready( function() {
doWPtouchReady();
} );
/*! /*!
* FitVids 1.0 * FitVids 1.0
...@@ -142,14 +169,14 @@ $wpt( document ).ready( function() { doWPtouchReady(); } ); ...@@ -142,14 +169,14 @@ $wpt( document ).ready( function() { doWPtouchReady(); } );
* Date: Thu Sept 01 18:00:00 2011 -0500 * Date: Thu Sept 01 18:00:00 2011 -0500
*/ */
(function( $ ){ (function( $ ){
$.fn.fitVids = function( options ) { $.fn.fitVids = function( options ) {
var settings = { var settings = {
customSelector: null customSelector: null
} }
var div = document.createElement('div'), var div = document.createElement('div'),
ref = document.getElementsByTagName('base')[0] || document.getElementsByTagName('script')[0]; ref = document.getElementsByTagName('base')[0] || document.getElementsByTagName('script')[0];
div.className = 'fit-vids-style'; div.className = 'fit-vids-style';
div.innerHTML = '&shy;<style> \ div.innerHTML = '&shy;<style> \
.fluid-width-video-wrapper { \ .fluid-width-video-wrapper { \
width: 100%; \ width: 100%; \
position: relative; \ position: relative; \
...@@ -166,29 +193,29 @@ width: 100%; \ ...@@ -166,29 +193,29 @@ width: 100%; \
height: 100%; \ height: 100%; \
} \ } \
</style>'; </style>';
ref.parentNode.insertBefore(div,ref); ref.parentNode.insertBefore(div,ref);
if ( options ) { if ( options ) {
$.extend( settings, options ); $.extend( settings, options );
} }
return this.each(function(){ return this.each(function(){
var selectors = [ var selectors = [
"iframe[src^='http://player.vimeo.com']", "iframe[src^='http://player.vimeo.com']",
"iframe[src^='http://www.youtube.com']", "iframe[src^='http://www.youtube.com']",
"iframe[src^='http://www.kickstarter.com']", "iframe[src^='http://www.kickstarter.com']",
"object", "object",
"embed" "embed"
]; ];
if (settings.customSelector) { if (settings.customSelector) {
selectors.push(settings.customSelector); selectors.push(settings.customSelector);
} }
var $allVideos = $(this).find(selectors.join(',')); var $allVideos = $(this).find(selectors.join(','));
$allVideos.each(function(){ $allVideos.each(function(){
var $this = $(this), var $this = $(this),
height = this.tagName == 'OBJECT' ? $this.attr('height') : $this.height(), height = this.tagName == 'OBJECT' ? $this.attr('height') : $this.height(),
aspectRatio = height / $this.width(); aspectRatio = height / $this.width();
$this.wrap('<div class="fluid-width-video-wrapper" />').parent('.fluid-width-video-wrapper').css('padding-top', (aspectRatio * 100)+"%"); $this.wrap('<div class="fluid-width-video-wrapper" />').parent('.fluid-width-video-wrapper').css('padding-top', (aspectRatio * 100)+"%");
$this.removeAttr('height').removeAttr('width'); $this.removeAttr('height').removeAttr('width');
}); });
}); });
} }
})( jQuery ); })( jQuery );
\ No newline at end of file
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
B3log Solo B3log Solo
</a> </a>
<span class="left">&nbsp;${onlineVisitor1Label}${onlineVisitorCnt}</span> <span class="left">&nbsp;${onlineVisitor1Label}${onlineVisitorCnt}</span>
<span class="right" id="admin"> <span class="right" id="admin" data-login="${isLoggedIn?string}">
<#if isLoggedIn> <#if isLoggedIn>
<span>${userName}</span> <span>${userName}</span>
<#if isAdmin> <#if isAdmin>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment