Version 2.3.6

This commit is contained in:
Neo committed 2025-12-19 00:26:08 -08:00
1 parent a3bb603c96
commit 19b38c7c74
764 files changed
+143731 -118164

No files matched your search

@@ -0,0 +1,240 @@
/**************************************************
* 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
* 07.29.2005 - Added "AddEvent" handler to prevent
* event clashes / overwrites
**************************************************/
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;
}
//Drag.addEvent( document, 'mousemove', Drag.drag , false );
//Drag.addEvent( document, 'mouseup' , Drag.end , false );
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
{
ipsclass.my_setcookie( Drag.cookiename, fx+','+fy, 1 );
}
catch(e)
{
}
}
Drag.obj = null;
},
addEvent: function(elm, evType, fn, useCapture)
{
// Cross-browser event handling for IE5+, NS6 and Mozilla
// By Scott Andrew
if ( elm.addEventListener )
{
elm.addEventListener(evType, fn, useCapture);
return true;
}
else if ( elm.attachEvent )
{
var r = elm.attachEvent('on' + evType, fn);
return r;
}
else
{
elm['on' + evType] = fn;
}
},
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;
}
};
@@ -0,0 +1,14 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title></title>
</head>
<body>
</body>
</html>
@@ -0,0 +1 @@
<html>␍<head><title>Invision Power Board - Bulletin Board System</title></head>␍<body>␍<h1>403: Invision Power Board -> Forbidden</h1>␍<hr>␍You have reached this Page in error, please use␍your back button to return to Invision Board.␍<hr>␍<a href="http://anonym.to/http://www.invisionboard.com/">Invision Power Board</a>␍</body>␍</html>
@@ -0,0 +1,246 @@
<html>
<head>
<title>Insert Custom BBCode</title>
<script type="text/javascript">
<!--
//-----------------------------------------
// Attempt to get editor ID
//-----------------------------------------
var editor_id = <?php print '"'.trim( htmlspecialchars( substr( $_REQUEST['editorid'], 0, 30 ) ) ).'";'; ?>
var bbcode_id = <?php print '"'.trim( htmlspecialchars( substr( $_REQUEST['id'], 0, 30 ) ) ).'";'; ?>
var this_module = 'bbcodeloader';
var this_height = 400;
var allow_advanced = null;
var current_selection = null;
var bbcode = parent.ips_bbcode_items[ bbcode_id ];
/*-------------------------------------------------------------------------*/
// INIT
/*-------------------------------------------------------------------------*/
function Init()
{
var allow_advanced = parent.IPS_editor[ editor_id ].allow_advanced;
var current_selection = parent.ipsclass.un_htmlspecialchars( parent.IPS_editor[ editor_id ].get_selection() );
//-----------------------------------------
// Set up main close button
//-----------------------------------------
parent.document.getElementById( editor_id + '_cb-close-window' ).onclick = do_cancel;
parent.document.getElementById( editor_id + '_cb-close-window' ).style.cursor = 'pointer';
//-----------------------------------------
// Resize window
//-----------------------------------------
parent.document.getElementById( editor_id + '_htmlblock_' + this_module + '_menu' ).style.height = this_height + 'px';
parent.document.getElementById( editor_id + '_iframeblock_' + this_module + '_menu' ).style.height = ( this_height - 10 ) + 'px';
//-----------------------------------------
// Module specific stuff
//-----------------------------------------
document.getElementById("f_content_text").focus();
//-----------------------------------------
// Set up initial text value
//-----------------------------------------
document.getElementById("f_content_text").value = current_selection;
//-----------------------------------------
// Add in data
//-----------------------------------------
document.getElementById("_title").innerHTML += ' ' + bbcode['title'];
document.getElementById("_example").innerHTML += ' ' + bbcode['example'];
document.getElementById("_option").innerHTML += ' ' + bbcode['text_option'];
document.getElementById("_content").innerHTML += ' ' + bbcode['text_content'];
//-----------------------------------------
// Using option?
//-----------------------------------------
if ( parseInt( bbcode['use_option'] ) == 1 )
{
document.getElementById( 'use-option' ).style.display = '';
}
//-----------------------------------------
// Set up initial text value
//-----------------------------------------
document.getElementById("f_content_text").value = parent.IPS_editor[ editor_id ].strip_empty_html( current_selection );
}
/*-------------------------------------------------------------------------*/
// Do cancel
/*-------------------------------------------------------------------------*/
function do_cancel()
{
parent.IPS_editor[ editor_id ].module_remove_control_bar();
return false;
}
/*-------------------------------------------------------------------------*/
// Do submit (low tech)
/*-------------------------------------------------------------------------*/
function do_submit()
{
var fields = [ "f_option_text", "f_content_text" ];
var param = new Object();
//-----------------------------------------
// Compile data
//-----------------------------------------
for ( var i in fields )
{
param[ fields[i] ] = document.getElementById( fields[i] ).value;
}
//-----------------------------------------
// Set up required fields
//-----------------------------------------
var required = {
"f_option_text" : "You must enter option text",
"f_content_text": "You must enter content text"
};
for (var i in required)
{
var el = document.getElementById(i);
if ( i == 'f_option_text' )
{
if ( parseInt( bbcode['use_option'] ) != 1 )
{
continue;
}
}
if ( ! el.value )
{
alert( required[i] );
el.focus();
return false;
}
}
//-----------------------------------------
// Now prep the table
//-----------------------------------------
var _html = '';
var _content = document.getElementById( 'f_content_text' ).value;
var _option = document.getElementById( 'f_option_text' ).value;
if ( parseInt( bbcode['use_option'] ) == 1 )
{
if ( parseInt( bbcode['switch_option'] ) == 1 )
{
_html = '[' + bbcode['tag'] + '="' + _content + '"]' + _option + '[/' + bbcode['tag'] + ']';
}
else
{
_html = '[' + bbcode['tag'] + '="' + _option + '"]' + _content + '[/' + bbcode['tag'] + ']';
}
}
else
{
_html = '[' + bbcode['tag'] + ']' + _content + '[/' + bbcode['tag'] + ']';
}
//-----------------------------------------
// Is this RTE?
//-----------------------------------------
if ( parent.IPS_editor[ editor_id ].is_rte )
{
_html = _html.replace( /(\n|\r|<br>|<br \/>)/g, "<br />" );
}
//-----------------------------------------
// Return..
//-----------------------------------------
parent.IPS_editor[ editor_id].editor_check_focus();
parent.IPS_editor[ editor_id ].insert_text( _html );
//-----------------------------------------
// Kill Window
//-----------------------------------------
do_cancel();
return false;
}
//-->
</script>
<style type='text/css' media="all">
@import url(rte_popup.css);
</style>
</head>
<body onload="Init()">
<div class="title" id="_title">Insert</div>
<fieldset style="margin-left: 5px;">
<legend><strong>Example</strong></legend>
<div id="_example" style='font-family:"Courier New", Monaco, Courier;font-size:12px'></div>
</fieldset>
<br />
<form action="" method="get">
<div id='use-option' style='display:none'>
<fieldset style="margin-left: 5px;">
<legend><strong>Option Text</strong></legend>
<div id='_option' style='padding:2px;color:#555;'></div>
<table border="0" width='100%' style="padding: 0px; margin: 0px">
<tbody>
<tr>
<td><textarea name="text" id="f_option_text" style='width:100%;height:70px' cols='23' rows='4'></textarea></td>
</tr>
</tbody>
</table>
</fieldset>
<br />
</div>
<fieldset style="margin-left: 5px;">
<legend><strong>Content Text</strong></legend>
<div id='_content' style='padding:2px;color:#555;'></div>
<table border="0" width='100%' style="padding: 0px; margin: 0px">
<tbody>
<tr>
<td><textarea name="href" id="f_content_text" style='width:100%;height:60px' cols='23' onfocus='this.select()' rows='4'></textarea></td>
</tr>
</tbody>
</table>
</fieldset>
<br />
<div style="text-align: center;">
<hr />
<button type="button" class='tblbutton' name="ok" onclick="return do_submit();">OK</button>
<button type="button" class='tblbutton' name="cancel" onclick="return do_cancel();">Cancel</button>
</div>
</form>
</body>
</html>
@@ -0,0 +1,264 @@
<html>
<head>
<title>Insert Div/Span</title>
<script type="text/javascript">
<!--
//-----------------------------------------
// Attempt to get editor ID
//-----------------------------------------
var editor_id = <?php print '"'.trim( htmlspecialchars( substr( $_REQUEST['editorid'], 0, 30 ) ) ).'";'; ?>
var this_module = 'div';
var this_height = 400;
/*-------------------------------------------------------------------------*/
// INIT
/*-------------------------------------------------------------------------*/
function Init()
{
//-----------------------------------------
// Set up main close button
//-----------------------------------------
parent.document.getElementById( editor_id + '_cb-close-window' ).onclick = do_cancel;
parent.document.getElementById( editor_id + '_cb-close-window' ).style.cursor = 'pointer';
//-----------------------------------------
// Resize window
//-----------------------------------------
parent.document.getElementById( editor_id + '_htmlblock_' + this_module + '_menu' ).style.height = this_height + 'px';
parent.document.getElementById( editor_id + '_iframeblock_' + this_module + '_menu' ).style.height = ( this_height - 10 ) + 'px';
//-----------------------------------------
// Module specific stuff
//-----------------------------------------
document.getElementById("f_type").focus();
}
/*-------------------------------------------------------------------------*/
// Do cancel
/*-------------------------------------------------------------------------*/
function do_cancel()
{
parent.IPS_editor[ editor_id ].module_remove_control_bar();
return false;
}
/*-------------------------------------------------------------------------*/
// Do submit (low tech)
/*-------------------------------------------------------------------------*/
function do_submit()
{
var fields = [ "f_type" , "f_fontfamily" , "f_fontsize", "f_color" , "f_backgroundimage", "f_backgroundrepeat",
"f_backgroundcolor", "f_border" , "f_padding", "f_margin" , "f_other" ];
var param = new Object();
//-----------------------------------------
// Compile data
//-----------------------------------------
for ( var i in fields )
{
param[ fields[i] ] = document.getElementById( fields[i] ).value;
}
//-----------------------------------------
// Now prep the table
//-----------------------------------------
var doc = parent.IPS_editor[ editor_id ].editor_document;
//-------------------------------
// Build remap array
//-------------------------------
var remap_elements = {
"f_fontfamily" : "font-family" ,
"f_fontsize" : "font-size" ,
"f_color" : "color" ,
"f_backgroundimage" : "background-image" ,
"f_backgroundrepeat" : "background-repeat",
"f_backgroundcolor" : "background-color" ,
"f_border" : "border" ,
"f_padding" : "padding" ,
"f_margin" : "margin"
};
//-------------------------------
// Get tag type
//-------------------------------
var tagtype = param["f_type"];
var style = "";
//-------------------------------
// Start building style
//-------------------------------
style += "style='";
for (var field in param)
{
var value = param[field];
if ( ! value || value == 'undefined' || field == 'undefined' || ! remap_elements[ field ] )
{
continue;
}
if ( remap_elements[ field ] && value )
{
style += remap_elements[ field ] + ":" + value + ";";
}
}
//-------------------------------
// Finish style
//-------------------------------
style += param["f_other"]+"'";
//-----------------------------------------
// Return..
//-----------------------------------------
parent.IPS_editor[ editor_id].editor_check_focus();
if ( style )
{
parent.IPS_editor[ editor_id ].wrap_tags_lite( '<' + tagtype + ' ' + style + '>', '</' + tagtype + '>' );
}
else
{
parent.IPS_editor[ editor_id ].wrap_tags_lite( '<' + tagtype + '>', '</' + tagtype + '>' );
}
//-----------------------------------------
// Kill Window
//-----------------------------------------
do_cancel();
return false;
}
//-->
</script>
<style type='text/css' media="all">
@import url(rte_popup.css);
</style>
</head>
<body onload="Init()">
<div class="title">Insert DIV/SPAN</div>
<form action="" method="get">
<table border="0" width='100%' style="padding: 0px; margin: 0px">
<tbody>
<tr>
<td width="1%" nowrap="nowrap">Type:</td>
<td width="99%"><select size="1" name="type" id="f_type" title="Div or Span?">
<option value="div" selected="1" >DIV</option>
<option value="span" >SPAN</option>
</select>
</td>
</tr>
</tbody>
</table>
<br />
<fieldset style="margin-left: 5px;">
<legend>Font</legend>
<table border="0" width='100%' style="padding: 0px; margin: 0px">
<tbody>
<tr>
<td>Family:</td>
<td><input type="text" name="fontfamily" id="f_fontfamily" size="20" value="Verdana" title="Enter name of font-family" /></td>
</tr>
<tr>
<td>Size:</td>
<td><input type="text" name="fontsize" id="f_fontsize" size="7" value="10px" title="Enter size and unit" /></td>
</tr>
<tr>
<td>Color:</td>
<td><input type="text" name="color" id="f_color" size="7" value="#000" title="Enter color" /></td>
</tr>
</tbody>
</table>
</fieldset>
<br />
<fieldset style="margin-left: 5px;">
<legend>Background</legend>
<table border="0" width='100%' style="padding: 0px; margin: 0px">
<tbody>
<tr>
<td>Image:</td>
<td><input type="text" name="backgroundimage" id="f_backgroundimage" size="15" value="" title="Leave blank for no image" /></td>
</tr>
<tr>
<td>Repeat:</td>
<td><input type="text" name="backgroundrepeat" id="f_backgroundrepeat" size="15" value="" title="Leave blank for no repeat" /></td>
</tr>
<tr>
<td>Color:</td>
<td><input type="text" name="backgroundcolor" id="f_backgroundcolor" size="7" value="" title="Leave blank for no color" /></td>
</tr>
</tbody>
</table>
</fieldset>
<br />
<fieldset style="margin-left: 5px;">
<legend>Box Model</legend>
<table border="0" width='100%' style="padding: 0px; margin: 0px">
<tbody>
<tr>
<td>Border:</td>
<td><input type="text" name="border" id="f_border" size="20" value="" title="Enter border values" /></td>
</tr>
<tr>
<td>Padding:</td>
<td><input type="text" name="padding" id="f_padding" size="20" value="4px" title="Enter size and unit" /></td>
</tr>
<tr>
<td>Margin:</td>
<td><input type="text" name="margin" id="f_margin" size="20" value="" title="Enter size and unit" /></td>
</tr>
</tbody>
</table>
</fieldset>
<fieldset style="margin-left: 5px;">
<legend>Custom Elements</legend>
<table border="0" width='100%' style="padding: 0px; margin: 0px">
<tbody>
<tr>
<td><textarea name="other" id="f_other" style='width:100%;height:70px' cols='23' rows='4'></textarea></td>
</tr>
</tbody>
</table>
</fieldset>
<div style="text-align: center;">
<hr />
<button type="button" class='tblbutton' name="ok" onclick="return do_submit();">OK</button>
<button type="button" class='tblbutton' name="cancel" onclick="return do_cancel();">Cancel</button>
</div>
</form>
</body>
</html>
@@ -0,0 +1,208 @@
<html>
<head>
<title>Insert Div/Span</title>
<script type="text/javascript">
<!--
//-----------------------------------------
// Attempt to get editor ID
//-----------------------------------------
var editor_id = <?php print '"'.trim( htmlspecialchars( substr( $_REQUEST['editorid'], 0, 30 ) ) ).'";'; ?>
var this_module = 'email';
var this_height = 300;
var allow_advanced = null;
var current_selection = null;
/*-------------------------------------------------------------------------*/
// INIT
/*-------------------------------------------------------------------------*/
function Init()
{
var allow_advanced = parent.IPS_editor[ editor_id ].allow_advanced;
var current_selection = parent.IPS_editor[ editor_id ].get_selection();
//-----------------------------------------
// Set up main close button
//-----------------------------------------
parent.document.getElementById( editor_id + '_cb-close-window' ).onclick = do_cancel;
parent.document.getElementById( editor_id + '_cb-close-window' ).style.cursor = 'pointer';
//-----------------------------------------
// Resize window
//-----------------------------------------
parent.document.getElementById( editor_id + '_htmlblock_' + this_module + '_menu' ).style.height = this_height + 'px';
parent.document.getElementById( editor_id + '_iframeblock_' + this_module + '_menu' ).style.height = ( this_height - 10 ) + 'px';
//-----------------------------------------
// Module specific stuff
//-----------------------------------------
document.getElementById("f_email").focus();
//-----------------------------------------
// Set up initial text value
//-----------------------------------------
var link_regex = '';
var link_text = '';
var link_href = '';
if ( parent.IPS_editor[ editor_id ].use_bbcode && ! parent.IPS_editor[ editor_id ].is_rte )
{
link_regex = new RegExp( "\[email=([^\]]+?)\]([^\[]+?)\[/email\]", "i" );
}
else
{
link_regex = new RegExp( "<a href=['\"]mailto\:([^\"']+?)['\"]([^>]+?)?>(.+?)</a>", "i" );
}
if ( current_selection.match( link_regex ) )
{
link_href = current_selection.replace( link_regex, "$1" );
link_text = current_selection.replace( link_regex, "$3" );
}
if ( link_text )
{
current_selection = link_text;
}
if ( link_href )
{
document.getElementById("f_email").value = link_href;
}
document.getElementById("f_text").value = parent.IPS_editor[ editor_id ].strip_empty_html( current_selection );
}
/*-------------------------------------------------------------------------*/
// Do cancel
/*-------------------------------------------------------------------------*/
function do_cancel()
{
parent.IPS_editor[ editor_id ].module_remove_control_bar();
return false;
}
/*-------------------------------------------------------------------------*/
// Do submit (low tech)
/*-------------------------------------------------------------------------*/
function do_submit()
{
var fields = [ "f_email", "f_text" ];
var param = new Object();
//-----------------------------------------
// Compile data
//-----------------------------------------
for ( var i in fields )
{
param[ fields[i] ] = document.getElementById( fields[i] ).value;
}
//-----------------------------------------
// Set up required fields
//-----------------------------------------
var required = {
"f_email": "You must enter an email address",
"f_text": "You must enter some text for the email body"
};
for (var i in required)
{
var el = document.getElementById(i);
if ( ! el.value )
{
alert(required[i]);
el.focus();
return false;
}
}
var link_html = '';
if ( parent.IPS_editor[ editor_id ].use_bbcode && ! parent.IPS_editor[ editor_id ].is_rte )
{
link_html = '[email=' + param['f_email'] + ']' + param['f_text'] + '[/email]';
}
else
{
link_html = '<a href="mailto:' + param['f_email'] + '">' + param['f_text'] + '</a>';
}
//-----------------------------------------
// Return..
//-----------------------------------------
parent.IPS_editor[ editor_id].editor_check_focus();
parent.IPS_editor[ editor_id ].insert_text( link_html );
//-----------------------------------------
// Kill Window
//-----------------------------------------
do_cancel();
return false;
}
//-->
</script>
<style type='text/css' media="all">
@import url(rte_popup.css);
</style>
</head>
<body onload="Init()">
<div class="title">Insert Email</div>
<form action="" method="get">
<fieldset style="margin-left: 5px;">
<legend>Email Address</legend>
<table border="0" width='100%' style="padding: 0px; margin: 0px">
<tbody>
<tr>
<td><textarea name="email" id="f_email" style='width:100%;height:60px' cols='23' onfocus='this.select()' rows='4'>user@domain.com</textarea></td>
</tr>
</tbody>
</table>
</fieldset>
<br />
<fieldset style="margin-left: 5px;">
<legend>Email Text</legend>
<table border="0" width='100%' style="padding: 0px; margin: 0px">
<tbody>
<tr>
<td><textarea name="text" id="f_text" style='width:100%;height:70px' cols='23' rows='4'></textarea></td>
</tr>
</tbody>
</table>
</fieldset>
<br />
<div style="text-align: center;">
<hr />
<button type="button" class='tblbutton' name="ok" onclick="return do_submit();">OK</button>
<button type="button" class='tblbutton' name="cancel" onclick="return do_cancel();">Cancel</button>
</div>
</form>
</body>
</html>
@@ -0,0 +1,231 @@
<html>
<head>
<title>Insert Div/Span</title>
<script type="text/javascript">
<!--
//-----------------------------------------
// Attempt to get editor ID
//-----------------------------------------
var editor_id = <?php print '"'.trim( htmlspecialchars( substr( $_REQUEST['editorid'], 0, 30 ) ) ).'";'; ?>
var this_module = 'image';
var this_height = 400;
var allow_advanced = null;
var current_selection = null;
/*-------------------------------------------------------------------------*/
// INIT
/*-------------------------------------------------------------------------*/
function Init()
{
var allow_advanced = parent.IPS_editor[ editor_id ].allow_advanced;
var current_selection = parent.IPS_editor[ editor_id ].get_selection();
//-----------------------------------------
// Set up main close button
//-----------------------------------------
parent.document.getElementById( editor_id + '_cb-close-window' ).onclick = do_cancel;
parent.document.getElementById( editor_id + '_cb-close-window' ).style.cursor = 'pointer';
//-----------------------------------------
// Resize window
//-----------------------------------------
parent.document.getElementById( editor_id + '_htmlblock_' + this_module + '_menu' ).style.height = this_height + 'px';
parent.document.getElementById( editor_id + '_iframeblock_' + this_module + '_menu' ).style.height = ( this_height - 10 ) + 'px';
//-----------------------------------------
// Module specific stuff
//-----------------------------------------
document.getElementById("f_src").focus();
//-----------------------------------------
// Show advanced options?
//-----------------------------------------
if ( allow_advanced )
{
document.getElementById("advanced-options").style.display = '';
}
//-----------------------------------------
// Set up initial text value
//-----------------------------------------
var link_regex = '';
var link_src = '';
if ( parent.IPS_editor[ editor_id ].use_bbcode && ! parent.IPS_editor[ editor_id ].is_rte )
{
link_regex = new RegExp( "\[img\]([^\[]+?)\[/img\]", "i" );
}
else
{
link_regex = new RegExp( "<img src=['\"]([^\"']+?)['\"]([^>]+?)?/>", "i" );
}
if ( current_selection.match( link_regex ) )
{
link_src = current_selection.replace( link_regex, "$1" );
}
if ( link_src )
{
current_selection = link_src;
}
document.getElementById("f_src").value = parent.IPS_editor[ editor_id ].strip_empty_html( current_selection );
}
/*-------------------------------------------------------------------------*/
// Do cancel
/*-------------------------------------------------------------------------*/
function do_cancel()
{
parent.IPS_editor[ editor_id ].module_remove_control_bar();
return false;
}
/*-------------------------------------------------------------------------*/
// Do submit (low tech)
/*-------------------------------------------------------------------------*/
function do_submit()
{
var fields = [ "f_src", "f_ad_title", "f_ad_alt" ];
var param = new Object();
//-----------------------------------------
// Compile data
//-----------------------------------------
for ( var i in fields )
{
param[ fields[i] ] = document.getElementById( fields[i] ).value;
}
//-----------------------------------------
// Set up required fields
//-----------------------------------------
var required = {
"f_src": "You must enter an image location"
};
for (var i in required)
{
var el = document.getElementById(i);
if ( ! el.value )
{
alert(required[i]);
el.focus();
return false;
}
}
//-----------------------------------------
// Now prep the table
//-----------------------------------------
var link_title = allow_advanced && param['f_ad_title'] != '' ? ' title="' + param['f_ad_title'] + '"' : '';
var link_alt = allow_advanced && param['f_ad_alt'] != '' ? ' alt="' + param['f_ad_alt'] + '"' : '';
var link_border = allow_advanced && param['f_ad_border'] != '' ? ' border="' + param['f_ad_border'] + '"' : '';
var link_html = '';
if ( parent.IPS_editor[ editor_id ].use_bbcode && ! parent.IPS_editor[ editor_id ].is_rte )
{
link_html = '[img]' + param['f_src'] + '[/img]';
}
else
{
link_html = '<img src="' + param['f_src'] + '"' + link_title + link_alt + link_border + ' />';
}
//-----------------------------------------
// Return..
//-----------------------------------------
parent.IPS_editor[ editor_id].editor_check_focus();
parent.IPS_editor[ editor_id ].insert_text( link_html );
//-----------------------------------------
// Kill Window
//-----------------------------------------
do_cancel();
return false;
}
//-->
</script>
<style type='text/css' media="all">
@import url(rte_popup.css);
</style>
</head>
<body onload="Init()">
<div class="title">Insert Image</div>
<form action="" method="get">
<fieldset style="margin-left: 5px;">
<legend>Image Location</legend>
<table border="0" width='100%' style="padding: 0px; margin: 0px">
<tbody>
<tr>
<td><textarea name="src" id="f_src" style='width:100%;height:60px' cols='23' onfocus='this.select()' rows='4'>http://</textarea></td>
</tr>
</tbody>
</table>
</fieldset>
<div id='advanced-options' style='display:none'>
<br />
<fieldset style="margin-left: 5px;">
<legend>Advanced Options</legend>
<table border="0" width='100%' style="padding: 0px; margin: 0px">
<tbody>
<tr>
<td>Border:</td>
<td><input type="text" name="border" id="f_ad_border" size="4" value="0" title="Image Border" /></td>
</tr>
<tr>
<td>Title:</td>
<td><input type="text" name="title" id="f_ad_title" size="20" value="" title="Image Title" /></td>
</tr>
<tr>
<td>Alt Text:</td>
<td><input type="text" name="fontsize" id="f_ad_alt" size="20" value="" title="Image ALT" /></td>
</tr>
</tbody>
</table>
</fieldset>
</div>
<br />
<div style="text-align: center;">
<hr />
<button type="button" class='tblbutton' name="ok" onclick="return do_submit();">OK</button>
<button type="button" class='tblbutton' name="cancel" onclick="return do_cancel();">Cancel</button>
</div>
</form>
</body>
</html>
@@ -0,0 +1,260 @@
<html>
<head>
<title>Insert Div/Span</title>
<script type="text/javascript">
<!--
//-----------------------------------------
// Attempt to get editor ID
//-----------------------------------------
var editor_id = <?php print '"'.trim( htmlspecialchars( substr( $_REQUEST['editorid'], 0, 30 ) ) ).'";'; ?>
var this_module = 'link';
var this_height = 400;
var allow_advanced = null;
var current_selection = null;
/*-------------------------------------------------------------------------*/
// INIT
/*-------------------------------------------------------------------------*/
function Init()
{
var allow_advanced = parent.IPS_editor[ editor_id ].allow_advanced;
var current_selection = parent.ipsclass.un_htmlspecialchars( parent.IPS_editor[ editor_id ].get_selection() );
//-----------------------------------------
// Set up main close button
//-----------------------------------------
parent.document.getElementById( editor_id + '_cb-close-window' ).onclick = do_cancel;
parent.document.getElementById( editor_id + '_cb-close-window' ).style.cursor = 'pointer';
//-----------------------------------------
// Resize window
//-----------------------------------------
parent.document.getElementById( editor_id + '_htmlblock_' + this_module + '_menu' ).style.height = this_height + 'px';
parent.document.getElementById( editor_id + '_iframeblock_' + this_module + '_menu' ).style.height = ( this_height - 10 ) + 'px';
//-----------------------------------------
// Module specific stuff
//-----------------------------------------
document.getElementById("f_href").focus();
//-----------------------------------------
// Set up initial text value
//-----------------------------------------
document.getElementById("f_text").value = current_selection;
//-----------------------------------------
// Show advanced options?
//-----------------------------------------
if ( allow_advanced )
{
document.getElementById("advanced-options").style.display = '';
}
//-----------------------------------------
// Set up initial text value
//-----------------------------------------
var link_regex = '';
var link_text = '';
var link_href = '';
if ( parent.IPS_editor[ editor_id ].use_bbcode && ! parent.IPS_editor[ editor_id ].is_rte )
{
link_regex = /\[url=([^\]]+?)\]([^\[]+?)\[\/url\]/ig;
if ( current_selection.match( link_regex ) )
{
link_href = current_selection.replace( link_regex, "$1" );
link_text = current_selection.replace( link_regex, "$2" );
}
}
else
{
link_regex = /<a href=['"]([^"']+?)['"]([^>]+?)?>(.+?)<\/a>/ig;
if ( current_selection.match( link_regex ) )
{
link_href = current_selection.replace( link_regex, "$1" );
link_text = current_selection.replace( link_regex, "$3" );
}
}
if ( link_text )
{
current_selection = link_text;
}
if ( link_href )
{
document.getElementById("f_href").value = link_href;
}
current_selection = current_selection.replace( /<br \/>|<br>|\n|\r/g, "");
document.getElementById("f_text").value = parent.IPS_editor[ editor_id ].strip_empty_html( current_selection );
}
/*-------------------------------------------------------------------------*/
// Do cancel
/*-------------------------------------------------------------------------*/
function do_cancel()
{
parent.IPS_editor[ editor_id ].module_remove_control_bar();
return false;
}
/*-------------------------------------------------------------------------*/
// Do submit (low tech)
/*-------------------------------------------------------------------------*/
function do_submit()
{
var fields = [ "f_href", "f_text", "f_ad_title", "f_ad_target" ];
var param = new Object();
//-----------------------------------------
// Compile data
//-----------------------------------------
for ( var i in fields )
{
param[ fields[i] ] = document.getElementById( fields[i] ).value;
}
//-----------------------------------------
// Set up required fields
//-----------------------------------------
var required = {
"f_href": "You must enter a link location",
"f_text": "You must enter some text for the link body"
};
for (var i in required)
{
var el = document.getElementById(i);
if ( ! el.value )
{
alert(required[i]);
el.focus();
return false;
}
}
//-----------------------------------------
// Now prep the table
//-----------------------------------------
var link_title = allow_advanced && param['f_ad_title'] ? ' title="' + param['f_ad_title'] + '" ' : '';
var link_target = allow_advanced && param['f_ad_target'] ? ' target="' + param['f_ad_target'] + '"' : '';
var link_html = '';
if ( parent.IPS_editor[ editor_id ].use_bbcode && ! parent.IPS_editor[ editor_id ].is_rte )
{
link_html = '[url=' + param['f_href'] + ']' + param['f_text'] + '[/url]';
}
else
{
link_html = '<a href="' + param['f_href'] + '"' + link_title + link_target + '>' + param['f_text'] + '</a>';
}
//-----------------------------------------
// Return..
//-----------------------------------------
parent.IPS_editor[ editor_id].editor_check_focus();
parent.IPS_editor[ editor_id ].insert_text( link_html );
//-----------------------------------------
// Kill Window
//-----------------------------------------
do_cancel();
return false;
}
//-->
</script>
<style type='text/css' media="all">
@import url(rte_popup.css);
</style>
</head>
<body onload="Init()">
<div class="title">Insert Link</div>
<form action="" method="get">
<fieldset style="margin-left: 5px;">
<legend>Link Location</legend>
<table border="0" width='100%' style="padding: 0px; margin: 0px">
<tbody>
<tr>
<td><textarea name="href" id="f_href" style='width:100%;height:60px' cols='23' onfocus='this.select()' rows='4'>http://</textarea></td>
</tr>
</tbody>
</table>
</fieldset>
<br />
<fieldset style="margin-left: 5px;">
<legend>Link Text</legend>
<table border="0" width='100%' style="padding: 0px; margin: 0px">
<tbody>
<tr>
<td><textarea name="text" id="f_text" style='width:100%;height:70px' cols='23' rows='4'></textarea></td>
</tr>
</tbody>
</table>
</fieldset>
<div id='advanced-options' style='display:none'>
<br />
<fieldset style="margin-left: 5px;">
<legend>Advanced Options</legend>
<table border="0" width='100%' style="padding: 0px; margin: 0px">
<tbody>
<tr>
<td>Title:</td>
<td><input type="text" name="title" id="f_ad_title" size="20" value="" title="Link Title" /></td>
</tr>
<tr>
<td>Target:</td>
<td><input type="text" name="fontsize" id="f_ad_target" size="20" value="" title="Link Target" /></td>
</tr>
</tbody>
</table>
</fieldset>
</div>
<br />
<div style="text-align: center;">
<hr />
<button type="button" class='tblbutton' name="ok" onclick="return do_submit();">OK</button>
<button type="button" class='tblbutton' name="cancel" onclick="return do_cancel();">Cancel</button>
</div>
</form>
</body>
</html>
@@ -0,0 +1,299 @@
<html>
<head>
<meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
<meta HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
<meta HTTP-EQUIV="Expires" CONTENT="Mon, 06 May 1996 04:57:00 GMT">
<title>Insert Table</title>
<script type="text/javascript">
<!--
//-----------------------------------------
// Attempt to get editor ID
//-----------------------------------------
var editor_id = <?php print '"'.trim( htmlspecialchars( substr( $_REQUEST['editorid'], 0, 30 ) ) ).'";'; ?>
var this_module = 'table';
var this_height = 350;
/*-------------------------------------------------------------------------*/
// INIT
/*-------------------------------------------------------------------------*/
function Init()
{
//-----------------------------------------
// Set up main close button
//-----------------------------------------
parent.document.getElementById( editor_id + '_cb-close-window' ).onclick = do_cancel;
parent.document.getElementById( editor_id + '_cb-close-window' ).style.cursor = 'pointer';
//-----------------------------------------
// Resize window
//-----------------------------------------
parent.document.getElementById( editor_id + '_htmlblock_' + this_module + '_menu' ).style.height = this_height + 'px';
parent.document.getElementById( editor_id + '_iframeblock_' + this_module + '_menu' ).style.height = ( this_height - 10 ) + 'px';
//-----------------------------------------
// Module specific stuff
//-----------------------------------------
document.getElementById("f_rows").focus();
}
/*-------------------------------------------------------------------------*/
// Do cancel
/*-------------------------------------------------------------------------*/
function do_cancel()
{
parent.IPS_editor[ editor_id ].module_remove_control_bar();
return false;
}
/*-------------------------------------------------------------------------*/
// Do submit (low tech)
/*-------------------------------------------------------------------------*/
function do_submit()
{
//-----------------------------------------
// Fail safe
//-----------------------------------------
if ( ! editor_id )
{
alert("Could not locate the editor ID");
return false;
}
//-----------------------------------------
// Set up required fields
//-----------------------------------------
var required = {
"f_rows": "You must enter a number of rows",
"f_cols": "You must enter a number of columns"
};
for (var i in required)
{
var el = document.getElementById(i);
if ( ! el.value )
{
alert(required[i]);
el.focus();
return false;
}
}
var fields = ["f_rows" , "f_cols" , "f_width" , "f_unit",
"f_align", "f_border", "f_spacing", "f_padding"];
var param = new Object();
//-----------------------------------------
// Compile data
//-----------------------------------------
for ( var i in fields )
{
param[ fields[i] ] = document.getElementById( fields[i] ).value;
}
//-----------------------------------------
// Now prep the table
//-----------------------------------------
var doc = parent.IPS_editor[ editor_id ].editor_document;
//-----------------------------------------
// create the table element inside a wrapper
// div that we can use innerHTML on
//-----------------------------------------
var wrap_div = document.createElement("DIV");
var table = document.createElement("table");
wrap_div.appendChild( table );
//-----------------------------------------
// assign the given arguments
//-----------------------------------------
for (var field in param)
{
var value = param[field];
if ( ! value )
{
continue;
}
switch (field)
{
case "f_width" : table.style.width = value + param["f_unit"]; break;
case "f_align" : table.align = value; break;
case "f_border" : table.border = parseInt(value); break;
case "f_spacing" : table.cellspacing = parseInt(value); break;
case "f_padding" : table.cellpadding = parseInt(value); break;
}
}
var tbody = document.createElement("tbody");
table.appendChild(tbody);
for (var i = 0; i < param["f_rows"]; ++i)
{
var tr = document.createElement("tr");
tbody.appendChild(tr);
for (var j = 0; j < param["f_cols"]; ++j)
{
var td = document.createElement("td");
tr.appendChild(td);
//-------------------------------
// Mozilla likes to see something
// inside the cell.
//-------------------------------
( ! parent.IPS_editor[ editor_id ].is_ie )
{
td.appendChild( document.createElement("br") );
}
}
}
//-----------------------------------------
// Clean up
//-----------------------------------------
wrap_div.innerHTML = parent.IPS_editor[ editor_id ].clean_html( wrap_div.innerHTML );
//-----------------------------------------
// Return..
//-----------------------------------------
parent.IPS_editor[ editor_id].editor_check_focus();
parent.IPS_editor[ editor_id ].insert_text( wrap_div.innerHTML );
//-----------------------------------------
// Kill node
//-----------------------------------------
//doc.removeChild( wrap_div );
//-----------------------------------------
// Kill Window
//-----------------------------------------
do_cancel();
}
//-->
</script>
<style type='text/css' media="all">
@import url(rte_popup.css);
</style>
</head>
<body onload="Init()">
<div class="title">Insert Table</div>
<form action="" method="get">
<fieldset style="margin-left: 5px;">
<legend>Basics</legend>
<table border="0" width='100%' style="padding: 0px; margin: 0px">
<tbody>
<tr>
<td>Rows:</td>
<td><input type="text" name="rows" id="f_rows" size="5" title="Number of rows" value="2" /></td>
</tr>
<tr>
<td>Cols:</td>
<td><input type="text" name="cols" id="f_cols" size="5" title="Number of columns" value="4" /></td>
</tr>
<tr>
<td>Width:</td>
<td><input type="text" name="width" id="f_width" size="5" title="Width of the table" value="100" />
<select size="1" name="unit" id="f_unit" title="Width unit">
<option value="%" selected="1" >Percent</option>
<option value="px" >Pixels</option>
<option value="em" >Em</option>
</select>
</td>
</tr>
</tbody>
</table>
</fieldset>
<br />
<fieldset style="margin-left: 5px;">
<legend>Layout</legend>
<table border="0" width='100%' >
<tbody>
<tr>
<td>Alignment:</td>
<td>
<select size="1" name="align" id="f_align"
title="Positioning of this image">
<option value="" selected="1" >Not set</option>
<option value="left" >Left</option>
<option value="right" >Right</option>
<option value="texttop" >Texttop</option>
<option value="absmiddle" >Absmiddle</option>
<option value="baseline" >Baseline</option>
<option value="absbottom" >Absbottom</option>
<option value="bottom" >Bottom</option>
<option value="middle" >Middle</option>
<option value="top" >Top</option>
</select>
</td>
</tr>
</tbody>
</table>
</fieldset>
<br />
<fieldset style="margin-left: 5px;">
<legend>Spacing</legend>
<table border="0" width='100%' style="padding: 0px; margin: 0px">
<tbody>
<tr>
<td>Cell Spacing:</td>
<td><input type="text" name="cols" id="f_spacing" size="5" title="Cell Spacing" value="0" /></td>
</tr>
<tr>
<td>Cell Padding:</td>
<td><input type="text" name="cols" id="f_padding" size="5" title="Cell Padding" value="0" /></td>
</tr>
<tr>
<td>Border thickness:</td>
<td><input type="text" name="border" id="f_border" size="5" value="1" title="Leave empty for no border" />
</td>
</tr>
</tbody>
</table>
</fieldset>
<hr />
<div align='center'>
<button type="button" class='tblbutton' name="ok" onclick="return do_submit();">OK</button>
<button type="button" class='tblbutton' name="cancel" onclick="return do_cancel();">Cancel</button>
</div>
</form>
</body>
</html>
@@ -0,0 +1,143 @@
//------------------------------------------------------------------------------
// IPS Cross-Browser Global Text Editor HTML
//------------------------------------------------------------------------------
// Supports all "v5" browsers (inc. Opera, Safari, etc)
// Used for non RTE applications.
// (c) 2005 Invision Power Services, Inc.
// http://www.invisionpower.com
//------------------------------------------------------------------------------
/**
* Rich Text Editor HTML Functions
*/
function rte_html_functions()
{
/**
* Main control bar object
* @var object Main control bar object
*/
this.control_obj = false;
/**
* Editor ID
*/
this.editor_id = false;
/**
* Current open bar object
*/
this.current_bar_object = null;
/**
* Main init function
* Nothing much to do
*/
this.init = function()
{
}
/**
* Show new control bar
*
* @param type Type of control bar (must be same as function key)
*/
this.show_control_bar = function( type )
{
if ( ! this.control_obj )
{
return;
}
//-----------------------------------------
// Already open? Kill it
//-----------------------------------------
if ( this.current_bar_object )
{
this.remove_control_bar();
}
var mainbar = document.getElementById( 'rte-main-bar');
var addtobar = document.getElementById( 'rte-hidden-items' );
//-----------------------------------------
// Spawn new DIV object
//-----------------------------------------
var newdiv = document.createElement('div');
newdiv.id = this.editor_id + '_htmlblock_' + type + '_menu';
newdiv.style.display = '';
newdiv.className = 'rte-buttonbar';
newdiv.style.zIndex = parseInt( this.control_obj.style.zIndex ) + 1;
newdiv.style.position = 'absolute';
newdiv.style.width = '220px';
newdiv.style.height = '400px';
newdiv.style.top = ipsclass.get_obj_toppos( mainbar ) + 'px';
newdiv.style.left = ipsclass.get_obj_leftpos( mainbar ) - ( parseInt(newdiv.style.width) + 10 ) + 'px';
var tmpheight = parseInt(newdiv.style.height) - 15;
newdiv.innerHTML = this.wrap_html_panel( "<iframe id='"+ this.editor_id + '_iframeblock_' + type + '_menu' + "' src='"+global_rte_includes_url + "insert_" + type + ".php?editorid="+this.editor_id+"' style='background-color:transparent;border:0px;overflow:auto;width:99%;height:" + tmpheight + "px'></iframe>" );
//-----------------------------------------
// Add and show
//-----------------------------------------
addtobar.appendChild(newdiv);
ipsclass.set_unselectable( newdiv );
//-----------------------------------------
// INIT Drag
//-----------------------------------------
var phdl = document.getElementById('rte-pallete-handle');
Drag.init( phdl, newdiv );
this.current_bar_object = newdiv;
}
/**
* Remove control bar
* Removes the control bar.
*/
this.remove_control_bar = function()
{
if ( ! this.current_bar_object )
{
return;
}
var addtobar = document.getElementById( 'rte-hidden-items' );
//-----------------------------------------
// Kill old bar
//-----------------------------------------
addtobar.removeChild( this.current_bar_object );
//-----------------------------------------
// Reset bar object
//-----------------------------------------
this.current_bar_object = null;
}
/**
* Wrap HTML block with basic control panel stuff
*/
this.wrap_html_panel = function( html )
{
var newhtml = "";
newhtml += " <div id='rte-pallete-wrap'>";
newhtml += " <div id='rte-pallete-main'>";
newhtml += " <div class='rte-cb-bg' id='rte-pallete-handle'>";
newhtml += " <div align='left'><img id='rte-cb-close-window' src='"+global_rte_images_url+"rte-cb-close.gif' alt='' class='ipd' border='0' /></div>";
newhtml += " </div>";
newhtml += " <div>" + html + "</div>";
newhtml += " </div>";
newhtml += " </div>";
return newhtml;
}
}
@@ -0,0 +1,81 @@
html, body
{
color: #000;
font: 10px Verdana,sans-serif;
background-color: transparent;
margin: 0px;
padding: 0px;
}
body
{
padding: 5px;
}
table
{
font: 10px Verdana,sans-serif;
}
.tblbutton
{
border:1px solid #999;
background-color: #CCC;
font-family:Verdana, Arial;
font-size:10px;
font-weight:bold;
padding:2px;
}
form p
{
margin-top: 5px;
margin-bottom: 5px;
}
.fl
{
width: 9em; float: left; padding: 2px 5px; text-align: right;
}
.fr
{
width: 7em; float: left; padding: 2px 5px; text-align: right;
}
.frlarge
{
width: 10em; float: left; padding: 2px 5px; text-align: right;
}
fieldset
{
padding: 0px 10px 5px 5px;
}
select, input, button
{
font: 10px Verdana,sans-serif;
}
button
{
width: 70px;
}
.space
{
padding: 2px;
}
.title
{
color: #000;
font-weight: bold;
font-size: 120%;
padding: 3px 10px;
margin-bottom: 10px;
border-bottom: 1px solid black;
letter-spacing: 2px;
}
form
{
padding: 0px; margin: 0px;
}
@@ -0,0 +1 @@
<html>␍<head><title>Invision Power Board - Bulletin Board System</title></head>␍<body>␍<h1>403: Invision Power Board -> Forbidden</h1>␍<hr>␍You have reached this Page in error, please use␍your back button to return to Invision Board.␍<hr>␍<a href="http://anonym.to/http://www.invisionboard.com/">Invision Power Board</a>␍</body>␍</html>␍
@@ -0,0 +1,15 @@
//------------------------------------------
// Invision Power Board v2.1
// Boards JS File
// (c) 2005 Invision Power Services, Inc.
//
// http://www.invisionboard.com
//------------------------------------------
/*--------------------------------------------*/
// Send request to update marker
// NO LONGER USED
/*--------------------------------------------*/
@@ -0,0 +1,75 @@
//------------------------------------------
// Invision Power Board v2.0
// Find User JS File
// (c) 2004 Invision Power Services, Inc.
//
// http://www.invisionboard.com
//------------------------------------------
function add_to_form()
{
var name = document.finduser.username.options[document.finduser.username.selectedIndex].value;
if (separator == 'line')
{
separator = '\n';
}
if (separator == 'none')
{
separator = '';
}
if (entry == 'textarea')
{
// Where shall we put the separator?
var tbox = eval('opener.document.REPLIER.'+in_name+'.value');
var tboxSize = eval('opener.document.REPLIER.'+in_name+'.value.length');
// Remove leading spaces...
while ( tbox.slice(0,1) == " " )
{
tbox = tbox.substr(1, tboxSize - 1);
tboxSize = tboxSize;
}
// Remove trailing spaces...
while ( tbox.slice(tboxSize - 1, tboxSize) == " " )
{
tbox = tbox.substr(0, tboxSize - 1);
tboxSize = tboxSize;
}
// Do we have a leading comma?
while ( tbox.slice(0,1) == "\n" )
{
tbox = tbox.substr(1, tboxSize - 1);
tboxSize = tboxSize;
}
// Do we have a trailing comma?...
while ( tbox.slice(tboxSize - 1, tboxSize) == "\n" )
{
tbox = tbox.substr(0, tboxSize - 1);
tboxSize = tboxSize;
}
// First in box?
if ( tboxSize == 0)
{
eval('opener.document.REPLIER.'+in_name+'.value += name');
}
else
{
eval('opener.document.REPLIER.'+in_name+'.value += separator + name');
}
}
}
@@ -0,0 +1,965 @@
//------------------------------------------
// Invision Power Board v2.1
// Forums JS File
// (c) 2005 Invision Power Services, Inc.
//
// http://www.invisionboard.com
//------------------------------------------
/*--------------------------------------------*/
// INIT
/*--------------------------------------------*/
var topic_dates = {};
var topic_flags = {};
var topic_state = {};
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 _this_select_all = 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, state )
{
//----------------------------------
// 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;
if ( topic_state[ tid ] )
{
state = topic_state[ tid ];
}
if ( state == 'closed' )
{
//----------------------------------
// Can?
//----------------------------------
if ( ! perm_can_open )
{
return false;
}
//----------------------------------
// Topic is locked
//----------------------------------
if ( folders[ tid ] )
{
td_content = folders[ tid ];
}
state = 'open';
}
else
{
//----------------------------------
// Can?
//----------------------------------
if ( ! perm_can_close )
{
return false;
}
//----------------------------------
// Topic isn't locked
//----------------------------------
folders[ tid ] = td_content;
state = 'closed';
}
//-----------------------------------------
// Store state
//-----------------------------------------
topic_state[ tid ] = state;
/*--------------------------------------------*/
// 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;
td_content = returned;
document.getElementById( 'tid-folder-' + tid ).innerHTML = td_content;
};
//----------------------------------
// 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
//----------------------------------
document.getElementById( 'tid-desc-' + tid ).innerHTML = '<input id="edit-'+tid+'" maxlength="70" 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 );
}
else if( evt.keyCode == 27 )
{
if( type == 'desc' )
{
document.getElementById( 'tid-desc-' + tid ).innerHTML = desc_html[ tid ];
}
else
{
document.getElementById( 'tid-span-' + tid ).innerHTML = span_html[ tid ];
document.getElementById( 'tid-link-' + tid ).innerHTML = text_html[ tid ];
}
return false;
}
}
/*--------------------------------------------*/
// 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( ipb_var_base_url+ "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_select_all()
{
clean = new Array();
saved = new Array();
var topics_this_page = new Array();
tmp = document.modform.selectedtids.value;
if ( tmp != "" )
{
saved = tmp.split(",");
}
if( _this_select_all == 0 )
{
var the_topics = document.getElementsByTagName('input');
for ( var i = 0 ; i <= the_topics.length ; i++ )
{
var e = the_topics[i];
if ( e && (e.type == 'hidden') && (! e.disabled) )
{
var s = e.id;
var a = s.replace( /^tid_(.+?)$/, "$1" );
if ( a )
{
try
{
document.getElementById( 'ipb-topic-' + a ).src = selectedbutton;
clean[clean.length] = a;
topics_this_page[ a ] = 1;
}
catch(err)
{
}
}
}
}
document.getElementById( 'ipb-topics-all' ).src = selectedbutton;
_this_select_all = 1;
}
else
{
var the_topics = document.getElementsByTagName('input');
for ( var i = 0 ; i <= the_topics.length ; i++ )
{
var e = the_topics[i];
if ( e && (e.type == 'hidden') && (! e.disabled) )
{
var s = e.id;
var a = s.replace( /^tid_(.+?)$/, "$1" );
if ( a )
{
try
{
document.getElementById( 'ipb-topic-' + a ).src = unselectedbutton;
topics_this_page[ a ] = 1;
}
catch(err)
{
}
}
}
}
document.getElementById( 'ipb-topics-all' ).src = unselectedbutton;
_this_select_all = 0;
}
for( i = 0 ; i < saved.length; i++ )
{
if ( saved[i] != "" && topics_this_page[ saved[i] ] != 1 )
{
clean[clean.length] = saved[i];
}
}
newvalue = clean.join(',');
var oldvalue = 0;
for( var k = 0; k < clean.length; k++ )
{
if( topics_this_page[ clean[ k ] ] != 1 )
{
oldvalue++;
}
}
my_setcookie( 'modtids', newvalue, 0 );
document.modform.selectedtids.value = newvalue;
newcount = stacksize(clean);
if( oldvalue > 0 )
{
document.modform.gobutton.value = ipsclass.html_entity_decode( lang_gobutton ) + ' (' + newcount + ') (' + oldvalue + ' ' + ipsclass.html_entity_decode( lang_otherpage ) +' )';
}
else
{
document.modform.gobutton.value = ipsclass.html_entity_decode( lang_gobutton ) + ' (' + newcount + ')';
}
return false;
}
function forum_toggle_tid( tid )
{
var saved = new Array();
var clean = new Array();
var add = 1;
var _img = document.getElementById( 'ipb-topic-' + tid );
//-----------------------------------
// 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;
_img.src = selectedbutton;
}
else
{
_img.src = unselectedbutton;
}
newvalue = clean.join(',');
var topics_this_page = new Array();
var oldvalue = 0;
var the_topics = document.getElementsByTagName('input');
for ( var i = 0 ; i <= the_topics.length ; i++ )
{
var e = the_topics[i];
if ( e && (e.type == 'hidden') && (! e.disabled) )
{
var s = e.id;
var a = s.replace( /^tid_(.+?)$/, "$1" );
if ( a )
{
topics_this_page[ a ] = 1;
}
}
}
for( var k = 0; k < clean.length; k++ )
{
if ( topics_this_page[ clean[ k ] ] != 1 )
{
oldvalue++;
}
}
my_setcookie( 'modtids', newvalue, 0 );
document.modform.selectedtids.value = newvalue;
newcount = stacksize(clean);
if ( oldvalue > 0 )
{
document.modform.gobutton.value = ipsclass.html_entity_decode( lang_gobutton ) + ' (' + newcount + ') (' + oldvalue + ' ' + ipsclass.html_entity_decode( lang_otherpage ) +' )';
}
else
{
document.modform.gobutton.value = ipsclass.html_entity_decode( 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 + "&start=" + start;
}
}
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){}
var text_return = 0;
/*--------------------------------------------*/
// 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;
};
//----------------------------------
// Do nothing
//----------------------------------
text_return = xmlobj.xmlhandler.responseText;
};
xmlobj = new ajax_request();
xmlobj.onreadystatechange( do_request_function );
xmlobj.process( ipb_var_base_url + 'act=xmlout&do=mark-forum&fid='+fid+'&sf='+is_subforum );
if ( text_return == 1 )
{
return false;
}
}
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,463 @@
//------------------------------------------------------------------------------
// 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 reg_img = '';
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_myass.readystate_ready_and_ok() )
{
// Could do a little loading graphic here?
return;
}
//----------------------------------
// INIT
//----------------------------------
var html = xmlobj_myass.xmlhandler.responseText;
//----------------------------------
// Stop IE showing select boxes over
// floating div [ 1 ]
//----------------------------------
if ( is_ie )
{
html = "<iframe id='myass-shim' src='" + ipb_var_image_url + "/iframe.html' 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 [ 1 ]
//----------------------------------
if ( is_ie )
{
drag_html = myass_drag.innerHTML;
main_drag_html = "<iframe id='myass-shim-two' src='" + ipb_var_image_url + "/iframe.html' class='iframshim' scrolling='no' frameborder='0' style='position:absolute; top:0px; left:0px; right:0px; display: none;'></iframe>" + drag_html;
myass_drag.innerHTML = main_drag_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";
myass_shim_d = document.getElementById('myass-shim-two');
myass_shim_d.style.width = myass_drag.offsetWidth;
myass_shim_d.style.height = myass_drag.offsetHeight;
myass_shim_d.style.zIndex = myass_drag.style.zIndex - 1;
myass_shim_d.style.top = myass_drag.style.top;
myass_shim_d.style.left = myass_drag.style.left;
myass_shim_d.style.display = "block";
}
};
xmlobj_myass = new ajax_request();
xmlobj_myass.onreadystatechange( do_request_function );
//----------------------------------
// LOAD XML
//----------------------------------
if ( ! tab )
{
xmlobj_myass.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_myass.process( ipb_var_base_url + 'act=buddy&xml=1&tab=' + tab + '&limit=' + limit_a );
myass_content.style.width = '398px';
myass_content.style.overflow = 'auto';
myass_content.style.overflowX = 'hidden';
}
else if ( tab == 'posts' )
{
xmlobj_myass.process( ipb_var_base_url + 'act=buddy&xml=1&tab=' + tab + '&st=' + posts_st );
}
else
{
xmlobj_myass.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 );
};
/*-------------------------------------------------------------------------*/
// INIT Post GD Image
/*-------------------------------------------------------------------------*/
function init_gd_image()
{
var reg_img = document.getElementById('gd-antispam');
try
{
reg_img.style.cursor = 'pointer';
}
catch(e)
{
reg_img.style.cursor = 'hand';
};
reg_img._ready = 1;
reg_img.onclick = do_change_img;
};
function do_change_img()
{
var rc = '';
var act = 'Reg';
var code = 'image';
var reg_img = document.getElementById('gd-antispam');
if ( ! reg_img._ready )
{
return false;
}
var url = ipb_var_base_url+'act=xmlout&do=change-gd-img&img='+rc;
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;
reg_img.src = ipb_var_base_url+'act=captcha&showImage&regid='+html;
var reg_field = document.getElementById('regid');
reg_field.value = html;
reg_img._ready = 1;
};
//----------------------------------
// LOAD XML
//----------------------------------
reg_img._ready = 0;
xmlobj = new ajax_request();
xmlobj.onreadystatechange( do_request_function );
xmlobj.process( url );
}
@@ -0,0 +1,179 @@
//------------------------------------------
// Invision Power Board v2.1
// PM JS File
// (c) 2005 Invision Power Services, Inc.
//
// http://www.invisionboard.com
//------------------------------------------
//==========================================
// Check All boxes
//==========================================
function CheckAll(fmobj)
{
for (var i=0;i<fmobj.elements.length;i++)
{
var e = fmobj.elements[i];
if ((e.name != 'allbox') && (e.type=='checkbox') && (!e.disabled))
{
e.checked = fmobj.allbox.checked;
}
}
}
//==========================================
// Check all or uncheck all?
//==========================================
function CheckCheckAll(fmobj)
{
var TotalBoxes = 0;
var TotalOn = 0;
for (var i=0;i<fmobj.elements.length;i++)
{
var e = fmobj.elements[i];
if ((e.name != 'allbox') && (e.type=='checkbox'))
{
TotalBoxes++;
if (e.checked)
{
TotalOn++;
}
}
}
if (TotalBoxes==TotalOn)
{
fmobj.allbox.checked=true;
}
else
{
fmobj.allbox.checked=false;
}
}
//==========================================
// INBOX FUNCTIONS
//==========================================
var ie = document.all ? 1 : 0;
//var ns4 = document.layers ? 1 : 0;
//==========================================
// highlite
//==========================================
function hl(cb)
{
if (ie)
{
while (cb.tagName != "TR")
{
cb = cb.parentElement;
}
}
else
{
while (cb.tagName != "TD")
{
cb = cb.parentNode;
}
}
cb.className = 'row1';
}
//==========================================
// down-lite
//==========================================
function dl(cb)
{
if (ie)
{
while (cb.tagName != "TR")
{
cb = cb.parentElement;
}
}
else
{
while (cb.tagName != "TD")
{
cb = cb.parentNode;
}
}
cb.className = 'row2';
}
//==========================================
// Boxes checked?
//==========================================
function cca(cb)
{
if (cb.checked)
{
hl(cb);
}
else
{
dl(cb);
}
}
//==========================================
// Inbox check all
//==========================================
function InboxCheckAll(cb)
{
var fmobj = document.mutliact;
for (var i=0;i<fmobj.elements.length;i++)
{
var e = fmobj.elements[i];
if ((e.name != 'allbox') && (e.type=='checkbox') && (!e.disabled))
{
e.checked = fmobj.allbox.checked;
if (fmobj.allbox.checked)
{
hl(e);
}
else
{
dl(e);
}
}
}
}
function select_read()
{
var fmobj = document.mutliact;
for (var i=0;i<fmobj.elements.length;i++)
{
var e = fmobj.elements[i];
if ((e.type=='hidden') && (e.value == 1) && (! isNaN(e.name) ))
{
eval("fmobj.msgid_" + e.name + ".checked=true;");
hl(e);
}
}
}
function unselect_all()
{
var fmobj = document.mutliact;
for (var i=0;i<fmobj.elements.length;i++)
{
var e = fmobj.elements[i];
if ((e.name != 'allbox') && (e.type=='checkbox') && (!e.disabled))
{
e.checked=false;
dl(e);
}
}
}
@@ -0,0 +1,440 @@
//------------------------------------------
// Invision Power Board v2.1
// 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 this_poll_multi = '';
for ( var x in poll_multi )
{
if( x == i )
{
if( poll_multi[x] == 1 )
{
this_poll_multi = "checked='checked'";
}
}
}
var inputhtml = lang_build_string( html_question_box, i, _poll_make_form_safe( question ), this_poll_multi );
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 = {};
var tmp_poll_multi = {};
for ( var i in poll_questions )
{
//-------------------------------
// Get form value...
//-------------------------------
try
{
tmp_poll_questions[ i ] = document.getElementById( 'question_' + i ).value;
}
catch(e) { }
}
for ( var x in poll_multi )
{
//-------------------------------
// Get form value...
//-------------------------------
try
{
tmp_poll_multi[ x ] = document.getElementById( 'multi_' + x ).checked ? 1 : 0;
}
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;
poll_multi = tmp_poll_multi;
}
/*--------------------------------------------*/
// 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_multi[ 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;
}
@@ -0,0 +1,36 @@
//------------------------------------------
// Invision Power Board v2.1
// 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;
}
@@ -0,0 +1,959 @@
//------------------------------------------
// Invision Power Board v2.1
// Register JS File
// (c) 2005 Invision Power Services, Inc.
//
// http://www.invisionboard.com
//------------------------------------------
var user_display_name_max_length = 26;
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;
RegExp.escape = function(text)
{
if (!arguments.callee.sRE)
{
var specials = [ '/', '.', '*', '+', '?', '|', '(', ')', '[', ']', '{', '}', '\\', '$' ];
arguments.callee.sRE = new RegExp( '(\\' + specials.join('|\\') + ')', 'g' );
}
return text.replace(arguments.callee.sRE, '\\$1');
};
/*-------------------------------------------------------------------------*/
// 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;
if ( ! reg_email_ok )
{
//------------------------------------------
// 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 )
{
if( !event )
{
event = window.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='+encodeURIComponent( 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 />";
}
if ( html == 'invalid' )
{
error_found += reg_error_email_invalid + "<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 )
{
if( !event )
{
event = window.event;
}
//----------------------------------
// INIT
//----------------------------------
var error_found = '';
//----------------------------------
// Check
//----------------------------------
if ( ! reg_field_ids['emailaddress'].value.match( /[@\.]/ ) )
{
error_found += reg_error_email_missing + "<br />";
}
if ( ! error_found && ( ! reg_field_ids['emailaddress'].value || ! reg_field_ids['emailaddress-two'].value ) )
{
error_found += reg_error_email_missing + "<br />";
}
if ( reg_field_ids['emailaddress'].value.toLowerCase() != reg_field_ids['emailaddress-two'].value.toLowerCase() )
{
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 && event.type != 'submit' )
{
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 )
{
if( !event )
{
event = window.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 )
{
if( !event )
{
event = window.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 > user_display_name_max_length )
{
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 />";
}
if ( allowed_chars != "" )
{
var test_regex = new RegExp();
test_regex.compile( "^[" + RegExp.escape(allowed_chars) + "]+$" );
if ( !test_regex.test( reg_field_ids['dname'].value ) )
{
error_found += allowed_error + "<br />";
}
}
//----------------------------------
// Ajax: check for existing member name
//----------------------------------
if ( use_enhanced_js && reg_field_ids['dname'].value && event.type != 'submit' )
{
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 )
{
if( !event )
{
event = window.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 > user_display_name_max_length )
{
error_found += reg_error_username_none + "<br />";
}
if ( allowed_chars != "" )
{
var test_regex = new RegExp();
test_regex.compile( "^[" + RegExp.escape(allowed_chars) + "]+$" );
if ( !test_regex.test( reg_field_ids['name'].value ) )
{
error_found += allowed_error + "<br />";
}
}
//----------------------------------
// Ajax: check for existing member name
//----------------------------------
if ( use_enhanced_js && reg_field_ids['name'].value && event.type != 'submit' )
{
// + symbols get stripped due to escape
reg_field_ids['name'].value = reg_field_ids['name'].value.replace("+", "&#43;");
//----------------------------------
// 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 = '';
}
reg_field_ids['name'].value = reg_field_ids['name'].value.replace("&#43;", "+");
};
/*-------------------------------------------------------------------------*/
// Validate the complete log in form
/*-------------------------------------------------------------------------*/
function validate_complete_login_form( event )
{
if( !event )
{
event = window.event;
}
//------------------------------------------
// Simply run the functions
//------------------------------------------
reg_oktogo = 1;
if ( ! email_ok )
{
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 )
{
if( !event )
{
event = window.event;
}
//------------------------------------------
// Simply run the functions
//------------------------------------------
reg_oktogo = 1;
check_email_addresses( event );
check_passwords( event );
if( register_method == 'username' )
{
check_user_name( event );
}
//------------------------------------------
// Got error messages
//------------------------------------------
if( register_method == 'username' )
{
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 );
my_setcookie( 'coppabday', bday_m + '-' + bday_d + '-' + bday_y, 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 );
var bdays = my_getcookie( 'coppabday' );
var dates = bdays.split( '-' );
locationjump( 'act=reg&CODE=coppa_two&m=' + dates[0] + '&d=' + dates[1] + '&y=' + dates[2] );
}
};
/*-------------------------------------------------------------------------*/
// 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');
}
};
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,238 @@
//------------------------------------------
// Invision Power Board v2.1
// 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 dname_max_length = 26;
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 = '';
RegExp.escape = function(text)
{
if (!arguments.callee.sRE)
{
var specials = [ '/', '.', '*', '+', '?', '|', '(', ')', '[', ']', '{', '}', '\\', '$' ];
arguments.callee.sRE = new RegExp( '(\\' + specials.join('|\\') + ')', 'g' );
}
return text.replace(arguments.callee.sRE, '\\$1');
};
/*-------------------------------------------------------------------------*/
// 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 > dname_max_length )
{
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 />";
}
if ( allowed_chars != "" )
{
var test_regex = new RegExp();
test_regex.compile( "^[" + RegExp.escape(allowed_chars) + "]+$" );
if ( !test_regex.test( ucp_dname_name.value ) )
{
error_found += allowed_error + "<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;
}
}
@@ -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.setAttribute( "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
}
}
}
@@ -0,0 +1,666 @@
//------------------------------------------------------------------------------
// IPS JS: Attach Functions
// (c) 2005 Invision Power Services, Inc.
// http://www.invisionpower.com
// Matt Mecham (16/12/05)
//------------------------------------------------------------------------------
var ipsattach = new ips_attach();
function ips_attach()
{
/**
* iFrame id
*/
this.iframe_id = 'ips--iframe-obj-attach';
/**
* iFrame Object
*/
this.iframe_obj = null;
/**
* Init URL
* URL to load to display current attachments, etc
*/
this.iframe_init_url = '';
/**
* URL for removing attachment
*/
this.iframe_remove_url = '';
/**
* The name of the DIV that this iframe is attached to
*/
this.iframe_add_to_div = 'ips-attach-div-iframe';
this.iframe_add_to_div_obj = null;
/**
* The name of the DIV that this iframe is attached to
*/
this.iframe_parent_div = 'ips-attach-div-parent';
this.iframe_parent_div_obj = null;
/**
* The name of the DIV that the status bar is in
*/
this.status_div = 'ips-attach-div-status';
this.status_div_obj = null;
/**
* The name of the DIV that the dropdown menu text is in
*/
this.dropdown_text = 'ips-attach-menu-text';
this.dropdown_text_obj = null;
/**
* Default iframe height
*/
this.iframe_height = 300;
/**
* css class names
*/
this.iframe_classname = 'attach-iframe';
/**
* Message cover
*/
this.message_div_id = 'ips-attach-message';
this.message_div_obj = null;
this.message_span_id = 'ips-attach-message-span';
this.message_span_obj = null;
/**
* Default Status message
*/
this.status_msg = '';
this.status_is_error = '';
/**
* Current items array
*/
this.current_items = new Array();
/**
* Current items' menu
*/
this.current_item_menu = 'ips-attach-menu';
this.current_item_menu_obj = null;
/**
* Images URL
*/
this.images_url = null;
/**
* Language array
*/
this.lang = new Array();
/**
* CSS classes
*/
this.css_menu_row = 'attach-menu-row';
this.css_menu_row_over = 'attach-menu-row-over';
/**
* Show attachments menu
*/
this.show_attach_menu = 1;
/**
* Onload command
*/
this.onload_function = '';
/**
* Has an upload...
*/
this.has_upload_pending = 0;
/**
* INIT
*/
this.init = function()
{
//-----------------------------------------
// INIT objects
//-----------------------------------------
this.iframe_add_to_div_obj = document.getElementById( this.iframe_add_to_div );
this.iframe_parent_div_obj = document.getElementById( this.iframe_parent_div );
this.message_div_obj = document.getElementById( this.message_div_id );
this.message_span_obj = document.getElementById( this.message_span_id );
this.status_div_obj = document.getElementById( this.status_div );
this.dropdown_text_obj = document.getElementById( this.dropdown_text );
//-----------------------------------------
// INIT Current button
//-----------------------------------------
if ( this.show_attach_menu )
{
// INIT div
this.current_item_menu_obj = document.getElementById( this.current_item_menu );
ipsmenu.register( this.current_item_menu );
this.current_item_menu_obj._onclick = this.current_item_menu_obj.onclick;
this.current_item_menu_obj.onmouseover = this.current_item_menu_obj.onmouseout = this.current_item_menu_obj.onclick = this.current_menu_mouseover;
ipsmenu.menu_registered[ this.current_item_menu ]._open = ipsmenu.menu_registered[ this.current_item_menu ].open;
ipsmenu.menu_registered[ this.current_item_menu ].open = this.current_menu_button_show;
}
};
/**
* Dynamically builds the HTML for the IPS Menu system
*
* @var object Javascript object clicked
*/
this.init_current_menu = function( obj )
{
//-----------------------------------------
// Old menu?
//-----------------------------------------
var menu = '';
try
{
menu = document.getElementById( ipsattach.current_item_menu + '_menu' );
menu.innerHTML = '';
}
catch(error)
{
menu = document.createElement('div');
}
//-----------------------------------------
// Create menu wrapper
//-----------------------------------------
var _items = 0;
menu.id = ipsattach.current_item_menu + '_menu';
menu.className = 'attach-popupmenu';
menu.style.display = 'none';
menu.style.cursor = 'default';
menu.style.padding = '3px';
menu.style.width = 'auto';
menu.style.overflow = 'auto';
//-----------------------------------------
// What are we doing?
//-----------------------------------------
for( var i in ipsattach.current_items )
{
var option = document.createElement('div');
option.innerHTML = ipsattach.current_items[i];
option.style.width = ipsattach.current_item_menu_obj.style.width;
option.className = 'attach-menu-row';
option.onmouseover = option.onmouseout = ipsattach.menu_onmouse_event;
menu.appendChild(option);
_items++;
}
if ( ! _items )
{
var option = document.createElement('div');
option.innerHTML = ipsattach.lang['no_items'];
option.style.width = ipsattach.current_item_menu_obj.style.width;
option.className = 'attach-menu-row';
option.onmouseover = option.onmouseout = ipsattach.menu_onmouse_event;
menu.appendChild(option);
}
// Set status counter correct
ipsattach.set_attach_count_status( _items );
ipsattach.iframe_parent_div_obj.appendChild(menu);
ipsclass.set_unselectable( menu );
};
/**
* Recounts number of current attachments and sets counter
*
* @param integer Cached count
*/
this.set_attach_count_status = function( _items )
{
if ( ! ipsattach.show_attach_menu )
{
return;
}
if ( typeof( _items ) == 'undefined' )
{
_items = 0;
for( var i in ipsattach.current_items )
{
_items++;
}
}
try
{
ipsattach.dropdown_text_obj.innerHTML = " (" + _items + ")";
}
catch(error)
{
}
};
/**
* Add item into current_attachments menu
*/
this.add_current_item = function( attach_id, attach_name, attach_size, attach_image )
{
//-----------------------------------------
// Fix up attach_name
//-----------------------------------------
if ( attach_name.length > 22 )
{
var _ext = attach_name.replace( /^.*\.(\S+?)$/ , "$1" );
var _main = attach_name.replace( /^(.*)\.\S+?$/ , "$1" );
var _a = _main.substr( 0, 8 );
var _b = _main.substr( _main.length - 8 , _main.length );
attach_name = _a + '...' + _b + '.' + _ext;
}
var html = '';
html += '<img onclick="ipsattach.add_attachment_into_editor(' + attach_id + ', \'' + attach_name + '\')" src="' + this.images_url + '/folder_attach_images/attach_add.png" title="' + this.lang['attach_insert'] + '" style="vertical-align:middle" border="0" alt="" /> &nbsp;';
html += '<img onclick="ipsattach.remove_attachment(' + attach_id + ');" src="' + this.images_url + '/folder_attach_images/attach_remove.png" title="' + this.lang['attach_remove'] + ': [' + attach_id + ']' + '" style="vertical-align:middle" border="0" alt="" />&nbsp;';
html += '<img src="' + this.images_url + '/' + attach_image + '" style="vertical-align:middle" border="0" alt="" /> &nbsp;';
html += '<span style="font-weight:bold" onclick="ipsattach.add_attachment_into_editor(' + attach_id + ', \'' + attach_name + '\')">' + attach_name + '</span>';
html += ' <span class="desctext">&nbsp;('+attach_size+')</span>';
this.current_items[ this.current_items.length ] = html;
};
/**
* Adds the IPD attach tag into the current editor
*
* @param integer Attachment ID
* @param string Attachment name
*/
this.add_attachment_into_editor = function( id, name )
{
// Form tag
var tag = "[attachment=" + id + ":" + name + "]";
// Add
ipsclass.add_editor_contents( tag );
};
/**
* Removes an attachment
*
* @param integer Attachment ID
*/
this.remove_attachment = function( id )
{
menu_action_close();
if ( confirm( ipsattach.lang['remove_warn'] + ' ['+ id + ']' ) )
{
ipsattach.iframe_obj.src = ipsattach.iframe_remove_url + "&attach_id=" + id;
ipsattach.iframe_on_un_load( 'attach_removal' );
}
};
/**
* Show upload field and attachments
* Draws the iFrame and sets the source
*/
this.show_attach_box = function()
{
//-----------------------------------------
// INIT
//-----------------------------------------
var iheight = parseInt( this.iframe_add_to_div_obj.style.height );
var iwidth = this.iframe_add_to_div_obj.style.width;
//-----------------------------------------
// Generate iFrame box
//-----------------------------------------
if ( ! this.iframe_obj )
{
this.iframe_obj = document.createElement( 'IFRAME' );
this.iframe_obj.src = this.iframe_init_url;
this.iframe_obj.id = this.iframe_id;
this.iframe_obj.name = this.iframe_id;
this.iframe_obj.scrolling = 'no';
this.iframe_obj.frameBorder = 'no';
this.iframe_obj.border = '0';
this.iframe_obj.className = this.iframe_classname;
this.iframe_obj.style.width = iwidth ? iwidth : '100%';
this.iframe_obj.style.height = iheight ? iheight - 5 + 'px' : this.iframe_height + 'px';
this.iframe_obj.style.overflow = 'hidden';
this.iframe_obj.style.display = '';
// Add environmentals..
this.iframe_obj.msg_open = 1;
this.iframe_obj.iframe_loaded = 0;
this.iframe_obj.iframe_init = 0;
// Attach iFrame inside our DIV
this.iframe_add_to_div_obj.appendChild( this.iframe_obj );
// Add handler
if ( is_ie )
{
this.iframe_obj.style.backgroundColor = 'transparent';
this.iframe_obj.allowTransparency = true;
this.iframe_obj.onreadystatechange = this.iframe_on_load_ie;
}
else
{
this.iframe_obj.onload = this.iframe_onload;
}
//-----------------------------------------
// Safari bug: Onload events don't fire
// when the parent DIV is hidden.
//-----------------------------------------
if ( is_safari )
{
this.iframe_parent_div_obj.style.display = '';
}
else
{
this.iframe_parent_div_obj.style.display = 'none';
}
}
//-----------------------------------------
// INIT cover div
//-----------------------------------------
if ( typeof this.message_div_obj != 'undefined' )
{
this.message_div_obj.style.width = typeof this.iframe_parent_div_obj.style.width != 'undefined' ? this.iframe_parent_div_obj.style.width : '100%';
this.message_div_obj.style.height = this.iframe_parent_div_obj.offsetHeight ? this.iframe_parent_div_obj.offsetHeight : '120px';
this.message_div_obj.style.position = 'relative';
this.message_div_obj.style.display = 'none';
}
//-----------------------------------------
// Show cover div during INIT
//-----------------------------------------
this.show_message( this.lang['init_progress'] );
};
/**
* Draws status bar
* Using "ipsattach" as is called in an event function
*/
this.init_status_bar = function()
{
//-----------------------------------------
// INIT
//-----------------------------------------
var _html = '';
if ( typeof ipsattach.status_div_obj != 'undefined' )
{
try
{
ipsattach.status_msg = ipsattach.lang[ ipsattach.status_msg ];
}
catch(error) { }
if ( ipsattach.status_msg )
{
if ( ipsattach.status_is_error )
{
_html += "<img src='" + this.images_url + "/folder_attach_images/attach_error.png' border='0' style='vertical-align:middle' alt='" + ipb_global_lang['general_error'] + "' />&nbsp;" + ipsattach.status_msg;
}
else
{
_html += "<img src='" + this.images_url + "/folder_attach_images/attach_ok.png' border='0' style='vertical-align:middle' alt='" + ipb_global_lang['general_OK'] + "' />&nbsp;" + ipsattach.status_msg;
}
}
ipsattach.status_div_obj.innerHTML = _html;
}
//-----------------------------------------
// Reset pending...
//-----------------------------------------
ipsattach.has_upload_pending = 0;
};
/**
* Manually show the iframe message
*/
this.iframe_on_un_load = function( msg )
{
//-----------------------------------------
// Message...
//-----------------------------------------
msg = typeof(msg) != 'undefined' ? ipsattach.lang[ msg ] : ipsattach.lang['uploading_file'];
//-----------------------------------------
// Show...
//-----------------------------------------
if ( this.iframe_obj.iframe_loaded )
{
this.iframe_obj.iframe_loaded = 0;
this.iframe_obj.msg_open = 1;
ipsattach.show_message( msg );
}
};
/**
* Each time the window is loaded, close
* any open messages
*/
this.iframe_onload = function( e )
{
//-----------------------------------------
// First load?
//-----------------------------------------
if ( ! this.iframe_init )
{
this.iframe_init = 1;
this.iframe_loaded = 1;
if ( this.msg_open )
{
this.msg_open = 0;
ipsattach.hide_message();
}
window.frames[ this.id ].document.onmousedown = menu_action_close;
}
else
{
this.iframe_loaded = 1;
window.frames[ this.id ].document.onmousedown = menu_action_close;
if ( this.msg_open )
{
this.msg_open = 0;
ipsattach.hide_message();
}
//-----------------------------------------
// Run command?
//-----------------------------------------
if ( ipsattach.onload_function )
{
ipsattach.onload_function();
}
}
// INIT stuff
ipsattach.init_status_bar();
// Set status counter correct
ipsattach.set_attach_count_status();
};
/**
* IE only calls onload once... So subsequent loads
* don't do anything.. hence the readystate change
*/
this.iframe_on_load_ie = function( e )
{
//-----------------------------------------
// First load?
//-----------------------------------------
if ( this.readyState == 'complete' )
{
if ( ! this.iframe_init )
{
this.iframe_init = 1;
this.iframe_loaded = 1;
window.frames[ this.id ].document.onmousedown = menu_action_close;
if ( this.msg_open )
{
this.msg_open = 0;
ipsattach.hide_message();
}
}
else
{
this.iframe_loaded = 1;
window.frames[ this.id ].document.onmousedown = menu_action_close;
if ( this.msg_open )
{
this.msg_open = 0;
ipsattach.hide_message();
}
}
//window.frames[ this.id ].document.getElementsByTagName('html')[0].allowTransparency = true;
window.frames[ this.id ].document.getElementsByTagName('html')[0].style.background = 'transparent';
//alert( window.frames[ this.id ].document.getElementsByTagName('html')[0].outerHTML );
//-----------------------------------------
// Run command?
//-----------------------------------------
if ( ipsattach.onload_function )
{
ipsattach.onload_function();
}
// INIT stuff
ipsattach.init_status_bar();
// Set status counter correct
ipsattach.set_attach_count_status();
}
};
/**
* Show message DIV
*/
this.show_message = function( msg )
{
//-----------------------------------------
// Safari bug: Onload events don't fire
// when the parent DIV is hidden.
//-----------------------------------------
if ( is_safari )
{
return;
}
if ( typeof ipsattach.message_div_obj != 'undefined' )
{
ipsattach.message_div_obj.style.display = '';
ipsattach.message_span_obj.innerHTML = msg;
// Hide other div
ipsattach.iframe_parent_div_obj.style.display = 'none';
}
};
/**
* Hide message DIV
*/
this.hide_message = function()
{
//-----------------------------------------
// Safari bug: Onload events don't fire
// when the parent DIV is hidden.
//-----------------------------------------
if ( is_safari )
{
return;
}
if ( typeof ipsattach.message_div_obj != 'undefined' )
{
ipsattach.message_div_obj.style.display = 'none';
ipsattach.message_span_obj.innerHTML = '';
// Show other div
ipsattach.iframe_parent_div_obj.style.display = '';
}
};
/**
* Mouseover events
*
* @param Event Object
*/
this.current_menu_mouseover = function(e)
{
e = ipsclass.cancel_bubble(e, true);
if ( e.type == 'click' )
{
this._onclick(e);
}
};
/**
* Shows the pop-up menu
* First, dynamically writes menu - then passes to ipsmenu class to show
*
* @param Object Object
*/
this.current_menu_button_show = function(obj)
{
ipsattach.init_current_menu(obj);
this._open(obj);
};
/**
* Roll over effect for the menu
* ^^
*
* @param Event Object
*/
this.menu_onmouse_event = function( e )
{
e = ipsclass.cancel_bubble(e, true);
if ( e.type == 'mouseover' )
{
this.className = ipsattach.css_menu_row_over;
}
else if ( e.type == 'mouseout' )
{
this.className = ipsattach.css_menu_row;
}
};
}
@@ -0,0 +1,597 @@
//------------------------------------------------------------------------------
// IPS Global JS functions
//------------------------------------------------------------------------------
// Matt Mecham Woz Here
// (c) 2005 Invision Power Services, Inc.
// http://www.invisionpower.com
//------------------------------------------------------------------------------
function ipsclass()
{
this.cookies = new Array();
this.ignore_cookies = new Array( ipb_var_cookieid + 'ipb_stronghold',
ipb_var_cookieid + 'session_id',
ipb_var_cookieid + 'ipb_admin_session_id',
ipb_var_cookieid + 'member_id',
ipb_var_cookieid + 'pass_hash' );
this.settings = {
'do_linked_resize' : 0,
'resize_percent' : 50
};
/*-------------------------------------------------------------------------*/
// Sort out cookies
/*-------------------------------------------------------------------------*/
this.init = function()
{
var _tmp = document.cookie.split(';');
if ( _tmp.length )
{
for( i = 0 ; i < _tmp.length ; i++ )
{
if ( _tmp[i].match( new RegExp( ipb_var_cookieid + ".*$" ) ) )
{
var _data = _tmp[i].split('=');
var _key = this.trim( _data[0] );
var _value = unescape( this.trim( _data[1] ) );
if ( _key && ( ! this.in_array( _key, this.ignore_cookies ) ) )
{
this.cookies[ _key.replace( ipb_var_cookieid, '' ) ] = _value;
}
}
}
}
_tmp = null;
};
//=============================================================================
// PHP EMULATION
//=============================================================================
/**
* Emulate PHPs trim function
*/
this.trim = function( text )
{
if( typeof(text) == 'undefined' )
{
return '';
}
text = text.replace(/^\s+/, '');
return text.replace(/\s+$/, '');
};
/**
* Emulate PHPs html_entity_decode function
*/
this.html_entity_decode = function( text )
{
if( typeof ca == 'undefined' )
{
var ca = document.createElement( 'textarea' );
}
ca.innerHTML = text.replace( /</g, '&lt;' ).replace( />/g, '&gt;' );
return ca.value;
};
/**
* Emulate PHPs in_array function
*/
this.in_array = function( needle, haystack )
{
if ( ! haystack.length )
{
return false;
}
for ( var i = 0 ; i < haystack.length ; i++)
{
if ( haystack[i] === needle )
{
return true;
}
}
return false;
};
/**
* Emulate PHPs htmlspecial chars function
*/
this.htmlspecialchars = function( text )
{
text = text.replace( /</g, '&lt;' );
text = text.replace( />/g, '&gt;' );
text = text.replace( /"/g, '&quot;' );
return text;
};
/**
* Emulate PHPs un htmlspecial chars function
*/
this.un_htmlspecialchars = function( text )
{
text = text.replace( /&lt;/g , '<' );
text = text.replace( /&gt;/g , '>' );
text = text.replace( /&quot;/g, '"' );
return text;
};
//=============================================================================
// EDITOR FUNCTIONS
//=============================================================================
/**
* Get contents from an open editor
*/
this.get_editor_contents = function( editor_id, editor_array )
{
var aIPS_editor = editor_array ? editor_array : IPS_editor;
if ( ! editor_id )
{
//-----------------------------------------
// Assume we don't care, and get first box
//-----------------------------------------
for( var i in aIPS_editor )
{
if( typeof( aIPS_editor[i] ) != 'object' )
{
continue;
}
editor_id = i;
break;
}
}
return aIPS_editor[ editor_id ].editor_get_contents;
};
/**
* Add contents to an open editor
*/
this.add_editor_contents = function( text, editor_id, editor_array )
{
var aIPS_editor = editor_array ? editor_array : IPS_editor;
if ( ! editor_id )
{
//-----------------------------------------
// Assume we don't care, and get first box
//-----------------------------------------
for( var i in aIPS_editor )
{
if( typeof( aIPS_editor[i] ) != 'object' )
{
continue;
}
editor_id = i;
break;
}
}
return aIPS_editor[ editor_id ].insert_text( text );
};
/**
* Convert saved tags to display tags
*/
this.convert_saved_tags_to_display_tags = function( text )
{
text = text.replace( /(<|&lt;|&#60;)!--/, "{" );
text = text.replace( /--(>|&gt;|&#62;)/ , "}" );
return text;
};
//=============================================================================
// MISC FUNCTIONS
//=============================================================================
/**
* Include a script...
*/
this.include_javascript = function( _file, div_id )
{
/* INIT */
var _doc = ( div_id ) ? document.getElementById( div_id ) : document.getElementsByTagName( 'head' ).item(0);
var _js = document.createElement('script' );
/* Create attribute */
_js.setAttribute( 'language', 'javascript' );
_js.setAttribute( 'type', 'text/javascript' );
_js.setAttribute( 'src', _file );
_doc.appendChild( _js );
return false;
};
/**
* Fade in colour...
*/
this.fade_in_element = function( div )
{
//-----------------------------------------
// INIT
//-----------------------------------------
var hash = '#';
var color_items = "0123456789abcdef";
var start_color = '#ffff66';
var orig_color = document.getElementById( div ).style.backgroundColor;
var temp_end = '#ffffff';
var iter = 20;
var time = 80;
var rbeg = color_items.indexOf(start_color.substr(1,1))*16 + color_items.indexOf(start_color.substr(2,1));
var gbeg = color_items.indexOf(start_color.substr(3,1))*16 + color_items.indexOf(start_color.substr(4,1));
var bbeg = color_items.indexOf(start_color.substr(5,1))*16 + color_items.indexOf(start_color.substr(6,1));
var rend = color_items.indexOf(temp_end.substr(1,1))*16 + color_items.indexOf(temp_end.substr(2,1));
var gend = color_items.indexOf(temp_end.substr(3,1))*16 + color_items.indexOf(temp_end.substr(4,1));
var bend = color_items.indexOf(temp_end.substr(5,1))*16 + color_items.indexOf(temp_end.substr(6,1));
for ( i = 1, r = rbeg, g = gbeg, b = bbeg;
i <= iter;
r = Math.round(rbeg + i * ((rend - rbeg) / (iter-1))),
g = Math.round(gbeg + i * ((gend - gbeg) / (iter-1))),
b = Math.round(bbeg + i * ((bend - bbeg) / (iter-1))), i++
)
{
hstr = '#' + color_items.charAt(Math.floor(r/16)) + color_items.charAt(r%16) + color_items.charAt(Math.floor(g/16)) + color_items.charAt(g%16) + color_items.charAt(Math.floor(b/16)) + color_items.charAt(b%16);
setTimeout('var div = document.getElementById("' + div + '"); div.style.backgroundColor = "' + hstr + '";', i * time);
}
setTimeout('var div = document.getElementById("' + div + '"); div.style.backgroundColor = "' + orig_color + '";', (i+1) * time);
};
/**
* Accepts a string followed by a list of replacements
*/
this.lang_build_string = function()
{
if ( ! arguments.length || ! arguments )
{
return;
}
var string = arguments[0];
for( var i = 1 ; i < arguments.length ; i++ )
{
var match = new RegExp('<%' + i + '>', 'gi');
string = string.replace( match, arguments[i] );
}
return string;
};
/**
* Return the ID from an ID title string
*
* @param string ID title
* @return integar ID
*/
this.get_id_from_text = function( id )
{
return id.replace( /.*(\-|_)(\S+)/, "$2" );
};
/**
* Return the name from an ID string
*
* @param string ID title
* @return integar ID
*/
this.get_name_from_text = function( id )
{
return id.replace( /(.*)(\-|_)(\S+)/, "$1" );
};
/**
* Location jump
* @param string URL to redirect to
* @param boolean Do not prepend normal URL
*/
this.location_jump = function( url, full )
{
url = url.replace( /&amp;/g, '&' );
if ( full )
{
window.location.href = url;
}
else
{
window.location.href = ipb_var_base_url + url;
}
};
/**
* Confirm an action
*/
this.confirm_action = function(url, msg)
{
if ( ! msg )
{
msg = 'PLEASE CONFIRM:\nOK to proceed?';
}
if ( url )
{
url = url.replace( '&amp;', '&' );
}
else
{
url = '';
}
if ( confirm( msg ) )
{
window.location.href = url;
}
else
{
alert ( ipb_global_lang['action_cancelled'] );
return false;
}
};
/**
* Create pop-up window
*/
this.pop_up_window = function(url, width, height, name)
{
if ( ! name )
{
var mydate = new Date();
name = mydate.getTime();
}
var Win = window.open( url.replace( '&amp;', '&' ), name, 'width='+width+',height='+height + ',resizable=1,scrollbars=1,location=no,directories=no,status=no,menubar=no,toolbar=no');
Win.focus();
return false;
};
/**
* Set stuff unselectable
*/
this.set_unselectable = function(obj)
{
if ( ! is_ie4 && typeof( obj.tagName ) != 'undefined' )
{
if ( obj.hasChildNodes() )
{
for (var i = 0; i < obj.childNodes.length; i++)
{
this.set_unselectable( obj.childNodes[i] );
}
}
obj.unselectable = 'on';
}
};
/**
* GET LEFT OBJECT POSITION
* Safari friendly version...
*/
this.get_obj_leftpos = function(obj)
{
var curleft = 0;
if (obj.offsetParent)
{
while (obj.offsetParent)
{
curleft += obj.offsetLeft;
obj = obj.offsetParent;
}
}
else if (obj.x)
{
curleft += obj.x;
}
return curleft;
};
/**
* GET TOP OBJECT POSITION
* Safari friendly version...
*/
this.get_obj_toppos = function(obj)
{
var curtop = 0;
if (obj.offsetParent)
{
while (obj.offsetParent)
{
curtop += obj.offsetTop;
obj = obj.offsetParent;
}
}
else if (obj.y)
{
curtop += obj.y;
}
return curtop;
};
//=============================================================================
// CANCEL BUBBLE FUNCTIONS
//=============================================================================
/**
* Stop the browser bubbling events
*/
this.cancel_bubble = function(obj, extra)
{
if ( extra !== false )
{
extra = true;
}
if ( ! obj || is_ie)
{
if ( extra )
{
window.event.returnValue = false;
}
window.event.cancelBubble = true;
return window.event;
}
else
{
obj.stopPropagation();
if ( extra )
{
obj.preventDefault();
}
return obj;
}
};
this.cancel_bubble_all = function( obj )
{
return ipsclass.cancel_bubble( obj, true );
};
this.cancel_bubble_low = function( obj )
{
return ipsclass.cancel_bubble( obj, false );
};
//=============================================================================
// COOKIE FUNCTIONS
//=============================================================================
/**
* Cookie: Get Cookie
*/
this.my_getcookie = function( name )
{
return this.cookies[ name ];
/*cname = ipb_var_cookieid + name + '=';
cpos = document.cookie.indexOf( cname );
if ( cpos != -1 )
{
cstart = cpos + cname.length;
cend = document.cookie.indexOf(";", cstart);
if (cend == -1)
{
cend = document.cookie.length;
}
return unescape( document.cookie.substring(cstart, cend) );
}
return null;*/
};
/**
* Cookie: Set Cookie
*/
this.my_setcookie = function( name, value, sticky )
{
expire = "";
domain = "";
path = "/";
if ( sticky )
{
expire = "; expires=Wed, 1 Jan 2020 00:00:00 GMT";
}
if ( ipb_var_cookie_domain != "" )
{
domain = '; domain=' + ipb_var_cookie_domain;
}
if ( ipb_var_cookie_path != "" )
{
path = ipb_var_cookie_path;
}
document.cookie = ipb_var_cookieid + name + "=" + value + "; path=" + path + expire + domain + ';';
//-----------------------------------------
// Update internal array
//-----------------------------------------
this.cookies[ name ] = value;
};
//=============================================================================
// ARRAY FUNCTIONS
//=============================================================================
/**
* Array: Get stacksize
* @param array Array
* @return int Array length
*/
this.array_stacksize = function( thearray )
{
for (i = 0 ; i < thearray.length; i++ )
{
if ( (thearray[i] == "") || (thearray[i] == null) || (thearray == 'undefined') )
{
return i;
}
}
return thearray.length;
};
/**
* Array: Add element to the stack
* @param array Array
* @param mixed New value
*/
this.array_pushstack = function ( thearray, newval )
{
var arraysize = this.array_stacksize(thearray);
thearray[arraysize] = newval;
};
/**
* Array: Remove last array element
* @param array Array
* @return int Array length
*/
this.array_popstack = function( thearray )
{
var arraysize = this.array_stacksize( thearray );
var theval = thearray[arraysize - 1];
delete thearray[arraysize - 1];
return theval;
};
}
@@ -0,0 +1,559 @@
/*-------------------------------------------------------------------------*/
// IPS BASIC MENU CLASS
// (c) 2005 Invision Power Services, Inc
// ASSUMES "ips_global.js" has been loaded
/*-------------------------------------------------------------------------*/
ipsmenu = new ips_menu();
/*-------------------------------------------------------------------------*/
// INIT Handler class
/*-------------------------------------------------------------------------*/
function ips_menu()
{
this.menu_registered = new Array();
this.menu_openfuncs = new Array();
this.menu_over_css = new Array();
this.menu_out_css = new Array();
this.menu_open_event = new Array();
this.dynamic_register = new Array();
this.menu_cur_open = null;
this.dynamic_html = null;
}
/*-------------------------------------------------------------------------*/
// Register menu control ID (add to array)
/*-------------------------------------------------------------------------*/
ips_menu.prototype.register = function ( cid, callback, menu_over_css, menu_out_css, event_type )
{
if ( event_type )
{
this.menu_open_event[ cid ] = ( event_type == 'onmouseover' ) ? 'onmouseover' : 'onclick';
}
this.menu_registered[ cid ] = new ips_menu_class( cid );
if ( callback )
{
this.menu_openfuncs[ cid ] = callback;
}
if ( menu_over_css && menu_out_css )
{
this.menu_over_css[ cid ] = menu_over_css;
this.menu_out_css[ cid ] = menu_out_css;
}
return this.menu_registered[ cid ];
};
/*-------------------------------------------------------------------------*/
// Register menu control ID (add to array)
/*-------------------------------------------------------------------------*/
ips_menu.prototype.close = function ()
{
if ( this.menu_cur_open )
{
this.menu_registered[ this.menu_cur_open ].close();
}
};
/*-------------------------------------------------------------------------*/
// ips_menu_class: Object for each menu
/*-------------------------------------------------------------------------*/
function ips_menu_class( cid )
{
this.cid = cid;
this.initialized = false;
this.init_control_object();
this.init_menu();
};
/*-------------------------------------------------------------------------*/
// ips_menu_class: Initiate a single menu
/*-------------------------------------------------------------------------*/
ips_menu_class.prototype.init_control_object = function()
{
this.cid_obj = document.getElementById( this.cid );
//----------------------------------
// Change cursor to show link
//----------------------------------
try
{
this.cid_obj.style.cursor = "pointer";
}
catch(e)
{
this.cid_obj.style.cursor = "hand";
}
this.cid_obj.unselectable = true;
if ( ipsmenu.menu_open_event[ this.cid ] == 'onmouseover' )
{
this.cid_obj.onmouseover = ips_menu_events.prototype.event_onclick;
}
else
{
this.cid_obj.onclick = ips_menu_events.prototype.event_onclick;
this.cid_obj.onmouseover = ips_menu_events.prototype.event_onmouseover;
}
this.cid_obj.onmouseout = ips_menu_events.prototype.event_onmouseout;
};
/*-------------------------------------------------------------------------*/
// ips_menu_class: Initiate a single menu
/*-------------------------------------------------------------------------*/
ips_menu_class.prototype.init_menu = function()
{
this.cid_menu_obj = document.getElementById( this.cid + '_menu' );
if ( this.cid_menu_obj )
{
//----------------------------------
// Save CPU - already init?
//----------------------------------
if ( this.initialized )
{
return;
}
//----------------------------------
// Pop-up menu obj (hidden div)
//----------------------------------
this.cid_menu_obj.style.display = "none";
this.cid_menu_obj.style.position = "absolute";
this.cid_menu_obj.style.left = "0px";
this.cid_menu_obj.style.top = "0px";
this.cid_menu_obj.onclick = ipsclass.cancel_bubble_low;
this.cid_menu_obj.zIndex = 50;
this.initialized = true;
}
};
/*-------------------------------------------------------------------------*/
// ips_menu_class: Open menu
/*-------------------------------------------------------------------------*/
ips_menu_class.prototype.open = function( obj )
{
//----------------------------------
// Not init?
//----------------------------------
if ( ! this.cid_menu_obj )
{
this.initialized = false;
this.init_menu();
}
//----------------------------------
// Close current menu(s)
//----------------------------------
if ( ipsmenu.menu_cur_open != null )
{
ipsmenu.menu_registered[ ipsmenu.menu_cur_open ].close();
}
//----------------------------------
// Save CPU - cur open clicked?
//----------------------------------
if ( ipsmenu.menu_cur_open == obj.id )
{
return false;
}
//----------------------------------
// Set current open menu
//----------------------------------
ipsmenu.menu_cur_open = obj.id;
//----------------------------------
// Get ID of menu DIV to show
//----------------------------------
var left_px = ipsclass.get_obj_leftpos(obj);
var top_px = ipsclass.get_obj_toppos(obj) + obj.offsetHeight;
var ifid = obj.id;
//try
//{
// if ( is_safari && ! ipb_is_acp )
// {
// top_px += 20;
// }
//}
//catch(error)
//{
// if ( is_safari )
// {
// top_px += 20;
// }
//}
//----------------------------------
// Show menu DIV.. but keep it underneath
//----------------------------------
this.cid_menu_obj.style.zIndex = -1;
this.cid_menu_obj.style.display = "";
//----------------------------------
// Try and keep it on screen
//----------------------------------
var width = parseInt( this.cid_menu_obj.style.width ) ? parseInt( this.cid_menu_obj.style.width ) : this.cid_menu_obj.offsetWidth;
if ( (left_px + width) >= document.body.clientWidth )
{
left_px = left_px + obj.offsetWidth - width;
}
//-----------------------------------------
// Firefox bump
//-----------------------------------------
if ( is_moz )
{
top_px -= 1;
}
//----------------------------------
// Finalize menu position
//----------------------------------
this.cid_menu_obj.style.left = left_px + "px";
this.cid_menu_obj.style.top = top_px + "px";
this.cid_menu_obj.style.zIndex = 100;
//----------------------------------
// Run a custom function?
//----------------------------------
if ( ipsmenu.menu_openfuncs[ obj.id ] )
{
eval( ipsmenu.menu_openfuncs[ obj.id ] );
}
//----------------------------------
// Workaround for IE bug which shows
// select boxes and other windows GUI
// over divs. SHOW IFRAME
//----------------------------------
if ( is_ie )
{
try
{
if ( ! document.getElementById( 'if_' + obj.id ) )
{
var iframeobj = document.createElement('iframe');
iframeobj.src = 'javascript:;';
iframeobj.id = 'if_' +obj.id;
document.getElementsByTagName('body').appendChild( iframeobj );
}
else
{
var iframeobj = document.getElementById( 'if_' +obj.id );
}
iframeobj.scrolling = 'no';
iframeobj.frameborder = 'no';
iframeobj.className = 'iframeshim';
iframeobj.style.position = 'absolute';
iframeobj.style.width = parseInt(this.cid_menu_obj.offsetWidth) + 'px';
iframeobj.style.height = parseInt(this.cid_menu_obj.offsetHeight) + 'px';
iframeobj.style.top = this.cid_menu_obj.style.top;
iframeobj.style.left = this.cid_menu_obj.style.left;
iframeobj.style.zIndex = 99;
iframeobj.style.display = "block";
}
catch(error)
{
//alert(error); // 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 = this.cid_menu_obj.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] != null
&& mlinks[i].href != null
&& mlinks[i].href
&& ( mlinks[i].href.indexOf( '#', 0 ) != (mlinks[i].href.length - 1) )
)
{
mlinks[i].onmousedown = ips_menu_events.prototype.event_safari_onclick_handler;
mlinks[i].id = 'saf-link-' + this.cid + i;
}
}
}
catch( error )
{
//alert( error );
}
}
if ( this.cid_obj.editor_id )
{
this.cid_obj.state = true;
IPS_editor[this.cid_obj.editor_id].set_menu_context(this.cid_obj, 'mousedown');
}
return false;
};
/*-------------------------------------------------------------------------*/
// ips_menu_class: Close a menu
/*-------------------------------------------------------------------------*/
ips_menu_class.prototype.close = function()
{
if ( this.cid_menu_obj != null )
{
this.cid_menu_obj.style.display = "none";
}
else if ( ipsmenu.menu_cur_open != null )
{
ipsmenu.menu_registered[ ipsmenu.menu_cur_open ].cid_menu_obj.style.display = 'none';
}
ipsmenu.menu_cur_open = null;
if ( this.cid_obj )
{
if ( ipsmenu.menu_out_css[ this.cid_obj.id ] )
{
this.cid_obj.className = ipsmenu.menu_out_css[ this.cid_obj.id ];
}
}
//----------------------------------
// Workaround for IE bug which shows
// select boxes and other windows GUI
// over divs. Hide IFRAME
//----------------------------------
if ( is_ie )
{
try
{
document.getElementById( 'if_' + this.cid ).style.display = "none";
}
catch(error)
{
//alert(e);// Oh dear, someones stolen the iframe
}
}
//-----------------------------------------
// IPS Editor stuff
//-----------------------------------------
if ( this.cid_obj.editor_id )
{
this.cid_obj.state = false;
IPS_editor[ this.cid_obj.editor_id ].set_menu_context( this.cid_obj, 'mouseout' );
}
};
/*-------------------------------------------------------------------------*/
// ACTION: If menu open and hover over another cid, close cur open new
/*-------------------------------------------------------------------------*/
ips_menu_class.prototype.hover = function(e)
{
if ( ipsmenu.menu_cur_open != null )
{
if ( ipsmenu.menu_registered[ ipsmenu.menu_cur_open ].cid != this.id )
{
this.open(e);
}
}
};
/*-------------------------------------------------------------------------*/
// INIT: ips menu events
/*-------------------------------------------------------------------------*/
function ips_menu_events()
{
};
/*-------------------------------------------------------------------------*/
// Safari: bug fix
/*-------------------------------------------------------------------------*/
ips_menu_events.prototype.event_safari_onclick_handler = function()
{
if ( this.id )
{
window.location = document.getElementById( this.id ).href;
}
};
/*-------------------------------------------------------------------------*/
// Event: On mouseover
/*-------------------------------------------------------------------------*/
ips_menu_events.prototype.event_onmouseover = function(e)
{
e = ipsclass.cancel_bubble(e, true);
ipsmenu.menu_registered[ this.id ].hover(this);
if ( ipsmenu.menu_over_css[ this.id ] )
{
this.className = ipsmenu.menu_over_css[ this.id ];
}
};
/*-------------------------------------------------------------------------*/
// Event: On mouseout
/*-------------------------------------------------------------------------*/
ips_menu_events.prototype.event_onmouseout = function(e)
{
e = ipsclass.cancel_bubble(e, true);
if ( ipsmenu.menu_out_css[ this.id ] && ipsmenu.menu_cur_open != this.id )
{
this.className = ipsmenu.menu_out_css[ this.id ];
}
};
/*-------------------------------------------------------------------------*/
// Event: On click
/*-------------------------------------------------------------------------*/
ips_menu_events.prototype.event_onclick = function(e)
{
e = ipsclass.cancel_bubble(e, true);
if ( ipsmenu.menu_cur_open == null )
{
if ( ipsmenu.menu_over_css[ this.id ] )
{
this.className = ipsmenu.menu_over_css[ this.id ];
}
ipsmenu.menu_registered[ this.id ].open(this);
}
else
{
// For the RTE, if we click from font to size, for example
// we want the menu to open...
//ipsmenu.menu_registered[ this.id ].close();
if ( ipsmenu.menu_cur_open == this.id )
{
ipsmenu.menu_registered[ this.id ].close();
if ( ipsmenu.menu_out_css[ this.id ] )
{
this.className = ipsmenu.menu_out_css[ this.id ];
}
}
else
{
if ( ipsmenu.menu_over_css[ this.id ] )
{
this.className = ipsmenu.menu_over_css[ this.id ];
}
ipsmenu.menu_registered[ this.id ].open(this);
};
}
};
/*-------------------------------------------------------------------------*/
// Global INIT
/*-------------------------------------------------------------------------*/
function menu_do_global_init()
{
//----------------------------------
// Close all menus on click
//----------------------------------
document.onclick = menu_action_close;
//----------------------------------
// Write HTML
//----------------------------------
if ( ipsmenu.dynamic_html != null && ipsmenu.dynamic_html != '' )
{
}
//----------------------------------
// Register
//----------------------------------
if ( ipsmenu.dynamic_register.length )
{
for( var i=0; i < ipsmenu.dynamic_register.length; i++ )
{
if ( ipsmenu.dynamic_register[i] )
{
ipsmenu.register( ipsmenu.dynamic_register[i] );
}
}
}
};
/*-------------------------------------------------------------------------*/
// Global: Close menus from any app
/*-------------------------------------------------------------------------*/
function menu_action_close(e)
{
try {
if( e.button == 2 || e.button == 3 )
{
return;
}
}
catch( acold ) {};
ipsmenu.close(e);
};
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,569 @@
//------------------------------------------
// Invision Power Board v2
// Text Editor Global Functions
// (c) 2006 Invision Power Services, Inc.
//
// http://www.invisionboard.com
//------------------------------------------
var _options_done = 0;
/**
* Check side panel
*
* @param string Editor ID
*/
function check_side_panel( editor_id )
{
//-----------------------------------------
// Remove side panel?
//-----------------------------------------
if ( global_rte_remove_side_panel )
{
//-----------------------------------------
// Turn off button.
//-----------------------------------------
document.getElementById( 'rte-toggle-side-panel-button' ).style.display = 'none';
return true;
}
var _open = global_rte_side_panel_open;
var _cookie = ipsclass.my_getcookie( 'rte-sidepanel' );
if ( _cookie == 'open' || _cookie == 'close' )
{
_open = ( _cookie == 'open' ) ? 1 : 0;
}
if ( _open )
{
show_options_panel( editor_id, _open );
}
};
/**
* Show more options panel
*
* @param string Editor ID
*/
function show_options_panel( editor_id, force, start_emo )
{
//-----------------------------------------
// Remove side panel?
//-----------------------------------------
if ( global_rte_remove_side_panel )
{
//-----------------------------------------
// Turn off button.
//-----------------------------------------
document.getElementById( 'rte-toggle-side-panel-button' ).style.display = 'none';
return true;
}
//-----------------------------------------
// Set start..
//-----------------------------------------
if ( typeof( start_emo ) == 'undefined' )
{
start_emo = 0;
}
var _editor = document.getElementById( editor_id + '_main-bar' );
var _options = document.getElementById( editor_id + '_options-bar' );
var _height = parseInt( _editor.offsetHeight );
var _mode = 'open';
var _more_less = '';
//-----------------------------------------
// Clear out content
//-----------------------------------------
_options.innerHTML = '';
//-----------------------------------------
// Opening or closing?
//-----------------------------------------
if ( typeof( force ) != 'undefined' )
{
_mode = ( force == 1 ) ? 'open' : 'close';
}
else
{
if ( _options._panel_open )
{
_mode = 'close';
}
}
//-----------------------------------------
// Set cookie
//-----------------------------------------
ipsclass.my_setcookie( 'rte-sidepanel', _mode, 1 );
//-----------------------------------------
// OPEN: Adjust editor to make room
//-----------------------------------------
if( _mode == 'open' && _options_done == 1 )
{
_editor.style.width = '80%';
_options.style.width = 'auto';
_options.style.height = 'auto';
_options.style.display = 'block';
_options._panel_open = 1;
document.getElementById( editor_id + '_spacer-bar' ).style.width = '4px';
}
if ( _mode == 'open' )
{
_editor.style.width = '80%';
if( is_opera )
{
_editor.style.width = '100%';
_editor.style.display = 'block';
}
_options.style.width = 'auto';
_options.style.height = 'auto';
_options.style.display = 'block';
_options._panel_open = 1;
document.getElementById( editor_id + '_spacer-bar' ).style.width = '4px';
//-----------------------------------------
// Build emoticons...
//-----------------------------------------
var _main_div = document.createElement( 'div' );
_main_div.className = 'rte-option-emo-box';
_main_div.style.width = '90%';
_main_div.innerHTML += '<div class="rte-menu-emo-header"><a href="#" style="text-decoration:none" onclick="return show_all_emoticons(\'' + editor_id + '\')">' + ips_language_array['emos_show_all'] + '</a></div>';
var _div = document.createElement( 'div' );
_div.style.width = '100%';
_div.style.height = '120px';
_div.style.overflow = 'auto';
_div.style.overflowY = 'auto';
_div.style.overflowX = 'auto';
var table = document.createElement('table');
table.cellPadding = 0;
table.cellSpacing = 0;
table.border = 0;
table.width = '99%';
var i = 0;
var perrow = 3;
var show_emos = 12;
var show_rows = show_emos / perrow;
var max_emos = 0;
var _previous = 0;
var _next = 0;
//-----------------------------------------
// Get max. emos
//-----------------------------------------
for( var emo in ips_smilie_items )
{
max_emos++;
}
for( var emo in ips_smilie_items )
{
var _tmp = ips_smilie_items[ emo ].split( "," );
var _id = _tmp[0] - 1;
if ( _id < start_emo || _id >= ( show_emos + start_emo ) )
{
continue;
}
if ( i % perrow == 0 )
{
var tr = table.insertRow(-1);
}
i++;
var div = document.createElement('div');
var img = '<img src="' + global_rte_emoticons_url + '/' + _tmp[1] + '" style="vertical-align:middle" border="0" id="smid_' + _tmp[0] + '" /> ';
div.innerHTML = img;
var td = tr.insertCell(-1);
td.width = '33%';
td.align = 'center';
td.className = 'rte-menu-emo-box';
td.appendChild(div);
td.cmd = 'emoticons';
td.editor_id = editor_id;
td.id = editor_id + '_emoticon_' + _tmp[0];
td.emo_id = _tmp[0];
td.emo_image = _tmp[1];
td.emo_code = emo;
td.onclick = ips_editor_events.prototype.emoticon_onclick;
}
//-----------------------------------------
// More?
//-----------------------------------------
_div.appendChild( table );
_main_div.appendChild( _div );
if ( start_emo > 0 )
{
if ( start_emo + i < max_emos )
{
_previous = start_emo - show_emos;
}
else
{
_previous = start_emo - show_emos;
}
_more_less = '<div style="float:left"><a href="#" style="text-decoration:none" onclick="return show_options_panel(\'' + editor_id + '\', ' + '1' + ',' + _previous + ')">' + ips_language_array['emos_show_prev'] + '</a></div>';
}
if ( show_emos + start_emo < max_emos )
{
if ( start_emo < 1 )
{
_next = start_emo + show_emos;
}
else
{
_next = start_emo + show_emos;
}
_more_less += '<div style="float:right"><a href="#" style="text-decoration:none" onclick="return show_options_panel(\'' + editor_id + '\', ' + '1' + ',' + _next + ');">' + ips_language_array['emos_show_next'] + '</a></div>';
}
if ( _more_less )
{
var _div = document.createElement('div');
_div.className = "rte-menu-emo-header";
_div.style.height = '17px';
_div.innerHTML = _more_less;
_main_div.appendChild( _div );
}
_options.appendChild( _main_div );
//-----------------------------------------
// Special Items
//-----------------------------------------
var _main_div = document.createElement( 'div' );
_main_div.className = 'rte-option-emo-box';
_main_div.style.width = '90%';
_main_div.innerHTML += '<div class="rte-menu-emo-header">'+ips_language_array['ed_quick_access']+'</div>';
var _div = document.createElement( 'div' );
_div.style.width = '100%';
var table = document.createElement('table');
table.cellPadding = 0;
table.cellSpacing = 0;
table.border = 0;
table.width = '99%';
var i = 0;
var perrow = 3;
for( var i in IPS_editor[ editor_id ].ips_special_items )
{
var tr = table.insertRow(-1);
var option = tr.insertCell(-1);
var img = ( typeof IPS_editor[ editor_id ].ips_special_items[i][1] != 'undefined' ) ? '<img src="' + global_rte_images_url + IPS_editor[ editor_id ].ips_special_items[i][1] + '" style="vertical-align:middle" border="" /> ' : '';
option.innerHTML = img + IPS_editor[ editor_id ].ips_special_items[i][0];
option.className = 'rte-menu-face';
option.style.textAlign = 'left';
option.style.paddingLeft = '2px';
option.cmd = 'module_load',
option.loader_key = i.replace( 'cmd_loader_', '' );
option.editor_id = editor_id;
option.onmouseover = option.onclick = option.onmouseout = option.onmouseup = option.onmousedown = ips_editor_events.prototype.special_onmouse_event;
}
_div.appendChild( table );
_main_div.appendChild( _div );
_options.appendChild( _main_div );
_options_done = 1;
ipsclass.set_unselectable( _options );
}
else
{
_editor.style.width = '100%';
document.getElementById( editor_id + '_spacer-bar' ).style.width = '0px';
_options.style.width = '0px';
_options.style.display = 'none';
_options._panel_open = 0;
//_options.innerHTML = '';
}
return false;
};
/**
* Switch between STD and RTE editors on the fly
*
* @param string Editor ID
*/
function switch_editor_mode( editor_id )
{
//----------------------------------
// INIT
//----------------------------------
var url = ipb_var_base_url+'act=xmlout&do=post-editorswitch';
var fields = new Array();
if ( use_enhanced_js )
{
var new_mode = IPS_editor[ editor_id ].is_rte ? 0 : 1;
if ( IPS_editor[ editor_id ].is_loading )
{
return;
}
else
{
IPS_editor[ editor_id ].is_loading = 1;
}
//-----------------------------------------
// Close menus
//-----------------------------------------
if ( typeof( ipsmenu ) != 'undefined' )
{
ipsmenu.close();
}
//-----------------------------------------
// Collect Info
//-----------------------------------------
var _file_path = IPS_editor[ editor_id ].file_path;
var _is_ie = IPS_editor[ editor_id ].is_ie;
var _is_moz = IPS_editor[ editor_id ].is_moz;
//----------------------------------
// Populate fields
//----------------------------------
fields['md5check'] = ipb_md5_check;
fields['act'] = 'xmlout';
fields['do'] = 'post-editorswitch';
fields['to_rte'] = new_mode;
fields['Post'] = IPS_editor[ editor_id ].editor_get_contents();
/*--------------------------------------------*/
// 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();
//-----------------------------------------
// Kill editor
//-----------------------------------------
IPS_editor[ editor_id ].destruct();
//----------------------------------
// INIT
//----------------------------------
var text = xmlobj.xmlhandler.responseText;
var matches = text.match( /&#([0-9]+);/g );
if ( matches )
{
for ( var i = 0; typeof( matches[i] ) != 'undefined'; i++ )
{
if ( sm = matches[i].match( /^&#([0-9]+);$/ ) )
{
text = text.replace( sm[0], String.fromCharCode(sm[1]) );
}
}
}
text = text.replace( /&amp(lt|gt|quot);/ig, "&$1;" );
text = text.replace( /&quot;/g, '"' );
// Fix emoticons for ACP
text = text.replace( /([^\/])style_emoticons\/$1([a-zA-Z0-9]+)/ig, global_rte_emoticons_url );
//-----------------------------------------
// BBCode specific fixes
//-----------------------------------------
if ( ! new_mode )
{
// Move closing tags on a new line up one
text = text.replace( /(?:\n|\r){1,}(\[\/\w{1,}\])/g, "$1" );
// Make sure list bullets are on a new line
text = text.replace( /(\S{1})\[\*\]/g, "$1\n[*]" );
}
//-----------------------------------------
// Get rid of old thing
//-----------------------------------------
IPS_editor[ editor_id ] = null;
//-----------------------------------------
// INIT New
//-----------------------------------------
IPS_editor[ editor_id ] = new ips_text_editor( editor_id, new_mode, new_mode == 1 ? 0 : 1, _file_path, text );
//-----------------------------------------
// Other set up
//-----------------------------------------
// Set up defaults
IPS_editor[ editor_id ].allow_advanced = 0;
IPS_editor[ editor_id ].forum_fix_ie_newlines = 1;
// Add bbcode items
for( var i in ips_bbcode_items )
{
IPS_editor[ editor_id ].module_add_item( 'bbcodeloader{id=' + i + '}', ips_language_array['insert_prefix'] + ": " + ips_bbcode_items[ i ]['title'] , 'rte-ipd-tag.png' );
}
IPS_editor[ editor_id ].editor_check_focus();
//-----------------------------------------
// Fix up forms
//-----------------------------------------
document.getElementById( editor_id + '_wysiwyg_used' ).value = new_mode;
};
//----------------------------------
// LOAD XML
//----------------------------------
xmlobj = new ajax_request();
xmlobj.onreadystatechange( do_request_function );
var xmlreturn = xmlobj.process( url, 'POST', xmlobj.format_for_post(fields) );
}
}
/**
* Show all emoticons
*
* @param string Editor ID
*/
function show_all_emoticons( editor_id )
{
IPS_editor[ editor_id ].emoticon_window_id = window.open( ipb_var_base_url + "act=legends&CODE=emoticons&editor_id=" + editor_id,"Legends","width=250,height=500,resizable=yes,scrollbars=yes");
menu_action_close();
return false;
}
/**
* Show BBCode pop-up
*
*/
function bbc_pop()
{
window.open( ipb_var_base_url + "act=legends&CODE=bbcode","Legends","width=700,height=500,resizable=yes,scrollbars=yes");
}
/**
* Legacy code validate form
*
*/
function ValidateForm()
{
return validate_form();
}
/**
* IPB specific.
*
*/
function validate_form()
{
//-----------------------------------------
// Check for uploads...
//-----------------------------------------
try
{
if ( ipsattach.has_upload_pending )
{
if ( confirm( ipb_global_lang['post_upload_not_empty'] ) )
{
return true;
}
else
{
return false;
}
}
}
catch(e)
{
}
for ( var i in IPS_editor )
{
if( typeof( IPS_editor[i] ) != 'object' )
{
continue;
}
var return_var = IPS_editor[ i ].update_for_form_submit();
if ( return_var == false )
{
return false;
}
}
return true;
}
@@ -0,0 +1,819 @@
//------------------------------------------
// Invision Power Board v2
// Text Editor Lite
// (c) 2006 Invision Power Services, Inc.
//
// http://www.invisionboard.com
//------------------------------------------
var IPS_Lite_Editor = new Array();
/**
* Text editor lite!
*
* @param string Editor ID
*/
function ips_text_editor_lite( editor_id )
{
this.editor_id = editor_id;
this.control_obj = document.getElementById( editor_id + '-controls' );
this.initialized = false;
this.buttons = new Array();
this.fonts = new Array();
this.state = new Array();
this.text_obj = document.getElementById( this.editor_id + '_textarea' );
this.open_brace = '[';
this.close_brace = ']';
this.editor_document = this.text_obj;
this.editor_window = this.editor_document;
this._ie_cache = null;
this.is_ie = is_ie;
this.is_moz = is_moz;
this.is_opera = is_opera;
this.has_focus = false;
this.emoticon_window_id = null;
//-----------------------------------------
// Do some set up
//-----------------------------------------
this.init = function()
{
//-----------------------------------------
// INIT
//-----------------------------------------
var controls = new Array();
if ( ! this.control_obj )
{
return;
}
//-----------------------------------------
// Grab all buttons
// 2 step 'cos moz goes into infinite loop otherwise
//-----------------------------------------
var items = this.control_obj.getElementsByTagName("DIV");
for ( var i = 0 ; i < items.length ; i++ )
{
if ( ( items[i].className == 'rte-normal' || items[i].className == 'rte-menu-button' || items[i].className == 'rte-normal-menubutton' ) && items[i].id )
{
controls[ controls.length ] = items[i].id;
}
}
for ( var i = 0 ; i < controls.length ; i++ )
{
var control = document.getElementById( controls[i] );
if ( control.className == 'rte-normal' )
{
this.init_editor_button( control );
}
else if ( control.className == 'rte-menu-button' || control.className == 'rte-normal-menubutton' )
{
this.init_editor_popup_button( control );
}
}
//ipsclass.set_unselectable( this.control_obj );
//-----------------------------------------
// Set up focus
//-----------------------------------------
this.text_obj.onfocus = ips_editor_events.prototype.editor_window_onfocus;
this.text_obj.onblur = ips_editor_events.prototype.editor_window_onblur;
if ( this.editor_document.addEventListener )
{
this.editor_document.addEventListener('keypress', ips_editor_events.prototype.editor_document_onkeypress, false);
}
};
/**
* Refocus editor check
*/
this.editor_check_focus = function()
{
if ( ! this.text_obj.has_focus )
{
if ( this.is_opera )
{
this.text_obj.focus();
}
try
{
this.text_obj.focus();
}
catch(err)
{
return false;
}
}
return true;
};
/**
* INIT Editor Button
* Initialize an editor button (bold, italic, etc)
*
* @param object Button DIV object
*/
this.init_editor_button = function( obj )
{
obj.cmd = obj.id.replace( new RegExp( '^' + this.editor_id + '_cmd_(.+?)$' ), '$1' );
obj.editor_id = this.editor_id;
//-----------------------------------------
// Add to buttons array
//-----------------------------------------
this.buttons[ obj.cmd ] = obj;
//-----------------------------------------
// Set up defaults
//-----------------------------------------
obj.state = false;
obj.mode = 'normal';
obj.real_type = 'button';
obj.onclick = ips_editor_events.prototype.button_onmouse_event;
obj.onmousedown = ips_editor_events.prototype.button_onmouse_event;
obj.onmouseover = ips_editor_events.prototype.button_onmouse_event;
obj.onmouseout = ips_editor_events.prototype.button_onmouse_event;
};
/**
* Toggle button context
* Toggles the menu's class for mouseover, select, etc
*
* @param object menu object
* @param object state
* @param object type
*/
this.set_button_context = function(obj, state, type)
{
if (typeof type == 'undefined')
{
type = 'button';
}
switch (obj.state)
{
case true:
{
switch (state)
{
case 'mouseout':
{
this.editor_set_ctl_style(obj, 'button', 'selected');
break;
}
case 'mouseover':
case 'mousedown':
case 'mouseup':
{
this.editor_set_ctl_style(obj, type, 'down');
break;
}
}
break;
}
default:
{
switch (state)
{
case 'mouseout':
{
this.editor_set_ctl_style(obj, type, 'normal');
break;
}
case 'mousedown':
{
this.editor_set_ctl_style(obj, type, 'down');
break;
}
case 'mouseover':
case 'mouseup':
{
this.editor_set_ctl_style(obj, type, 'hover');
break;
}
}
break;
}
}
};
/**
* Sets the editor button control style
*
* @var object Button Object
* @var string Control Type
* @var string Control Mode
*/
this.editor_set_ctl_style = function( obj, type, mode )
{
if ( obj.mode != mode )
{
//-----------------------------------------
// Add in -menu class
//-----------------------------------------
var extra = '';
if ( type == 'menu' )
{
extra = '-menu';
}
else if ( type == 'menubutton' )
{
extra = '-menubutton';
}
//-----------------------------------------
// Add in -color if it's a color box
//-----------------------------------------
extra += obj.colorname ? '-color' : '';
//-----------------------------------------
// Add in -emo if it's an emo
//-----------------------------------------
extra += obj.emo_id ? '-emo' : '';
//-----------------------------------------
// Set mote...
//-----------------------------------------
obj.mode = mode;
try
{
switch (mode)
{
case "normal":
{
// Normal
obj.className = 'rte-normal' + extra;
}
break;
case "hover":
{
// Hover
obj.className = 'rte-hover' + extra;
}
break;
case "selected":
case "down":
{
// On
obj.className = 'rte-selected' + extra;
}
break;
}
}
catch (e)
{
}
}
};
/**
* Format Text
*
* @var event Event Object
* @var string Formatted command
* @var string Formatting command extra
*/
this.format_text = function(e, command, arg)
{
e = ipsclass.cancel_bubble( e, true );
//-----------------------------------------
// Special considerations...
//-----------------------------------------
if ( command.match( /resize_/ ) )
{
this.resize_editorbox( command.replace( /.+?resize_(up|down)/, "$1" ) );
}
//-----------------------------------------
// Special considerations...
//-----------------------------------------
if ( command.match( /emoticon/ ) )
{
this.show_all_emoticons();
}
//-----------------------------------------
// Continue...
//-----------------------------------------
this.editor_check_focus();
if ( this[ command ] )
{
var return_val = this[ command ](e);
}
else
{
try
{
var return_val = this.apply_formatting( command, false, (typeof arg == 'undefined' ? true : arg) );
}
catch(e)
{
var return_val = false;
}
}
//-----------------------------------------
// Check focus
//-----------------------------------------
this.editor_check_focus();
return return_val;
};
/**
* STD:
* Create link override
*/
this.createlink = function()
{
var _url = prompt( ipb_global_lang['editor_enter_url'], 'http://' );
if ( ! _url || _url == null || _url == 'http://' )
{
return false;
}
var _text = this.get_selection();
_text = _text ? _text : prompt( ipb_global_lang['editor_enter_title'] );
if( !_text || _text == null )
{
return false;
}
this.wrap_tags( 'url', _url, _text);
};
/**
* STD:
* Insert image override
*/
this.insertimage = function()
{
var _text = this.get_selection();
var _url = prompt( ipb_global_lang['editor_enter_image'], _text ? _text : "http://" );
if( !_url || _url == null || _url == 'http://' )
{
return false;
}
this.wrap_tags( 'img', false, _url );
};
/**
* STD:
* IPB Quote override
*/
this.ipb_quote = function()
{
var _text = this.get_selection();
this.wrap_tags( 'quote', false, _text );
};
/**
* STD:
* IPB code override
*/
this.ipb_code = function()
{
var _text = this.get_selection();
this.wrap_tags( 'code', false, _text );
};
/**
* STD:
* Apply formatting
*/
this.apply_formatting = function(cmd, dialog, argument)
{
// undo & redo array pops
switch (cmd)
{
case 'bold':
case 'italic':
case 'underline':
{
this.wrap_tags(cmd.substr(0, 1), false);
return;
}
case 'justifyleft':
case 'justifycenter':
case 'justifyright':
{
this.wrap_tags(cmd.substr(7), false);
return;
}
case 'indent':
{
this.wrap_tags(cmd, false);
return;
}
case 'createlink':
{
var sel = this.get_selection();
if (sel)
{
this.wrap_tags('url', argument);
}
else
{
this.wrap_tags('url', argument, argument);
}
return;
}
case 'fontname':
{
this.wrap_tags('font', argument);
return;
}
case 'fontsize':
{
this.wrap_tags('size', argument);
return;
}
case 'forecolor':
{
this.wrap_tags('color', argument);
return;
}
case 'backcolor':
{
this.wrap_tags('background', argument);
return;
}
case 'insertimage':
{
this.wrap_tags('img', false, argument);
return;
}
case 'strikethrough':
{
this.wrap_tags('strike', false);
return;
}
case 'superscript':
{
this.wrap_tags('sup', false);
return;
}
case 'subscript':
{
this.wrap_tags('sub', false);
return;
}
case 'removeformat':
return;
}
};
/**
* Wrap Tags
*
* @param string Tag to wrap
* @param boolean Has optional params
* @param string Selected Text
*/
this.wrap_tags = function(tag_name, has_option, selected_text)
{
//-----------------------------------------
// Fix up for HTML use
//-----------------------------------------
var tag_close = tag_name;
//-----------------------------------------
// Got selected text?
//-----------------------------------------
if ( typeof selected_text == 'undefined' )
{
selected_text = this.get_selection();
selected_text = (selected_text === false) ? '' : new String(selected_text);
}
//-----------------------------------------
// Using option?
//-----------------------------------------
if ( has_option === true )
{
var option = prompt( ips_language_array['js_rte_optionals'] ? ips_language_array['js_rte_optionals'] : "Enter the optional arguments for this tag", '');
if ( option )
{
var opentag = this.open_brace + tag_name + '="' + option + '"' + this.close_brace;
}
else
{
return false;
}
}
else if ( has_option !== false )
{
var opentag = this.open_brace + tag_name + '="' + has_option + '"' + this.close_brace;
}
else
{
var opentag = this.open_brace + tag_name + this.close_brace;
}
var closetag = this.open_brace + '/' + tag_close + this.close_brace;
var text = opentag + selected_text + closetag;
this.insert_text( text );
return false;
};
/**
* Wrap tag: Lite
* Quick method of below
*
* @param string Start text
* @param string Close text
*/
this.wrap_tags_lite = function( start_text, close_text )
{
//-----------------------------------------
// Got selected text?
//-----------------------------------------
selected_text = this.get_selection();
selected_text = (selected_text === false) ? '' : new String(selected_text);
this.insert_text( start_text + selected_text + close_text );
return false;
};
/**
* STD:
* Get Editor Contents
*/
this.editor_get_contents = function()
{
return this.editor_document.value;
};
/**
* STD:
* Get Selected Text
*/
this.get_selection = function()
{
if ( typeof(this.editor_document.selectionStart) != 'undefined' )
{
return this.editor_document.value.substr(this.editor_document.selectionStart, this.editor_document.selectionEnd - this.editor_document.selectionStart);
}
else if ( ( document.selection && document.selection.createRange ) || this._ie_cache )
{
return this._ie_cache ? this._ie_cache.text : document.selection.createRange().text;
}
else if ( window.getSelection )
{
return window.getSelection() + '';
}
else
{
return false;
}
};
/**
* STD:
* Insert HTML
*/
this.insert_text = function(text)
{
if( this.editor_check_focus() == false )
{
return false;
}
if (typeof(this.editor_document.selectionStart) != 'undefined')
{
var open = this.editor_document.selectionStart + 0;
var st = this.editor_document.scrollTop;
this.editor_document.value = this.editor_document.value.substr(0, this.editor_document.selectionStart) + text + this.editor_document.value.substr(this.editor_document.selectionEnd);
// Don't adjust selection if we're simply adding <b></b>, etc
if ( ! text.match( new RegExp( "\\" + this.open_brace + "(\\S+?)" + "\\" + this.close_brace + "\\" + this.open_brace + "/(\\S+?)" + "\\" + this.close_brace ) ) )
{
this.editor_document.selectionStart = open;
this.editor_document.selectionEnd = open + text.length;
this.editor_document.scrollTop = st;
}
}
else if ( ( document.selection && document.selection.createRange ) || this._ie_cache )
{
var sel = this._ie_cache ? this._ie_cache : document.selection.createRange();
sel.text = text.replace(/\r?\n/g, '\r\n');
sel.select();
}
else
{
this.editor_document.value += text;
}
this._ie_cache = null;
};
/**
* Show all emoticons
*
* @param string Editor ID
*/
this.show_all_emoticons = function()
{
if ( typeof( this.emoticon_window_id ) != null )
{
this.emoticon_window_id = window.open( ipb_var_base_url + "act=legends&CODE=emoticons&_lite=1&editor_id=" + editor_id,"Legends","width=250,height=500,resizable=yes,scrollbars=yes");
}
else
{
this.emoticon_window_id.focus();
}
return false;
};
/**
* STD:
* Insert an emoticon
*/
this.insert_emoticon = function( emo_id, emo_image, emo_code, event )
{
emo_code = ipsclass.un_htmlspecialchars( emo_code );
this.wrap_tags_lite( " " + emo_code, " ");
if ( this.is_ie )
{
if ( IPS_Lite_Editor[ this.editor_id ].emoticon_window_id != '' && typeof( IPS_Lite_Editor[ this.editor_id ].emoticon_window_id ) != 'undefined' )
{
IPS_Lite_Editor[ this.editor_id ].emoticon_window_id.focus();
}
}
};
/**
* Resize editor
*
* @param string Up (smaller) Down (Larger)
*/
this.resize_editorbox = function( direction )
{
var inc_value = 100;
var current_height = parseInt( this.text_obj.style.height );
var new_height = 0;
current_height = current_height ? current_height : 200;
//-----------------------------------------
// If we're not going smaller than 300...
//-----------------------------------------
if ( current_height >= 50 )
{
if ( direction == 'up' )
{
new_height = current_height - inc_value;
}
else
{
new_height = current_height + inc_value;
}
if ( new_height > 149 )
{
this.text_obj.style.height = new_height + 'px';
}
}
};
};
// =============================================================================
// Text editor event functions
// =============================================================================
/**
* Class initialization
*/
function ips_editor_events()
{
}
/**
* Handles mouse events for buttons
*
* @param event Event Object
*/
ips_editor_events.prototype.button_onmouse_event = function(e)
{
if ( is_ie )
{
e = ipsclass.cancel_bubble(e, true);
}
if ( e.type == 'click' )
{
IPS_Lite_Editor[this.editor_id].format_text(e, this.cmd, false, true);
}
IPS_Lite_Editor[this.editor_id].set_button_context(this, e.type);
};
/**
* Sets the focus for the editor window
*
* @param event Event Object
*/
ips_editor_events.prototype.editor_window_onfocus = function(e)
{
this.has_focus = true;
};
/**
* Sets unfocus for the editor window
*
* @param event Event Object
*/
ips_editor_events.prototype.editor_window_onblur = function(e)
{
this.has_focus = false;
};
/**
* Handles editor document key-press event
*
* @param event Event Object
*/
ips_editor_events.prototype.editor_document_onkeypress = function(e)
{
if ( e.ctrlKey )
{
switch (String.fromCharCode(e.charCode).toLowerCase())
{
case 'b': cmd = 'bold'; break;
case 'i': cmd = 'italic'; break;
case 'u': cmd = 'underline'; break;
default: return;
}
e.preventDefault();
IPS_Lite_Editor[this.editor_id].apply_formatting(cmd, false, null);
return false;
}
};
@@ -0,0 +1,397 @@
//------------------------------------------------------------------------------
// 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
//------------------------------------------------------------------------------
/*--------------------------------------------*/
// 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');
}
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();
//------------------------------------------------
// Add the shadow
//------------------------------------------------
add_shadow('loading-layer-shadow', 'loading-layer-inner');
}
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;
};
/*--------------------------------------------*/
// Execute javascript returned from the HTML
/*--------------------------------------------*/
ajax_request.prototype.execute_javascript = function( source_code )
{
//-----------------------------------------
// INIT
//-----------------------------------------
var text_blocks = new Array();
var max_iteration = 50;
var i = 0;
//-----------------------------------------
// Got javascript?
// We force [^`] to make it match any character
// except a black-tick as JS doesn't have
// single line pattern matching.
//-----------------------------------------
while ( _match = source_code.match( new RegExp( "<script\\s+?type=['\"]text/javascript['\"]>([^`]+?)</script>", "i" ) ) )
{
i++;
if ( i >= max_iteration )
{
break;
}
else
{
text_blocks[ text_blocks.length ] = _match[1];
source_code = source_code.replace( _match[0], '' );
}
}
try
{
if ( text_blocks.length )
{
for ( i = 0 ; i < text_blocks.length ; i++ )
{
eval( text_blocks[ i ] );
}
}
}
catch(error)
{
}
};
/*--------------------------------------------*/
// IPB thinks we can use fancy JS, lets see...
/*--------------------------------------------*/
try
{
if ( use_enhanced_js )
{
use_enhanced_js = ajax_request.prototype.xml_init() ? 1 : 0;
}
}
catch(error)
{
var use_enhanced_js = 0;
}