?? ybbcode.js
字號:
var Quote = 0;
var Bold = 0;
var Italic = 0;
var Underline = 0;
var Code = 0;
function fontchuli(){
if ((document.selection)&&(document.selection.type == "Text")) {
var range = document.selection.createRange();
var ch_text=range.text;
range.text = fontbegin + ch_text + fontend;
}
else {
document.topic.content.value=fontbegin+document.topic.content.value+fontend;
document.topic.content.focus();
}
}
function AddText(text) {
if (document.topic.content.createTextRange && document.topic.content.caretPos) {
var caretPos = document.topic.content.caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ?
text + ' ' : text;
}
else document.topic.content.value += text;
document.topic.content.focus(caretPos);
}
function COLOR(color){
fontbegin="[color="+color+"]文字";
fontend="[/color]";
fontchuli();
}
helpstat = false;
stprompt = true;
basic = false;
function thelp(swtch){
if (swtch == 1){
basic = false;
stprompt = false;
helpstat = true;
} else if (swtch == 0) {
helpstat = false;
stprompt = false;
basic = true;
} else if (swtch == 2) {
helpstat = false;
basic = false;
stprompt = true;
}
}
function Crm() {
if (helpstat) {
alert("realplay\n播放realplay文件.\n用法: [rm=寬度, 高度]文件地址[/rm]");
} else if (basic) {
AddTxt="[rm=500,350][/rm]";
AddText(AddTxt);
} else {
txt2=prompt("視頻的寬度,高度","500,350");
if (txt2!=null) {
txt=prompt("視頻文件的地址","請輸入");
if (txt!=null) {
if (txt2=="") {
AddTxt="[rm=500,350]"+txt;
AddText(AddTxt);
AddTxt="[/rm]";
AddText(AddTxt);
} else {
AddTxt="[rm="+txt2+"]"+txt;
AddText(AddTxt);
AddTxt="[/rm]";
AddText(AddTxt);
}
}
}
}
}
function Cwmv() {
if (helpstat) {
alert("Media Player\n播放Media Player文件.\n用法: [mp=寬度, 高度]文件地址[/mp]");
} else if (basic) {
AddTxt="[mp=500,350][/mp]";
AddText(AddTxt);
} else {
txt2=prompt("視頻的寬度,高度","500,350");
if (txt2!=null) {
txt=prompt("視頻文件的地址","請輸入");
if (txt!=null) {
if (txt2=="") {
AddTxt="[mp=500,350]"+txt;
AddText(AddTxt);
AddTxt="[/mp]";
AddText(AddTxt);
} else {
AddTxt="[mp="+txt2+"]"+txt;
AddText(AddTxt);
AddTxt="[/mp]";
AddText(AddTxt);
}
}
}
}
}
function Cdir() {
if (helpstat) {
alert("Shockwave\n插入Shockwave文件.\n用法: [dir=寬度, 高度]文件地址[/dir]");
} else if (basic) {
AddTxt="[dir=500,350][/dir]";
AddText(AddTxt);
} else {
txt2=prompt("Shockwave文件的寬度,高度","500,350");
if (txt2!=null) {
txt=prompt("Shockwave文件的地址","請輸入地址");
if (txt!=null) {
if (txt2=="") {
AddTxt="[dir=500,350]"+txt;
AddText(AddTxt);
AddTxt="[/dir]";
AddText(AddTxt);
} else {
AddTxt="[dir="+txt2+"]"+txt;
AddText(AddTxt);
AddTxt="[/dir]";
AddText(AddTxt);
}
}
}
}
}
function ybbsize(theSmilie){
var text=prompt("請輸入文字", "");
if(text){
document.topic.content.value += '[size=' + theSmilie + ']'+ text + '[/size]';
}
}
function image() {
var FoundErrors = '';
var enterURL = prompt("請輸入圖片地址","http://");
if (!enterURL) {
FoundErrors +="\n";
}
if (FoundErrors) {
return;
}
var ToAdd = "[IMG]"+enterURL+"[/IMG]";
document.topic.content.value+=ToAdd;
document.topic.content.focus();
}
function fly() {
fontbegin="[fly]";
fontend="[/fly]";
fontchuli();
}
function move() {
fontbegin="[move]";
fontend="[/move]";
fontchuli();
}
function center() {
fontbegin="[align=center]";
fontend="[/align]";
fontchuli();
}
function light() {
fontbegin="[light]";
fontend="[/light]";
fontchuli();
}
function grade() {
var ToAdd = "[showtograde=1]內容[/s]";
document.topic.content.value+=ToAdd;
document.topic.content.focus();
}
function name() {
var ToAdd = "[showtoname=對方昵稱]內容[/s]";
document.topic.content.value+=ToAdd;
document.topic.content.focus();
}
function reply() {
var ToAdd = "[showtoreply]內容[/s]";
document.topic.content.value+=ToAdd;
document.topic.content.focus();
}
function ying() {
fontbegin="[SHADOW=255,yellow,1]";
fontend="[/shadow]";
fontchuli();
}
function smark() {
var ToAdd = "[smark=10]內容[/s]";
document.topic.content.value+=ToAdd;
document.topic.content.focus();
}
function Curl() {
var FoundErrors = '';
var enterURL = prompt("請輸入連接網址", "http://");
var enterTxT = prompt("請輸入連接說明", enterURL);
if (!enterURL) {
FoundErrors += "\n" + "您必須輸入網址";
}
if (!enterTxT) {
FoundErrors += "\n" + "您必須連接說明";
}
if (FoundErrors) {
alert("錯誤!"+FoundErrors);
return;
}
var ToAdd = "[URL="+enterURL+"]"+enterTxT+"[/URL]";
document.topic.content.value+=ToAdd;
document.topic.content.focus();
}
function showdate() {
var FoundErrors = '';
var enterdate=prompt("請輸入日期按這樣格式2003-10-1,該帖將這天以后方能瀏覽","2003-10-1");
if (!enterdate) {
FoundErrors += "\n" +"請輸入正確日期";
}
if (FoundErrors) {
alert("錯誤!"+FoundErrors);
return;
}
var ToAdd = "[showdate="+enterdate+"]內容[/s]";
document.topic.content.value+=ToAdd;
document.topic.content.focus();
}
function Cemail() {
var emailAddress = prompt("請輸入郵件地址","");
if (!emailAddress) { alert("請輸入正確的email地址"); return; }
var ToAdd = "[email]"+emailAddress+"[/email]";
document.topic.content.value+=ToAdd;
document.topic.content.focus();
}
function Cbold() {
fontbegin="[B]";
fontend="[/B]";
fontchuli();
}
function Citalic() {
fontbegin="[I]";
fontend="[/I]";
fontchuli();
}
function Cunder() {
fontbegin="[U]";
fontend="[/U]";
fontchuli();
}
function mustlogin() {
var ToAdd = "[slogin]內容[/s]";
document.topic.content.value+=ToAdd;
document.topic.content.focus();
}
function DoTitle(addTitle){
document.topic.topic.value=addTitle+document.topic.topic.value;
document.topic.topic.focus();
}
function openwin()
{
document.forms[1].topic.value=document.forms[0].topic.value;
document.forms[1].content.value=document.forms[0].content.value;
var popupWin = window.open('post.asp?action=preview', 'showgg', 'width=500,height=400,resizable=1,scrollbars=yes,menubar=no,status=yes');
document.forms[1].submit()
}
function Csound() {
var FoundErrors = '';
var enterURL = prompt("請輸入背景音樂地址", "http://");
if (!enterURL) {
FoundErrors += "\n" + "您必須要輸入有效地址";
}
if (FoundErrors) {
alert("錯誤!"+FoundErrors);
return;
}
var ToAdd = "[SOUND]"+enterURL+"[/SOUND]";
document.topic.content.value+=ToAdd;
document.topic.content.focus();
}
function Cra() {
var FoundErrors = '';
var enterURL = prompt("請輸入real音頻文件地址", "http://");
if (!enterURL) {
FoundErrors += "\n" + "您必須輸入有效的地址";
}
if (FoundErrors) {
alert("錯誤!"+FoundErrors);
return;
}
var ToAdd = "[RA]"+enterURL+"[/RA]";
document.topic.content.value+=ToAdd;
document.topic.content.focus();
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -