progman32 / Clean up - Move results to top, hide extras.

// ==UserScript==
// @name        Clean up - Move results to top, hide extras.
// @namespace   giferrari.net
// @include     http://www.alldatasheet.com/view.jsp*
// @version     1
// @grant       none
// @require       http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.js
// ==/UserScript==

// Of note: almost every darn thing on this page is wrapped in its own table.
// They went really overboard here... even the headers are their own tables.
// This is why there's a bunch of .closest('table') going on.

// *** Remove gratuitous line breaks. ***
$('body br').remove()


// *** Remove the inventory sections ***.

// Hide the headers.
var inventoryHeaders = $('.h2view:contains("Inventory")').closest('table');
inventoryHeaders.hide();
//Now hide the actual inventory tables.
inventoryHeaders.next('table').hide();
// Since we only have one section remaining, hide the header for the real datasheet section.
$('.h2view:contains(" Datasheets")').closest('table').hide();


// *** Move the datasheet results to the top ***
// Easy way is to move the search refinement box down to where the link share box is.

// Find some bits of the DOM we need.
var datasheetResultsHeader = $('td:contains("Search ")').closest('table');
var datasheetResults = datasheetResultsHeader.next('table');

var searchRefinementBox = $('#tdnews').closest('table');
var linkBox = $('#Linkurl').closest('table');

// Move the search refinement box down by the link share box at the bottom.
linkBox.prev().before(searchRefinementBox);