⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vbulletin_menu.js

📁 这是从网上下载下来的一个计算程序
💻 JS
📖 第 1 页 / 共 2 页
字号:
	vBulletin.events["vBmenuShow_" + this.controlkey].fire(this.controlkey);	vBulletin.events.vBmenuShow.fire(this.controlkey);};/*** Position the menu relative to a reference element** @param	object	Reference HTML element*/vB_Popup_Menu.prototype.set_menu_position = function(obj){	this.pos = this.fetch_offset(obj);	this.leftpx = this.pos['left'];	this.toppx = this.pos['top'] + obj.offsetHeight;	if ((this.leftpx + this.menuobj.offsetWidth) >= document.body.clientWidth && (this.leftpx + obj.offsetWidth - this.menuobj.offsetWidth) > 0)	{		this.leftpx = this.leftpx + obj.offsetWidth - this.menuobj.offsetWidth;		this.direction = 'right';	}	else	{		this.direction = 'left'	}	this.menuobj.style.left = this.leftpx + 'px';	this.menuobj.style.top  = this.toppx + 'px';};/*** Hide the menu*/vB_Popup_Menu.prototype.hide = function(e){	if (e && e.button && e.button != 1)	{		// get around some context menu issues etc.		return true;	}	this.stop_slide();	this.menuobj.style.display = 'none';	this.handle_overlaps(false);	if (this.controlobj.editorid)	{		this.controlobj.state = false;		//this.controlobj.editor.menu_context(this.controlobj, 'mouseout');		vB_Editor[this.controlobj.editorid].menu_context(this.controlobj, 'mouseout');	}	vBmenu.activemenu = null;	vBulletin.events["vBmenuHide_" + this.controlkey].fire(this.controlkey);	vBulletin.events.vBmenuHide.fire(this.controlkey);};/*** Hover behaviour for control object*/vB_Popup_Menu.prototype.hover = function(obj){	if (vBmenu.activemenu != null)	{		if (vBmenu.menus[vBmenu.activemenu].controlkey != this.id)		{			this.show(obj, true);		}	}};/*** Slides menu open** @param	integer	Clip X* @param	integer	Clip Y* @param	integer	Opacity (0-100)*/vB_Popup_Menu.prototype.slide = function(clipX, clipY, opacity){	if (this.direction == 'left' && (clipX < this.menuobj.offsetWidth || clipY < this.menuobj.offsetHeight))	{		if (vBmenu.open_fade && is_ie)		{			opacity += 10;			this.menuobj.filters.item('DXImageTransform.Microsoft.alpha').opacity = opacity;		}		clipX += this.intervalX;		clipY += this.intervalY;		this.menuobj.style.clip = "rect(auto, " + clipX + "px, " + clipY + "px, auto)";		this.slidetimer = setTimeout("vBmenu.menus[vBmenu.activemenu].slide(" + clipX + ", " + clipY + ", " + opacity + ");", 0);	}	else if (this.direction == 'right' && (clipX > 0 || clipY < this.menuobj.offsetHeight))	{		if (vBmenu.open_fade && is_ie)		{			opacity += 10;			menuobj.filters.item('DXImageTransform.Microsoft.alpha').opacity = opacity;		}		clipX -= this.intervalX;		clipY += this.intervalY;		this.menuobj.style.clip = "rect(auto, " + this.menuobj.offsetWidth + "px, " + clipY + "px, " + clipX + "px)";		this.slidetimer = setTimeout("vBmenu.menus[vBmenu.activemenu].slide(" + clipX + ", " + clipY + ", " + opacity + ");", 0);	}	else	{		this.stop_slide();	}};/*** Abort menu slider*/vB_Popup_Menu.prototype.stop_slide = function(){	clearTimeout(this.slidetimer);	this.menuobj.style.clip = 'rect(auto, auto, auto, auto)';	if (vBmenu.open_fade && is_ie)	{		this.menuobj.filters.item('DXImageTransform.Microsoft.alpha').opacity = 100;	}};/*** Fetch offset of an object** @param	object	The object to be measured** @return	array	The measured offsets left/top*/vB_Popup_Menu.prototype.fetch_offset = function(obj){	var left_offset = obj.offsetLeft;	var top_offset = obj.offsetTop;	while ((obj = obj.offsetParent) != null)	{		left_offset += obj.offsetLeft;		top_offset += obj.offsetTop;	}	return { 'left' : left_offset, 'top' : top_offset };};/*** Detect an overlap of an object and a menu** @param	object	Object to be tested for overlap* @param	array	Array of dimensions for menu object** @return	boolean	True if overlap*/vB_Popup_Menu.prototype.overlaps = function(obj, m){	var s = new Array();	var pos = this.fetch_offset(obj);	s['L'] = pos['left'];	s['T'] = pos['top'];	s['R'] = s['L'] + obj.offsetWidth;	s['B'] = s['T'] + obj.offsetHeight;	if (s['L'] > m['R'] || s['R'] < m['L'] || s['T'] > m['B'] || s['B'] < m['T'])	{		return false;	}	return true;};/*** Handle IE overlapping <select> elements** @param	boolean	Hide (true) or show (false) overlapping <select> elements*/vB_Popup_Menu.prototype.handle_overlaps = function(dohide){	if (is_ie && !is_ie7)	{		var selects = fetch_tags(document, 'select');		if (dohide)		{			var menuarea = new Array(); menuarea = {				'L' : this.leftpx,				'R' : this.leftpx + this.menuobj.offsetWidth,				'T' : this.toppx,				'B' : this.toppx + this.menuobj.offsetHeight			};			for (var i = 0; i < selects.length; i++)			{				if (this.overlaps(selects[i], menuarea))				{					var hide = true;					var s = selects[i];					while (s = s.parentNode)					{						if (s.className == 'vbmenu_popup')						{							hide = false;							break;						}					}					if (hide)					{						selects[i].style.visibility = 'hidden';						array_push(vBmenu.hidden_selects, i);					}				}			}		}		else		{			while (true)			{				var i = array_pop(vBmenu.hidden_selects);				if (typeof i == 'undefined' || i == null)				{					break;				}				else				{					selects[i].style.visibility = 'visible';				}			}		}	}};// #############################################################################// Menu event handler functions/*** Class containing menu popup event handlers*/function vB_Popup_Events(){};/*** Handles control object click events*/vB_Popup_Events.prototype.controlobj_onclick = function(e){	if (typeof do_an_e == 'function')	{		do_an_e(e);		if (vBmenu.activemenu == null || vBmenu.menus[vBmenu.activemenu].controlkey != this.id)		{			vBmenu.menus[this.id].show(this);		}		else		{			vBmenu.menus[this.id].hide();		}	}};/*** Handles control object mouseover events*/vB_Popup_Events.prototype.controlobj_onmouseover = function(e){	if (typeof do_an_e == 'function')	{		do_an_e(e);		vBmenu.menus[this.id].hover(this);	}};/*** Handles menu option click events for options with onclick events*/vB_Popup_Events.prototype.menuoption_onclick_function = function(e){	this.ofunc(e);	vBmenu.menus[this.controlkey].hide();};/*** Handles menu option click events for options containing links*/vB_Popup_Events.prototype.menuoption_onclick_link = function(e){	e = e ? e : window.event;	if (e.shiftKey || (this.target != null && this.target != '' && this.target.toLowerCase() != '_self'))	{		if (this.target != null && this.target.charAt(0) != '_')		{			window.open(this.href, this.target);		}		else		{			window.open(this.href);		}	}	else	{		window.location = this.href;	}	// Safari has "issues" with resetting what was clicked on, super minor and I dont care	e.cancelBubble = true;	if (e.stopPropagation) e.stopPropagation();	if (e.preventDefault) e.preventDefault();	vBmenu.menus[this.controlkey].hide();	return false;};/*** Handles menu option mouseover events*/vB_Popup_Events.prototype.menuoption_onmouseover = function(e){	this.className = 'vbmenu_hilite' + (this.islink ? ' vbmenu_hilite_alink' : '');	this.style.cursor = pointer_cursor;};/*** Handles menu option mouseout events*/vB_Popup_Events.prototype.menuoption_onmouseout = function(e){	this.className = 'vbmenu_option' + (this.islink ? ' vbmenu_option_alink' : '');	this.style.cursor = 'default';};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -