All pastes #581770 Raw Edit

Something

public text v1 · immutable
·published 2007-06-21 18:11 UTC
rendered paste body
var linkHolder = {
	'<a class="wiki" href="http://forums.whirlpool.net.au/index.cfm?a=wiki&tag=Xbox">Xbox</a>' : ['Xbox'],
	'<a class="wiki" href="http://forums.whirlpool.net.au/index.cfm?a=wiki&tag=Xbox360_Live__Tags">Xbox360_Live__Tags</a>' : ['Xbox','Live','Tags'],
	'<a class="wiki" href="http://forums.whirlpool.net.au/index.cfm?a=wiki&tag=Xbox_FAQ">Xbox_FAQ</a>' : ['Xbox','FAQ'],
	'<a class="wiki" href="http://forums.whirlpool.net.au/index.cfm?a=wiki&tag=xf_live">xf_live</a>' : ['Xbox','Live']
}


$('.bodytext p:not(".wcauth")').each(function(){
	var currentP = $(this);
    for (var item in linkHolder) {

        for(var z=0; z<linkHolder[item].length; z++){

			if(currentP.html().indexOf(linkHolder[item][z]) > -1){

				if((currentP.html().indexOf(' class="'+linkHolder[item][z]+'wikiOverlay') < 0) && (currentP.html().indexOf('wikiOverlay') > -1)){	

					var wOnum = {};
					var getwOvers = currentP.children('div[@class$=wikiOverlay]');

						var this1 = $(this);

						wOnum['temp' + i] = this1.children('a').get();

						this1.children('a').remove();					
					});

					currentP.html(currentP.html().replace(linkHolder[item][z], '<div ' +
					'style="display:none;border:red 1px solid; position:absolute;width:200px;height:100px;background-color:white;" ' +
					'class="'+linkHolder[item][z]+'wikiOverlay">' + item + '</div><span '+
					'style="cursor:pointer;text-decoration:underline;color:red;" class="wItem">' + linkHolder[item][z]+ '</span>'));

					getwOvers.each(function(q){
						
						var this2 = $(this);
						this2.append(wOnum['temp'+q]);	
					});
					
				}				
				else if(currentP.html().indexOf(' class="'+linkHolder[item][z]+'wikiOverlay') < 0){	
		
					currentP.html(currentP.html().replace(linkHolder[item][z], '<div ' +
					'style="display:none;border:red 1px solid; position:absolute;width:200px;height:100px;background-color:white;" ' +
					'class="'+linkHolder[item][z]+'wikiOverlay">' + item + '</div><span '+
					'style="cursor:pointer;text-decoration:underline;color:red;" class="wItem">' + linkHolder[item][z]+ '</span>'));
				}
				else {

					currentP.children('.'+linkHolder[item][z]+'wikiOverlay').prepend(item);

				}

			}

        }
    }
});


$('.wItem').mouseup( function(evt) {
	var ey = evt.pageY -210;
	var eX = evt.pageX -25;
	$(this).prev().toggle().css({top: ey,left: eX});
});