Commit e3088d67 authored by Vanessa's avatar Vanessa

fixed #129, fixed #130

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