修正撰写页识别错误

This commit is contained in:
joyqi 2013-10-20 01:53:35 +08:00
parent b9fa6ec7a2
commit 6c3ef6da05
4 changed files with 11 additions and 9 deletions

View File

@ -126,10 +126,12 @@ $(document).ready(function() {
idInput = $('input[name=cid]'),
autoSave = $('#auto-save-message'),
autoSaveOnce = !!idInput.val(),
lastSaveTime = null;
lastSaveTime = null,
cid = null;
function autoSaveListener () {
setInterval(function () {
idInput.val(cid);
var data = form.serialize();
if (savedData != data && !locked) {
@ -139,7 +141,7 @@ $(document).ready(function() {
$.post(formAction + '?do=save', data, function (o) {
savedData = data;
lastSaveTime = o.time;
idInput.val(o.cid);
cid = o.cid;
autoSave.text('<?php _e('内容已经保存'); ?>' + ' (' + o.time + ')').effect('highlight', 1000);
locked = false;
});

View File

@ -16,13 +16,13 @@ Typecho_Widget::widget('Widget_Contents_Page_Edit')->to($page);
Typecho_Common::url('/action/contents-page-edit?do=deleteDraft&cid=' . $page->cid, $options->index)); ?></cite>
<?php endif; ?>
<p class="title"><input type="text" id="title" name="title" value="<?php echo htmlspecialchars($page->title); ?>" placeholder="<?php _e('标题'); ?>" class="w-100 text title" /></p>
<p class="title"><input type="text" id="title" name="title" autocomplete="off" value="<?php echo htmlspecialchars($page->title); ?>" placeholder="<?php _e('标题'); ?>" class="w-100 text title" /></p>
<?php $permalink = Typecho_Common::url($options->routingTable['page']['url'], $options->index);
list ($scheme, $permalink) = explode(':', $permalink, 2);
$permalink = ltrim($permalink, '/');
?>
<?php if (preg_match("/\[slug:?[_0-9a-z-:]*\]/i", $permalink)):
$input = '<input type="text" id="slug" name="slug" value="' . htmlspecialchars($page->slug) . '" class="mono" />';
$input = '<input type="text" id="slug" name="slug" autocomplete="off" value="' . htmlspecialchars($page->slug) . '" class="mono" />';
?>
<p class="mono url-slug"><?php echo preg_replace("/\[slug:?[_0-9a-z-:]*\]/i", $input, $permalink); ?></p>
<?php endif; ?>

View File

@ -16,13 +16,13 @@ Typecho_Widget::widget('Widget_Contents_Post_Edit')->to($post);
Typecho_Common::url('/action/contents-post-edit?do=deleteDraft&cid=' . $post->cid, $options->index)); ?></cite>
<?php endif; ?>
<p class="title"><input type="text" id="title" name="title" value="<?php echo htmlspecialchars($post->title); ?>" placeholder="<?php _e('标题'); ?>" class="w-100 text title" /></p>
<p class="title"><input type="text" id="title" name="title" autocomplete="off" value="<?php echo htmlspecialchars($post->title); ?>" placeholder="<?php _e('标题'); ?>" class="w-100 text title" /></p>
<?php $permalink = Typecho_Common::url($options->routingTable['post']['url'], $options->index);
list ($scheme, $permalink) = explode(':', $permalink, 2);
$permalink = ltrim($permalink, '/');
?>
<?php if (preg_match("/\[slug:?[_0-9a-z-:]*\]/i", $permalink)):
$input = '<input type="text" id="slug" name="slug" value="' . htmlspecialchars($post->slug) . '" class="mono" />';
$input = '<input type="text" id="slug" name="slug" autocomplete="off" value="' . htmlspecialchars($post->slug) . '" class="mono" />';
?>
<p class="mono url-slug"><?php echo preg_replace("/\[slug:?[_0-9a-z-:]*\]/i", $input, $permalink); ?></p>
<?php endif; ?>

View File

@ -81,11 +81,11 @@ class Widget_Contents_Post_Edit extends Widget_Abstract_Contents implements Widg
protected function getCreated()
{
$created = $this->options->gmtTime;
if (isset($this->request->created)) {
if (!empty($this->request->created)) {
$created = $this->request->created;
} else if (isset($this->request->date)) {
} else if (!empty($this->request->date)) {
$created = strtotime($this->request->date) - $this->options->timezone + $this->options->serverTimezone;
} else if (isset($this->request->year) && isset($this->request->month) && isset($this->request->day)) {
} else if (!empty($this->request->year) && !empty($this->request->month) && !empty($this->request->day)) {
$second = intval($this->request->get('sec', date('s')));
$min = intval($this->request->get('min', date('i')));
$hour = intval($this->request->get('hour', date('H')));