From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.

$(document).ready(addRefTitles);



function addRefTitles()

{

	var refs = $('.reference');

	var reflist = $('li[id^="cite_note"]');

	var i;

	

	for(i =0; i < refs.length; i++)

	{

		var match = findMatches(refsi], reflist);

		if(match != null)

		{

                        var newTitle = $('#' + match.id + ' > span.reference-text').text()

			refsi].title = newTitle;

			refsi].children0].title = newTitle;

		}

	}

}



function findMatches(ref, reflist)

{

	var i;

	var refId = ref.id.slice(9);

	if(refId.search("_") != -1)

	{

		refId  = refId.slice(0, refId.lastIndexOf('_')) + '-' + refId.slice(refId.lastIndexOf("_")+1, refId.lastIndexOf("-"));

	}

	for(i=0; i < reflist.length; i++)

	{

		var reflistId = reflisti].id.slice(10);

		

		if(refId == reflistId) 

		{

			return reflisti];

		}

	}

	return null;

}