diff --git a/amd/build/primary-nav-tools.min.js b/amd/build/primary-nav-tools.min.js index 8cb6f74..13ade32 100644 --- a/amd/build/primary-nav-tools.min.js +++ b/amd/build/primary-nav-tools.min.js @@ -1,3 +1,3 @@ -define("local_treestudyplan/primary-nav-tools",["exports","./util/debugger"],(function(_exports,_debugger){var obj;function _typeof(obj){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof(obj)}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.hide_primary=function(hrefs){var element=document.createElement("style");document.head.appendChild(element);var sheet=element.sheet;("string"==typeof hrefs||hrefs instanceof String)&&(hrefs=[hrefs]);if("object"===_typeof(hrefs)&&Array.isArray(hrefs))for(var ix in hrefs){var href=hrefs[ix];debug.info("Hiding",href);var style='\n .primary-navigation li.nav-item > a[href*="'.concat(href,'"] {\n display: none;\n }\n ');debug.info("Adding style",style),sheet.insertRule(style,sheet.cssRules.length)}debug.info("stylesheet",sheet)};var debug=new(_debugger=(obj=_debugger)&&obj.__esModule?obj:{default:obj}).default("primary-nav-tools")})); +define("local_treestudyplan/primary-nav-tools",["exports"],(function(_exports){function _typeof(obj){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof(obj)}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.hide_primary=function(hrefs){var element=document.createElement("style");document.head.appendChild(element);var sheet=element.sheet;("string"==typeof hrefs||hrefs instanceof String)&&(hrefs=[hrefs]);if("object"===_typeof(hrefs)&&Array.isArray(hrefs))for(var ix in hrefs){var href=hrefs[ix],style='\n .primary-navigation li.nav-item > a[href*="'.concat(href,'"] {\n display: none;\n }\n ');sheet.insertRule(style,sheet.cssRules.length)}}})); //# sourceMappingURL=primary-nav-tools.min.js.map \ No newline at end of file diff --git a/amd/build/primary-nav-tools.min.js.map b/amd/build/primary-nav-tools.min.js.map index 38bd1b1..17304e8 100644 --- a/amd/build/primary-nav-tools.min.js.map +++ b/amd/build/primary-nav-tools.min.js.map @@ -1 +1 @@ -{"version":3,"file":"primary-nav-tools.min.js","sources":["../src/primary-nav-tools.js"],"sourcesContent":["/*eslint-env es6*/\n// Put this file in path/to/plugin/amd/src\n// You can call it anything you like\nimport Debugger from './util/debugger';\nlet debug = new Debugger(\"primary-nav-tools\");\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"],"mappings":"odAU6BA,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,YA7BxBO,MAAQ,yEAAa"} \ No newline at end of file +{"version":3,"file":"primary-nav-tools.min.js","sources":["../src/primary-nav-tools.js"],"sourcesContent":["/*eslint-env es6*/\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 let style = `\n .primary-navigation li.nav-item > a[href*=\"${href}\"] {\n display: none;\n }\n `;\n sheet.insertRule(style, sheet.cssRules.length);\n }\n }\n}\n"],"names":["hrefs","element","document","createElement","head","appendChild","sheet","String","_typeof","Array","isArray","ix","href","style","insertRule","cssRules","length"],"mappings":"gbAM6BA,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,IACfE,6EAC6CD,kFAIjDN,MAAMQ,WAAWD,MAAOP,MAAMS,SAASC"} \ No newline at end of file diff --git a/amd/src/primary-nav-tools.js b/amd/src/primary-nav-tools.js index c604011..c5aeac6 100644 --- a/amd/src/primary-nav-tools.js +++ b/amd/src/primary-nav-tools.js @@ -1,8 +1,4 @@ /*eslint-env es6*/ -// Put this file in path/to/plugin/amd/src -// You can call it anything you like -import Debugger from './util/debugger'; -let debug = new Debugger("primary-nav-tools"); /** * Hide a primary navigation item by href @@ -20,16 +16,12 @@ export function hide_primary(hrefs) { if(typeof hrefs === 'object' && Array.isArray(hrefs)){ for(const ix in hrefs){ const href = hrefs[ix]; - debug.info("Hiding",href); let style = ` .primary-navigation li.nav-item > a[href*="${href}"] { display: none; } `; - debug.info("Adding style",style); - sheet.insertRule(style, sheet.cssRules.length); } } - debug.info("stylesheet",sheet); }