Version 2.1.7

This commit is contained in:
Neo committed 2025-12-19 00:21:15 -08:00
1 parent 0eecc172d9
commit f73f8bff6d
941 files changed
+215301 -103093

No files matched your search

+214
View File
@@ -0,0 +1,214 @@
/**************************************************
* dom-drag.js
* 09.25.2001
* www.youngpup.net
**************************************************
* 10.28.2001 - fixed minor bug where events
* sometimes fired off the handle, not the root.
**************************************************
* IPS CHANGES
* 06.01.2005 - Added "cursorchange" to change
* 07.18.2005 - Added cookie to store values
* 07.18.2005 - Made it impossible to drag < 0 height (keeponscreen)
* mouse cursor when over drag handle
**************************************************/
var Drag = {
obj : null,
fx : null,
fy : null,
cookiename : null,
keeponscreen: true,
init : function(o, oRoot, minX, maxX, minY, maxY, bSwapHorzRef, bSwapVertRef, fXMapper, fYMapper)
{
o.onmousedown = Drag.start;
o.onmouseover = Drag.cursorchange;
o.hmode = bSwapHorzRef ? false : true ;
o.vmode = bSwapVertRef ? false : true ;
o.root = oRoot && oRoot != null ? oRoot : o ;
if (o.hmode && isNaN(parseInt(o.root.style.left ))) o.root.style.left = "0px";
if (o.vmode && isNaN(parseInt(o.root.style.top ))) o.root.style.top = "0px";
if (!o.hmode && isNaN(parseInt(o.root.style.right ))) o.root.style.right = "0px";
if (!o.vmode && isNaN(parseInt(o.root.style.bottom))) o.root.style.bottom = "0px";
o.minX = typeof minX != 'undefined' ? minX : null;
o.minY = typeof minY != 'undefined' ? minY : null;
o.maxX = typeof maxX != 'undefined' ? maxX : null;
o.maxY = typeof maxY != 'undefined' ? maxY : null;
o.xMapper = fXMapper ? fXMapper : null;
o.yMapper = fYMapper ? fYMapper : null;
//----------------------------------
// Figure width and height
//----------------------------------
if ( Drag.keeponscreen )
{
Drag.my_width = 0;
Drag.my_height = 0;
if ( typeof( window.innerWidth ) == 'number' )
{
//----------------------------------
// Non IE
//----------------------------------
Drag.my_width = window.innerWidth;
Drag.my_height = window.innerHeight;
}
else if ( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) )
{
//----------------------------------
// IE 6+
//----------------------------------
Drag.my_width = document.documentElement.clientWidth;
Drag.my_height = document.documentElement.clientHeight;
}
else if ( document.body && ( document.body.clientWidth || document.body.clientHeight ) )
{
//----------------------------------
// Old IE
//----------------------------------
Drag.my_width = document.body.clientWidth;
Drag.my_height = document.body.clientHeight;
}
}
o.root.onDragStart = new Function();
o.root.onDragEnd = new Function();
o.root.onDrag = new Function();
},
cursorchange : function(e)
{
var o = Drag.obj = this;
o.style.cursor = 'move';
},
start : function(e)
{
var o = Drag.obj = this;
e = Drag.fixE(e);
var y = parseInt(o.vmode ? o.root.style.top : o.root.style.bottom);
var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right );
o.root.onDragStart(x, y);
o.lastMouseX = e.clientX;
o.lastMouseY = e.clientY;
if (o.hmode) {
if (o.minX != null) o.minMouseX = e.clientX - x + o.minX;
if (o.maxX != null) o.maxMouseX = o.minMouseX + o.maxX - o.minX;
} else {
if (o.minX != null) o.maxMouseX = -o.minX + e.clientX + x;
if (o.maxX != null) o.minMouseX = -o.maxX + e.clientX + x;
}
if (o.vmode) {
if (o.minY != null) o.minMouseY = e.clientY - y + o.minY;
if (o.maxY != null) o.maxMouseY = o.minMouseY + o.maxY - o.minY;
} else {
if (o.minY != null) o.maxMouseY = -o.minY + e.clientY + y;
if (o.maxY != null) o.minMouseY = -o.maxY + e.clientY + y;
}
document.onmousemove = Drag.drag;
document.onmouseup = Drag.end;
return false;
},
drag : function(e)
{
e = Drag.fixE(e);
var o = Drag.obj;
var ey = e.clientY;
var ex = e.clientX;
var y = parseInt(o.vmode ? o.root.style.top : o.root.style.bottom);
var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right );
var nx, ny;
if (o.minX != null) ex = o.hmode ? Math.max(ex, o.minMouseX) : Math.min(ex, o.maxMouseX);
if (o.maxX != null) ex = o.hmode ? Math.min(ex, o.maxMouseX) : Math.max(ex, o.minMouseX);
if (o.minY != null) ey = o.vmode ? Math.max(ey, o.minMouseY) : Math.min(ey, o.maxMouseY);
if (o.maxY != null) ey = o.vmode ? Math.min(ey, o.maxMouseY) : Math.max(ey, o.minMouseY);
nx = x + ((ex - o.lastMouseX) * (o.hmode ? 1 : -1));
ny = y + ((ey - o.lastMouseY) * (o.vmode ? 1 : -1));
if (o.xMapper) nx = o.xMapper(y)
else if (o.yMapper) ny = o.yMapper(x)
//----------------------------------
// Keep on screen?
//----------------------------------
if ( Drag.keeponscreen )
{
ny = ny < 0 ? 0 : ny;
nx = nx < 0 ? 0 : nx;
if ( Drag.my_width )
{
nx = nx > Drag.my_width - parseInt(o.root.style.width) ? Drag.my_width - parseInt(o.root.style.width) : nx;
}
}
Drag.obj.root.style[o.hmode ? "left" : "right"] = nx + "px";
Drag.obj.root.style[o.vmode ? "top" : "bottom"] = ny + "px";
Drag.obj.lastMouseX = ex;
Drag.obj.lastMouseY = ey;
Drag.obj.root.onDrag(nx, ny);
return false;
},
end : function()
{
document.onmousemove = null;
document.onmouseup = null;
Drag.obj.root.onDragEnd( parseInt(Drag.obj.root.style[Drag.obj.hmode ? "left" : "right"]),
parseInt(Drag.obj.root.style[Drag.obj.vmode ? "top" : "bottom"]));
var o = Drag.obj;
fy = parseInt( o.root.style.top );
fx = parseInt( o.root.style.left );
//----------------------------------
// Store in a cookie?
//----------------------------------
if ( Drag.cookiename )
{
try
{
my_setcookie( Drag.cookiename, fx+','+fy, 1 );
}
catch(e)
{
}
}
Drag.obj = null;
},
fixE : function(e)
{
if (typeof e == 'undefined') e = window.event;
if (typeof e.layerX == 'undefined') e.layerX = e.offsetX;
if (typeof e.layerY == 'undefined') e.layerY = e.offsetY;
return e;
}
};
+15
View File
@@ -0,0 +1,15 @@
<html>
<head><title>Ошибка &lt; Русская версия Invision Power Board</title></head>
<body>
<h1>Ошибка &lt; Русская версия Invision Power Board</h1>
<hr>
Вы попали на несуществующую страницу!<br>Пожалуйста нажмите на кнопочку &laquo;<b>Назад</b>&raquo;
в вашем браузере для возвращения на предыдущую страницу.
<hr>
<b>Invision Power Board:</b>
<ul>
<li><a href="http://www.bestwarez.ru" title="BestWarez.Ru - Только лучший Варез!">Русская версия</a></li>
<li><a href="http://www.invisionboard.com" title="Official Site">English version</a></li>
</ul>
</body>
</html>
+443 -443
View File
@@ -1,443 +1,443 @@
//--------------------------------------------
// Set up our simple tag open values
//--------------------------------------------
var B_open = 0;
var I_open = 0;
var U_open = 0;
var QUOTE_open = 0;
var CODE_open = 0;
var SQL_open = 0;
var HTML_open = 0;
var bbtags = new Array();
var fombj = document.REPLIER;
//==========================================
// prep and set up
//==========================================
prep_mode();
function prep_mode()
{
cvalue = my_getcookie( "bbmode" );
if (cvalue == 'ezmode')
{
fombj.bbmode[0].checked = true;
}
else
{
fombj.bbmode[1].checked = true;
}
}
//==========================================
// Set BBCode mode
//==========================================
function setmode(mVal)
{
my_setcookie( 'bbmode', mVal, 1 );
}
function get_easy_mode_state()
{
//--------------------------------------------
// Returns true if we've chosen easy mode
//--------------------------------------------
if ( fombj.bbmode[0].checked )
{
return true;
}
else
{
return false;
}
}
//==========================================
// Set the help bar status
//==========================================
function hstat(msg)
{
fombj.helpbox.value = eval( "help_" + msg );
}
//==========================================
// Set the number of tags open box
//==========================================
function cstat()
{
var c = stacksize(bbtags);
if ( (c < 1) || (c == null) ) {
c = 0;
}
if ( ! bbtags[0] ) {
c = 0;
}
fombj.tagcount.value = c;
}
//==========================================
// Close all tags
//==========================================
function closeall()
{
if (bbtags[0])
{
while (bbtags[0])
{
tagRemove = popstack(bbtags)
fombj.Post.value += "[/" + tagRemove + "]";
//--------------------------------------------
// Change the button status
// Ensure we're not looking for FONT, SIZE or COLOR as these
// buttons don't exist, they are select lists instead.
//--------------------------------------------
if ( (tagRemove != 'FONT') && (tagRemove != 'SIZE') && (tagRemove != 'COLOR') )
{
eval("fombj." + tagRemove + ".value = ' " + tagRemove + " '");
eval(tagRemove + "_open = 0");
}
}
}
//--------------------------------------------
// Ensure we got them all
//--------------------------------------------
fombj.tagcount.value = 0;
bbtags = new Array();
fombj.Post.focus();
}
//==========================================
// EMOTICONS
//==========================================
function emoticon(theSmilie)
{
doInsert(" " + theSmilie + " ", "", false);
}
//==========================================
// ADD CODE
//==========================================
function add_code(NewCode)
{
fombj.Post.value += NewCode;
fombj.Post.focus();
}
//==========================================
// ALTER FONT
//==========================================
function alterfont(theval, thetag)
{
if (theval == 0)
return;
if(doInsert("[" + thetag + "=" + theval + "]", "[/" + thetag + "]", true))
pushstack(bbtags, thetag);
fombj.ffont.selectedIndex = 0;
fombj.fsize.selectedIndex = 0;
fombj.fcolor.selectedIndex = 0;
cstat();
}
//==========================================
// SIMPLE TAGS (such as B, I U, etc)
//==========================================
function simpletag(thetag)
{
var tagOpen = eval(thetag + "_open");
if ( get_easy_mode_state() )
{
inserttext = prompt(prompt_start + "\n[" + thetag + "]xxx[/" + thetag + "]");
if ( (inserttext != null) && (inserttext != "") )
{
doInsert("[" + thetag + "]" + inserttext + "[/" + thetag + "] ", "", false);
}
}
else
{
if (tagOpen == 0)
{
if(doInsert("[" + thetag + "]", "[/" + thetag + "]", true))
{
eval(thetag + "_open = 1");
//--------------------------------------------
// Change the button status
//--------------------------------------------
eval("fombj." + thetag + ".value += '*'");
pushstack(bbtags, thetag);
cstat();
hstat('click_close');
}
}
else
{
//--------------------------------------------
// Find the last occurance of the opened tag
//--------------------------------------------
lastindex = 0;
for (i = 0 ; i < bbtags.length; i++ )
{
if ( bbtags[i] == thetag )
{
lastindex = i;
}
}
//--------------------------------------------
// Close all tags opened up to that tag was opened
//--------------------------------------------
while (bbtags[lastindex])
{
tagRemove = popstack(bbtags);
doInsert("[/" + tagRemove + "]", "", false)
//--------------------------------------------
// Change the button status
//--------------------------------------------
if ( (tagRemove != 'FONT') && (tagRemove != 'SIZE') && (tagRemove != 'COLOR') )
{
eval("fombj." + tagRemove + ".value = ' " + tagRemove + " '");
eval(tagRemove + "_open = 0");
}
}
cstat();
}
}
}
//==========================================
// List tag
//==========================================
function tag_list()
{
var listvalue = "init";
var thelist = "";
while ( (listvalue != "") && (listvalue != null) )
{
listvalue = prompt(list_prompt, "");
if ( (listvalue != "") && (listvalue != null) )
{
thelist = thelist+"[*]"+listvalue+"\n";
}
}
if ( thelist != "" )
{
doInsert( "[LIST]\n" + thelist + "[/LIST]\n", "", false);
}
}
//==========================================
// URL tag
//==========================================
function tag_url()
{
var FoundErrors = '';
var enterURL = prompt(text_enter_url, "http://");
var enterTITLE = prompt(text_enter_url_name, "My Webpage");
if (!enterURL) {
FoundErrors += " " + error_no_url;
}
if (!enterTITLE) {
FoundErrors += " " + error_no_title;
}
if (FoundErrors) {
alert("Error!"+FoundErrors);
return;
}
doInsert("[URL="+enterURL+"]"+enterTITLE+"[/URL]", "", false);
}
//==========================================
// Insert attachment tag
//==========================================
function insert_attach_to_textarea(aid)
{
doInsert( "[attachmentid="+aid+"]" );
}
//==========================================
// Image tag
//==========================================
function tag_image()
{
var FoundErrors = '';
var enterURL = prompt(text_enter_image, "http://");
if (!enterURL) {
FoundErrors += " " + error_no_url;
}
if (FoundErrors) {
alert("Error!"+FoundErrors);
return;
}
doInsert("[IMG]"+enterURL+"[/IMG]", "", false);
}
function tag_email()
{
var emailAddress = prompt(text_enter_email, "");
if (!emailAddress) {
alert(error_no_email);
return;
}
doInsert("[EMAIL]"+emailAddress+"[/EMAIL]", "", false);
}
//--------------------------------------------
// GENERAL INSERT FUNCTION
//--------------------------------------------
// ibTag: opening tag
// ibClsTag: closing tag, used if we have selected text
// isSingle: true if we do not close the tag right now
// return value: true if the tag needs to be closed later
//
function doInsert(ibTag, ibClsTag, isSingle)
{
var isClose = false;
var obj_ta = fombj.Post;
//----------------------------------------
// It's IE!
//----------------------------------------
if ( (ua_vers >= 4) && is_ie && is_win)
{
if (obj_ta.isTextEdit)
{
obj_ta.focus();
var sel = document.selection;
var rng = sel.createRange();
rng.colapse;
if((sel.type == "Text" || sel.type == "None") && rng != null)
{
if(ibClsTag != "" && rng.text.length > 0)
ibTag += rng.text + ibClsTag;
else if(isSingle)
isClose = true;
rng.text = ibTag;
}
}
else
{
if(isSingle)
{
isClose = true;
}
obj_ta.value += ibTag;
}
}
//----------------------------------------
// It's MOZZY!
//----------------------------------------
else if ( obj_ta.selectionEnd )
{
var ss = obj_ta.selectionStart;
var st = obj_ta.scrollTop;
var es = obj_ta.selectionEnd;
if (es <= 2)
{
es = obj_ta.textLength;
}
var start = (obj_ta.value).substring(0, ss);
var middle = (obj_ta.value).substring(ss, es);
var end = (obj_ta.value).substring(es, obj_ta.textLength);
//-----------------------------------
// text range?
//-----------------------------------
if (obj_ta.selectionEnd - obj_ta.selectionStart > 0)
{
middle = ibTag + middle + ibClsTag;
}
else
{
middle = ibTag + middle;
if (isSingle)
{
isClose = true;
}
}
obj_ta.value = start + middle + end;
var cpos = ss + (middle.length);
obj_ta.selectionStart = cpos;
obj_ta.selectionEnd = cpos;
obj_ta.scrollTop = st;
}
//----------------------------------------
// It's CRAPPY!
//----------------------------------------
else
{
if (isSingle)
{
isClose = true;
}
obj_ta.value += ibTag;
}
obj_ta.focus();
return isClose;
}
//--------------------------------------------
// Set up our simple tag open values
//--------------------------------------------
var B_open = 0;
var I_open = 0;
var U_open = 0;
var QUOTE_open = 0;
var CODE_open = 0;
var SQL_open = 0;
var HTML_open = 0;
var bbtags = new Array();
var fombj = document.REPLIER;
//==========================================
// prep and set up
//==========================================
prep_mode();
function prep_mode()
{
cvalue = my_getcookie( "bbmode" );
if (cvalue == 'ezmode')
{
fombj.bbmode[0].checked = true;
}
else
{
fombj.bbmode[1].checked = true;
}
}
//==========================================
// Set BBCode mode
//==========================================
function setmode(mVal)
{
my_setcookie( 'bbmode', mVal, 1 );
}
function get_easy_mode_state()
{
//--------------------------------------------
// Returns true if we've chosen easy mode
//--------------------------------------------
if ( fombj.bbmode[0].checked )
{
return true;
}
else
{
return false;
}
}
//==========================================
// Set the help bar status
//==========================================
function hstat(msg)
{
fombj.helpbox.value = eval( "help_" + msg );
}
//==========================================
// Set the number of tags open box
//==========================================
function cstat()
{
var c = stacksize(bbtags);
if ( (c < 1) || (c == null) ) {
c = 0;
}
if ( ! bbtags[0] ) {
c = 0;
}
fombj.tagcount.value = c;
}
//==========================================
// Close all tags
//==========================================
function closeall()
{
if (bbtags[0])
{
while (bbtags[0])
{
tagRemove = popstack(bbtags)
fombj.Post.value += "[/" + tagRemove + "]";
//--------------------------------------------
// Change the button status
// Ensure we're not looking for FONT, SIZE or COLOR as these
// buttons don't exist, they are select lists instead.
//--------------------------------------------
if ( (tagRemove != 'FONT') && (tagRemove != 'SIZE') && (tagRemove != 'COLOR') )
{
eval("fombj." + tagRemove + ".value = ' " + tagRemove + " '");
eval(tagRemove + "_open = 0");
}
}
}
//--------------------------------------------
// Ensure we got them all
//--------------------------------------------
fombj.tagcount.value = 0;
bbtags = new Array();
fombj.Post.focus();
}
//==========================================
// EMOTICONS
//==========================================
function emoticon(theSmilie)
{
doInsert(" " + theSmilie + " ", "", false);
}
//==========================================
// ADD CODE
//==========================================
function add_code(NewCode)
{
fombj.Post.value += NewCode;
fombj.Post.focus();
}
//==========================================
// ALTER FONT
//==========================================
function alterfont(theval, thetag)
{
if (theval == 0)
return;
if(doInsert("[" + thetag + "=" + theval + "]", "[/" + thetag + "]", true))
pushstack(bbtags, thetag);
fombj.ffont.selectedIndex = 0;
fombj.fsize.selectedIndex = 0;
fombj.fcolor.selectedIndex = 0;
cstat();
}
//==========================================
// SIMPLE TAGS (such as B, I U, etc)
//==========================================
function simpletag(thetag)
{
var tagOpen = eval(thetag + "_open");
if ( get_easy_mode_state() )
{
inserttext = prompt(prompt_start + "\n[" + thetag + "]xxx[/" + thetag + "]");
if ( (inserttext != null) && (inserttext != "") )
{
doInsert("[" + thetag + "]" + inserttext + "[/" + thetag + "] ", "", false);
}
}
else
{
if (tagOpen == 0)
{
if(doInsert("[" + thetag + "]", "[/" + thetag + "]", true))
{
eval(thetag + "_open = 1");
//--------------------------------------------
// Change the button status
//--------------------------------------------
eval("fombj." + thetag + ".value += '*'");
pushstack(bbtags, thetag);
cstat();
hstat('click_close');
}
}
else
{
//--------------------------------------------
// Find the last occurance of the opened tag
//--------------------------------------------
lastindex = 0;
for (i = 0 ; i < bbtags.length; i++ )
{
if ( bbtags[i] == thetag )
{
lastindex = i;
}
}
//--------------------------------------------
// Close all tags opened up to that tag was opened
//--------------------------------------------
while (bbtags[lastindex])
{
tagRemove = popstack(bbtags);
doInsert("[/" + tagRemove + "]", "", false)
//--------------------------------------------
// Change the button status
//--------------------------------------------
if ( (tagRemove != 'FONT') && (tagRemove != 'SIZE') && (tagRemove != 'COLOR') )
{
eval("fombj." + tagRemove + ".value = ' " + tagRemove + " '");
eval(tagRemove + "_open = 0");
}
}
cstat();
}
}
}
//==========================================
// List tag
//==========================================
function tag_list()
{
var listvalue = "init";
var thelist = "";
while ( (listvalue != "") && (listvalue != null) )
{
listvalue = prompt(list_prompt, "");
if ( (listvalue != "") && (listvalue != null) )
{
thelist = thelist+"[*]"+listvalue+"\n";
}
}
if ( thelist != "" )
{
doInsert( "[LIST]\n" + thelist + "[/LIST]\n", "", false);
}
}
//==========================================
// URL tag
//==========================================
function tag_url()
{
var FoundErrors = '';
var enterURL = prompt(text_enter_url, "http://");
var enterTITLE = prompt(text_enter_url_name, jsfile_myweb_lang);
if (!enterURL) {
FoundErrors += " " + error_no_url;
}
if (!enterTITLE) {
FoundErrors += " " + error_no_title;
}
if (FoundErrors) {
alert(jsfile_error_lang + FoundErrors);
return;
}
doInsert("[URL="+enterURL+"]"+enterTITLE+"[/URL]", "", false);
}
//==========================================
// Insert attachment tag
//==========================================
function insert_attach_to_textarea(aid)
{
doInsert( "[attachmentid="+aid+"]" );
}
//==========================================
// Image tag
//==========================================
function tag_image()
{
var FoundErrors = '';
var enterURL = prompt(text_enter_image, "http://");
if (!enterURL) {
FoundErrors += " " + error_no_url;
}
if (FoundErrors) {
alert(jsfile_error_lang + FoundErrors);
return;
}
doInsert("[IMG]"+enterURL+"[/IMG]", "", false);
}
function tag_email()
{
var emailAddress = prompt(text_enter_email, "");
if (!emailAddress) {
alert(error_no_email);
return;
}
doInsert("[EMAIL]"+emailAddress+"[/EMAIL]", "", false);
}
//--------------------------------------------
// GENERAL INSERT FUNCTION
//--------------------------------------------
// ibTag: opening tag
// ibClsTag: closing tag, used if we have selected text
// isSingle: true if we do not close the tag right now
// return value: true if the tag needs to be closed later
//
function doInsert(ibTag, ibClsTag, isSingle)
{
var isClose = false;
var obj_ta = fombj.Post;
//----------------------------------------
// It's IE!
//----------------------------------------
if ( (ua_vers >= 4) && is_ie && is_win)
{
if (obj_ta.isTextEdit)
{
obj_ta.focus();
var sel = document.selection;
var rng = sel.createRange();
rng.colapse;
if((sel.type == "Text" || sel.type == "None") && rng != null)
{
if(ibClsTag != "" && rng.text.length > 0)
ibTag += rng.text + ibClsTag;
else if(isSingle)
isClose = true;
rng.text = ibTag;
}
}
else
{
if(isSingle)
{
isClose = true;
}
obj_ta.value += ibTag;
}
}
//----------------------------------------
// It's MOZZY!
//----------------------------------------
else if ( obj_ta.selectionEnd )
{
var ss = obj_ta.selectionStart;
var st = obj_ta.scrollTop;
var es = obj_ta.selectionEnd;
if (es <= 2)
{
es = obj_ta.textLength;
}
var start = (obj_ta.value).substring(0, ss);
var middle = (obj_ta.value).substring(ss, es);
var end = (obj_ta.value).substring(es, obj_ta.textLength);
//-----------------------------------
// text range?
//-----------------------------------
if (obj_ta.selectionEnd - obj_ta.selectionStart > 0)
{
middle = ibTag + middle + ibClsTag;
}
else
{
middle = ibTag + middle;
if (isSingle)
{
isClose = true;
}
}
obj_ta.value = start + middle + end;
var cpos = ss + (middle.length);
obj_ta.selectionStart = cpos;
obj_ta.selectionEnd = cpos;
obj_ta.scrollTop = st;
}
//----------------------------------------
// It's CRAPPY!
//----------------------------------------
else
{
if (isSingle)
{
isClose = true;
}
obj_ta.value += ibTag;
}
obj_ta.focus();
return isClose;
}
+70 -4
View File
@@ -1,14 +1,80 @@
//------------------------------------------
// Invision Power Board v2.0
// Invision Power Board 2.1.7
// Boards JS File
// (c) 2003 Invision Power Services, Inc.
// (c) 2005 Invision Power Services, Inc.
//
// http://www.invisionboard.com
//------------------------------------------
function waitforme()
{
/*--------------------------------------------*/
// Send request to update marker
// NO LONGER USED
/*--------------------------------------------*/
function boards_send_marker_update( fid, is_subforum )
{
//----------------------------------
// Get current image...
//----------------------------------
try
{
var imgsrc = document.getElementById( 'f-'+fid ).innerHTML;
if ( imgsrc )
{
//----------------------------------
// Find out what img its using...
//----------------------------------
var regex = new RegExp( "src=['\"](.*/)("+regex_markers+")['\"]" );
var results = imgsrc.match( regex );
//----------------------------------
// Got a replacement?
//----------------------------------
if ( img_markers[ results[2] ] )
{
imgsrc = imgsrc.replace( regex, "src='$1"+img_markers[ results[2] ]+"'" );
document.getElementById( 'f-'+fid ).innerHTML = imgsrc;
}
}
}
catch(e){}
//----------------------------------
// Get new xhttp obj
//----------------------------------
xmlobj = new xmlrequest();
/*--------------------------------------------*/
// Main function to do on request
// Must be defined first!!
/*--------------------------------------------*/
xmlrequest.do_request_functon = function()
{
//----------------------------------
// Do nothing
//----------------------------------
}
//----------------------------------
// LOAD XML
//----------------------------------
xmlrequest.load_xml_document( ipb_var_base_url + 'act=xmlout&do=mark-forum&fid='+fid+'&sf='+is_subforum );
if ( ! xmlrequest.allow_use )
{
window.location = document.getElementById( 'f-'+fid ).url;
}
return false;
}
-108
View File
@@ -1,108 +0,0 @@
resetposition = function()
{
if ( document.getElementById )
{
var div = document.getElementById( divToCenter );
var divWidth = div.offsetWidth ? div.offsetWidth : div.style.width ? parseInt( div.style.width ) : 0;
var divHeight = div.offsetHeight ? div.offsetHeight : div.style.height ? parseInt( div.style.height ) : 0;
var sx = getwidth();
var sy = getheight();
var scrolly = getYscroll();
var setX = ( sx - divWidth ) / 2;
var setY = ( sy - divHeight) / 2 + scrolly;
if( setX < 0 ) setX = 0;
if( setY < 0 ) setY = 0;
div.style.left = setX + "px";
div.style.top = setY + "px";
div.style.visibility = "visible";
}
};
function getwidth()
{
var width = 0;
if( document.documentElement && document.documentElement.clientWidth )
{
width = document.documentElement.clientWidth;
}
else if( document.body && document.body.clientWidth )
{
width = document.body.clientWidth;
}
else if( window.innerWidth )
{
width = window.innerWidth - 18;
}
return width;
}
function getheight()
{
var height = 0;
if( document.documentElement && document.documentElement.clientHeight )
{
height = document.documentElement.clientHeight;
}
else if( document.body && document.body.clientHeight )
{
height = document.body.clientHeight;
}
else if( window.innerHeight )
{
height = window.innerHeight - 18;
}
return height;
}
function getXscroll()
{
var scrollX = 0;
if( document.documentElement && document.documentElement.scrollLeft )
{
scrollX = document.documentElement.scrollLeft;
}
else if( document.body && document.body.scrollLeft )
{
scrollX = document.body.scrollLeft;
}
else if( window.pageXOffset )
{
scrollX = window.pageXOffset;
}
else if( window.scrollX )
{
scrollX = window.scrollX;
}
return scrollX;
}
function getYscroll()
{
var scrollY = 0;
if( document.documentElement && document.documentElement.scrollTop )
{
scrollY = document.documentElement.scrollTop;
}
else if( document.body && document.body.scrollTop )
{
scrollY = document.body.scrollTop;
}
else if( window.pageYOffset )
{
scrollY = window.pageYOffset;
}
else if( window.scrollY )
{
scrollY = window.scrollY;
}
return scrollY;
}
+328
View File
@@ -0,0 +1,328 @@
//------------------------------------------
// Invision Power Board 2.1.7
// Text Editor Global Functions
// (c) 2005 Invision Power Services, Inc.
//
// http://www.invisionboard.com
//------------------------------------------
/*-------------------------------------------------------------------------*/
// INIT
/*-------------------------------------------------------------------------*/
var dontpassgo = 0;
//-------------------------------
// Keep an array of open tags
//-------------------------------
var bbtags = new Array();
//-------------------------------
// Define font faces
//-------------------------------
var ips_primary_fonts = new Array(
"arial",
"arial black",
"arial narrow",
"book antiqua",
"century gothic",
"comic sans ms",
"courier new",
"fixedsys",
"franklin gothic medium",
"garamond",
"georgia",
"impact",
"lucida console",
"lucida sans unicode",
"microsoft sans serif",
"palatino linotype",
"system",
"tahoma",
"times new roman",
"trebuchet ms",
"verdana"
);
//-------------------------------
// Remap font sizes
//-------------------------------
var ips_fontsizes =
{
'8px' : 1,
'10pt' : 2,
'12pt' : 3,
'14pt' : 4,
'18pt' : 5,
'24pt' : 6,
'36pt' : 7
}
//-------------------------------
// Define sizes
//-------------------------------
var ips_font_sizes = new Array( 1, 2, 3, 4, 5, 6, 7 );
//-------------------------------
// Reverse them so we can look up
// by ID
//-------------------------------
var ips_reverse_primary_fonts = new Array();
var ips_reverse_font_sizes = new Array();
var ips_reverse_fontsizes = new Array();
for( var i in ips_primary_fonts )
{
ips_reverse_primary_fonts[ ips_primary_fonts[i] ] = i;
}
for( var i in ips_font_sizes )
{
ips_reverse_font_sizes[ ips_font_sizes[i] ] = i;
}
for( var i in ips_fontsizes )
{
ips_reverse_fontsizes[ ips_fontsizes[i] ] = i;
}
/*-------------------------------------------------------------------------*/
// Close all tags
/*-------------------------------------------------------------------------*/
function closeall()
{
if ( bbtags[0] )
{
while ( bbtags[0] )
{
tagRemove = popstack( bbtags )
postformobj.Post.value += "[/" + tagRemove + "]";
if ( i_am == 'std' )
{
toggle_button( tagRemove );
}
else
{
rte_button_update( tagRemove );
}
}
}
//--------------------------------------------
// Ensure we got them all
//--------------------------------------------
bbtags = new Array();
postformobj.Post.focus();
}
/*-------------------------------------------------------------------------*/
// Close all nested tags
/*-------------------------------------------------------------------------*/
function smart_close_tags( thetag )
{
//--------------------------------------------
// Find the last occurance of the opened tag
//--------------------------------------------
lastindex = 0;
for (i = 0 ; i < bbtags.length; i++ )
{
if ( bbtags[i] == thetag )
{
lastindex = i;
}
}
//--------------------------------------------
// Close all tags opened up to that tag was opened
//--------------------------------------------
while ( bbtags[lastindex] )
{
tagRemove = popstack(bbtags);
wrap_tags("[/" + tagRemove + "]", "")
//--------------------------------------------
// Change the button status
//--------------------------------------------
if ( i_am == 'std' )
{
toggle_button( tagRemove );
}
else
{
rte_button_update( tagRemove );
}
}
}
/*-------------------------------------------------------------------------*/
// Write font face box
/*-------------------------------------------------------------------------*/
function write_fontface_box()
{
html = "";
for( var i in ips_primary_fonts )
{
option = ips_primary_fonts[i];
display = ips_primary_fonts[i];
//-------------------------------
// Tidy up show name
// Make "courier new" "Courier New"
//-------------------------------
var tmp = display.split( " " );
var rtn = new Array;
for ( var id in tmp )
{
rtn[id] = tmp[id].substr(0, 1).toUpperCase() + tmp[id].substr(1);
}
display = rtn.join( " " );
html += "\n<option style='font-family:" + display + "' value='" + display + "'>" + display + "</option>";
}
return html;
}
/*-------------------------------------------------------------------------*/
// Write font size box
/*-------------------------------------------------------------------------*/
function write_fontsize_box()
{
html = "";
for( var i in ips_font_sizes )
{
option = ips_font_sizes[i];
display = ips_font_sizes[i];
html += "\n<option value='" + display + "'>" + display + "</option>";
}
return html;
}
/*-------------------------------------------------------------------------*/
// INIT Editor
/*-------------------------------------------------------------------------*/
function init_editor()
{
if ( ! postformid )
{
postformid = 'postingform';
}
if ( ! postfieldid )
{
postfieldid = 'postcontent';
}
postformobj = document.getElementById( postformid );
postfieldobj = document.getElementById( postfieldid );
}
/*-------------------------------------------------------------------------*/
// Remove an attachment
/*-------------------------------------------------------------------------*/
function removeattach(id)
{
if ( id != "" )
{
Override = 1;
postformobj.removeattachid.value = id;
}
}
/*-------------------------------------------------------------------------*/
// Insert attachment tag
/*-------------------------------------------------------------------------*/
function insert_attach_to_textarea(aid)
{
rtewindow.focus();
wrap_tags( "[attachmentid="+aid+"]", "" );
rtewindow.focus();
}
/*-------------------------------------------------------------------------*/
// Open emoticon window
/*-------------------------------------------------------------------------*/
var emowindow = '';
function emo_pop()
{
emowindow = window.open( ipb_var_base_url + "act=legends&CODE=emoticons","Legends","width=250,height=500,resizable=yes,scrollbars=yes");
}
/*-------------------------------------------------------------------------*/
// BBCode window
/*-------------------------------------------------------------------------*/
function bbc_pop()
{
window.open( ipb_var_base_url + "act=legends&CODE=bbcode","Legends","width=700,height=500,resizable=yes,scrollbars=yes");
}
/*--------------------------------------------*/
// Fix the amount of digging parents up.
/*--------------------------------------------*/
function getOffsetTop(elm)
{
var mOffsetTop = elm.offsetTop;
var mOffsetParent = elm.offsetParent;
var parents_up = 2;
while(parents_up > 0)
{
mOffsetTop += mOffsetParent.offsetTop;
mOffsetParent = mOffsetParent.offsetParent;
parents_up--;
}
return mOffsetTop;
}
/*--------------------------------------------*/
// Fix the amount of digging parents up.
/*--------------------------------------------*/
function getOffsetLeft(elm)
{
var mOffsetLeft = elm.offsetLeft;
var mOffsetParent = elm.offsetParent;
var parents_up = 2;
while(parents_up > 0)
{
mOffsetLeft += mOffsetParent.offsetLeft;
mOffsetParent = mOffsetParent.offsetParent;
parents_up--;
}
return mOffsetLeft;
}
File diff suppressed because it is too large. Load diff
+923
View File
@@ -0,0 +1,923 @@
//------------------------------------------
// Invision Power Board 2.1.7
// STD Editor Functions
// (c) 2005 Invision Power Services, Inc.
//
// http://www.invisionboard.com
// SHOULD BE CALLED AFTER ipb_editor.js
//------------------------------------------
/*-------------------------------------------------------------------------*/
// INIT
/*-------------------------------------------------------------------------*/
var i_am = 'std';
var rtewindow;
var buttonbar;
var opentags =
{
'b' : 0,
'i' : 0,
's' : 0,
'u' : 0,
'img' : 0,
'quote' : 0,
'left' : 0,
'center' : 0,
'right' : 0,
'color' : 0,
'background' : 0,
'indent' : 0,
'code' : 0
};
var tags_to_div =
{
'b' : 'do_bold',
'i' : 'do_italic',
's' : 'do_strikethrough',
'u' : 'do_underline',
'quote' : 'do_quote',
'left' : 'do_justifyleft',
'center' : 'do_justifycenter',
'right' : 'do_justifyright',
'color' : 'forecolor',
'background' : 'hilitecolor',
'indent' : 'do_indent',
'code' : 'do_code'
};
var rte_to_std =
{
'forecolor' : 'color',
'hilitecolor' : 'background'
};
var easymode = 0;
// IE bug fix
var ie_range_cache = '';
/*-------------------------------------------------------------------------*/
// INIT
/*-------------------------------------------------------------------------*/
function init_std_editor()
{
//--------------------------------------------
// Pull in width of textarea
//--------------------------------------------
try
{
rtewindow = document.getElementById( 'postcontent' );
oldwidth = parseInt(document.getElementById( 'postcontent' ).style.width);
buttonbar = document.getElementById( 'std-table-buttons' );
widthunit = document.getElementById( 'postcontent' ).style.width.match( /%/ ) ? '%' : 'px';
if ( widthunit == 'px' )
{
if ( is_opera )
{
document.getElementById( 'postcontent' ).style.width = oldwidth - 4 + widthunit;
buttonbar.style.width = parseInt( buttonbar.style.width ) - 4 + widthunit;
}
else if ( is_safari )
{
}
else
{
document.getElementById( 'postcontent' ).style.width = oldwidth - 6 + widthunit;
}
}
else
{
if ( is_ie || is_moz )
{
document.getElementById( 'postcontent' ).style.width = oldwidth - 1 + widthunit;
}
}
}
catch(e)
{}
cvalue = my_getcookie( "bbmode" );
if ( cvalue == 1 )
{
document.getElementById('togglebbmode').value = js_bbeasy_on;
easymode = 1;
}
else
{
document.getElementById('togglebbmode').value = js_bbeasy_off;
easymode = 0;
}
}
/*-------------------------------------------------------------------------*/
// Toggle button highlighting (used when clicked on)
/*-------------------------------------------------------------------------*/
function toggle_button( tag )
{
//--------------------------------------------
// Change the button status
// Ensure we're not looking for FONT, SIZE or COLOR as these
// buttons don't exist, they are select lists instead.
//--------------------------------------------
if ( (tag == 'font') || (tag == 'size') )
{
return;
}
if ( opentags[ tag ] )
{
document.getElementById( tags_to_div[ tag ] ).className = 'rteimage';
// Turn off
opentags[ tag ] = 0;
}
else
{
document.getElementById( tags_to_div[ tag ] ).className = 'rteImageRaised';
// Turn on
opentags[ tag ] = 1;
}
}
/*-------------------------------------------------------------------------*/
// Set BBCode mode
/*-------------------------------------------------------------------------*/
function toggle_bbmode(mVal)
{
if ( easymode )
{
document.getElementById('togglebbmode').value = js_bbeasy_off;
easymode = 0;
}
else
{
document.getElementById('togglebbmode').value = js_bbeasy_on;
easymode = 1;
}
my_setcookie( 'bbmode', easymode, 1 );
}
/*-------------------------------------------------------------------------*/
// Get easy mode state
/*-------------------------------------------------------------------------*/
function get_easy_mode_state()
{
//--------------------------------------------
// Returns true if we've chosen easy mode
//--------------------------------------------
if ( easymode )
{
return true;
}
else
{
return false;
}
}
/*-------------------------------------------------------------------------*/
// Pop open and set up the color palette
/*-------------------------------------------------------------------------*/
function popcolor( command )
{
//-------------------------------
// Already open?
//-------------------------------
if ( opentags[ rte_to_std[ command ] ] )
{
//--------------------------------------------
// Smart close tags
//--------------------------------------------
smart_close_tags( rte_to_std[ command ] );
return false;
}
else
{
//-------------------------------
// Save current values
//-------------------------------
parent.command = command;
if ( is_ie )
{
postfieldobj.focus();
ie_range_cache = document.selection.createRange();
}
//-------------------------------
// Position and show color palette
//-------------------------------
buttonElement = document.getElementById(command);
var iLeftPos = getOffsetLeft(buttonElement);
var iTopPos = getOffsetTop(buttonElement) + (buttonElement.offsetHeight + 30);
document.getElementById('cp').style.left = (iLeftPos) + "px";
document.getElementById('cp').style.top = (iTopPos) + "px";
if (document.getElementById('cp').style.visibility == "hidden")
{
document.getElementById('cp').style.visibility = "visible";
document.getElementById('cp').style.display = "inline";
}
else
{
document.getElementById('cp').style.visibility = "hidden";
document.getElementById('cp').style.display = "none";
}
}
}
/*-------------------------------------------------------------------------*/
// Write the color
/*-------------------------------------------------------------------------*/
function setColor(color)
{
var parentCommand = parent.command;
if ( parentCommand == "hilitecolor" )
{
if ( wrap_tags("[background=" +color+ "]", "[/background]", true ) )
{
toggle_button( "background" );
pushstack(bbtags, "background");
}
}
else
{
if ( wrap_tags("[color=" +color+ "]", "[/color]", true ) )
{
toggle_button( "color" );
pushstack(bbtags, "color");
}
}
document.getElementById('cp').style.visibility = "hidden";
document.getElementById('cp').style.display = "none";
}
/*-------------------------------------------------------------------------*/
// EMOTICONS
/*-------------------------------------------------------------------------*/
function emoticon(theSmilie)
{
doInsert(" " + theSmilie + " ", "", false);
if ( (ua_vers >= 4) && is_ie && is_win && emowindow != 'undefined' )
{
emowindow.focus();
}
}
/*-------------------------------------------------------------------------*/
// ALTER FONT
/*-------------------------------------------------------------------------*/
function alterfont(theval, thetag)
{
if (theval == 0)
{
return;
}
if ( wrap_tags("[" + thetag + "=" + theval + "]", "[/" + thetag + "]", true ) )
{
pushstack(bbtags, thetag);
}
postformobj.ffont.selectedIndex = 0;
postformobj.fsize.selectedIndex = 0;
}
/*-------------------------------------------------------------------------*/
// SIMPLE TAGS (such as B, I S U, etc)
/*-------------------------------------------------------------------------*/
function simpletag(thetag)
{
var tagOpen = opentags[ thetag ];
if ( get_easy_mode_state() )
{
inserttext = prompt(prompt_start + "\n[" + thetag + "]xxx[/" + thetag + "]");
if ( (inserttext != null) && (inserttext != "") )
{
wrap_tags("[" + thetag + "]" + inserttext + "[/" + thetag + "] ", "", false);
}
}
else
{
if ( tagOpen == 0 )
{
if ( wrap_tags("[" + thetag + "]", "[/" + thetag + "]", true ) )
{
//--------------------------------------------
// Toggle
//--------------------------------------------
toggle_button( thetag );
pushstack(bbtags, thetag);
}
}
else
{
//--------------------------------------------
// Smart close tags
//--------------------------------------------
smart_close_tags( thetag );
}
}
}
/*-------------------------------------------------------------------------*/
// List tag
/*-------------------------------------------------------------------------*/
function tag_list( type )
{
var listvalue = "init";
var thelist = "";
opentag = ( type == 'ordered' ) ? '[list=1]' : '[list]';
while ( (listvalue != "") && (listvalue != null) )
{
listvalue = prompt(list_prompt, "");
if ( (listvalue != "") && (listvalue != null) )
{
thelist = thelist+"[*]"+listvalue+"\n";
}
}
if ( thelist != "" )
{
wrap_tags( opentag + "\n" + thelist + "[/list]\n", "");
}
}
/*-------------------------------------------------------------------------*/
// URL tag
/*-------------------------------------------------------------------------*/
function tag_url()
{
var FoundErrors = '';
//----------------------------------------
// Do we have ranged text?
//----------------------------------------
if ( check_range() )
{
//----------------------------------------
// Yes, just ask for the URL and wrap
//----------------------------------------
var enterURL = prompt(text_enter_url, "http://");
if ( ! enterURL)
{
alert(error_no_url);
return;
}
wrap_tags( "[url="+enterURL+"]", "[/url]", "" );
}
else
{
var enterURL = prompt(text_enter_url, "http://");
var enterTITLE = prompt(text_enter_url_name, jsfile_myweb_lang );
if ( ! enterURL)
{
FoundErrors += " " + error_no_url;
}
if ( ! enterTITLE)
{
FoundErrors += " " + error_no_title;
}
if ( FoundErrors )
{
alert( jsfile_error_lang +FoundErrors);
return;
}
wrap_tags("[url="+enterURL+"]"+enterTITLE+"[/url]", "");
}
}
/*-------------------------------------------------------------------------*/
// Image tag
/*-------------------------------------------------------------------------*/
function tag_image()
{
var FoundErrors = '';
//----------------------------------------
// Do we have ranged text?
//----------------------------------------
if ( check_range() )
{
//----------------------------------------
// Yes, just wrap text
//----------------------------------------
wrap_tags( "[img]", "[/img]", "" );
}
else
{
var enterURL = prompt(text_enter_image, "http://");
if ( ! enterURL )
{
alert(error_no_url);
return;
}
wrap_tags("[img]"+enterURL+"[/img]", "");
}
}
/*-------------------------------------------------------------------------*/
// Email tag
/*-------------------------------------------------------------------------*/
function tag_email()
{
//----------------------------------------
// Do we have ranged text?
//----------------------------------------
if ( check_range() )
{
//----------------------------------------
// Yes, just wrap text
//----------------------------------------
wrap_tags( "[email]", "[/email]", "" );
}
else
{
var emailAddress = prompt(text_enter_email, "");
if ( ! emailAddress )
{
alert(error_no_email);
return;
}
wrap_tags( "[email]"+emailAddress+"[/email]", "" );
}
}
/*-------------------------------------------------------------------------*/
// Do we have ranged text?
/*-------------------------------------------------------------------------*/
function check_range()
{
var has_range = false;
//----------------------------------------
// It's IE!
//----------------------------------------
if ( (ua_vers >= 4) && is_ie && is_win )
{
var sel = document.selection;
var rng = sel.createRange();
rng.colapse;
if ( (sel.type == "Text" || sel.type == "None") && rng != null )
{
if ( rng.text.length > 0)
{
has_range = true;
}
}
}
//----------------------------------------
// It's MOZZY!
//----------------------------------------
else if ( postfieldobj.selectionEnd )
{
var ss = postfieldobj.selectionStart;
var st = postfieldobj.scrollTop;
var es = postfieldobj.selectionEnd;
if (es <= 2)
{
es = postfieldobj.textLength;
}
var start = (postfieldobj.value).substring(0, ss);
var middle = (postfieldobj.value).substring(ss, es);
var end = (postfieldobj.value).substring(es, postfieldobj.textLength);
//-----------------------------------
// text range?
//-----------------------------------
if (postfieldobj.selectionEnd - postfieldobj.selectionStart > 0)
{
has_range = true;
}
}
return has_range;
}
/*-------------------------------------------------------------------------*/
// Check message length
/*-------------------------------------------------------------------------*/
function check_length()
{
MessageLength = postfieldobj.value.length;
message = "";
if (MessageMax > 0)
{
message = js_post + ": " + js_max_length + " " + MessageMax + " " + js_characters +".";
}
else
{
message = "";
}
alert(message + " " + js_used + " " + MessageLength + " " + js_characters + ".");
}
/*-------------------------------------------------------------------------*/
// GENERAL INSERT FUNCTION
// opentext : opening tag
// closetext: closing tag, used if we have selected text
/*-------------------------------------------------------------------------*/
function wrap_tags(opentext, closetext, issingle)
{
var has_closed = false;
if ( ! issingle )
{
issingle = false;
}
//----------------------------------------
// It's IE!
//----------------------------------------
if ( (ua_vers >= 4) && is_ie && is_win )
{
if ( postfieldobj.isTextEdit )
{
postfieldobj.focus();
var sel = document.selection;
var rng = ie_range_cache ? ie_range_cache : sel.createRange();
var stored_range = rng.duplicate()
stored_range.moveToElementText( postfieldobj );
stored_range.setEndPoint( 'EndToEnd', rng );
// Stores start position of text selection
postfieldobj.selectionStart = stored_range.text.length - rng.text.length;
// Stores end position of text selection
postfieldobj.selectionEnd = postfieldobj.selectionStart + rng.text.length;
rng.colapse;
if ( (sel.type == "Text" || sel.type == "None") && rng != null)
{
if (closetext != "" && rng.text && rng.text.length > 0)
{
opentext += rng.text + closetext;
}
else if ( issingle )
{
has_closed = true;
}
rng.text = rng.text.charAt(rng.text.length - 1) == ' ' ? opentext + ' ' : opentext;
}
else
{
postfieldobj.value += opentext;
has_closed = true;
}
}
else
{
postfieldobj.value += opentext;
has_closed = true;
}
ie_range_cache = null;
rng.select();
}
//----------------------------------------
// It's MOZZY!
//----------------------------------------
else if ( postfieldobj.selectionEnd )
{
var ss = postfieldobj.selectionStart;
var st = postfieldobj.scrollTop;
var es = postfieldobj.selectionEnd;
if (es <= 0)
{
es = postfieldobj.textLength;
}
var start = (postfieldobj.value).substring(0, ss);
var middle = (postfieldobj.value).substring(ss, es);
var end = (postfieldobj.value).substring(es, postfieldobj.textLength);
//-----------------------------------
// text range?
//-----------------------------------
if ( postfieldobj.selectionEnd - postfieldobj.selectionStart > 0 )
{
middle = opentext + middle + closetext;
}
else
{
middle = opentext + middle;
if ( issingle )
{
has_closed = true;
}
}
postfieldobj.value = start + middle + end;
var cpos = ss + (middle.length);
postfieldobj.selectionStart = cpos;
postfieldobj.selectionEnd = cpos;
postfieldobj.scrollTop = st;
}
//----------------------------------------
// It's CRAPPY!
//----------------------------------------
else
{
if ( issingle )
{
has_closed = false;
}
postfieldobj.value += opentext + ' ' + closetext;
}
postfieldobj.focus();
return has_closed;
}
/*--------------------------------------------*/
// Make current STD window (n)px bigger
/*--------------------------------------------*/
function std_window_resize( pix )
{
var box = postfieldobj;
var cur_height = parseInt( box.style.height ) ? parseInt( box.style.height ) : 300;
var new_height = cur_height + pix;
if ( new_height > 0 )
{
box.style.height = new_height + "px";
}
return false;
}
/*-------------------------------------------------------------------------*/
// Validate form (must always have this method defined!)
/*-------------------------------------------------------------------------*/
function ValidateForm( isMsg )
{
MessageLength = postfieldobj.value.length;
errors = "";
//-----------------------------------------
// Check for remove attachments
//-----------------------------------------
try
{
if ( postformobj.removeattachid.value > 0 )
{
okdelete = confirm( js_remove_attach );
if ( okdelete == true )
{
return true;
}
else
{
postformobj.removeattachid.value = 0;
return false;
}
}
}
catch(error)
{
//
}
if ( isMsg == 1)
{
if ( postformobj.msg_title.value.length < 2 )
{
errors = js_msg_no_title;
}
}
if ( MessageLength < 2 )
{
errors = js_no_message;
}
if ( MessageMax !=0 )
{
if (MessageLength > MessageMax)
{
errors = js_max_length + " " + MessageMax + " " + js_characters + ". " + js_current + ": " + MessageLength;
}
}
if ( errors != "" && ! Override )
{
alert(errors);
return false;
}
else
{
try
{
postformobj.submit.disabled = true;
}
catch(e)
{
try
{
postformobj.dosubmit.disabled = true;
}
catch(e) { }
}
return true;
}
}
function doInsert(ibTag, ibClsTag, isSingle)
{
var isClose = false;
var obj_ta = fombj.Post;
//----------------------------------------
// It's IE!
//----------------------------------------
if ( (ua_vers >= 4) && is_ie && is_win)
{
if (obj_ta.isTextEdit)
{
obj_ta.focus();
var sel = document.selection;
var rng = sel.createRange();
rng.colapse;
if((sel.type == "Text" || sel.type == "None") && rng != null)
{
if(ibClsTag != "" && rng.text.length > 0)
ibTag += rng.text + ibClsTag;
else if(isSingle)
isClose = true;
rng.text = ibTag;
}
}
else
{
if(isSingle)
{
isClose = true;
}
obj_ta.value += ibTag;
}
}
//----------------------------------------
// It's MOZZY!
//----------------------------------------
else if ( obj_ta.selectionEnd )
{
var ss = obj_ta.selectionStart;
var st = obj_ta.scrollTop;
var es = obj_ta.selectionEnd;
if (es <= 2)
{
es = obj_ta.textLength;
}
var start = (obj_ta.value).substring(0, ss);
var middle = (obj_ta.value).substring(ss, es);
var end = (obj_ta.value).substring(es, obj_ta.textLength);
//-----------------------------------
// text range?
//-----------------------------------
if (obj_ta.selectionEnd - obj_ta.selectionStart > 0)
{
middle = ibTag + middle + ibClsTag;
}
else
{
middle = ibTag + middle;
if (isSingle)
{
isClose = true;
}
}
obj_ta.value = start + middle + end;
var cpos = ss + (middle.length);
obj_ta.selectionStart = cpos;
obj_ta.selectionEnd = cpos;
obj_ta.scrollTop = st;
}
//----------------------------------------
// It's CRAPPY!
//----------------------------------------
else
{
if (isSingle)
{
isClose = true;
}
obj_ta.value += ibTag;
}
obj_ta.focus();
return isClose;
}
var bbtags = new Array();
var fombj = document.REPLIER;
+1 -1
View File
@@ -1,5 +1,5 @@
//------------------------------------------
// Invision Power Board v2.0
// Invision Power Board 2.1.7
// Find User JS File
// (c) 2004 Invision Power Services, Inc.
//
+723 -109
View File
@@ -1,109 +1,723 @@
//------------------------------------------
// Invision Power Board v2.0
// Forums JS File
// (c) 2004 Invision Power Services, Inc.
//
// http://www.invisionboard.com
//------------------------------------------
//==========================================
// Who posted
//==========================================
function who_posted(tid)
{
window.open("index.php?act=Stats&CODE=who&t="+tid, "WhoPosted", "toolbar=no,scrollbars=yes,resizable=yes,width=230,height=300");
}
//==========================================
// Check delete
//==========================================
function checkdelete()
{
if ( ! document.modform.selectedtids.value )
{
return false;
}
isDelete = document.modform.tact.options[document.modform.tact.selectedIndex].value;
if (isDelete == 'delete')
{
formCheck = confirm( lang_suredelete );
if (formCheck == true)
{
return true;
}
else
{
return false;
}
}
}
//==========================================
// Toggle selection
//==========================================
function forum_toggle_tid( tid )
{
saved = new Array();
clean = new Array();
add = 1;
//-----------------------------------
// Get form info
//-----------------------------------
tmp = document.modform.selectedtids.value;
saved = tmp.split(",");
//-----------------------------------
// Remove bit if exists
//-----------------------------------
for( i = 0 ; i < saved.length; i++ )
{
if ( saved[i] != "" )
{
if ( saved[i] == tid )
{
add = 0;
}
else
{
clean[clean.length] = saved[i];
}
}
}
//-----------------------------------
// Add?
//-----------------------------------
if ( add )
{
clean[ clean.length ] = tid;
eval("document.img"+tid+".src=selectedbutton");
}
else
{
eval(" document.img"+tid+".src=unselectedbutton");
}
newvalue = clean.join(',');
my_setcookie( 'modtids', newvalue, 0 );
document.modform.selectedtids.value = newvalue;
newcount = stacksize(clean);
document.modform.gobutton.value = lang_gobutton + '(' + newcount + ')';
return false;
}
//------------------------------------------
// Invision Power Board 2.1.7
// Forums JS File
// (c) 2005 Invision Power Services, Inc.
//
// http://www.invisionboard.com
//------------------------------------------
/*--------------------------------------------*/
// INIT
/*--------------------------------------------*/
var topic_dates = {};
var topic_flags = {};
var forum_mark_time;
var newer_topics = new Array;
var newer_count = 0;
var flags_count = 0;
var forum_id;
var url_extra = '';
var start_int = 0;
var forum_mark_sent = 0;
var span_html = new Array;
var desc_html = new Array;
var text_html = new Array;
var folders = new Array;
var _desc_clicked = 0;
var topic_links_init = 0;
var tid_date = new Array();
var click_delay = 1200; //microseconds (1.2 seconds)
/*--------------------------------------------*/
// Pop up mod options
/*--------------------------------------------*/
function forum_mod_pop( fid )
{
try
{
menu_action_close();
}
catch(e) { }
PopUp( ipb_var_base_url + 'act=mod&CODE=prune_start&f='+fid+'&auth_key='+ipb_md5_check, 'PRUNE', 600,500);
}
/*--------------------------------------------*/
// INIT topic links...
/*--------------------------------------------*/
function forum_init_topic_links()
{
//----------------------------------
// Get page links...
// Gah.. another safari bug
//----------------------------------
var pagelinks = document.getElementsByTagName('a');
//----------------------------------
// Sort through and grab topic links
//----------------------------------
for ( var i = 0 ; i <= pagelinks.length ; i++ )
{
try
{
if ( ! pagelinks[i].id )
{
continue;
}
}
catch(e)
{
continue;
}
var linkid = pagelinks[i].id;
var linkname = linkid.replace( /^(.*)-(\d+)$/, "$1" );
if ( linkname == 'tid-link' )
{
pagelinks[i].onmousedown = topic_link_event_mousedown;
pagelinks[i].onmouseup = topic_link_event_mouseup;
//pagelinks[i].style.cursor = 'text';
if ( ! topic_links_init )
{
pagelinks[i].title = pagelinks[i].title + '. ' + lang_clickhold;
}
}
}
topic_links_init = 1;
}
/*--------------------------------------------*/
// Mousedown, start timer
/*--------------------------------------------*/
function topic_link_event_mousedown( event )
{
//----------------------------------
// Prevent link loading
//----------------------------------
event = global_cancel_bubble( event, true );
//----------------------------------
// Get TID
//----------------------------------
var tid = _get_tid_from_id( this.id );
//----------------------------------
// Start...
//----------------------------------
tid_date[ tid ] = _get_time_now();
//----------------------------------
// Start loop
//----------------------------------
setTimeout( "topic_link_event_timer("+tid+")", 5 );
}
/*--------------------------------------------*/
// Event, loop
/*--------------------------------------------*/
function topic_link_event_timer( tid )
{
//----------------------------------
// Get time now
//----------------------------------
var timenow = _get_time_now();
//----------------------------------
// Click held for 1.5 s+?
//----------------------------------
if ( timenow > 0 && tid_date[tid] > 0 && ( (timenow - tid_date[tid] ) > click_delay ) )
{
//----------------------------------
// Yeah.. wipe tid time and convert
//----------------------------------
tid_date[tid] = 0;
span_to_input( tid );
return false;
}
//----------------------------------
// Not wiped? loop on!
//----------------------------------
if ( tid_date[tid] > 0 )
{
setTimeout( "topic_link_event_timer("+tid+")", 5 );
}
else
{
return false;
}
}
/*--------------------------------------------*/
// Mouseup? Cancel timer to kill the loop
/*--------------------------------------------*/
function topic_link_event_mouseup( event )
{
//----------------------------------
// Prevent link loading
//----------------------------------
event = global_cancel_bubble( event, true );
//----------------------------------
// Get TID
//----------------------------------
var tid = _get_tid_from_id( this.id );
//----------------------------------
// Reset timer
//----------------------------------
tid_date[tid] = 0;
}
/*--------------------------------------------*/
// Get time now
/*--------------------------------------------*/
function _get_time_now()
{
var mydate = new Date();
return mydate.getTime();
}
/*--------------------------------------------*/
// Get TID from ID
/*--------------------------------------------*/
function _get_tid_from_id( id )
{
return id.replace( /.*\-(\d+)/, "$1" );
}
/*--------------------------------------------*/
// Turn topic title into text input
/*--------------------------------------------*/
function topic_toggle_folder( tid )
{
//----------------------------------
// Using fancy js?
//----------------------------------
if ( ! use_enhanced_js )
{
return false;
}
//----------------------------------
// Can edit?
//----------------------------------
if ( ! perm_can_open && ! perm_can_close )
{
return false;
}
var td_content = document.getElementById( 'tid-folder-' + tid ).innerHTML;
var state;
if ( td_content.match( new RegExp( "/("+img_folder_closed+")([\"'])", "i" ) ) )
{
//----------------------------------
// Can?
//----------------------------------
if ( ! perm_can_open )
{
return false;
}
//----------------------------------
// Topic is locked
//----------------------------------
if ( folders[ tid ] )
{
td_content = folders[ tid ];
}
else
{
td_content = td_content.replace( new RegExp( "([\"'])(.*)/(.+?)([\"'])"), "$1$2/"+img_folder_normal+"$4" );
}
state = 'open';
}
else
{
//----------------------------------
// Can?
//----------------------------------
if ( ! perm_can_close )
{
return false;
}
//----------------------------------
// Topic isn't locked
//----------------------------------
folders[ tid ] = td_content;
td_content = td_content.replace( new RegExp( "([\"'])(.*)/(.+?)([\"'])"), "$1$2/"+img_folder_closed+"$4" );
state = 'closed';
}
document.getElementById( 'tid-folder-' + tid ).innerHTML = td_content;
/*--------------------------------------------*/
// Main function to do on request
// Must be defined first!!
/*--------------------------------------------*/
do_request_function = function()
{
//----------------------------------
// Ignore unless we're ready to go
//----------------------------------
if ( ! xmlobj.readystate_ready_and_ok() )
{
// Could do a little loading graphic here?
return;
}
//----------------------------------
// INIT
//----------------------------------
var returned = xmlobj.xmlhandler.responseText;
}
//----------------------------------
// LOAD XML
//----------------------------------
xmlobj = new ajax_request();
xmlobj.onreadystatechange( do_request_function );
xmlobj.process( ipb_var_base_url + 'act=xmlout&do=save-topic&type=openclose&name='+state+'&md5check='+ipb_md5_check+'&tid='+tid );
return false;
}
/*--------------------------------------------*/
// Turn topic title into text input
/*--------------------------------------------*/
function span_to_input( tid )
{
//----------------------------------
// Using fancy js?
//----------------------------------
if ( ! use_enhanced_js )
{
return false;
}
//----------------------------------
// Can?
//----------------------------------
if ( ! perm_can_edit )
{
return false;
}
//----------------------------------
// Prevent double click when desc open
//----------------------------------
if ( _desc_clicked )
{
return false;
}
span_html[ tid ] = document.getElementById( 'tid-span-' + tid ).innerHTML;
text_html[ tid ] = document.getElementById( 'tid-link-' + tid ).innerHTML;
//----------------------------------
// Topic title
//----------------------------------
perm_max_length = perm_max_length ? perm_max_length : 50;
document.getElementById( 'tid-span-' + tid ).innerHTML = '<input id="edit-'+tid+'" class="dny-edit-title" maxlength="'+perm_max_length+'" type="text" size="40" value="'+text_html[ tid ].replace( /"/g, '&quot;') +'" />'; //"'
document.getElementById( 'edit-' + tid ).onkeyup = function( event ) { tid_keypress(event, tid) }
document.getElementById( 'edit-' + tid ).onblur = function( event ) { tid_blur(tid) }
document.getElementById( 'edit-' + tid ).focus();
return false;
}
/*--------------------------------------------*/
// Turn topic DESC into text input
/*--------------------------------------------*/
function span_desc_to_input( tid )
{
//----------------------------------
// Using fancy js?
//----------------------------------
if ( ! use_enhanced_js )
{
return false;
}
//----------------------------------
// Can?
//----------------------------------
if ( ! perm_can_edit )
{
return false;
}
//----------------------------------
// Prevent double click when desc open
//----------------------------------
if ( _desc_clicked )
{
return false;
}
_desc_clicked = 1;
desc_html[ tid ] = document.getElementById( 'tid-desc-' + tid ).innerHTML;
//----------------------------------
// Topic desc
//----------------------------------
perm_max_length = perm_max_length ? perm_max_length : 50;
document.getElementById( 'tid-desc-' + tid ).innerHTML = '<input id="edit-'+tid+'" maxlength="'+perm_max_length+'" class="dny-edit-title" type="text" size="40" onblur="tid_blur(\''+tid+'\', \'desc\')" onkeypress="tid_keypress(event, \''+tid+'\',\'desc\')" value="'+desc_html[ tid ].replace( /"/g, '&quot;')+'" />'; //"'
document.getElementById( 'edit-' + tid ).focus();
return false;
}
/*--------------------------------------------*/
// BLUR HANDLER
/*--------------------------------------------*/
tid_blur = function( tid, type )
{
new_text = document.getElementById( 'edit-' + tid ).value;
if( type == 'desc' )
{
tid_save( tid, new_text, type );
}
else
{
if ( new_text != "" )
{
tid_save( tid, new_text, type );
}
}
}
/*--------------------------------------------*/
// KEY PRESS HANDLER
/*--------------------------------------------*/
tid_keypress = function( evt, tid, type )
{
if ( is_safari )
{
return false;
}
evt = evt ? evt : window.event;
new_text = document.getElementById( 'edit-' + tid ).value;
if ( ( evt.keyCode == 13 || evt.keyCode == 3 ) && new_text != "" )
{
tid_save( tid, new_text, type );
}
}
/*--------------------------------------------*/
// UDPATE DB
/*--------------------------------------------*/
tid_save = function( tid, new_text, type )
{
var donotedit = 0;
if ( type == 'desc' )
{
if ( new_text == desc_html[ tid ] )
{
donotedit = 1;
}
_desc_clicked = 0;
document.getElementById( 'tid-desc-' + tid ).innerHTML = new_text;
}
else
{
if ( new_text == text_html[ tid ] )
{
donotedit = 1;
}
type = 'title';
document.getElementById( 'tid-span-' + tid ).innerHTML = span_html[ tid ];
document.getElementById( 'tid-link-' + tid ).innerHTML = new_text;
//----------------------------------
// Re-check topic links
//----------------------------------
forum_init_topic_links();
}
if ( donotedit )
{
return false;
}
var url = ipb_var_base_url + 'act=xmlout&do=save-topic&type='+type+'&md5check='+ipb_md5_check+'&tid='+tid;
var fields = new Array();
//----------------------------------
// Populate fields
//----------------------------------
fields['md5check'] = ipb_md5_check;
fields['tid'] = tid;
fields['act'] = 'xmlout';
fields['do'] = 'save-topic';
fields['type'] = type;
fields['name'] = new_text;
/*--------------------------------------------*/
// Main function to do on request
// Must be defined first!!
/*--------------------------------------------*/
do_request_function = function()
{
//----------------------------------
// Ignore unless we're ready to go
//----------------------------------
if ( ! xmlobj.readystate_ready_and_ok() )
{
// Could do a little loading graphic here?
return;
}
//----------------------------------
// INIT
//----------------------------------
var returned = xmlobj.xmlhandler.responseText;
if ( type != 'desc' && ! returned.match( /<null>s<\/null>/ ) )
{
document.getElementById( 'tid-link-' + tid ).innerHTML = returned;
}
}
//----------------------------------
// LOAD XML
//----------------------------------
xmlobj = new ajax_request();
xmlobj.onreadystatechange( do_request_function );
xmlobj.process( url, 'POST', xmlobj.format_for_post(fields) );
return false;
}
/*--------------------------------------------*/
// Who posted
/*--------------------------------------------*/
function who_posted(tid)
{
window.open("index.php?act=Stats&CODE=who&t="+tid, "WhoPosted", "toolbar=no,scrollbars=yes,resizable=yes,width=230,height=300");
}
/*--------------------------------------------*/
// Check delete
/*--------------------------------------------*/
function checkdelete()
{
if ( ! document.modform.selectedtids.value )
{
return false;
}
isDelete = document.modform.tact.options[document.modform.tact.selectedIndex].value;
if (isDelete == 'delete')
{
formCheck = confirm( lang_suredelete );
if (formCheck == true)
{
return true;
}
else
{
return false;
}
}
}
/*--------------------------------------------*/
// Toggle selection
/*--------------------------------------------*/
function forum_toggle_tid( tid )
{
saved = new Array();
clean = new Array();
add = 1;
//-----------------------------------
// Get form info
//-----------------------------------
tmp = document.modform.selectedtids.value;
if( tmp != "" )
{
saved = tmp.split(",");
}
//-----------------------------------
// Remove bit if exists
//-----------------------------------
for( i = 0 ; i < saved.length; i++ )
{
if ( saved[i] != "" )
{
if ( saved[i] == tid )
{
add = 0;
}
else
{
clean[clean.length] = saved[i];
}
}
}
//-----------------------------------
// Add?
//-----------------------------------
if ( add )
{
clean[ clean.length ] = tid;
eval("document.img"+tid+".src=selectedbutton");
}
else
{
eval(" document.img"+tid+".src=unselectedbutton");
}
newvalue = clean.join(',');
my_setcookie( 'modtids', newvalue, 0 );
document.modform.selectedtids.value = newvalue;
newcount = stacksize(clean);
document.modform.gobutton.value = lang_gobutton + ' (' + newcount + ')';
return false;
}
/*--------------------------------------------*/
// Do multi page jump
/*--------------------------------------------*/
function multi_page_jump( url_bit, total_posts, per_page )
{
pages = 1;
cur_st = ipb_var_st;
cur_page = 1;
if ( total_posts % per_page == 0 )
{
pages = total_posts / per_page;
}
else
{
pages = Math.ceil( total_posts / per_page );
}
msg = ipb_lang_tpl_q1 + " " + pages;
if ( cur_st > 0 )
{
cur_page = cur_st / per_page; cur_page = cur_page -1;
}
show_page = 1;
if ( cur_page < pages )
{
show_page = cur_page + 1;
}
if ( cur_page >= pages )
{
show_page = cur_page - 1;
}
else
{
show_page = cur_page + 1;
}
userPage = prompt( msg, show_page );
if ( userPage > 0 )
{
if ( userPage < 1 ) { userPage = 1; }
if ( userPage > pages ) { userPage = pages; }
if ( userPage == 1 ) { start = 0; }
else { start = (userPage - 1) * per_page; }
window.location = url_bit + "&st=" + start;
}
}
File diff suppressed because it is too large. Load diff
+369
View File
@@ -0,0 +1,369 @@
//------------------------------------------------------------------------------
// IPS XML HTTP REQUEST:: GET NEW POSTS
//------------------------------------------------------------------------------
// Supports Safari, Mozilla 1.3+ (Firefox, etc) and IE 5.5+
// (c) 2005 Invision Power Services, Inc.
// http://www.invisionpower.com
//------------------------------------------------------------------------------
/*--------------------------------------------*/
// INIT VARS
/*--------------------------------------------*/
var gnp_div = 'get-new-posts_menu';
var msg_div = 'get-new-msgs_menu';
var mem_div = 'get-members';
var divobj;
var divopen = 0;
var xmlobj;
var myass_main;
var myass_loaded = 0;
var pm_cycle_count = 0;
var search_cache = {};
var posts_st = 0;
/*--------------------------------------------*/
// Get NEXT posts link
/*--------------------------------------------*/
function xml_show_new_posts( st )
{
posts_st = st;
xml_myassistant_init( 'posts' );
}
/*--------------------------------------------*/
// Load MyASSISTANT!
/*--------------------------------------------*/
function xml_myassistant_init( tab )
{
myass_main = document.getElementById( 'get-myassistant' );
myass_drag = document.getElementById( 'myass-drag' );
myass_content = document.getElementById( 'myass-content' );
/*--------------------------------------------*/
// Main function to do on request
// Must be defined first!!
/*--------------------------------------------*/
do_request_function = function()
{
//----------------------------------
// Ignore unless we're ready to go
//----------------------------------
if ( ! xmlobj.readystate_ready_and_ok() )
{
// Could do a little loading graphic here?
return;
}
//----------------------------------
// INIT
//----------------------------------
var html = xmlobj.xmlhandler.responseText;
//----------------------------------
// Stop IE showing select boxes over
// floating div [ 1 ]
//----------------------------------
if ( is_ie )
{
html = "<iframe id='myass-shim' src='javascript;' class='iframshim' scrolling='no' frameborder='0' style='position:absolute; top:0px; left:0px; right:0px; display: none;'></iframe>" + html;
}
myass_content.innerHTML = html;
//----------------------------------
// Stop IE showing select boxes over
// floating div [ 2 ]
//----------------------------------
if ( is_ie )
{
myass_shim = document.getElementById('myass-shim');
myass_shim.style.width = myass_content.offsetWidth;
myass_shim.style.height = myass_content.offsetHeight;
myass_shim.style.zIndex = myass_content.style.zIndex - 1;
myass_shim.style.top = myass_content.style.top;
myass_shim.style.left = myass_content.style.left;
myass_shim.style.display = "block";
}
}
xmlobj = new ajax_request();
xmlobj.onreadystatechange( do_request_function );
//----------------------------------
// LOAD XML
//----------------------------------
if ( ! tab )
{
xmlobj.process( ipb_var_base_url + 'act=buddy&xml=1' );
}
else if ( tab == 'newpms' )
{
//----------------------------------
// Figure out where we are..
//----------------------------------
var limit_a = 0;
pm_cycle_count++;
if ( pm_cycle_count <= ipb_new_msgs )
{
limit_a = pm_cycle_count - 1;
}
else
{
pm_cycle_count = 1;
}
xmlobj.process( ipb_var_base_url + 'act=buddy&xml=1&tab=' + tab + '&limit=' + limit_a );
myass_content.style.width = '399px';
myass_content.style.overflow = 'auto';
}
else if ( tab == 'posts' )
{
xmlobj.process( ipb_var_base_url + 'act=buddy&xml=1&tab=' + tab + '&st=' + posts_st );
}
else
{
xmlobj.process( ipb_var_base_url + 'act=buddy&xml=1&tab=' + tab);
}
myass_main.style.position = 'absolute';
myass_main.style.display = 'block';
myass_main.style.zIndex = 99;
//----------------------------------
// Not loaded? INIT
//----------------------------------
if ( ! myass_loaded )
{
//----------------------------------
// Figure width and height
//----------------------------------
var my_width = 0;
var my_height = 0;
if ( typeof( window.innerWidth ) == 'number' )
{
//----------------------------------
// Non IE
//----------------------------------
my_width = window.innerWidth;
my_height = window.innerHeight;
}
else if ( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) )
{
//----------------------------------
// IE 6+
//----------------------------------
my_width = document.documentElement.clientWidth;
my_height = document.documentElement.clientHeight;
}
else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) )
{
//----------------------------------
// Old IE
//----------------------------------
my_width = document.body.clientWidth;
my_height = document.body.clientHeight;
}
//----------------------------------
// Get div height && width
//----------------------------------
var divheight = parseInt( myass_main.style.Height );
var divwidth = parseInt( myass_main.style.Width );
divheight = divheight ? divheight : 400;
divwidth = divwidth ? divwidth : 400;
//----------------------------------
// Got it stored in a cookie?
//----------------------------------
var divxy = my_getcookie( 'ipb-myass-div' );
var co_ords;
if ( divxy && divxy != null )
{
co_ords = divxy.split( ',' );
//----------------------------------
// Got co-ords?
//----------------------------------
if ( co_ords.length )
{
var final_width = co_ords[0];
var final_height = co_ords[1];
if ( co_ords[0] > my_width )
{
//----------------------------------
// Keep it on screen
//----------------------------------
final_width = my_width - divwidth;
}
if ( co_ords[1] > my_height )
{
//----------------------------------
// Keep it on screen
//----------------------------------
final_height = my_height - divheight;
}
myass_main.style.left = final_width + 'px';
myass_main.style.top = final_height + 'px';
}
}
else
{
//----------------------------------
// Reposition DIV roughly centered
//----------------------------------
myass_main.style.left = my_width / 2 - (divwidth / 2) + 'px';
myass_main.style.top = my_height / 2 - (divheight / 2 ) + 'px';
}
Drag.cookiename = 'ipb-myass-div';
Drag.init( myass_drag, myass_main );
myass_loaded = 1;
}
}
/*--------------------------------------------*/
// Alter DST Retrieve XML document
/*--------------------------------------------*/
function xml_myassistant_search( url )
{
var keywords = document.getElementById('myass-search-input').value;
var msg_field = document.getElementById('myass-search-message');
var url = ipb_var_base_url+'act=Search&CODE=01&forums=all&cat_forum=forum&joinname=1&search_in=posts&result_type=topics&xml=1&keywords='+escape(keywords);
if ( keywords.length < 4 )
{
msg_field.innerHTML = ipb_myass_chars_lang;
return false;
}
//----------------------------------
// Already cached?
//----------------------------------
if ( search_cache[ keywords ] )
{
msg_field.innerHTML = search_cache[ keywords ];
return;
}
/*--------------------------------------------*/
// Main function to do on request
// Must be defined first!!
/*--------------------------------------------*/
do_request_function = function()
{
//----------------------------------
// Ignore unless we're ready to go
//----------------------------------
if ( ! xmlobj.readystate_ready_and_ok() )
{
xmlobj.show_loading();
return;
}
xmlobj.hide_loading();
//----------------------------------
// INIT
//----------------------------------
var html = xmlobj.xmlhandler.responseText;
msg_field.innerHTML = html;
search_cache[ keywords ] = html;
}
//----------------------------------
// LOAD XML
//----------------------------------
xmlobj = new ajax_request();
xmlobj.onreadystatechange( do_request_function );
xmlobj.process( url );
}
/*--------------------------------------------*/
// Alter DST Retrieve XML document
/*--------------------------------------------*/
function xml_dst_set( url )
{
/*--------------------------------------------*/
// Main function to do on request
// Must be defined first!!
/*--------------------------------------------*/
do_request_function = function()
{
//----------------------------------
// Ignore unless we're ready to go
//----------------------------------
if ( ! xmlobj.readystate_ready_and_ok() )
{
// Could do a little loading graphic here?
return;
}
//----------------------------------
// INIT
//----------------------------------
var html = xmlobj.xmlhandler.responseText;
if ( html == 'error' )
{
window.location = url.replace( '&xml=1', '&xml=0');
}
}
//----------------------------------
// LOAD XML
//----------------------------------
xmlobj = new ajax_request();
xmlobj.onreadystatechange( do_request_function );
xmlobj.process( url );
}
+3 -3
View File
@@ -1,7 +1,7 @@
//------------------------------------------
// Invision Power Board v2.0
// Invision Power Board 2.1.7
// PM JS File
// (c) 2003 Invision Power Services, Inc.
// (c) 2005 Invision Power Services, Inc.
//
// http://www.invisionboard.com
//------------------------------------------
@@ -29,7 +29,7 @@ function CheckAll(fmobj)
function CheckCheckAll(fmobj)
{
var TotalBoxes = 0;
var TotalOn = 0;
var TotalOn = 0;
for (var i=0;i<fmobj.elements.length;i++)
{
var e = fmobj.elements[i];
+409
View File
@@ -0,0 +1,409 @@
//------------------------------------------
// Invision Power Board 2.1.7
// POLL JS File
// (c) 2005 Invision Power Services, Inc.
//
// http://www.invisionboard.com
// ASSUMES 'ipb_global.php' as been loaded
//------------------------------------------
/*--------------------------------------------*/
// INIT
/*--------------------------------------------*/
//-------------------------------
// DIV & FORM id names
//-------------------------------
var open_div = 'poll-box-open';
var closed_div = 'poll-box-closed';
var stat_div = 'poll-box-stat';
var main_div = 'poll-box-main';
var form_id = 'postingform';
//-------------------------------
// DIV AND FORM objects
//-------------------------------
var openobj;
var closedobj;
var formobj;
var statobj;
var mainobj;
//-------------------------------
// Counters
//-------------------------------
var used_questions = 0;
/*--------------------------------------------*/
// INIT STATE
/*--------------------------------------------*/
function poll_init_state()
{
//-------------------------------
// Get objects
//-------------------------------
openobj = document.getElementById( open_div );
closedobj = document.getElementById( closed_div );
formobj = document.getElementById( form_id );
statobj = document.getElementById( stat_div );
mainobj = document.getElementById( main_div );
//-------------------------------
// Open and close divs
//-------------------------------
if ( showfullonload )
{
my_show_div( openobj );
my_hide_div( closedobj );
}
else
{
my_show_div( closedobj );
my_hide_div( openobj );
}
poll_draw_main_box();
}
/*--------------------------------------------*/
// DRAW MAIN BOX
/*--------------------------------------------*/
function poll_draw_main_box()
{
var html = '';
used_questions = 0;
//-------------------------------
// Draw all current questions
//-------------------------------
for( var i in poll_questions )
{
var qhtml = '';
used_questions++;
//-------------------------------
// Show question box
//-------------------------------
var question = poll_questions[i];
var inputhtml = lang_build_string( html_question_box, i, _poll_make_form_safe( question ) );
qhtml += "\n" + inputhtml + "\n";
//-------------------------------
// Now, to add the poll choices..
//-------------------------------
var choices = '';
var choices_count = 0;
for ( var c in poll_choices )
{
var votes_box;
//-------------------------------
// Is this a choice for this q?
//-------------------------------
var id = c.replace( new RegExp( "^" + i + "_(\\d+)$" ), "$1" );
if ( ! isNaN( id ) )
{
if ( is_mod )
{
votes_box = lang_build_string( html_votes_box, i, id, poll_votes[c]);
}
else
{
votes_box = '';
}
choices_count++;
choices += "\n" + lang_build_string( html_choice_box, i, id, _poll_make_form_safe( poll_choices[c] ), votes_box );
}
}
//-------------------------------
// Not used max questions?
//-------------------------------
if ( choices_count < max_poll_choices )
{
choices += lang_build_string( html_add_choice, i );
}
if ( choices != '' )
{
qhtml += "\n" + lang_build_string( html_choice_wrap, choices ) + "\n";
}
//-------------------------------
// Add wrapped question w/choice
//-------------------------------
html += lang_build_string(html_question_wrap, qhtml );
}
//-------------------------------
// Add a question link?
//-------------------------------
if ( used_questions < max_poll_questions )
{
html += lang_build_string( html_question_wrap, html_add_question );
}
mainobj.innerHTML = html;
poll_update_state();
}
/*--------------------------------------------*/
// WRITE FORM TO ARRAY
/*--------------------------------------------*/
function poll_write_form_to_array()
{
//-------------------------------
// Update question array with form
//-------------------------------
var tmp_poll_questions = {};
var tmp_poll_choices = {};
for ( var i in poll_questions )
{
//-------------------------------
// Get form value...
//-------------------------------
try
{
tmp_poll_questions[ i ] = document.getElementById( 'question_' + i ).value;
}
catch(e) { }
}
for ( var c in poll_choices )
{
//-------------------------------
// Get form value...
//-------------------------------
try
{
tmp_poll_choices[ c ] = document.getElementById( 'choice_' + c ).value;
}
catch(e) { }
}
//-------------------------------
// Update
//-------------------------------
poll_questions = tmp_poll_questions;
poll_choices = tmp_poll_choices;
}
/*--------------------------------------------*/
// ADD POLL QUESTION
/*--------------------------------------------*/
function poll_add_question()
{
var maxid = 0;
//-------------------------------
// Get max choice ID
//-------------------------------
for ( var i in poll_questions )
{
if ( i > maxid )
{
maxid = parseInt(i);
}
}
maxid = maxid + 1;
poll_write_form_to_array();
poll_questions[ maxid ] = '';
poll_draw_main_box();
return false;
}
/*--------------------------------------------*/
// ADD POLL CHOICE
/*--------------------------------------------*/
function poll_add_choice( qid )
{
var maxid = 0;
//-------------------------------
// Get max choice ID
//-------------------------------
for ( var c in poll_choices )
{
//-------------------------------
// Is this a choice for this q?
//-------------------------------
var id = c.replace( new RegExp( "^" + qid + "_(\\d+)$" ), "$1" );
if ( ! isNaN( id ) )
{
if ( id > maxid )
{
maxid = parseInt(id);
}
}
}
maxid = maxid + 1;
poll_write_form_to_array();
poll_choices[ qid +'_'+maxid ] = '';
if ( is_mod )
{
poll_votes[ qid +'_'+maxid ] = 0;
}
poll_draw_main_box();
return false;
}
/*--------------------------------------------*/
// REMOVE POLL CHOICE
/*--------------------------------------------*/
function poll_remove_choice( mainid )
{
if ( confirm( js_lang_confirm ) )
{
delete( poll_choices[ mainid ] );
if ( is_mod )
{
delete( poll_votes[ mainid ] );
}
poll_write_form_to_array();
poll_draw_main_box();
}
return false;
}
/*--------------------------------------------*/
// REMOVE POLL QUESTION
/*--------------------------------------------*/
function poll_remove_question( mainid )
{
if ( confirm( js_lang_confirm ) )
{
//-------------------------------
// Delete question
//-------------------------------
delete( poll_questions[ mainid ] );
//-------------------------------
// Delete choices
//-------------------------------
for ( var c in poll_choices )
{
//-------------------------------
// Is this a choice for this q?
//-------------------------------
var id = c.replace( new RegExp( "^" + mainid + "_(\\d+)$" ), "$1" );
if ( ! isNaN( id ) )
{
delete( poll_choices[ c ] );
if ( is_mod )
{
delete( poll_votes[ c ] );
}
}
}
poll_write_form_to_array();
poll_draw_main_box();
}
return false;
}
/*--------------------------------------------*/
// UPDATE POLL STATE
/*--------------------------------------------*/
function poll_update_state()
{
used = max_poll_questions - used_questions;
var tmp_lang = lang_build_string( poll_stat_lang, used, max_poll_choices );
statobj.innerHTML = lang_build_string( html_stat_wrap, tmp_lang );
}
/*--------------------------------------------*/
// SHOW POLL FORM
/*--------------------------------------------*/
function show_poll_form()
{
my_show_div( openobj );
my_hide_div( closedobj );
}
/*--------------------------------------------*/
// CLOSE POLL FORM
/*--------------------------------------------*/
function close_poll_form()
{
my_show_div( closedobj );
my_hide_div( openobj );
}
/*--------------------------------------------*/
// FORM MAKE SAFE
/*--------------------------------------------*/
function _poll_make_form_safe( t )
{
t = t.replace( /'/g, '&#039;' );
t = t.replace( /"/g, '&quot;' );
return t;
}
+36
View File
@@ -0,0 +1,36 @@
//------------------------------------------
// Invision Power Board 2.1.7
// Profile JS File
// (c) 2005 Invision Power Services, Inc.
//
// http://www.invisionboard.com
//------------------------------------------
/*--------------------------------------------*/
// Profile: Open pop-up window
/*--------------------------------------------*/
function profile_dname_history( mid )
{
//----------------------------------
// Attempt to close the menu
//----------------------------------
try
{
menu_action_close();
}
catch(e)
{
}
//----------------------------------
// Launch Pop Up
//----------------------------------
PopUp( ipb_var_base_url + 'act=profile&CODE=show-display-names&id=' + mid, 'DNAMETITLE', 400, 300 );
return false;
}
+862 -39
View File
@@ -1,40 +1,863 @@
//------------------------------------------
// Invision Power Board v2.0
// Register JS File
// (c) 2004 Invision Power Services, Inc.
//
// http://www.invisionboard.com
//------------------------------------------
function Validate()
{
//------------------------------------------
// Check for Empty fields
//------------------------------------------
if (document.REG.UserName.value == "" || document.REG.PassWord.value == "" || document.REG.PassWord_Check.value == "" || document.REG.EmailAddress.value == "")
{
alert ( ipb_lang_js_blanks );
return false;
}
}
function get_more_info()
{
var chosenid = document.REG.subspackage.options[document.REG.subspackage.selectedIndex].value;
if ( ! chosenid )
{
chosenid = 0;
}
//------------------------------------------
// Toggle view...
//------------------------------------------
eval("document.REG.pkdesc.value=subsdesc_"+chosenid);
toggleview('subspkdiv');
//------------------------------------------
// Invision Power Board 2.1.7
// Register JS File
// (c) 2005 Invision Power Services, Inc.
//
// http://www.invisionboard.com
//------------------------------------------
var reg_got_dname = 0;
var reg_oktogo = 0;
var reg_field_ids = new Array();
var reg_img_ids = new Array();
var reg_box_ids = new Array();
var reg_msg_ids = new Array();
var ucp_dname_illegal_chars = new Array( '[', ']', '|', ',', ';' );
var ucp_dname_illegal_regex = '';
for ( var i in ucp_dname_illegal_chars )
{
ucp_dname_illegal_regex += '\\' + ucp_dname_illegal_chars[i];
}
var error_email = 0;
var in_member_id = 0;
/*-------------------------------------------------------------------------*/
// INIT Reg form
/*-------------------------------------------------------------------------*/
function init_reg_form( got_dname, register_method )
{
//------------------------------------------
// INIT objects
//------------------------------------------
reg_got_dname = got_dname;
//------------------------------------------
// Fields...
//------------------------------------------
if( register_method == 'username' )
{
reg_field_ids['name'] = document.getElementById( 'reg-name' );
}
reg_field_ids['password'] = document.getElementById( 'reg-password' );
reg_field_ids['password-check'] = document.getElementById( 'reg-password-check' );
reg_field_ids['emailaddress'] = document.getElementById( 'reg-emailaddress' );
reg_field_ids['emailaddress-two'] = document.getElementById( 'reg-emailaddress-two' );
//------------------------------------------
// Images
//------------------------------------------
if( register_method == 'username' )
{
reg_img_ids['name'] = document.getElementById( 'img-name' );
}
reg_img_ids['password'] = document.getElementById( 'img-password' );
reg_img_ids['emailaddress'] = document.getElementById( 'img-emailaddress' );
//------------------------------------------
// Boxes
//------------------------------------------
if( register_method == 'username' )
{
reg_box_ids['name'] = document.getElementById( 'box-name' );
}
reg_box_ids['password'] = document.getElementById( 'box-password' );
reg_box_ids['emailaddress'] = document.getElementById( 'box-emailaddress' );
//------------------------------------------
// Messages
//------------------------------------------
if( register_method == 'username' )
{
reg_msg_ids['name'] = document.getElementById( 'msg-name' );
}
reg_msg_ids['password'] = document.getElementById( 'msg-password' );
reg_msg_ids['emailaddress'] = document.getElementById( 'msg-emailaddress' );
//------------------------------------------
// Set up onblur
//------------------------------------------
if( register_method == 'username' )
{
reg_field_ids['name'].onblur = check_user_name;
}
reg_field_ids['password-check'].onblur = check_passwords;
reg_field_ids['emailaddress'].onblur = check_email_addresses_one;
reg_field_ids['emailaddress-two'].onblur = check_email_addresses;
//------------------------------------------
// Already got error messages?
//------------------------------------------
if( register_method == 'username' )
{
if ( ! reg_msg_ids['name'].innerHTML )
{
reg_box_ids['name'].style.display = 'none';
}
}
if ( ! reg_msg_ids['password'].innerHTML )
{
reg_box_ids['password'].style.display = 'none';
}
if ( ! reg_msg_ids['emailaddress'].innerHTML )
{
reg_box_ids['emailaddress'].style.display = 'none';
}
//------------------------------------------
// Display name...
//------------------------------------------
if ( reg_got_dname )
{
reg_field_ids['dname'] = document.getElementById( 'reg-members-display-name' );
reg_box_ids['dname'] = document.getElementById( 'box-dname' );
reg_msg_ids['dname'] = document.getElementById( 'msg-dname' );
reg_img_ids['dname'] = document.getElementById( 'img-members-display-name' );
if ( ! reg_msg_ids['dname'].innerHTML )
{
reg_box_ids['dname'].style.display = 'none';
}
reg_field_ids['dname'].onblur = check_display_name;
}
}
/*-------------------------------------------------------------------------*/
// INIT Reg form
/*-------------------------------------------------------------------------*/
function init_complete_login_form()
{
//------------------------------------------
// INIT objects
//------------------------------------------
reg_got_dname = got_dname;
//------------------------------------------
// Fields...
//------------------------------------------
reg_field_ids['emailaddress'] = document.getElementById( 'reg-emailaddress' );
reg_field_ids['emailaddress-two'] = document.getElementById( 'reg-emailaddress-two' );
//------------------------------------------
// Images
//------------------------------------------
reg_img_ids['emailaddress'] = document.getElementById( 'img-emailaddress' );
//------------------------------------------
// Boxes
//------------------------------------------
reg_box_ids['emailaddress'] = document.getElementById( 'box-emailaddress' );
//------------------------------------------
// Messages
//------------------------------------------
reg_msg_ids['emailaddress'] = document.getElementById( 'msg-emailaddress' );
//------------------------------------------
// Set up onblur
//------------------------------------------
reg_field_ids['emailaddress'].onblur = check_email_addresses_one;
reg_field_ids['emailaddress-two'].onblur = check_email_addresses;
//------------------------------------------
// Already got error messages?
//------------------------------------------
if ( ! reg_msg_ids['emailaddress'].innerHTML )
{
reg_box_ids['emailaddress'].style.display = 'none';
}
//------------------------------------------
// Display name...
//------------------------------------------
if ( reg_got_dname )
{
reg_field_ids['dname'] = document.getElementById( 'reg-members-display-name' );
reg_box_ids['dname'] = document.getElementById( 'box-dname' );
reg_msg_ids['dname'] = document.getElementById( 'msg-dname' );
reg_img_ids['dname'] = document.getElementById( 'img-members-display-name' );
if ( ! reg_msg_ids['dname'].innerHTML )
{
reg_box_ids['dname'].style.display = 'none';
}
reg_field_ids['dname'].onblur = check_display_name;
}
in_member_id = member_id;
}
/*-------------------------------------------------------------------------*/
// Check email address validity
/*-------------------------------------------------------------------------*/
function check_email_addresses_one( event )
{
//----------------------------------
// INIT
//----------------------------------
var error_found = '';
//----------------------------------
// Ajax: check for existing email address
//----------------------------------
if ( use_enhanced_js && reg_field_ids['emailaddress'].value )
{
var url = ipb_var_base_url+'act=xmlout&do=check-email-address&email='+escape( reg_field_ids['emailaddress'].value );
/*--------------------------------------------*/
// Main function to do on request
// Must be defined first!!
/*--------------------------------------------*/
do_request_function = function()
{
//----------------------------------
// Ignore unless we're ready to go
//----------------------------------
if ( ! xmlobj.readystate_ready_and_ok() )
{
// Could do a little loading graphic here?
return;
}
//----------------------------------
// INIT
//----------------------------------
var html = xmlobj.xmlhandler.responseText;
if ( html == 'found' )
{
error_found += reg_error_email_taken + "<br />";
}
if ( html == 'banned' )
{
error_found += reg_error_email_ban + "<br />";
}
//----------------------------------
// Show errors
//----------------------------------
if ( error_found )
{
reg_field_ids['emailaddress'].className = input_red;
reg_img_ids['emailaddress'].src = ipb_var_image_url + '/' + img_cross;
reg_msg_ids['emailaddress'].innerHTML = error_found;
reg_box_ids['emailaddress'].style.display = 'block';
error_email = 1;
}
else
{
error_email = 0;
}
error_found = '';
}
//----------------------------------
// LOAD XML
//----------------------------------
xmlobj = new ajax_request();
xmlobj.onreadystatechange( do_request_function );
xmlobj.process( url );
}
}
/*-------------------------------------------------------------------------*/
// Check email addresses
/*-------------------------------------------------------------------------*/
function check_email_addresses( event )
{
//----------------------------------
// INIT
//----------------------------------
var error_found = '';
//----------------------------------
// Check
//----------------------------------
if ( ! reg_field_ids['emailaddress'].value.match( /[@\.]/ ) )
{
error_found += reg_error_email_missing + "<br />";
}
if ( ! reg_field_ids['emailaddress'].value || ! reg_field_ids['emailaddress-two'].value )
{
error_found += reg_error_email_missing + "<br />";
}
if ( reg_field_ids['emailaddress'].value != reg_field_ids['emailaddress-two'].value )
{
error_found += reg_error_email_nm + "<br />";
}
if ( error_found )
{
reg_field_ids['emailaddress'].className = input_red;
reg_field_ids['emailaddress-two'].className = input_red;
reg_img_ids['emailaddress'].src = ipb_var_image_url + '/' + img_cross;
reg_msg_ids['emailaddress'].innerHTML = error_found;
reg_box_ids['emailaddress'].style.display = 'block';
error_email = 1;
}
else
{
error_email = 0;
}
//----------------------------------
// No error....
//----------------------------------
if ( error_email == 0 )
{
check_email_addresses_one();
}
//----------------------------------
// Still no errors...
//----------------------------------
if ( error_email == 0 )
{
reg_field_ids['emailaddress'].className = input_green;
reg_field_ids['emailaddress-two'].className = input_green;
reg_img_ids['emailaddress'].src = ipb_var_image_url + '/' + img_tick;
reg_box_ids['emailaddress'].style.display = 'none';
reg_msg_ids['emailaddress'].innerHTML = '';
}
if( reg_field_ids['emailaddress'].className == input_red )
{
reg_field_ids['emailaddress-two'].className = input_red;
}
}
/*-------------------------------------------------------------------------*/
// Check passwords match
/*-------------------------------------------------------------------------*/
function check_passwords( event )
{
//----------------------------------
// INIT
//----------------------------------
var error_found = '';
//----------------------------------
// Check
//----------------------------------
if ( ! reg_field_ids['password'].value || ! reg_field_ids['password-check'].value )
{
error_found += reg_error_no_pass + "<br />";
}
if ( reg_field_ids['password'].value != reg_field_ids['password-check'].value )
{
error_found += reg_error_pass_nm + "<br />";
}
if ( error_found )
{
reg_field_ids['password'].className = input_red;
reg_field_ids['password-check'].className = input_red;
reg_img_ids['password'].src = ipb_var_image_url + '/' + img_cross;
reg_msg_ids['password'].innerHTML = error_found;
reg_box_ids['password'].style.display = 'block';
}
else
{
reg_field_ids['password'].className = input_green;
reg_field_ids['password-check'].className = input_green;
reg_img_ids['password'].src = ipb_var_image_url + '/' + img_tick;
reg_box_ids['password'].style.display = 'none';
reg_msg_ids['password'].innerHTML = '';
}
}
/*-------------------------------------------------------------------------*/
// Check display name
/*-------------------------------------------------------------------------*/
function check_display_name( event )
{
//----------------------------------
// INIT
//----------------------------------
var error_found = '';
//----------------------------------
// Make sure we have sommat
//----------------------------------
if ( ! reg_field_ids['dname'].value || reg_field_ids['dname'].value.length < 3 || reg_field_ids['dname'].value.length > 32 )
{
error_found += reg_error_no_name + "<br />";
}
//----------------------------------
// Check for illegal chars
//----------------------------------
if ( reg_field_ids['dname'].value.match( new RegExp( "[" + ucp_dname_illegal_regex + "]" ) ) )
{
error_found += reg_error_chars + "<br />";
}
//----------------------------------
// Ajax: check for existing member name
//----------------------------------
if ( use_enhanced_js && reg_field_ids['dname'].value )
{
var url = ipb_var_base_url+'act=xmlout&do=check-display-name&name='+escape( reg_field_ids['dname'].value );
// Complete reg form?
if ( in_member_id )
{
url += '&id=' + in_member_id;
}
/*--------------------------------------------*/
// Main function to do on request
// Must be defined first!!
/*--------------------------------------------*/
do_request_function = function()
{
//----------------------------------
// Ignore unless we're ready to go
//----------------------------------
if ( ! xmlobj.readystate_ready_and_ok() )
{
// Could do a little loading graphic here?
return;
}
//----------------------------------
// INIT
//----------------------------------
var html = xmlobj.xmlhandler.responseText;
if ( html == 'found' )
{
error_found += reg_error_taken + "<br />";
}
//----------------------------------
// Show errors
//----------------------------------
if ( error_found )
{
reg_field_ids['dname'].className = input_red;
reg_img_ids['dname'].src = ipb_var_image_url + '/' + img_cross;
reg_msg_ids['dname'].innerHTML = error_found;
reg_box_ids['dname'].style.display = 'block';
}
else
{
reg_field_ids['dname'].className = input_green;
reg_img_ids['dname'].src = ipb_var_image_url + '/' + img_tick;
reg_box_ids['dname'].style.display = 'none';
reg_msg_ids['dname'].innerHTML = '';
}
error_found = '';
}
//----------------------------------
// LOAD XML
//----------------------------------
xmlobj = new ajax_request();
xmlobj.onreadystatechange( do_request_function );
xmlobj.process( url );
}
else
{
//----------------------------------
// Show errors
//----------------------------------
if ( error_found )
{
reg_field_ids['dname'].className = input_red;
reg_img_ids['dname'].src = ipb_var_image_url + '/' + img_cross;
reg_msg_ids['dname'].innerHTML = error_found;
reg_box_ids['dname'].style.display = 'block';
}
else
{
reg_field_ids['dname'].className = input_green;
reg_img_ids['dname'].src = ipb_var_image_url + '/' + img_tick;
reg_box_ids['dname'].style.display = 'none';
reg_msg_ids['dname'].innerHTML = '';
}
error_found = '';
}
}
/*-------------------------------------------------------------------------*/
// Check username
/*-------------------------------------------------------------------------*/
function check_user_name( event )
{
//----------------------------------
// INIT
//----------------------------------
var error_found = '';
//----------------------------------
// Make sure we have sommat
//----------------------------------
if ( ! reg_field_ids['name'].value || reg_field_ids['name'].value.length < 3 || reg_field_ids['name'].value.length > 32 )
{
error_found += reg_error_username_none + "<br />";
}
//----------------------------------
// Ajax: check for existing member name
//----------------------------------
if ( use_enhanced_js && reg_field_ids['name'].value )
{
//----------------------------------
// Get new xhttp obj
//----------------------------------
var url = ipb_var_base_url+'act=xmlout&do=check-user-name&name='+escape( reg_field_ids['name'].value );
/*--------------------------------------------*/
// Main function to do on request
// Must be defined first!!
/*--------------------------------------------*/
do_request_function = function()
{
//----------------------------------
// Ignore unless we're ready to go
//----------------------------------
if ( ! xmlobj.readystate_ready_and_ok() )
{
// Could do a little loading graphic here?
return;
}
//----------------------------------
// INIT
//----------------------------------
var html = xmlobj.xmlhandler.responseText;
if ( html == 'found' )
{
error_found += reg_error_username_taken + "<br />";
}
//----------------------------------
// Show errors
//----------------------------------
if ( error_found )
{
reg_field_ids['name'].className = input_red;
reg_img_ids['name'].src = ipb_var_image_url + '/' + img_cross;
reg_msg_ids['name'].innerHTML = error_found;
reg_box_ids['name'].style.display = 'block';
}
else
{
reg_field_ids['name'].className = input_green;
reg_img_ids['name'].src = ipb_var_image_url + '/' + img_tick;
reg_box_ids['name'].style.display = 'none';
reg_msg_ids['name'].innerHTML = '';
}
error_found = '';
}
//----------------------------------
// LOAD XML
//----------------------------------
xmlobj = new ajax_request();
xmlobj.onreadystatechange( do_request_function );
xmlobj.process( url );
}
else
{
//----------------------------------
// Show errors
//----------------------------------
if ( error_found )
{
reg_field_ids['name'].className = input_red;
reg_img_ids['name'].src = ipb_var_image_url + '/' + img_cross;
reg_msg_ids['name'].innerHTML = error_found;
reg_box_ids['name'].style.display = 'block';
}
else
{
reg_field_ids['name'].className = input_green;
reg_img_ids['name'].src = ipb_var_image_url + '/' + img_tick;
reg_box_ids['name'].style.display = 'none';
reg_msg_ids['name'].innerHTML = '';
}
error_found = '';
}
}
/*-------------------------------------------------------------------------*/
// Validate the complete log in form
/*-------------------------------------------------------------------------*/
function validate_complete_login_form( event )
{
//------------------------------------------
// Simply run the functions
//------------------------------------------
reg_oktogo = 1;
check_email_addresses( event );
//------------------------------------------
// Got error messages
//------------------------------------------
if ( reg_msg_ids['emailaddress'].innerHTML )
{
reg_oktogo = 0;
}
//------------------------------------------
// Display name...
//------------------------------------------
if ( reg_got_dname )
{
check_display_name( event );
if ( reg_msg_ids['dname'].innerHTML )
{
reg_oktogo = 0;
}
}
//------------------------------------------
// Return
//------------------------------------------
return reg_oktogo ? true : false;
}
/*-------------------------------------------------------------------------*/
// Validate the registration form
/*-------------------------------------------------------------------------*/
function validate_reg_form( event )
{
//------------------------------------------
// Simply run the functions
//------------------------------------------
reg_oktogo = 1;
check_email_addresses( event );
check_passwords( event );
check_user_name( event );
//------------------------------------------
// Got error messages
//------------------------------------------
if ( reg_msg_ids['name'].innerHTML )
{
reg_oktogo = 0;
}
if ( reg_msg_ids['password'].innerHTML )
{
reg_oktogo = 0;
}
if ( reg_msg_ids['emailaddress'].innerHTML )
{
reg_oktogo = 0;
}
//------------------------------------------
// Display name...
//------------------------------------------
if ( reg_got_dname )
{
check_display_name( event );
if ( reg_msg_ids['dname'].innerHTML )
{
reg_oktogo = 0;
}
}
//------------------------------------------
// Return
//------------------------------------------
return reg_oktogo ? true : false;
}
/*-------------------------------------------------------------------------*/
// They are a COPPA :D
/*-------------------------------------------------------------------------*/
function coppa_save()
{
//------------------------------------------
// Set cookie
//------------------------------------------
my_setcookie( 'coppa', 'yes', 1 );
}
/*-------------------------------------------------------------------------*/
// Run from the COPPA
/*-------------------------------------------------------------------------*/
function coppa_cancel()
{
//------------------------------------------
// Set cookie
//------------------------------------------
my_setcookie( 'coppa', '0', 1 );
locationjump( '' );
}
/*-------------------------------------------------------------------------*/
// Run from the COPPA
/*-------------------------------------------------------------------------*/
function coppa_check()
{
//------------------------------------------
// Set cookie
//------------------------------------------
var coppa_check = my_getcookie( 'coppa' );
if ( coppa_check == 'yes' )
{
alert( coppa_bounce );
locationjump( 'act=reg&CODE=coppa_two' );
}
}
/*-------------------------------------------------------------------------*/
// Show a more info button?
/*-------------------------------------------------------------------------*/
function reg_get_more_check()
{
var dropdown = document.getElementById( 'subspackage' );
var chosenid = dropdown.options[dropdown.selectedIndex].value;
if ( ! chosenid )
{
chosenid = 0;
}
if ( subdesc[chosenid] )
{
document.getElementById( 'reg-get-more-info' ).style.display = '';
}
else
{
document.getElementById( 'reg-get-more-info' ).style.display = 'none';
}
}
/*-------------------------------------------------------------------------*/
// Show subs more info form
/*-------------------------------------------------------------------------*/
function get_more_info()
{
var dropdown = document.getElementById( 'subspackage' );
var chosenid = dropdown.options[dropdown.selectedIndex].value;
if ( ! chosenid )
{
chosenid = 0;
}
//------------------------------------------
// Toggle view...
//------------------------------------------
if ( subdesc[chosenid] )
{
document.getElementById('pkdesc').innerHTML = subdesc[chosenid];
toggleview('subspkdiv');
}
}
+615 -191
View File
@@ -1,192 +1,616 @@
//------------------------------------------
// Invision Power Board v2.0
// Topics JS File
// (c) 2003 Invision Power Services, Inc.
//
// http://www.invisionboard.com
//------------------------------------------
//==========================================
// Link to a post
//==========================================
function link_to_post(pid)
{
temp = prompt( ipb_lang_tt_prompt, ipb_var_base_url + "showtopic=" + ipb_input_t + "&view=findpost&p=" + pid );
return false;
}
//==========================================
// Delete post
//==========================================
function delete_post(theURL)
{
if (confirm( ipb_lang_js_del_1 ))
{
window.location.href=theURL;
}
else
{
alert ( ipb_lang_js_del_2 );
}
}
//==========================================
// Multi quote
//==========================================
function multiquote_add(id)
{
saved = new Array();
clean = new Array();
add = 1;
//-----------------------------------
// Get any saved info
//-----------------------------------
if ( tmp = my_getcookie('mqtids') )
{
saved = tmp.split(",");
}
//-----------------------------------
// Remove bit if exists
//-----------------------------------
for( i = 0 ; i < saved.length; i++ )
{
if ( saved[i] != "" )
{
if ( saved[i] == id )
{
add = 0;
}
else
{
clean[clean.length] = saved[i];
}
}
}
//-----------------------------------
// Add?
//-----------------------------------
if ( add )
{
clean[ clean.length ] = id;
eval("document.mad_"+id+".src=removequotebutton");
}
else
{
eval(" document.mad_"+id+".src=addquotebutton");
}
my_setcookie( 'mqtids', clean.join(','), 0 );
return false;
}
//==========================================
// Check delete
//==========================================
function checkdelete()
{
if ( ! document.modform.selectedpids.value )
{
return false;
}
isDelete = document.modform.tact.options[document.modform.tact.selectedIndex].value;
if (isDelete == 'delete')
{
formCheck = confirm( lang_suredelete );
if (formCheck == true)
{
return true;
}
else
{
return false;
}
}
}
//==========================================
// Toggle selection
//==========================================
function topic_toggle_pid( pid )
{
//-----------------------------------
// Got a number?
//-----------------------------------
if ( isNaN( pid ) )
{
return false;
}
saved = new Array();
clean = new Array();
add = 1;
//-----------------------------------
// Get form info
//-----------------------------------
tmp = document.modform.selectedpids.value;
saved = tmp.split(",");
//-----------------------------------
// Remove bit if exists
//-----------------------------------
for( i = 0 ; i < saved.length; i++ )
{
if ( saved[i] != "" )
{
if ( saved[i] == pid )
{
add = 0;
}
else
{
clean[clean.length] = saved[i];
}
}
}
//-----------------------------------
// Add?
//-----------------------------------
if ( add )
{
clean[ clean.length ] = pid;
eval("document.img"+pid+".src=selectedbutton");
}
else
{
eval(" document.img"+pid+".src=unselectedbutton");
}
newvalue = clean.join(',');
my_setcookie( 'modpids', newvalue, 0 );
document.modform.selectedpids.value = newvalue;
newcount = stacksize(clean);
document.modform.gobutton.value = lang_gobutton + ' (' + newcount + ')';
return false;
//------------------------------------------
// Invision Power Board 2.1.7
// Topics JS File
// (c) 2005 Invision Power Services, Inc.
//
// http://www.invisionboard.com
//------------------------------------------
var mystored_selection = '';
var post_cache = new Array();
var ajax_loaded = 1;
var ignore_cache = new Array();
/*--------------------------------------------*/
// Fast reply stuff
/*--------------------------------------------*/
function emoticon( ecode, eobj, eurl )
{
ecode = ' ' + ecode + ' ';
var obj_ta = document.getElementById( 'fastreplyarea' );
if ( (ua_vers >= 4) && is_ie && is_win)
{
if (obj_ta.isTextEdit)
{
obj_ta.focus();
var sel = document.selection;
var rng = sel.createRange();
rng.colapse;
if((sel.type == "Text" || sel.type == "None") && rng != null)
{
if(ecode != "" && rng.text.length > 0)
ecode = rng.text + ecode ;
rng.text = ecode;
}
}
else
{
obj_ta.value += ecode;
}
}
//----------------------------------------
// It's MOZZY!
//----------------------------------------
else if ( obj_ta.selectionEnd )
{
var ss = obj_ta.selectionStart;
var st = obj_ta.scrollTop;
var es = obj_ta.selectionEnd;
if (es <= 2)
{
es = obj_ta.textLength;
}
var start = (obj_ta.value).substring(0, ss);
var middle = (obj_ta.value).substring(ss, es);
var end = (obj_ta.value).substring(es, obj_ta.textLength);
//-----------------------------------
// text range?
//-----------------------------------
if (obj_ta.selectionEnd - obj_ta.selectionStart > 0)
{
middle = ecode + middle;
}
else
{
middle = ecode + middle;
}
obj_ta.value = start + middle + end;
var cpos = ss + (middle.length);
obj_ta.selectionStart = cpos;
obj_ta.selectionEnd = cpos;
obj_ta.scrollTop = st;
}
//----------------------------------------
// It's CRAPPY!
//----------------------------------------
else
{
obj_ta.value += ecode;
}
obj_ta.focus();
if ( (ua_vers >= 4) && is_ie && is_win && emowindow != 'undefined' )
{
emowindow.focus();
}
//document.getElementById( 'fastreplyarea' ).value += ' ' + ecode + ' ';
}
/*--------------------------------------------*/
// Topic: Scroll to post: IE fix
/*--------------------------------------------*/
function topic_scroll_to_post( post_id )
{
//----------------------------------
// Check for PID
//----------------------------------
if ( ! post_id )
{
return false;
}
try
{
var post_main_obj = document.getElementById( 'post-main-' + post_id );
}
catch(error)
{
var post_main_obj;
}
if ( post_main_obj )
{
var post_box_top = _get_obj_toppos( post_main_obj );
if ( post_box_top )
{
scroll( 0, post_box_top - 30 );
}
}
}
/*--------------------------------------------*/
// Show hidden post
/*--------------------------------------------*/
function topic_show_ignored_post( pid )
{
try
{
// Set up
var post_main = document.getElementById( 'post-main-' + pid );
var post_ignore = document.getElementById( 'post-ignore-' + pid );
// Show it
post_main.innerHTML = ignore_cache[ pid ];
}
catch( e )
{
//alert( e );
}
return false;
}
/*--------------------------------------------*/
// Initiate topic hide
/*--------------------------------------------*/
function topic_init_ignored_post( pid )
{
try
{
// Set up
var post_main = document.getElementById( 'post-main-' + pid );
var post_ignore = document.getElementById( 'post-ignore-' + pid );
// Cache it...
ignore_cache[ pid ] = post_main.innerHTML;
// Display "ignored" msg
post_main.innerHTML = post_ignore.innerHTML;
}
catch( e )
{
//alert( e );
}
}
/*--------------------------------------------*/
// Window Resize
/*--------------------------------------------*/
function ajax_std_window_resize( pix, pid )
{
var box = document.getElementById( 'post-edit-'+pid );
var cur_height = parseInt( box.style.height ) ? parseInt( box.style.height ) : 300;
var new_height = cur_height + pix;
if ( new_height > 0 )
{
box.style.height = new_height + "px";
}
return false;
}
/*--------------------------------------------*/
// Ajax: Cancel for edit
/*--------------------------------------------*/
function ajax_cancel_for_edit( post_id )
{
if ( post_cache[ post_id ] != "" )
{
document.getElementById( 'post-'+post_id ).innerHTML = post_cache[ post_id ];
}
return false;
}
/*--------------------------------------------*/
// Ajax: Save for edit
/*--------------------------------------------*/
function ajax_save_for_edit( post_id )
{
//----------------------------------
// INIT
//----------------------------------
var url = ipb_var_base_url+'act=xmlout&do=post-edit-save&p='+post_id+'&t='+ipb_input_t+'&f='+ipb_input_f;
var fields = new Array();
//----------------------------------
// Populate fields
//----------------------------------
fields['md5check'] = ipb_md5_check;
fields['t'] = ipb_input_t;
fields['f'] = ipb_input_f;
fields['p'] = post_id;
fields['act'] = 'xmlout';
fields['do'] = 'post-edit-save';
fields['Post'] = document.getElementById( 'post-edit-'+post_id ).value;
fields['std_used'] = 1; // Make sure STD BBCode parser is used
/*--------------------------------------------*/
// Main function to do on request
// Must be defined first!!
/*--------------------------------------------*/
do_request_function = function()
{
//----------------------------------
// Ignore unless we're ready to go
//----------------------------------
if ( ! xmlobj.readystate_ready_and_ok() )
{
xmlobj.show_loading();
return;
}
xmlobj.hide_loading();
//----------------------------------
// INIT
//----------------------------------
var html = xmlobj.xmlhandler.responseText;
if ( html != 'error' )
{
document.getElementById( 'post-'+post_id ).innerHTML = html;
}
}
//----------------------------------
// LOAD XML
//----------------------------------
xmlobj = new ajax_request();
xmlobj.onreadystatechange( do_request_function );
var xmlreturn = xmlobj.process( url, 'POST', xmlobj.format_for_post(fields) );
post_cache[ post_id ] = '';
return false;
}
/*--------------------------------------------*/
// Ajax: Prep for edit
/*--------------------------------------------*/
function ajax_prep_for_edit( post_id, event )
{
//----------------------------------
// Cancel bubble (Prevent IE scroll...)
//----------------------------------
global_cancel_bubble( event, true );
var post_main_obj = document.getElementById( 'post-main-' + post_id );
var post_box_top = _get_obj_toppos( post_main_obj );
//----------------------------------
// INIT
//----------------------------------
var url = ipb_var_base_url+'act=xmlout&do=post-edit-show&p='+post_id+'&t='+ipb_input_t+'&f='+ipb_input_f;
if ( ! post_cache[ post_id ] || post_cache[ post_id ] == '' )
{
post_cache[ post_id ] = document.getElementById( 'post-'+post_id ).innerHTML;
}
//----------------------------------
// Attempt to close open menus
//----------------------------------
try
{
menu_action_close();
}
catch(e)
{
//alert( e );
}
/*--------------------------------------------*/
// Main function to do on request
// Must be defined first!!
/*--------------------------------------------*/
do_request_function = function()
{
//----------------------------------
// Ignore unless we're ready to go
//----------------------------------
if ( ! xmlobj.readystate_ready_and_ok() )
{
xmlobj.show_loading();
return;
}
xmlobj.hide_loading();
//----------------------------------
// INIT
//----------------------------------
var html = xmlobj.xmlhandler.responseText;
if ( html == 'nopermission' )
{
alert( js_error_no_permission );
}
else if ( html != 'error' )
{
if ( post_box_top )
{
scroll( 0, post_box_top - 30 );
}
document.getElementById( 'post-'+post_id ).innerHTML = html;
}
}
//----------------------------------
// LOAD XML
//----------------------------------
xmlobj = new ajax_request();
xmlobj.onreadystatechange( do_request_function );
xmlobj.process( url );
return false;
}
/*--------------------------------------------*/
// check selection
/*--------------------------------------------*/
function checkselection()
{
var myselection = '';
if ( window.getSelection )
{
myselection = window.getSelection();
}
else if ( document.selection )
{
myselection = document.selection.createRange().text;
}
else if ( document.getSelection )
{
myselection = document.getSelection();
}
if ( myselection != '' && myselection != null )
{
if ( myselection != mystored_selection )
{
document.getElementById('fastreply-pastesel').style.display = '';
mystored_selection = (myselection.toString() != '') ? myselection.toString() : null;
}
}
else
{
mystored_selection = null;
}
}
/*--------------------------------------------*/
// Paste selection
/*--------------------------------------------*/
function pasteselection()
{
if ( mystored_selection != '' && mystored_selection != null )
{
var fr = document.getElementById('fastreplyarea');
if (fr)
{
fr.value += '[quote]'+mystored_selection+'[/quote]\n';
fr.focus();
}
}
return false;
}
/*--------------------------------------------*/
// Link to a post
/*--------------------------------------------*/
function link_to_post(pid)
{
temp = prompt( ipb_lang_tt_prompt, ipb_var_base_url + "showtopic=" + ipb_input_t + "&view=findpost&p=" + pid );
return false;
}
/*--------------------------------------------*/
// Delete post
/*--------------------------------------------*/
function delete_post(theURL)
{
if (confirm( ipb_lang_js_del_1 ))
{
window.location.href=theURL;
}
else
{
alert ( ipb_lang_js_del_2 );
}
}
/*--------------------------------------------*/
// Multi quote
/*--------------------------------------------*/
function multiquote_add(id)
{
saved = new Array();
clean = new Array();
add = 1;
//-----------------------------------
// Get any saved info
//-----------------------------------
if ( tmp = my_getcookie('mqtids') )
{
saved = tmp.split(",");
}
//-----------------------------------
// Remove bit if exists
//-----------------------------------
for( i = 0 ; i < saved.length; i++ )
{
if ( saved[i] != "" )
{
if ( saved[i] == id )
{
add = 0;
}
else
{
clean[clean.length] = saved[i];
}
}
}
//-----------------------------------
// Add?
//-----------------------------------
if ( add )
{
clean[ clean.length ] = id;
eval("document.mad_"+id+".src=removequotebutton");
}
else
{
eval(" document.mad_"+id+".src=addquotebutton");
}
my_setcookie( 'mqtids', clean.join(','), 0 );
return false;
}
/*--------------------------------------------*/
// Check delete
/*--------------------------------------------*/
function checkdelete()
{
if ( ! document.modform.selectedpids.value )
{
return false;
}
isDelete = document.modform.tact.options[document.modform.tact.selectedIndex].value;
if (isDelete == 'delete')
{
formCheck = confirm( lang_suredelete );
if (formCheck == true)
{
return true;
}
else
{
return false;
}
}
}
/*--------------------------------------------*/
// Toggle selection
//*--------------------------------------------*/
function topic_toggle_pid( pid )
{
//-----------------------------------
// Got a number?
//-----------------------------------
if ( isNaN( pid ) )
{
return false;
}
saved = new Array();
clean = new Array();
add = 1;
//-----------------------------------
// Get form info
//-----------------------------------
tmp = document.modform.selectedpids.value;
saved = tmp.split(",");
//-----------------------------------
// Remove bit if exists
//-----------------------------------
for( i = 0 ; i < saved.length; i++ )
{
if ( saved[i] != "" )
{
if ( saved[i] == pid )
{
add = 0;
}
else
{
clean[clean.length] = saved[i];
}
}
}
//-----------------------------------
// Add?
//-----------------------------------
if ( add )
{
clean[ clean.length ] = pid;
eval("document.img"+pid+".src=selectedbutton");
}
else
{
eval(" document.img"+pid+".src=unselectedbutton");
}
newvalue = clean.join(',');
my_setcookie( 'modpids', newvalue, 0 );
document.modform.selectedpids.value = newvalue;
newcount = stacksize(clean);
document.modform.gobutton.value = lang_gobutton + ' (' + newcount + ')';
return false;
}
+213
View File
@@ -0,0 +1,213 @@
//------------------------------------------
// Invision Power Board 2.1.7
// User CP JS File
// (c) 2005 Invision Power Services, Inc.
//
// http://www.invisionboard.com
//------------------------------------------
var ucp_dname_name;
var ucp_dname_pass;
var ucp_dname_name_img;
var ucp_dname_pass_img;
var ucp_dname_form;
var ucp_dname_warn;
var ucp_dname_warn_content;
var ucp_dname_ok_to_go = 0;
var ucp_dname_illegal_chars = new Array( '[', ']', '|', ',', ';' );
var ucp_dname_illegal_regex = '';
for ( var i in ucp_dname_illegal_chars )
{
ucp_dname_illegal_regex += '\\' + ucp_dname_illegal_chars[i];
}
var error_found = '';
/*-------------------------------------------------------------------------*/
// INIT Display name change stuff
/*-------------------------------------------------------------------------*/
function ucp_dname_init( name, pass, form, wbox )
{
ucp_dname_name = document.getElementById( name );
ucp_dname_pass = document.getElementById( pass );
ucp_dname_form = document.getElementById( form );
ucp_dname_warn = document.getElementById( wbox );
ucp_dname_warn_content = document.getElementById( wbox+'-content' );
ucp_dname_name_img = document.getElementById( name+'-img' );
ucp_dname_pass_img = document.getElementById( pass+'-img' );
ucp_dname_name.onblur = ucp_dname_check;
ucp_dname_form.onsubmit = ucp_dname_form_check;
if ( ucp_dname_warn_content.innerHTML )
{
ucp_dname_warn.style.display = 'block';
}
}
/*-------------------------------------------------------------------------*/
// EVENT: Check display name
/*-------------------------------------------------------------------------*/
function ucp_dname_check( event )
{
//----------------------------------
// INIT
//----------------------------------
//----------------------------------
// Make sure we have sommat
//----------------------------------
if ( ! ucp_dname_name.value || ucp_dname_name.value.length < 3 || ucp_dname_name.value.length > 32 )
{
error_found += dname_error_no_name + "<br />";
}
//----------------------------------
// Check for illegal chars
//----------------------------------
if ( ucp_dname_name.value.match( new RegExp( "[" + ucp_dname_illegal_regex + "]" ) ) )
{
error_found += dname_error_chars + "<br />";
}
//----------------------------------
// Ajax: check for existing member name
//----------------------------------
if ( use_enhanced_js && ucp_dname_name.value )
{
var url = ipb_var_base_url+'act=xmlout&do=check-display-name&name='+escape( ucp_dname_name.value );
/*--------------------------------------------*/
// Main function to do on request
// Must be defined first!!
/*--------------------------------------------*/
do_request_function = function()
{
//----------------------------------
// Ignore unless we're ready to go
//----------------------------------
if ( ! xmlobj.readystate_ready_and_ok() )
{
// Could do a little loading graphic here?
return;
}
//----------------------------------
// INIT
//----------------------------------
var html = xmlobj.xmlhandler.responseText;
if ( html == 'found' )
{
error_found += dname_error_taken + "<br />";
}
//----------------------------------
// Show errors
//----------------------------------
if ( error_found )
{
ucp_dname_name.className = input_red;
ucp_dname_name_img.src = ipb_var_image_url + '/' + img_cross;
ucp_dname_warn_content.innerHTML = error_found;
ucp_dname_warn.style.display = 'block';
}
else
{
ucp_dname_name.className = input_green;
ucp_dname_name_img.src = ipb_var_image_url + '/' + img_tick;
ucp_dname_warn.style.display = 'none';
ucp_dname_warn_content.innerHTML = '';
}
error_found = '';
}
//----------------------------------
// LOAD XML
//----------------------------------
xmlobj = new ajax_request();
xmlobj.onreadystatechange( do_request_function );
xmlobj.process( url );
}
else
{
//----------------------------------
// Show errors
//----------------------------------
if ( error_found )
{
ucp_dname_name.className = input_red;
ucp_dname_name_img.src = ipb_var_image_url + '/' + img_cross;
ucp_dname_warn_content.innerHTML = error_found;
ucp_dname_warn.style.display = 'block';
}
else
{
ucp_dname_name.className = input_green;
ucp_dname_name_img.src = ipb_var_image_url + '/' + img_tick;
ucp_dname_warn.style.display = 'none';
ucp_dname_warn_content.innerHTML = '';
}
error_found = '';
}
}
/*-------------------------------------------------------------------------*/
// EVENT: Check display name
/*-------------------------------------------------------------------------*/
function ucp_dname_form_check( event )
{
//----------------------------------
// DO pass fields
//----------------------------------
if ( ! ucp_dname_pass.value )
{
error_found += dname_error_no_pass + "<br />";
}
//----------------------------------
// Check name
//----------------------------------
ucp_dname_check( event );
if ( error_found )
{
ucp_dname_ok_to_go = 0;
}
else
{
ucp_dname_ok_to_go = 1;
}
//----------------------------------
// Return
//----------------------------------
if ( ucp_dname_ok_to_go )
{
return true;
}
else
{
return false;
}
}
+720
View File
@@ -0,0 +1,720 @@
//------------------------------------------------------------------------------
// IPS XML HTTP REQUEST:: GET NEW POSTS
//------------------------------------------------------------------------------
// Supports Safari, Mozilla 1.3+ (Firefox, etc) and IE 5.5+
// (c) 2005 Invision Power Services, Inc.
// http://www.invisionpower.com
//------------------------------------------------------------------------------
/*--------------------------------------------*/
// INIT VARS
/*--------------------------------------------*/
var mem_div = 'ipb-get-members';
var divobj;
var iframeobj;
var formobj;
var xmlobj;
var _result_cache = new Array();
var _div_rows = 0;
var _cur_updown_pressed = 0;
var _last_key_code = 0;
var _event_key_code = 0;
var _cur_input_val = '';
var _old_input_val = '';
var _hiliteindex = -1;
var _hilite_sug_div;
var _complete_div_list;
var delay_action = false;
var _allow_update = true;
var _form_onsubmit_saved;
var _urllookup;
var _timemout_main = 0;
var _timeout_blur = 0;
var _in_focus = 0;
/*--------------------------------------------*/
// SHOW POSSIBLE MEMBER NAME MATCHES
/*--------------------------------------------*/
main_loop = function()
{
if ( ( _old_input_val != _cur_input_val ) && ( _cur_input_val.length >= 3 ) && ( _in_focus == 1 ) )
{
if ( ! delay_action && _allow_update )
{
//----------------------------------
// Try cache
//----------------------------------
var cached = _result_cache[ _cur_input_val ];
if ( cached )
{
returnSearch( _cur_input_val, cached[0], cached[1] );
}
else
{
/*--------------------------------------------*/
// Main function to do on request
// Must be defined first!!
/*--------------------------------------------*/
do_request_function = function()
{
//----------------------------------
// Ignore unless we're ready to go
//----------------------------------
if ( ! xmlobj.readystate_ready_and_ok() )
{
// Could do a little loading graphic here?
return;
}
//----------------------------------
// INIT
//----------------------------------
var returned = xmlobj.xmlhandler.responseText;
//----------------------------------
// Did we get something?
//----------------------------------
if ( returned.charAt(0) == '<' )
{
return false;
}
else
{
eval( returned );
}
}
xmlobj = new ajax_request();
xmlobj.onreadystatechange( do_request_function );
xmlobj.process( ipb_var_base_url + 'act=xmlout&do='+_urllookup+'&name='+escape(inobj.value) );
inobj.focus();
}
}
delay_action = false;
}
_old_input_val = _cur_input_val;
_timemout_main = setTimeout( 'main_loop()', 10 );
return false;
}
/*--------------------------------------------*/
// Initalize...
/*--------------------------------------------*/
function init_js( formobjname, fieldobjname, urllookup )
{
//----------------------------------
// Set up
//----------------------------------
if ( ! urllookup )
{
_urllookup = 'get-member-names';
}
else
{
_urllookup = urllookup;
}
formobj = document.getElementById( formobjname );
inobj = document.getElementById( fieldobjname );
divobj = document.getElementById( mem_div );
inobj.autocomplete = "off";
inobj.onfocus = function () { _in_focus = 1; }
inobj.onblur = onblurhandler;
inobj.onsubmit = submit_handler;
//----------------------------------
// Already got a submit handler?
//----------------------------------
if ( formobj.onsubmit )
{
_form_onsubmit_saved = formobj.onsubmit;
}
formobj.onsubmit = submit_handler;
if ( inobj.createTextRange )
{
inobj.onkeyup = new Function( "return onkeyuphandler(event);" );
}
else
{
inobj.onkeyup = onkeyuphandler;
}
cache_name_results("",new Array(),new Array());
_cur_input_val = inobj.value;
document.onkeydown = keydownhandler;
set_up_key_down();
}
/*--------------------------------------------*/
// Set up key down
/*--------------------------------------------*/
function set_up_key_down()
{
if ( document.createEventObject )
{
var y = document.createEventObject();
y.ctrlKey = true;
y.keyCode = 70;
document.fireEvent( "onkeydown", y )
}
}
/*--------------------------------------------*/
// Key down handler
/*--------------------------------------------*/
function keydownhandler( event )
{
if( ! event && window.event )
{
event = window.event;
}
if ( event )
{
_last_key_code = event.keyCode;
}
}
/*--------------------------------------------*/
// On blur handler
/*--------------------------------------------*/
function onblurhandler( event )
{
if ( ! event && window.event )
{
event = window.event;
}
if ( ! _cur_updown_pressed )
{
_in_focus = 0;
my_xr_hide_div( divobj );
_hiliteindex = -1;
// Tab?
if ( _last_key_code == 9 )
{
_last_key_code = -1;
}
}
_cur_updown_pressed = false;
}
/*--------------------------------------------*/
// On key up handler
/*--------------------------------------------*/
function key_handler_function()
{
//----------------------------------
// trap up/down cursor
//----------------------------------
if ( _event_key_code == 40 || _event_key_code == 38 )
{
_allow_update = false;
blur_then_focus();
}
else
{
_cur_updown_pressed = false;
_allow_update = true;
}
_cur_input_val = inobj.value;
handle_cursor_press( _event_key_code );
}
/*--------------------------------------------*/
// Handle cursor press
/*--------------------------------------------*/
function handle_cursor_press( eventcode )
{
if ( eventcode == 40 )
{
hilite_new_value( _hiliteindex + 1 );
}
else if ( eventcode == 38 )
{
hilite_new_value( _hiliteindex - 1 );
}
else if ( eventcode == 13 || eventcode == 3 )
{
//----------------------------------
// Are we looking through the divs?
//----------------------------------
if ( _hiliteindex != -1 )
{
my_xr_hide_div( divobj );
_hiliteindex = -1;
}
return false;
}
return true;
}
/*--------------------------------------------*/
// Highlight new value (cursor keys pressed)
/*--------------------------------------------*/
function hilite_new_value( index )
{
if ( _div_rows <= 0 )
{
return;
}
my_show_div( divobj );
if ( index > _div_rows )
{
index = _div_rows - 1;
}
if ( _hiliteindex != -1 && index != _hiliteindex )
{
set_style_for_element( _hilite_sug_div, 'wrapdiv' );
}
if ( index < 0 )
{
_hiliteindex = -1;
inobj.focus();
return;
}
_hiliteindex = index;
_hilite_sug_div = divobj.getElementsByTagName('DIV').item( index );
set_style_for_element( _hilite_sug_div, 'spanhilite' );
newval = find_span_value_for_class( _hilite_sug_div, 'namespan' );
if ( newval && typeof(newval) != 'undefined' )
{
inobj.value = find_span_value_for_class( _hilite_sug_div, 'namespan' );
}
}
/*--------------------------------------------*/
// Blur then focus
/*--------------------------------------------*/
function blur_then_focus()
{
_cur_updown_pressed = true;
inobj.blur();
_timemout_blur = setTimeout( "set_input_field_focus();", 10 );
return;
}
/*--------------------------------------------*/
// Set input field focus
/*--------------------------------------------*/
function set_input_field_focus()
{
inobj.focus();
}
/*--------------------------------------------*/
// Styles element
/*--------------------------------------------*/
function set_style_for_element( c, name )
{
try
{
if ( ! c )
{
return;
}
}
catch(e)
{
return;
}
c.className = name;
switch( name )
{
case 'wrapdiv':
c.style.backgroundColor = "white";
c.style.color = "black";
if ( c.displaySpan )
{
c.displaySpan.style.color = "green";
}
break;
case 'wrapspan':
c.style.display = "block";
c.style.paddingLeft = "3";
c.style.paddingRight = "3";
c.style.height = "16px";
c.style.overflow = "hidden";
break;
case 'namespan':
c.style.cssFloat = "left";
c.style.width = '100%';
break;
case 'idspan':
c.style.cssFloat = "right";
c.style.display = 'none';
break;
case 'spanhilite':
c.style.backgroundColor = "#3366cc";
c.style.color = "white";
if ( c.displaySpan )
{
c.displaySpan.style.color = "white";
}
break;
}
}
/*--------------------------------------------*/
// Get value of named span
/*--------------------------------------------*/
function find_span_value_for_class( i, dc )
{
try
{
if ( ! i )
{
return;
}
}
catch(e)
{
return;
}
var ga = i.getElementsByTagName('span');
if ( ga )
{
for( var f=0; f < ga.length; ++f )
{
if ( ga[f].className == dc )
{
var value = ga[f].innerHTML;
if ( value == "&nbsp;" )
{
return "";
}
else
{
return value;
}
}
}
}
else
{
return "";
}
}
/*--------------------------------------------*/
// Displays the actual list
/*--------------------------------------------*/
function display_suggested_list( na, ia )
{
//----------------------------------
// Clear div
//----------------------------------
while( divobj.childNodes.length > 0 )
{
divobj.removeChild( divobj.childNodes[0] );
}
//----------------------------------
// Write Div
//----------------------------------
_div_rows = 0;
for( var f = 0 ; f < na.length; ++f )
{
_div_rows++;
var od = document.createElement("DIV");
set_style_for_element( od, 'wrapdiv' );
od.onmousedown = sb_mdown;
od.onmouseover = sb_mover;
od.onmouseout = sb_mout;
var span_wrap = document.createElement("SPAN");
set_style_for_element( span_wrap, 'wrapspan' );
var span_name = document.createElement("SPAN");
span_name.innerHTML = na[f];
var span_id = document.createElement("SPAN");
set_style_for_element( span_name, 'namespan' );
set_style_for_element( span_id, 'idspan' );
od.displaySpan = span_id;
span_id.innerHTML = ia[f];
span_wrap.appendChild( span_name );
span_wrap.appendChild( span_id );
od.appendChild( span_wrap );
divobj.appendChild( od );
}
//----------------------------------
// Calc pos.
//----------------------------------
var mid = inobj;
var left_px = _get_obj_leftpos(mid);
var top_px = _get_obj_toppos(mid) + mid.offsetHeight;
var width = parseInt( divobj.style.width );
var height = parseInt( divobj.style.height );
//----------------------------------
// Show menu DIV
//----------------------------------
divobj.style.position = "absolute";
//----------------------------------
// Try and keep it on screen
//----------------------------------
if ( (left_px + width) >= document.body.clientWidth )
{
left_px = left_px + mid.offsetWidth - width;
}
//----------------------------------
// Try and keep it on screen
//----------------------------------
if ( (top_px + height) >= document.body.clientHeight )
{
top_px = top_px - height;
}
//----------------------------------
// Finalize menu position
//----------------------------------
divobj.style.left = left_px + "px";
divobj.style.top = top_px + "px";
divobj.style.display = "block";
_hiliteindex= -1;
//----------------------------------
// Workaround for IE bug which shows
// select boxes and other windows GUI
// over divs. SHOW IFRAME
//----------------------------------
if ( is_ie )
{
try
{
if ( ! document.getElementById( 'if_xhr_' + mem_div ) )
{
iframeobj = document.createElement('iframe');
iframeobj.src = 'javascript:;';
iframeobj.id = 'if_xhr_' + mem_div
document.getElementsByTagName('body')[0].appendChild( iframeobj );
}
else
{
iframeobj = document.getElementById( 'if_xhr_' + mem_div );
}
iframeobj.scrolling = 'no';
iframeobj.frameborder = 'no';
iframeobj.className = 'iframeshim';
iframeobj.style.position = 'absolute';
iframeobj.style.width = parseInt(divobj.offsetWidth) + 'px';
iframeobj.style.height = parseInt(divobj.offsetHeight) + 'px';
iframeobj.style.top = divobj.style.top;
iframeobj.style.left = divobj.style.left;
iframeobj.style.zIndex = divobj.style.zIndex - 1;
iframeobj.style.display = "block";
}
catch(error)
{
//alert(error); // Oh dear, someones stolen the iframe
}
}
}
/*--------------------------------------------*/
// Caches the results
/*--------------------------------------------*/
function cache_name_results( mstring, na, ia )
{
_result_cache[mstring] = new Array( na, ia );
}
/*--------------------------------------------*/
// This is the function the response XML text gives
/*--------------------------------------------*/
returnSearch = function( mstring, namearray, idarray )
{
//----------------------------------
// Cache..
//----------------------------------
cache_name_results( mstring, namearray, idarray );
if ( _in_focus != 1 )
{
return false;
}
//----------------------------------
// Display
//----------------------------------
display_suggested_list( namearray, idarray );
//----------------------------------
// Resize or hide?
//----------------------------------
if ( _div_rows > 0 )
{
divobj.style.height = 16 * _div_rows + 4;
}
else
{
my_xr_hide_div( divobj );
_hiliteindex = -1;
}
}
/*--------------------------------------------*/
// Submit handler
/*--------------------------------------------*/
submit_handler = function ( event )
{
delay_action = true;
var retval = true;
if ( _hiliteindex != -1 )
{
return false;
}
else
{
if ( _form_onsubmit_saved )
{
eval( 'tmpsubmit = ' + _form_onsubmit_saved );
retval = tmpsubmit();
}
return retval;
}
}
/*--------------------------------------------*/
// On key up handler
/*--------------------------------------------*/
onkeyuphandler = function( event )
{
_event_key_code = event.keyCode;
key_handler_function();
}
/*--------------------------------------------*/
// Div mouse events
/*--------------------------------------------*/
sb_mdown = function()
{
delay_action = true;
inobj.value = find_span_value_for_class( this, 'namespan' );
}
sb_mover = function()
{
set_style_for_element( this, 'spanhilite' );
}
sb_mout = function()
{
set_style_for_element( this, 'wrapdiv' );
}
function my_xr_hide_div ( dobj )
{
dobj.style.display = "none";
if ( is_ie )
{
try
{
document.getElementById( 'if_xhr_' + mem_div ).style.display = "none";
}
catch(e)
{
//alert(e);// Oh dear, someones stolen the iframe
}
}
}
+447
View File
@@ -0,0 +1,447 @@
/*-------------------------------------------------------------------------*/
// IPS BASIC MENU CLASS
// (c) 2005 Invision Power Services, Inc
// ASSUMES "ips_global.js" has been loaded
/*-------------------------------------------------------------------------*/
var menu_registered = new Array();
var menu_openfuncs = new Array();
var menu_built = new Array();
var menu_open_menus = new Array();
var menu_cur_open = false;
/*-------------------------------------------------------------------------*/
// menu_do_global_init: Initiate all registered menus in HTML
/*-------------------------------------------------------------------------*/
function menu_do_global_init()
{
if ( menu_registered.length > 0 )
{
for( var i in menu_registered )
{
menu_init( menu_registered[i] );
}
//----------------------------------
// Close all menus on click
//----------------------------------
document.onclick = menu_action_close;
}
}
/*-------------------------------------------------------------------------*/
// menu_init: Initiate a single menu
/*-------------------------------------------------------------------------*/
function menu_init(cid)
{
var mid = _menu_get_base_name(cid) + "_menu";
var mobj = my_getbyid(mid);
if ( document.getElementsByTagName && mobj )
{
//----------------------------------
// Control object (link / img, etc)
//----------------------------------
var cobj = my_getbyid(cid);
// Change cursor to show link
try
{
cobj.style.cursor = "pointer";
}
catch(e)
{
cobj.style.cursor = "hand";
}
cobj.unselectable = true;
cobj.onclick = _event_menu_click;
cobj.onmouseover = _event_menu_mouseover;
//----------------------------------
// Save CPU - already init?
//----------------------------------
if ( typeof( menu_built[mid]) != "undefined" )
{
return;
}
//----------------------------------
// Pop-up menu obj (hidden div)
//----------------------------------
var pobj = my_getbyid(mid);
// Set up style defaults
pobj.style.display = "none";
pobj.style.position = "absolute";
pobj.style.left = "0px";
pobj.style.top = "0px";
pobj.onclick = _cancel_bubble;
pobj.zIndex = 1000;
menu_built[mid] = true;
}
}
/*-------------------------------------------------------------------------*/
// Register menu control ID (add to array)
/*-------------------------------------------------------------------------*/
function menu_register(cid, callback)
{
if ( document.getElementsByTagName )
{
var cobj = my_getbyid(cid);
if (cobj)
{
menu_registered[menu_registered.length] = cid;
if ( callback )
{
menu_openfuncs[ cobj ] = callback;
}
return true;
}
}
return false;
}
/*-------------------------------------------------------------------------*/
// ACTION: If registered control ID clicked, open menu
/*-------------------------------------------------------------------------*/
function menu_action_open(e)
{
var openmenu = menu_cur_open;
var negpad = true;
//----------------------------------
// Close current menu(s)
//----------------------------------
menu_action_close();
//----------------------------------
// Save CPU - cur open clicked?
//----------------------------------
if ( openmenu == e.id )
{
return false;
}
//----------------------------------
// Get ID of menu DIV to show
//----------------------------------
var mid = _menu_get_base_name(e.id) + "_menu";
var mobj = my_getbyid(mid);
var left_px = _get_obj_leftpos(e);
var top_px = _get_obj_toppos(e) + e.offsetHeight;
var callbackobj = my_getbyid( e.id );
var ifid = e.id;
menu_open_menus[e.id] = true;
menu_cur_open = e.id;
//----------------------------------
// Show menu DIV
//----------------------------------
mobj.style.display = "";
//----------------------------------
// Try and keep it on screen
//----------------------------------
var width = parseInt( mobj.style.width ) ? parseInt( mobj.style.width ) : mobj.offsetWidth;
if ( (left_px + width) >= document.body.clientWidth )
{
left_px = left_px + e.offsetWidth - width;
negpad = false;
}
//----------------------------------
// IE needs a tweak...
//----------------------------------
if ( is_ie )
{
left_px += ( negpad ) ? -2 : 2;
}
//----------------------------------
// Finalize menu position
//----------------------------------
mobj.style.left = left_px + "px";
mobj.style.top = top_px + "px";
mobj.style.zIndex = 100;
//----------------------------------
// Run a custom function?
//----------------------------------
if ( menu_openfuncs[ callbackobj ] )
{
eval( menu_openfuncs[ callbackobj ] );
}
//----------------------------------
// Workaround for IE bug which shows
// select boxes and other windows GUI
// over divs. SHOW IFRAME
//----------------------------------
if ( is_ie )
{
try
{
if ( ! document.getElementById( 'if_' + e.id ) )
{
var iframeobj = document.createElement('iframe');
iframeobj.src = 'javascript;';
iframeobj.id = 'if_' + e.id;
document.getElementsByTagName('body').appendChild( iframeobj );
}
else
{
var iframeobj = document.getElementById( 'if_' + e.id );
}
iframeobj.scrolling = 'no';
iframeobj.frameborder = 'no';
iframeobj.className = 'iframeshim';
iframeobj.style.position = 'absolute';
iframeobj.style.width = parseInt(mobj.offsetWidth) + 'px';
iframeobj.style.height = parseInt(mobj.offsetHeight) + 'px';
iframeobj.style.top = mobj.style.top;
iframeobj.style.left = mobj.style.left;
iframeobj.style.zIndex = 99;
iframeobj.style.display = "block";
}
catch(e)
{
//alert(e); // Oh dear, someones stolen the iframe
}
}
//----------------------------------
// Work around for safari which doesnt
// allow a hrefs top be clickable in
// a pop up div
//----------------------------------
if ( is_safari )
{
try
{
mlinks = mobj.getElementsByTagName('a');
for ( var i = 0 ; i <= mlinks.length ; i++ )
{
//----------------------------------
// Ignore non links and links that end with #
// As safari likes to do that with href='#' links
//----------------------------------
if ( mlinks[i].href && ( mlinks[i].href.indexOf( '#', 0 ) != (mlinks[i].href.length - 1) ) )
{
mlinks[i].onmousedown = _safari_onclick_handler;
mlinks[i].id = 'saf-link-' + mid + i;
}
}
}
catch( e )
{
//alert( e );
}
}
return false;
}
/*-------------------------------------------------------------------------*/
// Safari: bug fix
/*-------------------------------------------------------------------------*/
function _safari_onclick_handler()
{
if ( this.id )
{
window.location = document.getElementById( this.id ).href;
}
}
/*-------------------------------------------------------------------------*/
// ACTION: Close all open menus
/*-------------------------------------------------------------------------*/
function menu_action_close()
{
if ( menu_cur_open )
{
for ( i in menu_open_menus )
{
my_getbyid(_menu_get_base_name(i) + "_menu").style.display = "none";
//----------------------------------
// Workaround for IE bug which shows
// select boxes and other windows GUI
// over divs. Hide IFRAME
//----------------------------------
if ( is_ie )
{
try
{
document.getElementById( 'if_' + i ).style.display = "none";
}
catch(e)
{
//alert(e);// Oh dear, someones stolen the iframe
}
}
menu_open_menus[i] = false;
}
}
menu_cur_open = false;
}
/*-------------------------------------------------------------------------*/
// ACTION: If menu open and hover over another cid, close cur open new
/*-------------------------------------------------------------------------*/
function menu_action_hover(e)
{
for ( i in menu_open_menus )
{
if (menu_open_menus[i] == true && i != e.id)
{
menu_action_open(e);
return;
}
}
}
/*-------------------------------------------------------------------------*/
// Prevent browser bubblin'
/*-------------------------------------------------------------------------*/
function _cancel_bubble(obj, extra)
{
if ( ! obj || is_ie)
{
if ( extra )
{
window.event.returnValue = false;
}
window.event.cancelBubble = true;
return window.event;
}
else
{
if (obj.target.type == 'submit')
{
obj.target.form.submit();
}
obj.stopPropagation();
if ( extra )
{
obj.preventDefault();
}
return obj;
}
}
/*-------------------------------------------------------------------------*/
// EVENT : Mouse over menu
/*-------------------------------------------------------------------------*/
function _event_menu_mouseover(e)
{
e = _cancel_bubble(e, true);
menu_action_hover(this);
}
/*-------------------------------------------------------------------------*/
// EVENT: Menu click
/*-------------------------------------------------------------------------*/
function _event_menu_click(e)
{
e = _cancel_bubble(e, true);
menu_action_open(this);
}
/*-------------------------------------------------------------------------*/
// Get menu basename
/*-------------------------------------------------------------------------*/
function _menu_get_base_name(cid)
{
var endpos = cid.indexOf(".");
if (endpos != -1)
{
return cid.substr(0, endpos);
}
else
{
return cid;
}
}
/*-------------------------------------------------------------------------*/
// Get left posititon of object
/*-------------------------------------------------------------------------*/
function _get_obj_leftpos(obj)
{
var left = obj.offsetLeft;
while( (obj = obj.offsetParent) != null )
{
left += obj.offsetLeft;
}
return left;
}
/*-------------------------------------------------------------------------*/
// Get top position of object
/*-------------------------------------------------------------------------*/
function _get_obj_toppos(obj)
{
var top = obj.offsetTop;
while( (obj = obj.offsetParent) != null )
{
top += obj.offsetTop;
}
return top;
}
+342
View File
@@ -0,0 +1,342 @@
//------------------------------------------------------------------------------
// IPS XML HTTP REQUEST
//------------------------------------------------------------------------------
// Supports Safari, Mozilla 1.3+ (Firefox, etc) and IE 5.5+
// (c) 2005 Invision Power Services, Inc.
// http://www.invisionpower.com
//------------------------------------------------------------------------------
try
{
if ( ! use_charset )
{
var use_charset = '';
}
}
catch( e ) { }
/*--------------------------------------------*/
// New object
/*--------------------------------------------*/
function ajax_request()
{
this.isIE = false;
this.allow_use = use_enhanced_js ? true : false;
this.xmlhandler = null;
this.error_string = '';
this.nocache = true;
this.do_request_functon = function() {}
this.loading_fired = 0;
this.centerdiv = null;
}
/*--------------------------------------------*/
// Initiate
/*--------------------------------------------*/
ajax_request.prototype.xml_init = function()
{
try
{
//------------------------------------------------
// Moz, Safari, Opera
//------------------------------------------------
this.xmlhandler = new XMLHttpRequest();
this.ie = false;
this.allow_use = true;
return true;
}
catch(e)
{
try
{
//------------------------------------------------
// IE
//------------------------------------------------
this.xmlhandler = new ActiveXObject('Microsoft.XMLHTTP');
this.ie = true;
this.allow_use = true;
return true;
}
catch(e)
{
this.ie = true;
this.allow_use = false;
return false;
}
}
}
/*--------------------------------------------*/
// Actually send data
/*--------------------------------------------*/
ajax_request.prototype.process = function( url, type, post )
{
//------------------------------------------------
// The 'post' variable needs to be in the following format:
//
// var=content&var2=content&var3=content
//
// All values need to be escaped with encodeURIComponent();
//------------------------------------------------
type = type == "POST" ? "POST" : "GET";
//------------------------------------------------
// Use nocache where possible...
//------------------------------------------------
if ( this.nocache == true && type == 'GET' )
{
url = this.nocache_url( url );
}
//------------------------------------------------
// Make sure we're initialized
//------------------------------------------------
if ( ! this.xmlhandler )
{
this.xml_init();
}
//------------------------------------------------
// Only go when ready
//------------------------------------------------
if ( ! this.readystate_not_ready() )
{
this.xmlhandler.open(type, url, true);
if ( type == "GET" )
{
this.xmlhandler.send(null);
}
else
{
if ( typeof( this.xmlhandler.setRequestHeader ) != "undefined" )
{
this.xmlhandler.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=' + use_charset);
}
this.xmlhandler.send( post );
}
if ( this.xmlhandler.readyState == 4 && this.xmlhandler.status == 200 )
{
return true;
}
}
return false;
}
/*--------------------------------------------*/
// retrieve text of an XML document element, including
// elements using namespaces
/*--------------------------------------------*/
ajax_request.prototype.get_element_text_ns = function(prefix, local, parentElem, index)
{
var result = "";
if ( prefix && this.isIE )
{
//-------------------------------
// IE
//-------------------------------
result = parentElem.getElementsByTagName(prefix + ":" + local)[index];
}
else
{
//-------------------------------
// Safari, Gecko
//-------------------------------
result = parentElem.getElementsByTagName(local)[index];
}
if ( result )
{
if (result.childNodes.length > 1)
{
return result.childNodes[1].nodeValue;
}
else
{
return result.firstChild.nodeValue;
}
}
else
{
return "n/a";
}
}
/*--------------------------------------------*/
// Make sure URL is not cached
/*--------------------------------------------*/
ajax_request.prototype.nocache_url = function (url)
{
var sep = ( -1 < url.indexOf("?") ) ? "&" : "?";
var mydate = new Date();
var newurl = url + sep + "__=" + mydate.getTime();
return newurl;
}
/*--------------------------------------------*/
// Takes an array of:
// array[ field ] = value
// and returns a nice encoded POST string
/*--------------------------------------------*/
ajax_request.prototype.format_for_post = function( arrayfields )
{
var str = '';
try
{
for( var i in arrayfields )
{
str += i + '=' + this.encodeurl(arrayfields[i]) + '&';
}
}
catch(e)
{
}
return str;
}
/*--------------------------------------------*/
// Hand roll encode URL to UTF-8
/*--------------------------------------------*/
ajax_request.prototype.encodeurl = function( url )
{
//-------------------------------
// Ensure we have a string
//-------------------------------
url = url.toString();
var regcheck = url.match(/[\x90-\xFF]/g);
if ( regcheck )
{
for (var i = 0; i < i.length; i++)
{
url = url.replace(regcheck[i], '%u00' + (regcheck[i].charCodeAt(0) & 0xFF).toString(16).toUpperCase());
}
}
return escape(url).replace(/\+/g, "%2B");
}
/*--------------------------------------------*/
// Check to ensure ready state-ness
/*--------------------------------------------*/
ajax_request.prototype.readystate_not_ready = function()
{
return ( this.xmlhandler.readyState && ( this.xmlhandler.readyState < 4 ) );
}
/*--------------------------------------------*/
// Check to ensure ready state-ness
/*--------------------------------------------*/
ajax_request.prototype.readystate_ready_and_ok = function()
{
return ( this.xmlhandler.readyState == 4 && this.xmlhandler.status == 200 ) ? true : false;
}
/*--------------------------------------------*/
// Onready state change event handler
/*--------------------------------------------*/
ajax_request.prototype.onreadystatechange = function( event )
{
//------------------------------------------------
// Make sure we're initialized
//------------------------------------------------
if ( ! this.xmlhandler )
{
this.xml_init();
}
//------------------------------------------------
// Make sure its a function event
//------------------------------------------------
if ( typeof(event) == 'function' )
{
this.xmlhandler.onreadystatechange = event;
}
}
/*--------------------------------------------*/
// Show loading layer
/*--------------------------------------------*/
ajax_request.prototype.show_loading = function( message )
{
if ( ! this.loading_fired )
{
this.loading_fired = 1;
//------------------------------------------------
// Change text?
//------------------------------------------------
if ( message )
{
document.getElementById( 'loading-layer-text' ).innerHTML = message;
}
this.centerdiv = new center_div();
this.centerdiv.divname = 'loading-layer';
this.centerdiv.move_div();
}
return;
}
/*--------------------------------------------*/
// Hide loading layer
/*--------------------------------------------*/
ajax_request.prototype.hide_loading = function()
{
try
{
if ( this.centerdiv && this.centerdiv.divobj )
{
this.centerdiv.hide_div();
}
}
catch(e)
{
}
this.loading_fired = 0;
return;
}
/*--------------------------------------------*/
// IPB thinks we can use fancy JS, lets see...
/*--------------------------------------------*/
if ( use_enhanced_js )
{
use_enhanced_js = ajax_request.prototype.xml_init() ? 1 : 0;
}