📄 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 getActiveText(selectedtext) {
text = (document.all) ? document.selection.createRange().text: document.getSelection()+"aaa";
if(text!=""){
alert(text);
}
if (selectedtext.createTextRange) {
selectedtext.caretPos = document.selection.createRange().duplicate();
}
return true;
}*/
function setfocus(){
document.FORM.content.focus();
}
function AddText(NewCode){
if(document.FORM.content.createTextRange && document.FORM.content.caretPos){
var caretPos=document.FORM.content.caretPos;
caretPos.text=caretPos.text.charAt(caretPos.text.length - 1)==' ' ? NewCode+" " : NewCode;
}
else
{
document.FORM.content.value+=NewCode;
}
setfocus();
}
var defaultmode='2';
var divmode="";
var nomode="";
var helpmode="";
if(defaultmode=='1'){
nomode='1';
divmode='0';
helpmode='0';
}
if(defaultmode=='2'){
nomode='0';
divmode='1';
helpmode='0';
}
if(defaultmode='3'){
nomode='0';
divmode='0';
helpmode='3';
}
function checkmode(txt){
if(txt=='1'){
nomode='1';
divmode='0';
helpmode='0';
alert("wind 代码--帮助信息\n点击按扭后不出现提示即直接插入代码.")
}else if(txt=='2'){
divmode='1';
nomode='0';
helpmode='0';
alert("wind 代码--帮助信息\n点击按扭后出现向导窗口帮助您完成代码插入.")
}else if(txt=='3'){
helpmode='1';
nomode='0';
divmode='0';
alert("wind 代码 --帮助信息\n点击相应的代码即可获得相应的说明和提示.");
}
}
/*function setfocus()
{
document.FORM.content.focus();
}
*/
/*function AddText(NewCode)
{
if (document.FORM.content.createTextRange && document.FORM.content.caretPos)
{
var caretPos = document.FORM.content.caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? NewCode+ 'a ' : NewCode;
}
else
{
document.FORM.content.value+=NewCode
}
setfocus();
}
*/
function bold(){
if (helpmode) {
alert("加粗标记\n使文本加粗.\n用法: [b]这是加粗的文字[/b]");
}else if(nomode=='1' || (document.selection && document.selection.type=="Text")){
AddTxt="[b]"+text+"[/b]";
AddText(AddTxt);
}
else
{
var txt=prompt("文字将被变粗.","文字");
if(txt!=null){
AddTxt="[b]"+txt;
AddText(AddTxt);
AddTxt="[/b]";
AddText(AddTxt);
}
}
}
function showfont(font){
if(font!="no"){
if (helpmode=='1'){
alert("字体标记\n给文字设置字体.\n用法: [font="+font+"]改变文字字体为"+font+"[/font]");
}else if(nomode=='1' || document.selection && document.selection.type=='Text'){
var AddTxt="[font="+font+"]"+text+"[/font]";
AddText(AddTxt);
}
else
{
var txt=prompt("要设置字体的文字为"+font,"文字");
if(txt!=null){
AddTxt="[font="+font+"]"+txt;
AddText(AddTxt);
AddTxt="[/font]";
AddText(AddTxt);
}
}
}
}
function showsize(size){
if(size!="no"){
if (helpmode) {
alert("文字大小标记\n设置文字大小.\n可变范围 1 - 6.\n 1 为最小 6 为最大.\n用法: [size="+size+"]这是 "+size+" 文字[/size]");
}else if(nomode=='1' || document.selection && document.selection.type=="Text"){
AddTxt="[size="+size+"]"+text+"[/size]";
AddText(AddTxt);
}
else
{
var txt=prompt("大小"+size,"文字");
if(txt!=null){
var AddTxt="[size="+size+"]"+txt;
AddText(AddTxt);
AddTxt="[/size]";
AddText(AddTxt);
}
}
}
}
function showcolor(color){
if(color!='no'){
if (helpmode) {
alert("颜色标记\n设置文本颜色. 任何颜色名都可以被使用.\n用法: [color="+color+"]颜色要改变为"+color+"的文字[/color]");
}else if(nomode=='1' || document.selection && document.selection.type=="Text"){
var AddTxt="[color="+color+"]"+text+"[/color]";
AddText(AddTxt);
}
else
{
var txt=prompt("选择的颜色为"+color,"文字");
if(txt!=null){
var AddTxt="[color="+color+"]"+txt;
AddText(AddTxt);
AddTxt="[/color]";
AddText(AddTxt);
}
}
}
}
function italicize(){
if (helpmode=='1') {
alert("斜体标记\n使文本字体变为斜体.\n用法: [i]这是斜体字[/i]");
}else if(nomde=='1' || document.selection && document.selection.type=="Text"){
var AddTxt="[i]"+text+"[/i]";
AddText(AddTxt);
}
else
{
var txt=prompt("文字将变为斜体","文字");
if(txt!=null){
var AddTxt="[i]"+txt;
AddText(AddTxt);
AddTxt="[/i]";
AddText(AddTxt);
}
}
}
function underline(){
if (helpmode=='1') {
alert("下划线标记\n给文字加下划线.\n用法: [u]要加下划线的文字[/u]");
}else if(nomode=='1' || document.selection && document.selection.type=="Text"){
var AddTxt="[u]"+text+"[/u]";
AddText(AddTxt);
}
else
{
var txt=prompt("下划线文字","文字");
if(txt!=null){
var AddTxt="[u]"+txt;
AddText(AddTxt);
AddTxt="[/u]";
AddText(AddTxt);
}
}
}
function center(){
if (helpmode=='1') {
alert("对齐标记\n使用这个标记, 可以使文本左对齐、居中、右对齐.\n用法: [align=center|left|right]要对齐的文本[/align]");
} else if (nomode=='1' || document.selection && document.selection.type == "Text") {
var txt=prompt("对齐样式\n输入'center'表示居中,输入'left'表示左对齐,输入'right'表示右对齐.","center");
if(txt!=null){
var AddTxt="[align="+txt+"]"+text+"[/align]";
AddText(AddTxt);
}
}
else
{
var txt1=prompt("对齐样式\n输入'center'表示居中,输入'left'表示左对齐,输入'right'表示右对齐.","center");
if(txt1!=null){
var txt2=prompt("要对齐的文本","文字");
if(txt2!=null){
var AddTxt="[align="+txt1+"]"+txt2;
AddText(AddTxt);
AddTxt="[/align]";
AddText(AddTxt);
}
}
}
}
function hyperlink(){
if (helpmode=='1') {
alert("超级链接标记\n插入一个超级链接标记\n使用方法: [url]http://www.qqwm.com[/url]\nUSE: [url=http://www.qqwm.com]链接文字[/url]");
} else if (nomode=='1' || document.selection && document.selection.type == "Text") {
var AddTxt="[url]"+text+"[/url]";
AddText(AddTxt);
}
else
{
var txt1=prompt("链接文本显示\n如果不想使用,可以为空,将只显示超级链接地址.","");
if(txt1!=null){
var txt2=prompt("超级链接.","http://");
if(txt2!=null && txt1.charAt(0)!=""){
var AddTxt="[url="+txt2+"]"+txt1;
AddText(AddTxt);
AddTxt="[/url]";
AddText(AddTxt);
}
if(txt2!=null && txt1.charAt(0)==""){
var AddTxt="[url]"+txt2+"[/url]";
AddText(AddTxt);
}
}
}
}
function mail(){
if (helpmode=='1') {
alert("Email 标记\n插入 Email 超级链接\n用法1: [email]liujiawm@163.com[/email]\n用法2: [email=liujiawm@163.com]柳甲[/email]");
} else if (nomode=='1' || document.selection && document.selection.type == "Text") {
var AddTxt="[email]"+text+"[/email]";
AddText(AddTxt);
}
else
{
var txt1=prompt("链接显示的文字\n如果为空那么就将显示你的Email地址.","");
if(txt1!=null){
var txt2=prompt("Email地址.","ljyxmu@163.com");
if(txt2!=null && txt1.charAt(0)!=""){
var AddTxt="[email="+txt2+"]"+txt1;
AddText(AddTxt);
AddTxt="[/email]";
AddText(AddTxt);
}
if(txt2!=null && txt1.charAt(0)==""){
var AddTxt="[email]"+txt2+"[/email]";
AddText(AddTxt);
}
}
}
}
function image(){
if (helpmode=='1'){
alert("图片标记\n插入图片\n用法: [img]http:\/\/www.qqwm.com\/images\/php.gif[/img]");
} else if (nomode=='1' || document.selection && document.selection.type == "Text") {
var AddTxt="[img]"+text+"[/img]";
AddText(AddTxt);
}
else
{
var txt=prompt("图片的URL","http://");
if(txt!=null){
var AddTxt="[img]"+txt;
AddText(AddTxt);
AddTxt="[/img]";
AddText(AddTxt);
}
}
}
function setflash(){
if (helpmode=='1'){
alert("Flash 动画\n插入 Flash 动画.\n用法: [flash=宽度,高度]Flash 文件的地址[/flash]");
} else if (nomode=='1' || document.selection && document.selection.type == "Text") {
var AddTxt="[flash=370,250]"+text+"[/flash]";
AddText(AddTxt);
}
else
{
var txt1=prompt("宽度,高度.","370,250");
if(txt1!=null){
var txt2=prompt("Flash 文件的地址.","http://");
if(txt2!=null){
if(txt1.charAt(0)==""){
txt1="370,250";
}
var AddTxt="[flash="+txt1+"]"+txt2;
AddText(AddTxt);
AddTxt="[/flash]";
AddText(AddTxt);
}
}
}
}
/*function list(){
var txt1=prompt("列表类型\n输入'a'表示字母列表,输入'1'表示数字列表,留空表示普通列表.","");
while(txt1!=null && txt1!='a' && txt1!='1' && txt1.charAt(0)!=''){
txt1=prompt("错误!\n类型只能输入'a','A','1'或者留空.","");
}
if(txt1!=null && (txt1=='a' || txt1=='1' || txt1.charAt(0)=='')){
var txt='';
var txt2=prompt("列表\n空白表示结束列表.","");
while(txt2.charAt(0)!="" && txt2!=null){
txt+="[*]"+txt2+"\n";
txt2=prompt("列表\n空白表示结束列表.","");
}
if(txt1!=null && (txt1=='1' || txt1=='a')){
var AddTxt="[list="+txt1+"]\n"+txt;
AddText(AddTxt);
AddTxt="[/list]";
AddText(AddTxt);
}
if(txt1!=null && txt1.charAt(0)==""){
var AddTxt="[list]"+txt;
AddText(AddTxt);
AddTxt="[/list]";
AddText(AddTxt);
}
}
}*/
function list() {
if (helpmode=='1') {
alert("列表标记\n建造一个文字或则数字列表.\nUSE: [list]\n[*]item1\n[*]item2\n[*]item3\n[/list]");
} else if (nomode=='1') {
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 showcode(){
if (helpmode=='1') {
alert("代码标记\n使用代码标记,可以使你的程序代码里面的 html 等标志不会被破坏.\n使用方法:\n [code]这里是代码文字[/code]");
} else if (nomode=='1' || document.selection && document.selection.type == "Text") {
var AddTxt="[code]"+text+"[/code]";
AddText(AddTxt);
}
else
{
var txt=prompt("插入代码","");
if(txt!=null){
var AddTxt="[code]"+txt;
AddText(AddTxt);
AddTxt="[/code]";
AddText(AddTxt);
}
}
}
function fly(){
if (helpmode=='1'){
alert("飞行标记\n使文字飞行.\n用法: [fly]文字为这样文字[/fly]");
} else if (nomode=='1' || document.selection && document.selection.type == "Text") {
var AddTxt="[fly]"+text+"[/fly]";
AddText(AddTxt);
}
else
{
var txt=prompt("飞行文字.","文字");
if(txt!=null){
var AddTxt="[fly]"+txt;
AddText(AddTxt);
AddTxt="[/fly]";
AddText(AddTxt);
}
}
}
function shadow(){
if (helpmode=='1') {
alert("阴影标记\n使文字产生阴影效果.\n用法: [SHADOW=宽度, 颜色, 边界]要产生阴影效果的文字[/SHADOW]");
} else if (nomode=='1' || document.selection && document.selection.type == "Text") {
var AddTxt="[shadow=255,blue,1]"+text+"[/shadow]";
AddText(AddTxt);
}
else
{
var txt1=prompt("输入文字的长度,颜色,边界大小.","250,blue,0");
if(txt1!=null){
var txt2=prompt("要产生阴影效果的文字.","文字");
if(txt2!=null){
var AddTxt="[shadow="+txt1+"]"+txt2;
AddText(AddTxt);
AddTxt="[/shadow]";
AddText(AddTxt);
}
}
}
}
function rming(){
if (helpmode=='1') {
alert("RM音乐标记\n插入一个RM链接标记\n使用方法: [rm]http:\/\/www.qqwm.com\/rm\/php.rm[/rm]");
} else if (nomode=='1' || document.selection && document.selection.type == "Text") {
var AddTxt="[rm]"+text+"[/rm]";
AddText(AddTxt);
}
else
{
var txt=prompt("rm电影的URL","http://");
if(txt!=null){
var AddTxt="[rm]"+txt;
AddText(AddTxt);
AddTxt="[/rm]";
AddText(AddTxt);
}
}
}
function wmv(){
if (helpmode=='1'){
alert("wmv标记\n插入wmv\n用法: [wmv]http:\/\/www.qqwm.com\/wmv\/php.wmv[/wmv]");
} else if (nomode=='1' || document.selection && document.selection.type == "Text") {
var AddTxt="[wmv]"+text+"[/wmv]";
AddText(AddTxt);
}
else
{
var txt=prompt("wmv电影的URL","http://");
if(txt!=null){
var AddTxt="[wmv]"+txt;
AddText(AddTxt);
AddTxt="[/wmv]";
AddText(AddTxt);
}
}
}
function glow(){
if (helpmode=='1') {
alert("光晕标记\n使文字产生光晕效果.\n用法: [GLOW=宽度, 颜色, 边界]要产生光晕效果的文字[/GLOW]");
} else if (nomode=='1' || document.selection && document.selection.type == "Text") {
var AddTxt="[glow=250,red,2]"+text+"[/glow]";
AddText(AddTxt);
}
else
{
var txt1=prompt("文字的长度,颜色,边界大小.","250,red,2");
if(txt1!=null){
var txt2=prompt("要产生光晕效果的文字.","文字");
if(txt2!=null){
var AddTxt="[glow="+txt1+"]"+txt2;
AddText(AddTxt);
AddTxt="[/glow]";
AddText(AddTxt);
}
}
}
}
function checklength(){
alert(document.FORM.content.value.length);
}
function copytext()
{
var tempval=eval(document.FORM.content);
tempval.focus();
tempval.select();
therange=tempval.createTextRange();
therange.execCommand("Copy");
}
function replac()
{
if (helpmode=='1')
{
alert("替换关键字");
}
else
{
txt2=prompt("请输入搜寻目标关键字","");
if (txt2 != null)
{
if (txt2 != "")
{
txt=prompt("关键字替换为:",txt2);
}
else
{
replac();
}
var Rtext = txt2; var Itext = txt; document.FORM.content.value= eval('FORM.content.value.replace("'+Rtext+'","'+Itext+'")');
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -