📄 post.js
字号:
Array('YuZi_SPECIALCHAR', 'specialchar.gif', '插入特殊字符'),
Array('YuZi_ICON', 'emoticons.gif', '插入表情'),
Array('YuZi_TABLE', 'table.gif', '插入表格'),
Array('YuZi_IMAGE', 'image.gif', '插入图片'),
Array('YuZi_Media', 'Media.gif', '插入 FLASH、MediaPlayer、RealPlayer 文件'),
Array('YuZi_LINK', 'link.gif', '创建超级连接'),
Array('YuZi_UNLINK', 'unlink.gif', '删除超级连接'),
Array('YuZi_Delete','delete.gif','删除当前选中区域'),
Array('InsertInputText','InputText.gif','插入输入框'),
Array('InsertTextArea','TextArea.gif','插入文字输入区'),
Array('InsertInputRadio','InputRadio.gif','插入单选按钮'),
Array('InsertCheckbox','Checkbox.gif','插入复选框'),
Array('InsertSelectDropdown','SelectDropdown.gif','插入下拉框'),
Array('InsertButton','Button.gif','插入按钮'),
Array('YuZi_PRINT', 'print.gif', '打印')
);
var YuZi_TITLE_TABLE = Array(
Array('H1', YuZi_LANG['SUBJECT'] + ' 1'),
Array('H2', YuZi_LANG['SUBJECT'] + ' 2'),
Array('H3', YuZi_LANG['SUBJECT'] + ' 3'),
Array('H4', YuZi_LANG['SUBJECT'] + ' 4'),
Array('H5', YuZi_LANG['SUBJECT'] + ' 5'),
Array('H6', YuZi_LANG['SUBJECT'] + ' 6')
);
var YuZi_FONT_SIZE = Array(
Array(1,'8pt'),
Array(2,'10pt'),
Array(3,'12pt'),
Array(4,'14pt'),
Array(5,'18pt'),
Array(6,'24pt'),
Array(7,'36pt')
);
var YuZi_POPUP_MENU_TABLE = Array(
"YuZi_TITLE", "YuZi_FONTNAME", "YuZi_FONTSIZE", "YuZi_TEXTCOLOR", "YuZi_BGCOLOR",
"YuZi_TABLE", "YuZi_HR", "YuZi_ICON", "YuZi_SPECIALCHAR",
"YuZi_Replace", "YuZi_IMAGE", "YuZi_Media", "YuZi_LINK"
);
var YuZi_COLOR_TABLE = Array(
"#000000","#993300","#333300","#003300","#003366","#000080","#333399","#333333",
"#800000","#FF6600","#808000","#008000","#008080","#0000FF","#666699","#808080",
"#FF0000","#FF9900","#99CC00","#339966","#33CCCC","#3366FF","#800080","#999999",
"#FF00FF","#FFCC00","#FFFF00","#00FF00","#00FFFF","#00CCFF","#993366","#C0C0C0",
"#FF99CC","#FFCC99","#FFFF99","#CCFFCC","#CCFFFF","#99CCFF","#CC99FF","#FFFFFF"
);
var YuZi_OBJ_NAME;
var YuZi_SELECTION;
var YuZi_RANGE;
var YuZi_RANGE_TEXT;
var YuZi_EDITFORM_DOCUMENT;
var YuZi_Replace_DOCUMENT;
var YuZi_IMAGE_DOCUMENT;
var YuZi_Media_DOCUMENT;
var YuZi_LINK_DOCUMENT;
var YuZi_BROWSER;
var YuZi_TOOLBAR_ICON;
//浏览器类型
function BBSXPGetBrowser()
{
var browser = '';
var agentInfo = navigator.userAgent.toLowerCase();
if (agentInfo.indexOf("msie") > -1) {
var re = new RegExp("msie\\s?([\\d\\.]+)","ig");
var arr = re.exec(agentInfo);
if (parseInt(RegExp.$1) >= 5.5) {
browser = 'IE';
}
} else if (agentInfo.indexOf("firefox") > -1) {
browser = 'FF';
} else if (agentInfo.indexOf("netscape") > -1) {
var temp1 = agentInfo.split(' ');
var temp2 = temp1[temp1.length-1].split('/');
if (parseInt(temp2[1]) >= 7) {
browser = 'NS';
}
} else if (agentInfo.indexOf("gecko") > -1) {
browser = 'ML';
} else if (agentInfo.indexOf("opera") > -1) {
var temp1 = agentInfo.split(' ');
var temp2 = temp1[0].split('/');
if (parseInt(temp2[1]) >= 9) {
browser = 'OPERA';
}
}
return browser;
}
function BBSXPHtmlToXhtml(str)
{
str = str.replace(/<br.*?>/gi, "<br />");
str = str.replace(/(<hr\s+[^>]*[^\/])(>)/gi, "$1 />");
str = str.replace(/(<img\s+[^>]*[^\/])(>)/gi, "$1 />");
str = str.replace(/(<\w+)(.*?>)/gi, function ($0,$1,$2) {
return($1.toLowerCase() + BBSXPConvertAttribute($2));
}
);
str = str.replace(/(<\/\w+>)/gi, function ($0,$1) {
return($1.toLowerCase());
}
);
return str;
}
function BBSXPConvertAttribute(str)
{
if (YuZi_SAFE_MODE == true) {
str = BBSXPClearAttributeScriptTag(str);
}
return str;
}
function BBSXPClearAttributeScriptTag(str)
{
var re = new RegExp("(\\son[a-z]+=)[\"']?[^>]*?[^\\\\\>][\"']?([\\s>])","ig");
str = str.replace(re, function ($0,$1,$2) {
return($1.toLowerCase() + "\"\"" + $2);
}
);
return str;
}
function BBSXPClearScriptTag(str)
{
if (YuZi_SAFE_MODE == false) {
return str;
}
str = str.replace(/<(script.*?)>/gi, "[$1]");
str = str.replace(/<\/script>/gi, "[/script]");
return str;
}
function BBSXPHtmlentities(str)
{
str = str.replace(/&/g,'&');
str = str.replace(/</g,'<');
str = str.replace(/>/g,'>');
str = str.replace(/"/g,'"');
return str;
}
function BBSXPDisplayMenu(cmd)
{
BBSXPEditorForm.focus();
BBSXPSelection();
BBSXPDisableMenu();
var Top = ie_y(document.getElementById(cmd))+25;
var Left = ie_x(document.getElementById(cmd));
document.getElementById('POPUP_'+cmd).style.top = Top.toString(10) + 'px';
document.getElementById('POPUP_'+cmd).style.left = Left.toString(10) + 'px';
document.getElementById('POPUP_'+cmd).style.display = 'block';
}
function BBSXPDisableMenu()
{
for (i = 0; i < YuZi_POPUP_MENU_TABLE.length; i++) {
document.getElementById('POPUP_'+YuZi_POPUP_MENU_TABLE[i]).style.display = 'none';
}
}
function BBSXPReloadIframe()
{
var str = '';
str += BBSXPPopupMenu('YuZi_Replace');
str += BBSXPPopupMenu('YuZi_IMAGE');
str += BBSXPPopupMenu('YuZi_Media');
document.getElementById('InsertIframe').innerHTML = str;
BBSXPDrawIframe('YuZi_Replace');
BBSXPDrawIframe('YuZi_IMAGE');
BBSXPDrawIframe('YuZi_Media');
}
function BBSXPGetMenuCommonStyle()
{
var str = 'position:absolute;top:1px;left:1px;font-size:12px;color:'+YuZi_MENU_TEXT_COLOR+
';background-color:'+YuZi_MENU_BG_COLOR+';border:solid 1px '+YuZi_MENU_BORDER_COLOR+';z-index:1;display:none;';
return str;
}
function BBSXPGetCommonMenu(cmd, content)
{
var str = '';
str += '<div id="POPUP_'+cmd+'" style="'+BBSXPGetMenuCommonStyle()+'">';
str += content;
str += '</div>';
return str;
}
function BBSXPCreateColorTable(cmd, eventStr)
{
var str = '';
str += '<table cellpadding="0" cellspacing="2" border="0">';
for (i = 0; i < YuZi_COLOR_TABLE.length; i++) {
if (i == 0 || (i >= 8 && i%8 == 0)) {
str += '<tr>';
}
str += '<td style="width:12px;height:12px;border:1px solid #AAAAAA;font-size:1px;cursor:pointer;background-color:' +
YuZi_COLOR_TABLE[i] + ';" onmouseover="this.style.borderColor=\'#000000\';' + ((eventStr) ? eventStr : '') + '" ' +
'onmouseout="this.style.borderColor=\'#AAAAAA\';" ' +
'onclick="BBSXPExecute(\''+cmd+'_END\', \'' + YuZi_COLOR_TABLE[i] + '\');"> </td>';
if (i >= 7 && i%(i-1) == 0) {
str += '</tr>';
}
}
str += '</table>';
return str;
}
function BBSXPDrawColorTable(cmd)
{
var str = '';
str += '<div id="POPUP_'+cmd+'" style="width:128px;padding:2px;'+BBSXPGetMenuCommonStyle()+'">';
str += BBSXPCreateColorTable(cmd);
str += '</div>';
return str;
}
//弹出菜单
function BBSXPPopupMenu(cmd)
{
switch (cmd)
{
case 'YuZi_TITLE':
var str = '';
for (i = 0; i < YuZi_TITLE_TABLE.length; i++) {
str += '<div style="width:140px;cursor:pointer;" ' +
'onclick="BBSXPExecute(\'YuZi_TITLE_END\', \'' + YuZi_TITLE_TABLE[i][0] + '\');" ' +
'onmouseover="this.style.backgroundColor=\''+YuZi_MENU_SELECTED_COLOR+'\';" ' +
'onmouseout="this.style.backgroundColor=\''+YuZi_MENU_BG_COLOR+'\';"><' + YuZi_TITLE_TABLE[i][0] + ' style="margin:2px;">' +
YuZi_TITLE_TABLE[i][1] + '</' + YuZi_TITLE_TABLE[i][0] + '></div>';
}
str = BBSXPGetCommonMenu('YuZi_TITLE', str);
return str;
break;
case 'YuZi_FONTNAME':
var str = '';
for (i = 0; i < YuZi_FONT_NAME.length; i++) {
str += '<div style="font-family:' + YuZi_FONT_NAME[i][0] +
';padding:2px;width:160px;cursor:pointer;" ' +
'onclick="BBSXPExecute(\'YuZi_FONTNAME_END\', \'' + YuZi_FONT_NAME[i][0] + '\');" ' +
'onmouseover="this.style.backgroundColor=\''+YuZi_MENU_SELECTED_COLOR+'\';" ' +
'onmouseout="this.style.backgroundColor=\''+YuZi_MENU_BG_COLOR+'\';">' +
YuZi_FONT_NAME[i][1] + '</div>';
}
str = BBSXPGetCommonMenu('YuZi_FONTNAME', str);
return str;
break;
case 'YuZi_FONTSIZE':
var str = '';
for (i = 0; i < YuZi_FONT_SIZE.length; i++) {
str += '<div style="font-size:' + YuZi_FONT_SIZE[i][1] +
';padding:2px;width:120px;cursor:pointer;" ' +
'onclick="BBSXPExecute(\'YuZi_FONTSIZE_END\', \'' + YuZi_FONT_SIZE[i][0] + '\');" ' +
'onmouseover="this.style.backgroundColor=\''+YuZi_MENU_SELECTED_COLOR+'\';" ' +
'onmouseout="this.style.backgroundColor=\''+YuZi_MENU_BG_COLOR+'\';">' +
YuZi_FONT_SIZE[i][1] + '</div>';
}
str = BBSXPGetCommonMenu('YuZi_FONTSIZE', str);
return str;
break;
case 'YuZi_TEXTCOLOR':
var str = '';
str = BBSXPDrawColorTable('YuZi_TEXTCOLOR');
return str;
break;
case 'YuZi_BGCOLOR':
var str = '';
str = BBSXPDrawColorTable('YuZi_BGCOLOR');
return str;
break;
case 'YuZi_HR':
var str = '';
str += '<div id="POPUP_'+cmd+'" style="width:128px;'+BBSXPGetMenuCommonStyle()+'">';
str += '<div id="hrPreview" style="margin:10px 2px 10px 2px;height:1px;border:0;font-size:0;background-color:#FFFFFF;"></div>';
str += BBSXPCreateColorTable(cmd, 'document.getElementById(\'hrPreview\').style.backgroundColor = this.style.backgroundColor;');
str += '</div>';
return str;
break;
case 'YuZi_ICON':
var str = '';
str = '<div id="POPUP_'+cmd+'" style="'+BBSXPGetMenuCommonStyle()+'"></div>';
return str;
break;
case 'YuZi_SPECIALCHAR':
var str = '';
str += '<table id="POPUP_'+cmd+'" cellpadding="0" cellspacing="2" style="'+BBSXPGetMenuCommonStyle()+'">';
for (i = 0; i < YuZi_SPECIAL_CHARACTER.length; i++) {
if (i == 0 || (i >= 10 && i%10 == 0)) {
str += '<tr>';
}
str += '<td style="padding:2px;border:1px solid #AAAAAA;cursor:pointer;" ' +
'onclick="BBSXPExecute(\'YuZi_SPECIALCHAR_END\', \'' + YuZi_SPECIAL_CHARACTER[i] + '\');" ' +
'onmouseover="this.style.borderColor=\'#000000\';" ' +
'onmouseout="this.style.borderColor=\'#AAAAAA\';">' + YuZi_SPECIAL_CHARACTER[i] + '</td>';
if (i >= 9 && i%(i-1) == 0) {
str += '</tr>';
}
}
str += '</table>';
return str;
break;
case 'YuZi_TABLE':
var str = '';
var num = 10;
str += '<table id="POPUP_'+cmd+'" cellpadding="0" cellspacing="0" style="'+BBSXPGetMenuCommonStyle()+'">';
for (i = 1; i <= num; i++) {
str += '<tr>';
for (j = 1; j <= num; j++) {
var value = i.toString(10) + ',' + j.toString(10);
str += '<td id="BBSXPTableTd' + i.toString(10) + '_' + j.toString(10) +
'" style="width:15px;height:15px;background-color:#FFFFFF;border:1px solid #DDDDDD;cursor:pointer;" ' +
'onclick="BBSXPExecute(\'YuZi_TABLE_END\', \'' + value + '\');" ' +
'onmouseover="BBSXPDrawTableSelected(\''+i.toString(10)+'\', \''+j.toString(10)+'\');" ' +
'onmouseout=""> </td>';
}
str += '</tr>';
}
str += '<tr><td colspan="10" id="tableLocation" style="text-align:center;height:20px;"></td></tr>';
str += '</table>';
return str;
break;
case 'YuZi_Replace':
var str = '';
str += '<div id="POPUP_'+cmd+'" style="width:250px;'+BBSXPGetMenuCommonStyle()+'">';
str += '<iframe name="BBSXPReplaceIframe" id="BBSXPReplaceIframe" frameborder="0" style="width:250px;height:120px;padding:0;margin:0;border:0;">';
str += '</iframe></div>';
return str;
break;
case 'YuZi_IMAGE':
var str = '';
str += '<div id="POPUP_'+cmd+'" style="width:250px;'+BBSXPGetMenuCommonStyle()+'">';
str += '<iframe name="BBSXPImageIframe" id="BBSXPImageIframe" frameborder="0" style="width:250px;height:240px;padding:0;margin:0;border:0;">';
str += '</iframe></div>';
return str;
break;
case 'YuZi_Media':
var str = '';
str += '<div id="POPUP_'+cmd+'" style="width:250px;'+BBSXPGetMenuCommonStyle()+'">';
str += '<iframe name="BBSXPMediaIframe" id="BBSXPMediaIframe" frameborder="0" style="width:250px;height:300px;padding:0;margin:0;border:0;">';
str += '</iframe></div>';
return str;
break;
case 'YuZi_LINK':
var str = '';
str += '<div id="POPUP_'+cmd+'" style="width:250px;'+BBSXPGetMenuCommonStyle()+'">';
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -