1 line
1.9 KiB
Plaintext
1 line
1.9 KiB
Plaintext
![]() |
{"version":3,"file":"primary-nav-tools.min.js","sources":["../src/primary-nav-tools.js"],"sourcesContent":["/*eslint no-var: \"error\" */\n/*eslint no-unused-vars: \"off\" */\n/*eslint linebreak-style: \"off\" */\n/*eslint no-trailing-spaces: \"off\" */\n/*eslint-env es6*/\n// Put this file in path/to/plugin/amd/src\n// You can call it anything you like\nimport Debugger from './debugger';\nlet debug = new Debugger(\"primary-nav-tools\");\ndebug.enable();\n\n/**\n * Hide a primary navigation item by href\n * @param {string|Array} hrefs The link that should be hidden\n */\nexport function hide_primary(hrefs) {\n let element = document.createElement('style');\n document.head.appendChild(element);\n let sheet = element.sheet;\n\n if(typeof hrefs === 'string' || hrefs instanceof String){\n hrefs = [hrefs];\n }\n\n if(typeof hrefs === 'object' && Array.isArray(hrefs)){\n for(const ix in hrefs){\n const href = hrefs[ix];\n debug.info(\"Hiding\",href);\n let style = `\n .primary-navigation li.nav-item > a[href*=\"${href}\"] {\n display: none;\n }\n `;\n debug.info(\"Adding style\",style);\n\n sheet.insertRule(style, sheet.cssRules.length);\n }\n }\n debug.info(\"stylesheet\",sheet);\n}\n"],"names":["hrefs","element","document","createElement","head","appendChild","sheet","String","_typeof","Array","isArray","ix","href","debug","info","style","insertRule","cssRules","length","enable"],"mappings":"+cAe6BA,WACrBC,QAAUC,SAASC,cAAc,SACrCD,SAASE,KAAKC,YAAYJ,aACtBK,MAAQL,QAAQK,OAEA,iBAAVN,OAAsBA,iBAAiBO,UAC7CP,MAAQ,CAACA,WAGO,WAAjBQ,QAAOR,QAAsBS,MAAMC,QAAQV,WACtC,IAAMW,MAAMX,MAAM,KACZY,KAAOZ,MAAMW,IACnBE,MAAMC,KAAK,SAASF,UAChBG,6EAC6CH,kFAIjDC,MAAMC,KAAK,eAAeC,OAE1BT,MAAMU,WAAWD,MAAOT,MAAMW,SAASC,QAG/CL,MAAMC,KAAK,aAAaR,YA9BxBO,MAAQ,yEAAa,qBACzBA,MAAMM"}
|