📄 globals.js
字号:
/* ----------------------------------------------------------- */
// Toggles and objects visibliity
/* ----------------------------------------------------------- */
function if_ToggleVisability(obj, visible) {
obj = if_returnObjRef(obj);
if (visible) {obj.style.display = "";}
else {obj.style.display = "none";}
}
/* ----------------------------------------------------------- */
// Starting with the given node, find the nearest contained element
// with the specified tag name.
/* ----------------------------------------------------------- */
function if_getContainer(node, tagName) {
while (node != null) {
if (node.tagName != null && node.tagName == tagName)
return node; node = node.parentNode;
}
return node;
}
/* ----------------------------------------------------------- */
// This funtion removes the px chars from top and left
// properties for NS6 browsers and returns a int
/* ----------------------------------------------------------- */
function if_removePX(strInput) {
var strOutput = 0;
strOutput = strInput.substr(0, strInput.length -2);
return strOutput;
}
/* ----------------------------------------------------------- */
// This funtion removes any trialing anchor points within a string
/* ----------------------------------------------------------- */
function if_removeBookmark(strInput) {
var uri = new String(strInput)
var strOutput; var intPos = uri.indexOf('#');
if (intPos > 0) {strOutput = uri.substring(0, intPos);}
else {strOutput = uri;} return strOutput;
}
/* ----------------------------------------------------------- */
// This funtion removes any querystring from a string
/* ----------------------------------------------------------- */
function if_removeQueryString(strInput) {
var uri = new String(strInput)
var strOutput; var intPos = uri.indexOf('?');
if (intPos > 0) {strOutput = uri.substring(0, intPos);}
else {strOutput = uri;} return strOutput;
}
/* ----------------------------------------------------------- */
// This funtion expands and collapses a group of panel bars
/* ----------------------------------------------------------- */
function if_ExpandPanelBars(objName, bolState, strSkin) {
if (ie4 || ie5 || opera || ns6) {
// toggle all table rows matching object name
tr = document.getElementsByTagName("tr");
for (var i = 0; i < tr.length; i++)
{
if (tr[i].id.indexOf(objName) >= 0) {
if (bolState)
{tr[i].style.display = "";}
else
{tr[i].style.display = "none";}
}
}
// toggle all tables matching object name
table = document.getElementsByTagName("table");
for (var i = 0; i < table.length; i++)
{
if (table[i].id.indexOf(objName) >= 0) {
if (bolState)
{table[i].style.display = "";}
else
{table[i].style.display = "none";}
}
}
// change all images matching object name
input = document.getElementsByTagName("img");
for (var i = 0; i < input.length; i++)
{
if (input[i].id.indexOf(objName) >= 0) {
if (bolState)
{input[i].src = strSkin + "Images/Misc_Collapse.gif";}
else
{input[i].src = strSkin + "Images/Misc_Expand.gif";}
}
}
}
}
/* ----------------------------------------------------------- */
// Inserts IFCode into the target textbox control
/* ----------------------------------------------------------- */
function if_InsertIFCode(startTag, middleTag, endTag, objTextBox) {
if (ns4) {
objTextBox.value += startTag + middleTag + endTag;
} else if (opera || opera8) {
if (opera8) {
objTextBox.focus(); var txt;
var s = objTextBox.document.selection;
if (s.type == "Text" || s.type == "None") {
var r = s.createRange(); r.colapse;
if (r.text.length > 0) {txt = startTag + r.text + endTag;}
else {txt = startTag + middleTag + endTag;}
r.text = txt;
r.moveEnd("character", - (endTag.length));
r.select();
} else {alert(if_WYSIWYGPrompt);}
}
else {objTextBox.value += startTag + middleTag + endTag;}
} else if (ie4 || ie5) {
var s; objTextBox.focus();
if (objTextBox.type != null) // we are working with the textarea
{s = objTextBox.document.selection;}
else // we are working with the iframe
{objTextBox.focus();
s = objTextBox.document.selection;}
if (s.type == "Text" || s.type == "None") {
var txt; var r = s.createRange(); r.colapse;
if (r.text.length > 0)
{txt = startTag + r.text + endTag;}
else
{txt = startTag + middleTag + endTag;}
if (r.parentElement().isMultiLine && r.parentElement().isContentEditable || objTextBox.type == "textarea") {
r.text = txt;
r.moveEnd("character", - (endTag.length));
r.select();
}
} else {alert(if_WYSIWYGPrompt);}
} else if (ns6) {
if (objTextBox.selectionEnd) {
var charPos; var charMiddle;
var selStart = objTextBox.selectionStart;
var selEnd = objTextBox.selectionEnd; if (selEnd <= 2) {selEnd = objTextBox.textLength;}
var charStart = objTextBox.value.substring(0, selStart);
var charEnd = objTextBox.value.substring(selEnd, objTextBox.textLength);
// do we have a selection
if (selStart != selEnd) {
charMiddle = objTextBox.value.substring(selStart, selEnd);
objTextBox.value = charStart + startTag + charMiddle + endTag + charEnd;
charPos = selStart + (startTag.length + charMiddle.length);}
else {
objTextBox.value = charStart + startTag + middleTag + endTag + charEnd;
charPos = selStart + (startTag.length + middleTag.length);
}
objTextBox.selectionStart = charPos;
objTextBox.selectionEnd = charPos;
} else {
objTextBox.value += startTag + middleTag + endTag;
objTextBox.selectionStart = (startTag.length + middleTag.length);
objTextBox.selectionEnd = (startTag.length + middleTag.length);
}
}
objTextBox.focus();
}
/* ----------------------------------------------------------- */
// This function handles a window resize to ensure menus display correctly
/* ----------------------------------------------------------- */
function if_winResize() {
if_hideAllMenus();
}
/* ----------------------------------------------------------- */
// This function handles a selectedIndex changed events for the
// forum jump drop down list
/* ----------------------------------------------------------- */
function if_ForumJump(location) {
// ensure we have a URL
if (location != "" && location != null)
{window.location = location;}
}
/* ----------------------------------------------------------- */
// Opens a window within the forums. Used for printtopic.aspx
/* ----------------------------------------------------------- */
function if_wOpen(Url, Width, Height, Scroll, ToolBar, Location, Status, MenuBar, Resizeable, Unique) {
var String;
var winName = Width.toString() + Height.toString()
String = "toolbar=" + ToolBar + ",location=" + Location
String += ", directories=0,status=" + Status + ",menubar=" + MenuBar + ","
String += "scrollbars=" + Scroll + ",resizable=" + Resizeable + ",copyhistory=0,";
String += ",width=";
String += Width;
String += ",height=";
String += Height;
// should we center popup window
if (ie4 || ie5 || opera || ns6) {
WndTop = (screen.height - Height) / 2;
WndLeft = (screen.width - Width) / 2;
String += ",top=";
String += WndTop;
String += ",left=";
String += WndLeft;}
// should we display single popup or allow multiple
try {
if (Unique == true) {WinPic = window.open(Url,WinNum++,String);}
else {WinPic = window.open(Url,winName,String);WinPic.focus();}}
catch (e) {};
}
/* ----------------------------------------------------------- */
// Forum logout confirmation alert
/* ----------------------------------------------------------- */
function if_logOut() {
if (ie4 || ie5 || opera || ns6) {
ht = document.getElementsByTagName("body");
ht[0].style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=55)";
if (confirm(if_strLogoutAlertText)) {return true;}
else {ht[0].style.filter = ""; return false;}
}
else {
if (confirm(if_strLogoutAlertText)) {return true;}
else {return false;}
}
}
/* ----------------------------------------------------------- */
// EmotIcons Functions
/* ----------------------------------------------------------- */
function if_InsertEmotIconPopup(uri, ControlID) {
if_wOpen(uri+"?ControlID="+ControlID,250,500,1,0,0,0,0,1,false);
}
/* ----------------------------------------------------------- */
// Insert IFCode from Model Dialog Window
/* ----------------------------------------------------------- */
function if_InsertIFCodePopup(uri, ControlID) {
if_wOpen(uri+"?ControlID="+ControlID,535,500,1,0,0,0,0,1,false);
}
/* ----------------------------------------------------------- */
// Attachment Functions
/* ----------------------------------------------------------- */
function if_EditAttachments(uri) {
if_wOpen(uri,525,375,1,0,0,0,0,1,false);
}
/* ----------------------------------------------------------- */
// User Detail Functions
/* ----------------------------------------------------------- */
function if_UserDetail(uri) {
if_wOpen(uri,525,375,1,0,0,0,0,1,false);
}
/* ----------------------------------------------------------- */
// Attachment Functions
/* ----------------------------------------------------------- */
function if_PrintTopic(uri) {
var WinNum = 1;
window.open(uri,WinNum++);
}
/* ----------------------------------------------------------- */
// Prompt to grab direct link to post
/* ----------------------------------------------------------- */
function if_PostLink(uri) {
var link = if_removeQueryString(uri);
var linkDialog = prompt(if_linkPrompt,link);
}
/* ----------------------------------------------------------- */
// Prompt displayed with unread private messages
/* ----------------------------------------------------------- */
function if_UnreadPrivateMessagePrompt(uri) {
if (confirm(if_UnreadPrivateMessages))
{location = uri;} else {return false;}
}
//-->
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -