🏠 Home 

Alldatasheet.com: Decrapify and move search r###lts to top

Move search to top, remove questionably-useful inventory and distributor search, remove gratuitous line breaks.


Install this script?
  1. // ==UserScript==
  2. // @name Alldatasheet.com: Decrapify and move search r###lts to top
  3. // @description Move search to top, remove questionably-useful inventory and distributor search, remove gratuitous line breaks.
  4. // @namespace giferrari.net
  5. // @include http://*.alldatasheet.com/*
  6. // @version 2
  7. // @grant none
  8. // @require http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.js
  9. // ==/UserScript==
  10. // Of note: almost every darn thing on this page is wrapped in its own table.
  11. // They went really overboard here... even the headers are their own tables.
  12. // This is why there's a bunch of .closest('table') going on.
  13. // *** Remove gratuitous line breaks. ***
  14. $('body br').remove();
  15. // *** Prevent gratuitous new windows
  16. $('[target="_blank"]').prop('target', '');
  17. // *** Remove the inventory sections ***.
  18. // Hide the headers.
  19. var inventoryHeaders = $('.h2view:contains("Inventory")').closest('table');
  20. inventoryHeaders.hide();
  21. //Now hide the actual inventory tables.
  22. inventoryHeaders.next('table').hide();
  23. // Since we only have one section remaining, hide the header for the real datasheet section.
  24. $('.h2view:contains(" Datasheets")').closest('table').hide();
  25. // *** Move the datasheet r###lts to the top ***
  26. // Easy way is to move the search refinement box down to where the link share box is.
  27. // Find some bits of the DOM we need.
  28. var datasheetR###ltsHeader = $('td:contains("Search ")').closest('table');
  29. var datasheetR###lts = datasheetR###ltsHeader.next('table');
  30. var searchRefinementBox = $('#tdnews').closest('table');
  31. var linkBox = $('form[name="Linkurl"]').closest('table');
  32. // Move the search refinement box down by the link share box at the bottom.
  33. linkBox.prev().before(searchRefinementBox);
  34. $('#layer1').remove();
  35. $('#abc').remove(); // Yes, there's a random DIV with an ID of abc. Nix.
  36. // Get rid of manufacturer noise
  37. var manufacturersHeaderTable = $('td b').filter(function() { return $(this).text().endsWith(' Manufacturer'); }).closest('table');
  38. manufacturersHeaderTable.next('table').remove();
  39. manufacturersHeaderTable.remove();
  40. $('.h2view:contains(" Distributor")').closest('table').remove();