User:Xbony2/common/nei.js

/** var isHovering = false; var gEvent = null;
 * Mimics having NEI installed; pressing "r" while hovering over over an item will take you to its page (hopefully with its recipe), and pressing "u" will see what links to it (which can include crafting components; more so if a lazy-loaded navbox is used)
 * Is proof-of-concept; not really recommended for serious usage.
 * @author User:Xbony2
 * @author User:Xbony2

$('.grid').on('mouseenter.minetip', function(event){	isHovering = true;	gEvent = event; });

$('.grid').on('mouseleave.minetip', function(event){	isHovering = false; });

$(document).on('keydown', function(event){	if(!mw.config.get('wgPageName').startsWith("Special:")){		if(isHovering && event.which == 82 && gEvent.currentTarget.firstChild.href !== undefined){//"R"			window.location = gEvent.currentTarget.firstChild.href;		}else if(isHovering && event.which == 85 && gEvent.currentTarget.getAttribute("data-minetip-title") !== undefined){//"U"			window.location = 'http://ftb.gamepedia.com/index.php?title=Special%3AWhatLinksHere&target=' + mw.util.rawurlencode(gEvent.currentTarget.getAttribute("data-minetip-title")) + '&namespace=0';		}	} });