📄 post_editor.js
字号:
/*
[Discuz!] (C)2001-2007 Comsenz Inc.
This is NOT a freeware, use is title to license terms
$RCSfile: post_editor.js,v $
$Revision: 1.10 $
$Date: 2007/06/25 21:47:26 $
*/
function checklength(theform) {
var message = bbinsert && wysiwyg ? html2bbcode(getEditorContents()) : (!theform.parseurloff.checked ? parseurl(theform.message.value) : theform.message.value);
var showmessage = postmaxchars != 0 ? lang['board_allowed'] + ': ' + postminchars + ' ' + lang['lento'] + ' ' + postmaxchars + ' ' + lang['bytes'] : '';
alert('\n' + lang['post_curlength'] + ': ' + mb_strlen(message) + ' ' + lang['bytes'] + '\n\n' + showmessage);
}
function postsubmit(theform, previewpost) {
if(!previewpost) {
theform.replysubmit ? theform.replysubmit.disabled = true : theform.topicsubmit.disabled = true;
theform.submit();
}
}
function clearcontent() {
if(wysiwyg && bbinsert) {
editdoc.body.innerHTML = is_moz ? '<br />' : '';
} else {
textobj.value = '';
}
}
function resizeEditor(change) {
var editorbox = bbinsert ? editbox : textobj;
var newheight = parseInt(editorbox.style.height, 10) + change;
if(newheight >= 100) {
editorbox.style.height = newheight + 'px';
}
}
function prohibit(name){
$(name).oncontextmenu=function(){return false;}
$(name).onselectstart=function(){return false;}
$(name).onmousedown=function(){
if(event.button==2)return false;
}
$(name).onkeydown=function(){
if(event.ctrlKey)return false;
}
}
function iframeAutoFit()
{
try
{
if(window!=parent)
{
var a = parent.document.getElementsByTagName("IFRAME");
for(var i=0; i<a.length; i++) //author:Momoca
{
if(a[i].contentWindow==window)
{
var h1=0, h2=0, d=document, dd=d.documentElement;
a[i].parentNode.style.height = a[i].offsetHeight +"px";
a[i].style.height = "10px";
if(dd && dd.scrollHeight) h1=dd.scrollHeight;
if(d.body) h2=d.body.scrollHeight;
var h=Math.max(h1, h2);
if(document.all) {h += 0;}
if(window.opera) {h += 1;}
a[i].style.height = a[i].parentNode.style.height = h +"px";
}
}
parent.document.getElementById($_get('input')).value=$('posteditor_textarea').value;
}
}
catch (ex){}
}
if(window.attachEvent)
{
window.attachEvent("onload", iframeAutoFit);
//window.attachEvent("onresize", iframeAutoFit);
}
else if(window.addEventListener)
{
window.addEventListener('load', iframeAutoFit, false);
//window.addEventListener('resize', iframeAutoFit, false);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -