?? postcode.js
字號:
var text = "";function getActiveText(selectedtext) { text = (document.all) ? document.selection.createRange().text : document.getSelection(); if (selectedtext.createTextRange) { selectedtext.caretPos = document.selection.createRange().duplicate(); } return true;}function submitonce(theform){ if (document.all||document.getElementById) { for (i=0;i<theform.length;i++) { var tempobj=theform.elements[i]; if(tempobj.type.toLowerCase()=="submit"||tempobj.type.toLowerCase()=="reset") tempobj.disabled=true; } }}function checklength(theform){ alert("你的信息已經有 "+theform.content.value.length+" 字節.");}function AddText(NewCode) { if (document.myform.content.createTextRange && document.myform.content.caretPos) { var caretPos = document.myform.content.caretPos; caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? NewCode + ' ' : NewCode; } else { document.myform.content.value+=NewCode } setfocus();}function setfocus(){ document.myform.content.focus();}defaultmode = "divmode";if (defaultmode == "nomode") { helpmode = false; divmode = false; nomode = true;} else if (defaultmode == "helpmode") { helpmode = true; divmode = false; nomode = false;} else { helpmode = false; divmode = true; nomode = false;}function checkmode(swtch){ if (swtch == 1){ nomode = false; divmode = false; helpmode = true; alert("Wm 代碼 - 幫助信息\n\n點擊相應的代碼按鈕即可獲得相應的說明和提示"); } else if (swtch == 0) { helpmode = false; divmode = false; nomode = true; alert("Wm 代碼 - 直接插入\n\n點擊代碼按鈕后不出現提示即直接插入相應代碼"); } else if (swtch == 2) { helpmode = false; nomode = false; divmode = true; alert("Wm 代碼 - 提示插入\n\n點擊代碼按鈕后出現向導窗口幫助您完成代碼插入"); }}function showsize(size) { if (helpmode) { alert("文字大小標記\n設置文字大小.\n可變范圍 1 - 6.\n 1 為最小 6 為最大.\n用法: [size="+size+"]這是 "+size+" 文字[/size]"); } else if (nomode || document.selection && document.selection.type == "Text") { AddTxt="[size="+size+"]"+text+"[/size]"; AddText(AddTxt); } else { txt=prompt("大小 "+size,"文字"); if (txt!=null) { AddTxt="[size="+size+"]"+txt; AddText(AddTxt); AddTxt="[/size]"; AddText(AddTxt); } }}function showfont(font) { if (helpmode){ alert("字體標記\n給文字設置字體.\n用法: [font="+font+"]改變文字字體為"+font+"[/font]"); } else if (nomode || document.selection && document.selection.type == "Text") { AddTxt="[font="+font+"]"+text+"[/font]"; AddText(AddTxt); } else { txt=prompt("要設置字體的文字"+font,"文字"); if (txt!=null) { AddTxt="[font="+font+"]"+txt; AddText(AddTxt); AddTxt="[/font]"; AddText(AddTxt); } }}function showcolor(color) { if (helpmode) { alert("顏色標記\n設置文本顏色. 任何顏色名都可以被使用.\n用法: [color="+color+"]顏色要改變為"+color+"的文字[/color]"); } else if (nomode || document.selection && document.selection.type == "Text") { AddTxt="[color="+color+"]"+text+"[/color]"; AddText(AddTxt); } else { txt=prompt("選擇的顏色是: "+color,"文字"); if(txt!=null) { AddTxt="[color="+color+"]"+txt; AddText(AddTxt); AddTxt="[/color]"; AddText(AddTxt); } }}function bold() { if (helpmode) { alert("加粗標記\n使文本加粗.\n用法: [b]這是加粗的文字[/b]"); } else if (nomode || document.selection && document.selection.type == "Text") { AddTxt="[b]"+text+"[/b]"; AddText(AddTxt); } else { txt=prompt("文字將被變粗.","文字"); if (txt!=null) { AddTxt="[b]"+txt; AddText(AddTxt); AddTxt="[/b]"; AddText(AddTxt); } }}function italicize() { if (helpmode) { alert("斜體標記\n使文本字體變為斜體.\n用法: [i]這是斜體字[/i]"); } else if (nomode || document.selection && document.selection.type == "Text") { AddTxt="[i]"+text+"[/i]"; AddText(AddTxt); } else { txt=prompt("文字將變斜體","文字"); if (txt!=null) { AddTxt="[i]"+txt; AddText(AddTxt); AddTxt="[/i]"; AddText(AddTxt); } }}function quoteme() { if (helpmode){ alert("引用標記\n引用一些文字.\n用法: [quote]引用內容[/quote]"); } else if (nomode || document.selection && document.selection.type == "Text") { AddTxt="[quote]"+text+"[/quote]"; AddText(AddTxt); } else { txt=prompt("被引用的文字","文字"); if(txt!=null) { AddTxt="[quote]"+txt; AddText(AddTxt); AddTxt="[/quote]"; AddText(AddTxt); } }}function setfly() { if (helpmode){ alert("飛行標記\n使文字飛行.\n用法: [fly]文字為這樣文字[/fly]"); } else if (nomode || document.selection && document.selection.type == "Text") { AddTxt="[fly]"+text+"[/fly]"; AddText(AddTxt); } else { txt=prompt("飛行文字","文字"); if (txt!=null) { AddTxt="[fly]"+txt; AddText(AddTxt); AddTxt="[/fly]"; AddText(AddTxt); } }}function movesign() { if (helpmode) { alert("移動標記\n使文字產生移動效果.\n用法: [move]要產生移動效果的文字[/move]"); } else if (nomode || document.selection && document.selection.type == "Text") { AddTxt="[move]"+text+"[/move]"; AddText(AddTxt); } else { txt=prompt("要產生移動效果的文字","文字"); if (txt!=null) { AddTxt="[move]"+txt; AddText(AddTxt); AddTxt="[/move]"; AddText(AddTxt); } }}function shadow() { if (helpmode) {alert("陰影標記\n使文字產生陰影效果.\n用法: [SHADOW=寬度, 顏色, 邊界]要產生陰影效果的文字[/SHADOW]"); } else if (nomode || document.selection && document.selection.type == "Text") { AddTxt="[SHADOW=255,blue,1]"+text+"[/SHADOW]"; AddText(AddTxt); } else { txt2=prompt("文字的長度、顏色和邊界大小","255,blue,1"); if (txt2!=null) { txt=prompt("要產生陰影效果的文字","文字"); if (txt!=null) { if (txt2=="") { AddTxt="[shadow=255, blue, 1]"+txt; AddText(AddTxt); AddTxt="[/shadow]"; AddText(AddTxt); } else { AddTxt="[shadow="+txt2+"]"+txt; AddText(AddTxt); AddTxt="[/shadow]"; AddText(AddTxt); } } } }}function glow() { if (helpmode) { alert("光暈標記\n使文字產生光暈效果.\n用法: [GLOW=寬度, 顏色, 邊界]要產生光暈效果的文字[/GLOW]"); } else if (nomode || document.selection && document.selection.type == "Text") { AddTxt="[glow=255,red,2]"+text+"[/glow]"; AddText(AddTxt); } else { txt2=prompt("文字的長度、顏色和邊界大小","255,red,2"); if (txt2!=null) { txt=prompt("要產生光暈效果的文字.","文字"); if (txt!=null) { if (txt2=="") { AddTxt="[glow=255,red,2]"+txt; AddText(AddTxt); AddTxt="[/glow]"; AddText(AddTxt); } else { AddTxt="[glow="+txt2+"]"+txt; AddText(AddTxt); AddTxt="[/glow]"; AddText(AddTxt); } } } }}function center() { if (helpmode) { alert("對齊標記\n使用這個標記, 可以使文本左對齊、居中、右對齊.\n用法: [align=center|left|right]要對齊的文本[/align]"); } else if (nomode || document.selection && document.selection.type == "Text") { AddTxt="[align=center]"+text+"[/align]"; AddText(AddTxt); } else { txt2=prompt("對齊樣式\n輸入 'center' 表示居中, 'left' 表示左對齊, 'right' 表示右對齊.","center"); while ((txt2!="") && (txt2!="center") && (txt2!="left") && (txt2!="right") && (txt2!=null)) { txt2=prompt("錯誤!\n類型只能輸入 'center' 、 'left' 或者 'right'.",""); } txt=prompt("要對齊的文本","文本"); if (txt!=null) { AddTxt="\r[align="+txt2+"]"+txt; AddText(AddTxt); AddTxt="[/align]"; AddText(AddTxt); } }}function rming() { if (helpmode) { alert("RM音樂標記\n插入一個RM鏈接標記\n使用方法: [rm]http:\/\/www.qqwm.com\/rm\/php.rm[/rm]"); } else if (nomode || document.selection && document.selection.type == "Text") { AddTxt="[rm]"+text+"[/rm]"; AddText(AddTxt); } else { txt=prompt("rm電影的 URL","http://"); if(txt!=null) { AddTxt="\r[rm]"+txt; AddText(AddTxt); AddTxt="[/rm]"; AddText(AddTxt); } }}function image() { if (helpmode){ alert("圖片標記\n插入圖片\n用法: [img]http:\/\/www.qqwm.com\/images\/php.gif[/img]"); } else if (nomode || document.selection && document.selection.type == "Text") { AddTxt="[img]"+text+"[/img]"; AddText(AddTxt); } else { txt=prompt("圖片的 URL","http://"); if(txt!=null) { AddTxt="\r[img]"+txt; AddText(AddTxt); AddTxt="[/img]"; AddText(AddTxt); } }}function wmv() { if (helpmode){ alert("wmv標記\n插入wmv\n用法: [wmv]http:\/\/www.qqwm.com\/wmv\/php.wmv[/wmv]"); } else if (nomode || document.selection && document.selection.type == "Text") { AddTxt="[wmv]"+text+"[/wmv]"; AddText(AddTxt); } else { txt=prompt("電影的 URL","http://"); if(txt!=null) { AddTxt="\r[wmv]"+txt; AddText(AddTxt); AddTxt="[/wmv]"; AddText(AddTxt); } }}function showcode() { if (helpmode) { alert("代碼標記\n使用代碼標記,可以使你的程序代碼里面的 html 等標志不會被破壞.\n使用方法:\n [code]這里是代碼文字[/code]"); } else if (nomode || document.selection && document.selection.type == "Text") { AddTxt="\r\n[code]"+text+"[/code]"; AddText(AddTxt); } else { txt=prompt("輸入代碼",""); if (txt!=null) { AddTxt="\r[code]"+txt; AddText(AddTxt); AddTxt="[/code]"; AddText(AddTxt); } }}function list() { if (helpmode) { alert("列表標記\n建造一個文字或則數字列表.\nUSE: [list]\n[*]item1\n[*]item2\n[*]item3\n[/list]"); } else if (nomode) { AddTxt="\r[list]\r[*]\r[*]\r[*]\r[/list]"; AddText(AddTxt); } else { txt=prompt("列表類型\n輸入 'a' 表示字母列表, '1' 表示數字列表, 留空表示普通列表.",""); while ((txt!="") && (txt!="A") && (txt!="a") && (txt!="1") && (txt!=null)) { txt=prompt("錯誤!\n類型只能輸入 'a'、'A' 、 '1' 或者留空.",""); } if (txt!=null) { if (txt==""){ AddTxt="\r[list]\r\n"; } else if (txt=="1") { AddTxt="\r[list=1]\r\n"; } else if(txt=="a") { AddTxt="\r[list=a]\r\n"; } ltxt="1"; while ((ltxt!="") && (ltxt!=null)) { ltxt=prompt("列表項\n空白表示結束列表",""); if (ltxt!="") { AddTxt+="[*]"+ltxt+"\r"; } } AddTxt+="[/list]\r\n"; AddText(AddTxt); } }}function underline() { if (helpmode) { alert("下劃線標記\n給文字加下劃線.\n用法: [u]要加下劃線的文字[/u]"); } else if (nomode || document.selection && document.selection.type == "Text") { AddTxt="[u]"+text+"[/u]"; AddText(AddTxt); } else { txt=prompt("下劃線文字.","文字"); if (txt!=null) { AddTxt="[u]"+txt; AddText(AddTxt); AddTxt="[/u]"; AddText(AddTxt); } }}function hyperlink() { if (helpmode) { alert("超級鏈接標記\n插入一個超級鏈接標記\n使用方法: [url]http://www.qqwm.com[/url]\nUSE: [url=http://www.qqwm.com]鏈接文字[/url]"); } else if (nomode || document.selection && document.selection.type == "Text") { AddTxt="[url]"+text+"[/url]"; AddText(AddTxt); } else { txt2=prompt("鏈接文本顯示.\n如果不想使用, 可以為空, 將只顯示超級鏈接地址. ",""); if (txt2!=null) { txt=prompt("超級鏈接.","http://"); if (txt!=null) { if (txt2=="") { AddTxt="[url]"+txt; AddText(AddTxt); AddTxt="[/url]"; AddText(AddTxt); } else { AddTxt="[url="+txt+"]"+txt2; AddText(AddTxt); AddTxt="[/url]"; AddText(AddTxt); } } } }}function email() { if (helpmode) { alert("Email 標記\n插入 Email 超級鏈接\n用法1: [email]liujiawm@163.com[/email]\n用法2: [email=liujiawm@163.com]柳甲[/email]"); } else if (nomode || document.selection && document.selection.type == "Text") { AddTxt="[email]"+text+"[/email]"; AddText(AddTxt); } else { txt2=prompt("鏈接顯示的文字.\n如果為空,那么將只顯示你的 Email 地址. ",""); if (txt2!=null) { txt=prompt("Email 地址.","qqwm@qqwm.com"); if (txt!=null) { if (txt2=="") { AddTxt="[email]"+txt; AddText(AddTxt); AddTxt="[/email]"; AddText(AddTxt); } else { AddTxt="[email="+txt+"]"+txt2; AddText(AddTxt); AddTxt="[/email]"; AddText(AddTxt); } } } }}function setswf() { if (helpmode){ alert("Flash 動畫\n插入 Flash 動畫.\n用法: [flash=寬度,高度]Flash 文件的地址[/flash]"); } else if (nomode || document.selection && document.selection.type == "Text") { AddTxt="\r[flash=370,250]"+text+"[/flash]"; AddText(AddTxt); } else { txt2=prompt("寬度,高度","370,250"); if (txt2!=null) { txt=prompt("Flash 文件的地址","http://"); if (txt!=null) { if (txt2=="") { AddTxt="[flash=370,250]"+txt; AddText(AddTxt); AddTxt="[/flash]"; AddText(AddTxt); } else { AddTxt="\r[flash="+txt2+"]"+txt; AddText(AddTxt); AddTxt="[/flash]"; AddText(AddTxt); } } } }}////////////////////////////////// function add_title(addTitle) { var revisedTitle; var currentTitle = document.myform.atc_title.value; revisedTitle = currentTitle+addTitle; document.myform.atc_title.value=revisedTitle; document.myform.atc_title.focus(); return; } function Addaction(addTitle) { var revisedTitle; var currentTitle = document.myform.content.value; revisedTitle = currentTitle+addTitle; document.myform.content.value=revisedTitle; document.myform.content.focus(); return; } function copytext(theField) { var tempval=eval("document."+theField); tempval.focus(); tempval.select(); therange=tempval.createTextRange(); therange.execCommand("Copy"); } function replac() { if (helpmode) { alert("替換關鍵字"); } else { txt2=prompt("請輸入搜尋目標關鍵字",""); if (txt2 != null) { if (txt2 != "") { txt=prompt("關鍵字替換為:",txt2); } else { replac(); } var Rtext = txt2; var Itext = txt; document.myform.content.value = eval('myform.content.value.replace("'+Rtext+'","'+Itext+'")'); } } }function addsmile(NewCode) { document.myform.content.value += ' '+NewCode+' '; }
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -