如,在write-post.php中的代码:
代码: 全选
<script type="text/javascript">
(function () {
window.addEvent('domready', function() {
/** 绑定按钮 */
$(document).getElement('span.advance').addEvent('click', function () {
Typecho.toggle('#advance-panel', this,
'<?php _e('收起高级选项'); ?>', '<?php _e('展开高级选项'); ?>');
});
$(document).getElement('span.attach').addEvent('click', function () {
Typecho.toggle('#upload-panel', this,
'<?php _e('收起附件'); ?>', '<?php _e('展开附件'); ?>');
});
$('btn-save').removeProperty('disabled');
$('btn-submit').removeProperty('disabled');
$('btn-save').addEvent('click', function (e) {
this.getParent('span').addClass('loading');
this.setProperty('disabled', true);
$(document).getElement('input[name=draft]').set('value', 1);
$(document).getElement('form[name=write_post]').submit();
});
$('btn-submit').addEvent('click', function (e) {
this.getParent('span').addClass('loading');
this.setProperty('disabled', true);
$(document).getElement('input[name=draft]').set('value', 0);
});
/** 标签自动完成 */
var _tags = [<?php while ($tags->next()) { echo '"' . str_replace('"', '"', $tags->name) . '"'
. ($tags->sequence != $tags->length ? ',' : NULL); } ?>];
/** 自动完成 */
Typecho.autoComplete('#tags', _tags);
});
})();
</script>