Jump to content

User:Relentlessly/hiderefs.js

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.
if ($('.mw-ext-cite-cite_section_preview_references').length) {
	$('#wikiPreview ol.references').each(function(i, ol) {
	  var button = $('<a href="#"/>')
	    .css(
	      {
	        float: 'right',
	        display: 'block',
	        width: '8em',
	        background: '#ddd',
	        padding: '5px',
	        'text-align': 'center',
	        border: '1px solid blue',
	        'border-radius': '5px'
	      }
	    )
	    .text('Show/hide refs')
	    .click(function(e) {
	      $(ol).slideToggle();
	      e.preventDefault();
	      $(this).blur();
	    });
	  $(this).slideUp().before(button);
	});
}