Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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