mirror of
https://github.com/typecho/typecho.git
synced 2025-03-24 20:09:47 +01:00
Merge branch 'master' of https://github.com/typecho/typecho-replica
Conflicts: admin/write-post.php
This commit is contained in:
commit
1dfcba6188
@ -1595,6 +1595,8 @@ ul.typecho-list-notable li .loading {
|
||||
}
|
||||
|
||||
.typecho-post-area #auto-save-message {
|
||||
display: block;
|
||||
margin-top: 0.5em;
|
||||
color: #999;
|
||||
font-size: .92857em;
|
||||
}
|
||||
@ -2140,6 +2142,8 @@ ul.typecho-list-notable li .loading {
|
||||
}
|
||||
#ui-datepicker-div .ui-datepicker-close { float: right; }
|
||||
|
||||
.ui-effects-transfer { border: 2px dotted #ccc; }
|
||||
|
||||
|
||||
/*
|
||||
* Jquery Tokeninput
|
||||
|
1508
admin/javascript/jquery-ui.js
vendored
1508
admin/javascript/jquery-ui.js
vendored
File diff suppressed because it is too large
Load Diff
@ -186,9 +186,9 @@ $.TokenList = function (input, url_or_data, settings) {
|
||||
|
||||
// Create a new text input an attach keyup events
|
||||
var input_box = $("<input type=\"text\" autocomplete=\"off\">")
|
||||
// .css({
|
||||
// outline: "none"
|
||||
// })
|
||||
.css({
|
||||
outline: "none"
|
||||
})
|
||||
.attr("id", settings.idPrefix + input.id)
|
||||
.focus(function () {
|
||||
if (settings.tokenLimit === null || settings.tokenLimit !== token_count) {
|
||||
|
@ -885,3 +885,112 @@ $.fn.extend({
|
||||
|
||||
})(jQuery);
|
||||
|
||||
/*
|
||||
* jQuery plugin: fieldSelection - v0.1.1 - last change: 2006-12-16
|
||||
* (c) 2006 Alex Brem <alex@0xab.cd> - http://blog.0xab.cd
|
||||
*/
|
||||
|
||||
jQuery.fn.extend({
|
||||
getSelection: function () {
|
||||
|
||||
var e = this.get(0);
|
||||
if (!e) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
/* mozilla / dom 3.0 */
|
||||
('selectionStart' in e && function() {
|
||||
var l = e.selectionEnd - e.selectionStart;
|
||||
return { start: e.selectionStart, end: e.selectionEnd, length: l, text: e.value.substr(e.selectionStart, l) };
|
||||
}) ||
|
||||
|
||||
/* other */
|
||||
(window.getSelection() && function () {
|
||||
var selection = window.getSelection(), range = selection.getRangeAt(0);
|
||||
|
||||
return { start: range.startOffset, end: range.endOffset, length: range.endOffset - range.startOffset, text: range.toString()};
|
||||
|
||||
}) ||
|
||||
|
||||
/* exploder */
|
||||
(document.selection && function() {
|
||||
|
||||
e.focus();
|
||||
|
||||
var r = document.selection.createRange();
|
||||
if (r === null) {
|
||||
return { start: 0, end: e.value.length, length: 0 }
|
||||
}
|
||||
|
||||
var re = e.createTextRange();
|
||||
var rc = re.duplicate();
|
||||
re.moveToBookmark(r.getBookmark());
|
||||
rc.setEndPoint('EndToStart', re);
|
||||
|
||||
return { start: rc.text.length, end: rc.text.length + r.text.length, length: r.text.length, text: r.text };
|
||||
}) ||
|
||||
|
||||
/* browser not supported */
|
||||
function() { return null; }
|
||||
|
||||
)();
|
||||
},
|
||||
|
||||
setSelection: function (start, end) {
|
||||
var e = this.get(0);
|
||||
if (!e) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($.browser.opera && $.browser.version >= 9.5 && len == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (e.setSelectionRange) {
|
||||
e.focus();
|
||||
e.setSelectionRange(start, end);
|
||||
} else if (e.createTextRange) {
|
||||
var range = e.createTextRange();
|
||||
range.collapse(true);
|
||||
range.moveEnd('character', end);
|
||||
range.moveStart('character', start);
|
||||
range.select();
|
||||
}
|
||||
},
|
||||
|
||||
replaceSelection: function () {
|
||||
|
||||
var e = this.get(0);
|
||||
if (!e) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var text = arguments[0] || '';
|
||||
|
||||
return (
|
||||
|
||||
/* mozilla / dom 3.0 */
|
||||
('selectionStart' in e && function() {
|
||||
e.value = e.value.substr(0, e.selectionStart) + text + e.value.substr(e.selectionEnd, e.value.length);
|
||||
return this;
|
||||
}) ||
|
||||
|
||||
/* exploder */
|
||||
(document.selection && function() {
|
||||
e.focus();
|
||||
document.selection.createRange().text = text;
|
||||
return this;
|
||||
}) ||
|
||||
|
||||
/* browser not supported */
|
||||
function() {
|
||||
e.value += text;
|
||||
return jQuery(e);
|
||||
}
|
||||
|
||||
)();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -72,7 +72,7 @@ $stat = Typecho_Widget::widget('Widget_Stat');
|
||||
echo '<em>(' . _t('密码保护') . ')</em>';
|
||||
}
|
||||
?>
|
||||
<?php if ('#' != $pages->permalink): ?>
|
||||
<?php if ('page_draft' != $pages->type): ?>
|
||||
<a class="right" href="<?php $pages->permalink(); ?>"><img src="<?php $options->adminUrl('images/link.png'); ?>" title="<?php _e('浏览 %s', htmlspecialchars($pages->title)); ?>" width="16" height="16" alt="view" /></a>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
|
@ -81,7 +81,7 @@ $stat = Typecho_Widget::widget('Widget_Stat');
|
||||
echo '<em>(' . _t('密码保护') . ')</em>';
|
||||
}
|
||||
?>
|
||||
<?php if ('#' != $posts->permalink): ?>
|
||||
<?php if ('post_draft' != $posts->type): ?>
|
||||
<a class="right" href="<?php $posts->permalink(); ?>"><img src="<?php $options->adminUrl('images/link.png'); ?>" title="<?php _e('浏览 %s', htmlspecialchars($posts->title)); ?>" width="16" height="16" alt="view" /></a>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
|
@ -77,6 +77,7 @@ $(document).ready(function() {
|
||||
t.width($('.token-input-list').outerWidth() - offset);
|
||||
});
|
||||
|
||||
// 缩略名自适应宽度
|
||||
var slug = $('#slug'), sw = slug.width();
|
||||
|
||||
if (slug.val().length > 0) {
|
||||
@ -93,6 +94,52 @@ $(document).ready(function() {
|
||||
}
|
||||
}).width();
|
||||
|
||||
// 自动保存
|
||||
<?php if ($options->autoSave): ?>
|
||||
var savedData = null, locked = false,
|
||||
form = $('form[name=write_post],form[name=write_page]'),
|
||||
formAction = form.attr('action'),
|
||||
idInput = $('input[name=cid]'),
|
||||
autoSave = $('#auto-save-message'),
|
||||
autoSaveOnce = !!idInput.val(),
|
||||
lastSaveTime = null;
|
||||
|
||||
function autoSaveListener () {
|
||||
setInterval(function () {
|
||||
var data = form.serialize();
|
||||
|
||||
if (savedData != data) {
|
||||
savedData = data;
|
||||
locked = true;
|
||||
|
||||
autoSave.text('<?php _e('正在保存'); ?>');
|
||||
$.post(formAction + '?do=save', data, function (o) {
|
||||
lastSaveTime = o.time;
|
||||
idInput.val(o.cid);
|
||||
autoSave.text('<?php _e('内容已经保存'); ?>' + ' (' + o.time + ')').effect('highlight', '#AACB36', 1000);
|
||||
locked = false;
|
||||
});
|
||||
}
|
||||
}, 10000);
|
||||
}
|
||||
|
||||
if (autoSaveOnce) {
|
||||
savedData = form.serialize();
|
||||
autoSaveListener();
|
||||
}
|
||||
|
||||
$('#text').bind('input propertychange', function () {
|
||||
if (!locked) {
|
||||
autoSave.text('<?php _e('内容尚未保存'); ?>' + (lastSaveTime ? ' (<?php _e('上次保存时间'); ?>: ' + lastSaveTime + ')' : ''));
|
||||
}
|
||||
|
||||
if (!autoSaveOnce) {
|
||||
autoSaveOnce = true;
|
||||
autoSaveListener();
|
||||
}
|
||||
});
|
||||
<?php endif; ?>
|
||||
|
||||
// 高级选项控制
|
||||
$('#advance-panel-btn').click(function() {
|
||||
$('#advance-panel').toggle();
|
||||
|
@ -44,16 +44,14 @@ Typecho_Widget::widget('Widget_Contents_Post_Edit')->to($post);
|
||||
</p>
|
||||
<p>
|
||||
<textarea style="height: <?php $options->editorSize(); ?>px" autocomplete="off" id="text" name="text" class="w-100 mono"><?php echo htmlspecialchars($post->text); ?></textarea>
|
||||
<span id="auto-save-message"></span>
|
||||
</p>
|
||||
|
||||
<?php include 'file-upload.php'; ?>
|
||||
|
||||
<?php Typecho_Plugin::factory('admin/write-post.php')->content($post); ?>
|
||||
<p class="submit">
|
||||
<span class="left">
|
||||
</span>
|
||||
|
||||
<span class="right">
|
||||
<span id="auto-save-message">1 分钟前保存 </span>
|
||||
<input type="hidden" name="cid" value="<?php $post->cid(); ?>" />
|
||||
<button type="submit" name="do" value="save" id="btn-save"><?php _e('保存草稿'); ?></button>
|
||||
<button type="submit" name="do" value="publish" class="primary" id="btn-submit"><?php _e('发布文章'); ?></button>
|
||||
|
@ -91,9 +91,9 @@ class Widget_Contents_Page_Edit extends Widget_Contents_Post_Edit implements Wid
|
||||
if ($this->request->isAjax()) {
|
||||
$created = new Typecho_Date($this->options->gmtTime);
|
||||
$this->response->throwJson(array(
|
||||
'success' => 1,
|
||||
'message' => _t('文章保存于 %s', $created->format('H:i A')),
|
||||
'cid' => $this->cid
|
||||
'success' => 1,
|
||||
'time' => $created->format('H:i:s A'),
|
||||
'cid' => $this->cid
|
||||
));
|
||||
} else {
|
||||
/** 设置提示信息 */
|
||||
|
@ -588,9 +588,9 @@ class Widget_Contents_Post_Edit extends Widget_Abstract_Contents implements Widg
|
||||
if ($this->request->isAjax()) {
|
||||
$created = new Typecho_Date($this->options->gmtTime);
|
||||
$this->response->throwJson(array(
|
||||
'success' => 1,
|
||||
'message' => _t('文章保存于 %s', $created->format('H:i A')),
|
||||
'cid' => $this->cid
|
||||
'success' => 1,
|
||||
'time' => $created->format('H:i:s A'),
|
||||
'cid' => $this->cid
|
||||
));
|
||||
} else {
|
||||
/** 设置提示信息 */
|
||||
|
Loading…
x
Reference in New Issue
Block a user