User:I9606/swl viewer.js

// User scripts

//operates on the edit page

//operates on pages where it can find semantic wiki links $(document).ready(function{ var subject = document.title.split("-")[0];

var timer; // //  // protein kinase A //

//When you mouse over a SWL indicated by its 'swl' class, get and show the elelements of the link $(function {  $(".swl").hover(function { var predicate = ""; var object = ""; //add the holders and set ids for them //add the info box holder //in case they use spaces it will get wacky var classList =$("span",this).attr('class').split(/\s+/); $.each( classList, function(index, item){  		predicate += item+" ";	}); predicate = $.trim(predicate); //get semantic information out object = $("a",this).attr('title'); var link = ""+predicate+""; //display add the information box $(this).append(''+ subject +" "+link+" " + object +' (close) '); //add a delay if(timer) { clearTimeout(timer); timer = null }       timer = setTimeout(function {		//Fade in Background to hide page		//render a clickable pop up window  		//$('#fade').css({'filter' : 'alpha(opacity=.95)'}).fadeIn;    		//$('body').append(' ');     	$("#popup_swl").css({'filter' : 'alpha(opacity=10)'}).fadeIn;    	$("#popup_swl").position({ top: 10, left: 30 }); //finish timer, set time to wait    }, 1500) }, //handle mouse out function { //   $("#popup_swl").hide; } );

//Close Popups and Fade Layer, body $('a.close').live('click', function { //When clicking on the close or fade layer...   $('#fade, .popup_block').fadeOut(function { $('#fade, a.close').remove; //fade them both out $("#popup_swl").remove; });   return false; }); });

});