📄 function.js
字号:
/********************************************************\ * * * Dream Fly XP 3 留言本 JavaScript Functions * * * * 程 序:无马骑士 * * 版 权:酷虫工作室 * * 修 改:2004/05/17 * * 主 页:http://hotage.myrice.com * * *\********************************************************/// -----------------------------------------// find the object// -----------------------------------------function findObj(theObj, theDoc){ var i, foundObj; if(!theDoc) theDoc = document; if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj]; for (i=0; !foundObj && i < theDoc.forms.length; i++) foundObj = theDoc.forms[i][theObj]; if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj); return foundObj;}// -----------------------------------------// Show Date & Time// -----------------------------------------function timeString(){ today=new Date(); var hours = today.getHours(); var minutes = today.getMinutes(); var seconds = today.getSeconds(); var timeValue = ((hours >12) ? hours -12 :hours); timeValue += ((minutes < 10) ? ":0" : ":") + minutes; timeValue += (hours >= 12) ? " PM" : " AM"; timeString= document.write("",today.getYear(),"-","",today.getMonth()+1,"-","",today.getDate()," ",timeValue); return timeString}// -----------------------------------------// Creat Tool Tips// -----------------------------------------/* Example: <BODY> <div id="toolTipLayer" style="position:absolute; visibility: hidden; z-index:0"></div> <script language="JavaScript">initToolTips(); </script> ... <span onMouseOver="showToolTip('标签文字');" onMouseOut ="showToolTip();">hello,world</a> ...*/var ns4 = document.layers;var ns6 = document.getElementById && !document.all;var ie4 = document.all;var offsetX = 0;var offsetY = 20;var toolTipSTYLE="";function initToolTips(){ if(ns4||ns6||ie4){ if(ns4) toolTipSTYLE = document.toolTipLayer; else if(ns6) toolTipSTYLE = document.getElementById("toolTipLayer").style; else if(ie4) toolTipSTYLE = document.all.toolTipLayer.style; if(ns4) document.captureEvents(Event.MOUSEMOVE); else { toolTipSTYLE.visibility = "visible"; toolTipSTYLE.display = "none"; } document.onmousemove = moveToMouseLoc; }}function showToolTip(content){ if(content==null) { // hide: note - function ... showToolTip.arguments ... if(ns4) toolTipSTYLE.visibility = "hidden"; else toolTipSTYLE.display = "none"; } else { // show if(ns4){ toolTipSTYLE.document.write(content); toolTipSTYLE.document.close(); toolTipSTYLE.visibility = "visible"; } if(ns6){ document.getElementById("toolTipLayer").innerHTML = content; toolTipSTYLE.display='block' } if(ie4){ document.all("toolTipLayer").innerHTML=content; toolTipSTYLE.display='block' } }}function moveToMouseLoc(e){ if(ns4||ns6){ x = e.pageX; y = e.pageY; } else { x = event.x + document.body.scrollLeft; y = event.y + document.body.scrollTop; } toolTipSTYLE.left = x + offsetX; toolTipSTYLE.top = y + offsetY; return true;}// -----------------------------------------// UBB Codes// -----------------------------------------function insertText(str) { var oContent = findObj('content'); if (oContent) { if (document.all) { insertAtCaret(oContent, str); } else { oContent.value += str; } oContent.focus(); }}function insertAtCaret(textEl, text) { if (textEl.createTextRange && textEl.caretPos) { var caretPos = textEl.caretPos; caretPos.text += caretPos.text.charAt(caretPos.text.length - 2) == ' ' ? text + ' ' : text; } else if (textEl) { textEl.value += text; } else { textEl.value = text; }}function insertCode(code, option){ var promptTitle; var promptValue; var codeBegin; var codeClose; var text; switch (code){ case 'B': promptTitle = promptValue = "粗体文字"; codeBegin = "[b]"; codeClose = "[/b]"; break; case 'I': promptTitle = promptValue = "斜体文字"; codeBegin = "[i]"; codeClose = "[/i]"; break; case 'U': promptTitle = promptValue = "下划线文字"; codeBegin = "[u]"; codeClose = "[/u]"; break; case 'CODE': promptTitle = promptValue = "程序代码"; codeBegin = "[code]"; codeClose = "[/code]"; break; case 'IMG': promptTitle = "图象地址"; promptValue = "http://"; codeBegin = "[img]"; codeClose = "[/img]"; break; case 'URL': promptTitle = "超级链接"; promptValue = "http://"; codeBegin = "[url]"; codeClose = "[/url]"; break; case 'EMAIL': promptTitle = "电子邮件"; promptValue = "@"; codeBegin = "[email]"; codeClose = "[/email]"; break; case 'FLY': promptTitle = promptValue = "飞行文字"; codeBegin = "[fly]"; codeClose = "[/fly]"; break; case 'MOVE': promptTitle = promptValue = "滚动文字"; codeBegin = "[move]"; codeClose = "[/move]"; break; case 'GLOW': promptTitle = "光晕文字 (参数: glow=颜色,光晕大小)"; promptValue = "光晕文字"; codeBegin = "[glow=red,2]"; codeClose = "[/glow]"; break; case 'SHADOW': promptTitle = "阴影文字 (参数: shadow=颜色,方向,阴影大小)"; promptValue = "阴影文字"; codeBegin = "[shadow=green,45,2]"; codeClose = "[/shadow]"; break; case 'FONT' : promptTitle = "字体 (" +option+ ")"; promptValue = option; codeBegin = "[font=" +option+ "]"; codeClose = "[/font]"; break; case 'SIZE' : promptTitle = "字号 (" +option+ ")"; promptValue = option; codeBegin = "[size=" +option+ "]"; codeClose = "[/size]"; break; case 'COLOR' : promptTitle = "字体颜色 (" +option+ ")"; promptValue = "颜色字"; codeBegin = "[color=" +option+ "]"; codeClose = "[/color]"; break; default: text = code; } if(text){ insertText(text); }else if(code && option!='false'){ txt = prompt( "DreamFly 留言本 - " + promptTitle + ": ", promptValue); if (txt != null) { insertText(codeBegin + txt + codeClose); } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -