/*eslint-env es6*/ /*eslint no-console: "off"*/ /** * Hide a primary navigation item by href * @param {string|Array} hrefs The link that should be hidden */ export function hide_primary(hrefs) { if(typeof hrefs === 'string' || hrefs instanceof String){ hrefs = [hrefs]; } if(typeof hrefs === 'object' && Array.isArray(hrefs)){ let css = '' ; for(const ix in hrefs){ const href = hrefs[ix]; css += ` li > a[href*="${href}"] { display: none !important; } `; css += ` #usernavigation a[href*="${href}"] { display: none !important; } `; } const element = document.createElement('style'); element.setAttribute('type', 'text/css'); if ('textContent' in element) { element.textContent = css; } else { element.styleSheet.cssText = css; } document.head.appendChild(element); } }