📄 post.js
字号:
content = content.replace(/(<(meta|iframe|frame|span|tbody|layer)[^>]*>|<\/(iframe|frame|meta|span|tbody|layer)>)/gi, "");
content = content.replace(/<\\?\?xml[^>]*>/gi, "") ;
content = content.replace(/o:/gi, "");
content = content.replace(/ /gi, " ");
return content;
}
function FormatText(command,option){
IframeID.document.execCommand(command,true,option);
IframeID.focus();
}
function CheckLength(){
alert("最大字符为 "+50000+ " 字节\n您的内容已有 "+IframeID.document.body.innerHTML.length+" 字节");
}
function emoticon(theSmilie){
frames.HtmlEditor.focus();
sel=frames.HtmlEditor.document.selection.createRange();
sel.pasteHTML("<img src=images/Emotions/1/R"+theSmilie+".gif>");
}
function DoTitle(addTitle) {
var revisedTitle;var currentTitle = document.TM_form.topic.value;revisedTitle = addTitle+currentTitle;document.TM_form.topic.value=revisedTitle;document.TM_form.topic.focus();
}
function CheckForm(form){
TM_form.content.value=IframeID.document.body.innerHTML;
MessageLength=IframeID.document.body.innerHTML.length;
if(MessageLength<2)
{
alert("文章内容不能小于2个字符!");return false;
}
if(MessageLength>50000)
{
alert("文章内容不能超过50000个字符!");return false;
}
//document.TM_form.submit.disabled = true;
}
function Gopreview(){
document.preview.content.value=IframeID.document.body.innerHTML;
window.open('', 'preview_page', 'resizable,scrollbars,width=750,height=450');
document.preview.submit()
}
function BackColor()
{
var arr = showModalDialog("images/post/selcolor.htm", "", "dialogWidth:18em; dialogHeight:17.5em; status:0;help:0");
if (arr != null) FormatText('BackColor', arr);
else frames.HtmlEditor.focus();
}
function foreColor()
{
var arr = showModalDialog("images/post/selcolor.htm", "", "dialogWidth:18em; dialogHeight:17.5em; status:0;help:0");
if (arr != null) FormatText('forecolor', arr);
else frames.HtmlEditor.focus();
}
//替换内容
function replace()
{
var arr = showModalDialog("images/post/replace.html", "", "dialogWidth:22em;dialogHeight:10em;status:0;help:0");
if (arr != null){
var ss;
ss = arr.split("*")
a = ss[0];
b = ss[1];
i = ss[2];
con = IframeID.document.body.innerHTML;
if (i == 1)
{
con = bbsxp_rCode(con,a,b,true);
}else{
con = bbsxp_rCode(con,a,b);
}
IframeID.document.body.innerHTML = con;
}
else IframeID.focus();
}
function bbsxp_rCode(s,a,b,i){
a = a.replace("?","\\?");
if (i==null)
{
var r = new RegExp(a,"gi");
}else if (i) {
var r = new RegExp(a,"g");
}
else{
var r = new RegExp(a,"gi");
}
return s.replace(r,b);
}
//替换内容结束
function img(){
url=prompt("请输入图片文件地址:","http://");
if(!url || url=="http://") return;
frames.HtmlEditor.focus();
sel=frames.HtmlEditor.document.selection.createRange();
sel.pasteHTML("[img]"+url+"[/img]");
}
function myem(){
var arr = showModalDialog("images/post/Emotion.htm", "", "dialogWidth:33em; dialogHeight:15em; status:0;help:0");
if (arr != null){
frames.HtmlEditor.focus()
sel=frames.HtmlEditor.document.selection.createRange();
sel.pasteHTML(arr);
}
}
function RealPlay(){
var arr = showModalDialog("images/post/RealPlay.htm", "", "dialogWidth:22em; dialogHeight:10.5em; status:0;help:0");
if (arr != null){
frames.HtmlEditor.focus()
sel=frames.HtmlEditor.document.selection.createRange();
sel.pasteHTML(arr);
}
}
function MediaPlayer(){
var arr = showModalDialog("images/post/MediaPlayer.htm", "", "dialogWidth:22em; dialogHeight:10.5em; status:0;help:0");
if (arr != null){
frames.HtmlEditor.focus()
sel=frames.HtmlEditor.document.selection.createRange();
sel.pasteHTML(arr);
}
}
function flash(){
var arr = showModalDialog("images/post/flash.htm", "", "dialogWidth:22em; dialogHeight:9em; status:0;help:0");
if (arr != null){
frames.HtmlEditor.focus()
sel=frames.HtmlEditor.document.selection.createRange();
sel.pasteHTML(arr);
}
}
function doZoom( sizeCombo ){
if (sizeCombo.value != null || sizeCombo.value != ""){
var z = IframeID.document.body.style;
}
z.zoom = sizeCombo.value + "%" ;
}
function TM_Size(num)
{
var obj=document.getElementById("HtmlEditor");
if (parseInt(obj.offsetHeight)+num>=150) {
obj.height = (parseInt(obj.offsetHeight) + num);
}
if (num>0)
{
obj.width="100%";
}
}
function fortable(){
IframeID.focus();
var arr = showModalDialog("images/post/table.html", window, "dialogWidth:22em; dialogHeight:19em; status:0; help:0;scroll:no;");
if (arr){
IframeID.document.body.innerHTML+=arr;
}
IframeID.focus();
}
function CleanCode(){
var editor=IframeID;
editor.focus();
var body = editor.document.body;
for (var index = 0; index < body.all.length; index++) {
tag = body.all[index];
tag.removeAttribute("className","",0);
tag.removeAttribute("style","",0);
}
var html = editor.document.body.innerHTML;
html = html.replace(/\<p>/gi,"[$p]");
html = html.replace(/\<\/p>/gi,"[$\/p]");
html = html.replace(/\<br>/gi,"[$br]");
html = html.replace(/\<[^>]*>/g,"");
html = html.replace(/\[\$p\]/gi,"<p>");
html = html.replace(/\[\$\/p\]/gi,"<\/p>");
html = html.replace(/\[\$br\]/gi,"<br>");
editor.document.body.innerHTML = html;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -