Version 2.2.0 RC-1

This commit is contained in:
Neo committed 2025-12-19 00:22:37 -08:00
1 parent f73f8bff6d
commit 22f1b963ee
1034 files changed
+178610 -70897

No files matched your search

+1 -447
View File
@@ -1,447 +1 @@
/*-------------------------------------------------------------------------*/
// IPS BASIC MENU CLASS
// (c) 2005 Invision Power Services, Inc
// ASSUMES "ips_global.js" has been loaded
/*-------------------------------------------------------------------------*/
var menu_registered = new Array();
var menu_openfuncs = new Array();
var menu_built = new Array();
var menu_open_menus = new Array();
var menu_cur_open = false;
/*-------------------------------------------------------------------------*/
// menu_do_global_init: Initiate all registered menus in HTML
/*-------------------------------------------------------------------------*/
function menu_do_global_init()
{
if ( menu_registered.length > 0 )
{
for( var i in menu_registered )
{
menu_init( menu_registered[i] );
}
//----------------------------------
// Close all menus on click
//----------------------------------
document.onclick = menu_action_close;
}
}
/*-------------------------------------------------------------------------*/
// menu_init: Initiate a single menu
/*-------------------------------------------------------------------------*/
function menu_init(cid)
{
var mid = _menu_get_base_name(cid) + "_menu";
var mobj = my_getbyid(mid);
if ( document.getElementsByTagName && mobj )
{
//----------------------------------
// Control object (link / img, etc)
//----------------------------------
var cobj = my_getbyid(cid);
// Change cursor to show link
try
{
cobj.style.cursor = "pointer";
}
catch(e)
{
cobj.style.cursor = "hand";
}
cobj.unselectable = true;
cobj.onclick = _event_menu_click;
cobj.onmouseover = _event_menu_mouseover;
//----------------------------------
// Save CPU - already init?
//----------------------------------
if ( typeof( menu_built[mid]) != "undefined" )
{
return;
}
//----------------------------------
// Pop-up menu obj (hidden div)
//----------------------------------
var pobj = my_getbyid(mid);
// Set up style defaults
pobj.style.display = "none";
pobj.style.position = "absolute";
pobj.style.left = "0px";
pobj.style.top = "0px";
pobj.onclick = _cancel_bubble;
pobj.zIndex = 1000;
menu_built[mid] = true;
}
}
/*-------------------------------------------------------------------------*/
// Register menu control ID (add to array)
/*-------------------------------------------------------------------------*/
function menu_register(cid, callback)
{
if ( document.getElementsByTagName )
{
var cobj = my_getbyid(cid);
if (cobj)
{
menu_registered[menu_registered.length] = cid;
if ( callback )
{
menu_openfuncs[ cobj ] = callback;
}
return true;
}
}
return false;
}
/*-------------------------------------------------------------------------*/
// ACTION: If registered control ID clicked, open menu
/*-------------------------------------------------------------------------*/
function menu_action_open(e)
{
var openmenu = menu_cur_open;
var negpad = true;
//----------------------------------
// Close current menu(s)
//----------------------------------
menu_action_close();
//----------------------------------
// Save CPU - cur open clicked?
//----------------------------------
if ( openmenu == e.id )
{
return false;
}
//----------------------------------
// Get ID of menu DIV to show
//----------------------------------
var mid = _menu_get_base_name(e.id) + "_menu";
var mobj = my_getbyid(mid);
var left_px = _get_obj_leftpos(e);
var top_px = _get_obj_toppos(e) + e.offsetHeight;
var callbackobj = my_getbyid( e.id );
var ifid = e.id;
menu_open_menus[e.id] = true;
menu_cur_open = e.id;
//----------------------------------
// Show menu DIV
//----------------------------------
mobj.style.display = "";
//----------------------------------
// Try and keep it on screen
//----------------------------------
var width = parseInt( mobj.style.width ) ? parseInt( mobj.style.width ) : mobj.offsetWidth;
if ( (left_px + width) >= document.body.clientWidth )
{
left_px = left_px + e.offsetWidth - width;
negpad = false;
}
//----------------------------------
// IE needs a tweak...
//----------------------------------
if ( is_ie )
{
left_px += ( negpad ) ? -2 : 2;
}
//----------------------------------
// Finalize menu position
//----------------------------------
mobj.style.left = left_px + "px";
mobj.style.top = top_px + "px";
mobj.style.zIndex = 100;
//----------------------------------
// Run a custom function?
//----------------------------------
if ( menu_openfuncs[ callbackobj ] )
{
eval( menu_openfuncs[ callbackobj ] );
}
//----------------------------------
// Workaround for IE bug which shows
// select boxes and other windows GUI
// over divs. SHOW IFRAME
//----------------------------------
if ( is_ie )
{
try
{
if ( ! document.getElementById( 'if_' + e.id ) )
{
var iframeobj = document.createElement('iframe');
iframeobj.src = 'javascript;';
iframeobj.id = 'if_' + e.id;
document.getElementsByTagName('body').appendChild( iframeobj );
}
else
{
var iframeobj = document.getElementById( 'if_' + e.id );
}
iframeobj.scrolling = 'no';
iframeobj.frameborder = 'no';
iframeobj.className = 'iframeshim';
iframeobj.style.position = 'absolute';
iframeobj.style.width = parseInt(mobj.offsetWidth) + 'px';
iframeobj.style.height = parseInt(mobj.offsetHeight) + 'px';
iframeobj.style.top = mobj.style.top;
iframeobj.style.left = mobj.style.left;
iframeobj.style.zIndex = 99;
iframeobj.style.display = "block";
}
catch(e)
{
//alert(e); // Oh dear, someones stolen the iframe
}
}
//----------------------------------
// Work around for safari which doesnt
// allow a hrefs top be clickable in
// a pop up div
//----------------------------------
if ( is_safari )
{
try
{
mlinks = mobj.getElementsByTagName('a');
for ( var i = 0 ; i <= mlinks.length ; i++ )
{
//----------------------------------
// Ignore non links and links that end with #
// As safari likes to do that with href='#' links
//----------------------------------
if ( mlinks[i].href && ( mlinks[i].href.indexOf( '#', 0 ) != (mlinks[i].href.length - 1) ) )
{
mlinks[i].onmousedown = _safari_onclick_handler;
mlinks[i].id = 'saf-link-' + mid + i;
}
}
}
catch( e )
{
//alert( e );
}
}
return false;
}
/*-------------------------------------------------------------------------*/
// Safari: bug fix
/*-------------------------------------------------------------------------*/
function _safari_onclick_handler()
{
if ( this.id )
{
window.location = document.getElementById( this.id ).href;
}
}
/*-------------------------------------------------------------------------*/
// ACTION: Close all open menus
/*-------------------------------------------------------------------------*/
function menu_action_close()
{
if ( menu_cur_open )
{
for ( i in menu_open_menus )
{
my_getbyid(_menu_get_base_name(i) + "_menu").style.display = "none";
//----------------------------------
// Workaround for IE bug which shows
// select boxes and other windows GUI
// over divs. Hide IFRAME
//----------------------------------
if ( is_ie )
{
try
{
document.getElementById( 'if_' + i ).style.display = "none";
}
catch(e)
{
//alert(e);// Oh dear, someones stolen the iframe
}
}
menu_open_menus[i] = false;
}
}
menu_cur_open = false;
}
/*-------------------------------------------------------------------------*/
// ACTION: If menu open and hover over another cid, close cur open new
/*-------------------------------------------------------------------------*/
function menu_action_hover(e)
{
for ( i in menu_open_menus )
{
if (menu_open_menus[i] == true && i != e.id)
{
menu_action_open(e);
return;
}
}
}
/*-------------------------------------------------------------------------*/
// Prevent browser bubblin'
/*-------------------------------------------------------------------------*/
function _cancel_bubble(obj, extra)
{
if ( ! obj || is_ie)
{
if ( extra )
{
window.event.returnValue = false;
}
window.event.cancelBubble = true;
return window.event;
}
else
{
if (obj.target.type == 'submit')
{
obj.target.form.submit();
}
obj.stopPropagation();
if ( extra )
{
obj.preventDefault();
}
return obj;
}
}
/*-------------------------------------------------------------------------*/
// EVENT : Mouse over menu
/*-------------------------------------------------------------------------*/
function _event_menu_mouseover(e)
{
e = _cancel_bubble(e, true);
menu_action_hover(this);
}
/*-------------------------------------------------------------------------*/
// EVENT: Menu click
/*-------------------------------------------------------------------------*/
function _event_menu_click(e)
{
e = _cancel_bubble(e, true);
menu_action_open(this);
}
/*-------------------------------------------------------------------------*/
// Get menu basename
/*-------------------------------------------------------------------------*/
function _menu_get_base_name(cid)
{
var endpos = cid.indexOf(".");
if (endpos != -1)
{
return cid.substr(0, endpos);
}
else
{
return cid;
}
}
/*-------------------------------------------------------------------------*/
// Get left posititon of object
/*-------------------------------------------------------------------------*/
function _get_obj_leftpos(obj)
{
var left = obj.offsetLeft;
while( (obj = obj.offsetParent) != null )
{
left += obj.offsetLeft;
}
return left;
}
/*-------------------------------------------------------------------------*/
// Get top position of object
/*-------------------------------------------------------------------------*/
function _get_obj_toppos(obj)
{
var top = obj.offsetTop;
while( (obj = obj.offsetParent) != null )
{
top += obj.offsetTop;
}
return top;
}
ipsmenu=new ips_menu();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.dynamic_register=new Array();this.menu_cur_open=null;this.dynamic_html=null;}ips_menu.prototype.register=function(cid,callback,menu_over_css,menu_out_css){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];};ips_menu.prototype.close=function(){if(this.menu_cur_open){this.menu_registered[this.menu_cur_open].close();}};function ips_menu_class(cid){this.cid=cid;this.initialized=false;this.init_control_object();this.init_menu();};ips_menu_class.prototype.init_control_object=function(){this.cid_obj=document.getElementById(this.cid);try{this.cid_obj.style.cursor="pointer";}catch(e){this.cid_obj.style.cursor="hand";}this.cid_obj.unselectable=true;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.prototype.init_menu=function(){this.cid_menu_obj=document.getElementById(this.cid+'_menu');if(this.cid_menu_obj){if(this.initialized){return;}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.prototype.open=function(obj){if(!this.cid_menu_obj){this.initialized=false;this.init_menu();}if(ipsmenu.menu_cur_open!=null){ipsmenu.menu_registered[ipsmenu.menu_cur_open].close();}if(ipsmenu.menu_cur_open==obj.id){return false;}ipsmenu.menu_cur_open=obj.id;var left_px=ipsclass.get_obj_leftpos(obj);var top_px=ipsclass.get_obj_toppos(obj)+obj.offsetHeight;var ifid=obj.id;if(is_safari){top_px+=20;}this.cid_menu_obj.style.zIndex=-1;this.cid_menu_obj.style.display="";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;}if(is_moz){top_px-=1;}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;if(ipsmenu.menu_openfuncs[obj.id]){eval(ipsmenu.menu_openfuncs[obj.id]);}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){}}if(is_safari){try{mlinks=this.cid_menu_obj.getElementsByTagName('a');for(var i=0;i<=mlinks.length;i++){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){}}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.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];}}if(is_ie){try{document.getElementById('if_'+this.cid).style.display="none";}catch(error){}}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');}};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);}}};function ips_menu_events(){};ips_menu_events.prototype.event_safari_onclick_handler=function(){if(this.id){window.location=document.getElementById(this.id).href;}};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];}};ips_menu_events.prototype.event_onmouseout=function(e){e=ipsclass.cancel_bubble(e,true);if(ipsmenu.menu_out_css[this.id]&&ipsmenu.mLine truncated