Skip to content

Instantly share code, notes, and snippets.

@aysiu
Last active March 3, 2017 19:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aysiu/22175a1bec769b50fef805b4bbe877e6 to your computer and use it in GitHub Desktop.
Save aysiu/22175a1bec769b50fef805b4bbe877e6 to your computer and use it in GitHub Desktop.
Hides optional items in Managed Software Center
<script>
// Put this at the top of the footer_template.html
// Get the page name
var current_page=document.getElementsByClassName('title')[0].getElementsByTagName('H2')[0].innerHTML;
// If the page name is All items or Featured items
if ( current_page == "All items" || current_page == "Featured items"){
// Create an array of optional items to hide
// These are just examples. Obviously, you'd put in the names of items you wanted to hide
items_to_omit=["Skype", "Xcode", "YemuZip"];
// Get an array of img tags for optional items
var optional_items = document.getElementsByTagName('img');
// Loop through the array of img tags
for(var i = 0; i < optional_items.length; i++)
{
// Find the item name based on the img src
var item_name=optional_items[i].src.split("icons/")[1].replace(".png","");
// If the items to omit array contains the item name...
if (items_to_omit.includes(item_name)){
// ... remove the whole div that contains that item
optional_items[i].parentNode.parentNode.parentNode.parentNode.removeChild(optional_items[i].parentNode.parentNode.parentNode);
}
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment