{"version":3,"sources":["webpack:///2b264dcfe0c70f40a726.js","webpack:///./LeLab.Web/src/common/com-event-css-modifier/event-css-modifier.js"],"names":["webpackJsonp","7","module","exports","__webpack_require__","evtCssMod","emptySelectorText","uidPrefix","uidCount","eventState","eventInitiate","stylesheet","error","msg","info","console","uid","CSSStyleSheet","ownerNode","id","touchCssText","cssText","selectorText","arr","split","newSelectorText","i","length","selector","trim","match","replace","parseRuleList","CSSRuleList","rulelist","rule","tmp","index","cssRules","type","push","css","base","touch","parseStyleSheet","document","styleSheets","err","href","reference","replaceStyleRule","CSSGroupingRule","deleteRule","insertRule","updateRuleList","update","updateEvent","onTouchStart","evt","onMouseMove","init","window","addEventListener"],"mappings":"AAAAA,cAAc,IAERC,EACA,SAAUC,EAAQC,EAASC,GAEjC,YCUA,IAAIC,IAQAC,kBAAmB,kBAGnBC,UAAW,YAGXC,SAAU,EAGVC,WAAY,OAGZC,eAAe,EAGfC,cAWAC,MAAO,SAAUC,GACb,KAAM,wBAA0BA,GAMpCC,KAAM,SAAUD,GACZE,QAAQD,KAAK,wBAA0BD,IAM3CG,IAAK,SAAUC,GACX,SAAIA,IAAiBA,EAAcC,aACG,IAA9BD,EAAcC,UAAUC,GACjBF,EAAcC,UAAUC,IAG/Bd,EAAUG,SAAWH,EAAUG,SAAW,EACnCH,EAAUE,UAAYF,EAAUG,YASnDY,aAAc,SAAUC,EAASC,GAO7B,IAAK,GAHDC,GAAMD,EAAaE,MAAM,KACzBC,EAAkB,GAEbC,EAAI,EAAGA,EAAIH,EAAII,OAAQD,IAAK,CACjC,GAAIE,GAAWL,EAAIG,GAAGG,MAClBD,GAASE,MAAM,YAGQ,IAAnBL,IACAA,GAAoC,MAExCA,GAAoCG,GAa5C,MAPuB,IAAnBH,IACAA,EAAkBpB,EAAUC,mBAIhCe,EAAUA,EAAQU,QAAQT,EAAcG,IAQ5CO,cAAe,SAAUC,GACrB,GAAIC,KAEJ,IAAID,EAEA,IAAK,GAAIP,GAAI,EAAGA,EA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,EAAKD,UAIlD,gBAAbC,EAAKI,OAEkB,SAAxBlC,EAAUI,WACVJ,EAAU6C,iBAAiBC,EAAiBhB,EAAKM,IAAIE,MAAOR,EAAKE,OAIjEhC,EAAU6C,iBAAiBC,EAAiBhB,EAAKM,IAAIC,KAAMP,EAAKE,UAShFkB,OAAQ,WACJ,IAAK,GAAI7B,GAAI,EAAGA,EAAIrB,EAAUM,WAAWgB,OAAQD,IAAK,CAClD,GAAIf,GAAaN,EAAUM,WAAWe,EAClCf,GAAWuB,SAASP,OAAS,GAC7BtB,EAAUiD,eAAe3C,EAAWsC,UAAWtC,EAAWuB,YAQtEsB,YAAa,SAAU/C,GAEnBJ,EAAUI,WAAaA,EAEvBJ,EAAUkD,UAMdE,aAAc,SAAUC,GAEQ,SAAxBrD,EAAUI,YAAoD,GAA3BJ,EAAUK,eAC7CL,EAAUmD,YAAY,SAG1BnD,EAAUK,eAAgB,GAG9BiD,YAAa,SAAUD,GAES,QAAxBrD,EAAUI,YAAmD,GAA3BJ,EAAUK,eAC5CL,EAAUmD,YAAY,QAGtBnD,EAAUK,gBACVL,EAAUK,eAAgB,IAOlCkD,KAAM,WAEFvD,EAAUuC,kBAIN,gBAAkBiB,SAClBxD,EAAUmD,YAAY,SAG1BX,SAASiB,iBAAiB,aAAczD,EAAUoD,cAAc,GAChEZ,SAASiB,iBAAiB,YAAazD,EAAUsD,aAAa,IAMtEzD,GAAOC,SACHyD,KAAMvD,EAAUuD,KAChBL,OAAQlD,EAAUkD","file":"2b264dcfe0c70f40a726.js","sourcesContent":["webpackJsonp([0],{\n\n/***/ 7:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\n/**\n * Event CSS Modifier\n * \n * Remove / Add :hover pseudo-class from selector text\n * base on event use for interaction.\n * \n * On mobile, we don't want :hover state because they always\n * show up, but we need them on desktop. There is also a need\n * for computer having both touch and mouse event.\n * \n * This JS remove :hover selector when using touch event.\n * If a mouse event is use, the default selector is restored.\n */\n\n// This object is \"private\" and should not be expose\nvar evtCssMod = {\n\n //\n // Variables\n //\n\n // Default selector, matching nothing, if a selectorText\n // is empty after modification.\n emptySelectorText: \"#evtCssModEmpty\",\n\n // Unique ID prefix\n uidPrefix: \"evtCssMod\",\n\n // Unique ID counter\n uidCount: 0,\n\n // Current event state applied to CSS modification\n eventState: \"base\",\n\n // Boolean mentionning if an event is currently initiated\n eventInitiate: false,\n\n // StyleSheet\n stylesheet: [],\n\n //\n // Functions\n //\n\n\n // Throw error\n //\n error: function error(msg) {\n throw \"Event CSS Modifier : \" + msg;\n },\n\n // Console log information\n //\n info: function info(msg) {\n console.info(\"Event CSS Modifier : \" + msg);\n },\n\n // Apply and return a unique ID for the CSSStyleSheet\n //\n uid: function uid(CSSStyleSheet) {\n if (CSSStyleSheet && CSSStyleSheet.ownerNode) {\n if (CSSStyleSheet.ownerNode.id != \"\") {\n return CSSStyleSheet.ownerNode.id;\n } else {\n evtCssMod.uidCount = evtCssMod.uidCount + 1;\n return evtCssMod.uidPrefix + evtCssMod.uidCount;\n }\n }\n return false;\n },\n\n // Return a \"cssText\" without :hover pseudo-class\n //\n touchCssText: function touchCssText(cssText, selectorText) {\n\n // Build the new selector text without :hover\n //\n var arr = selectorText.split(\",\");\n var newSelectorText = \"\";\n\n for (var i = 0; i < arr.length; i++) {\n var selector = arr[i].trim();\n if (selector.match(\":hover\")) {\n continue;\n } else {\n if (newSelectorText != \"\") {\n newSelectorText = newSelectorText + \", \";\n }\n newSelectorText = newSelectorText + selector;\n }\n }\n\n // If new selector text is empty, \n // assign a selector matching nothing\n if (newSelectorText == \"\") {\n newSelectorText = evtCssMod.emptySelectorText;\n }\n\n // Replace selector of cssTest\n cssText = cssText.replace(selectorText, newSelectorText);\n\n return cssText;\n },\n\n // Parse rule list (recursive)\n //\n parseRuleList: function parseRuleList(CSSRuleList) {\n var rulelist = [];\n\n if (CSSRuleList) {\n // Loop through each rule in sheet\n for (var i = 0; i < CSSRuleList.length; i++) {\n\n // CSSStyleRule or CSSMediaRule\n var rule = CSSRuleList[i];\n // Temporary object with rulelist info\n var tmp = {\n index: i\n };\n\n // CSSMediaRule\n if (rule.cssRules) {\n // Store object name\n tmp.type = 'CSSMediaRule';\n // Recursion\n tmp.rulelist = evtCssMod.parseRuleList(rule.cssRules);\n // Push to array (if not empty)\n if (tmp.rulelist.length > 0) {\n rulelist.push(tmp);\n }\n }\n // CSSStyleRule\n else {\n // Store object name\n tmp.type = 'CSSStyleRule';\n // If selector text contain :hover pseudo-class\n if (rule.selectorText && rule.selectorText.match(\":hover\")) {\n // Store information about the selector\n // Base : It's the original\n // Touch : Modified for touch event\n tmp.css = {};\n tmp.css.base = rule.cssText;\n tmp.css.touch = evtCssMod.touchCssText(rule.cssText, rule.selectorText);\n // Push to array\n rulelist.push(tmp);\n }\n }\n }\n }\n\n return rulelist;\n },\n\n // Parse all stylesheet\n //\n parseStyleSheet: function parseStyleSheet() {\n // Loop through each stylesheet\n for (var i = 0; i < document.styleSheets.length; i++) {\n var CSSStyleSheet = document.styleSheets[i];\n // Apply a unique ID to the stylesheet (if none)\n if (CSSStyleSheet.ownerNode.id == \"\") {\n var uid = CSSStyleSheet.ownerNode.id = evtCssMod.uid(CSSStyleSheet);\n }\n // Retreive the ID (if exist)\n else if (CSSStyleSheet.ownerNode.id) {\n var uid = CSSStyleSheet.ownerNode.id;\n }\n // Can't assign or retreive ID\n else {\n evtCssMod.error(\"Impossible to assing unique ID to stylesheet.\");\n continue;\n }\n // Try to retreive the cssRules\n try {\n var cssRules = CSSStyleSheet.cssRules;\n } catch (err) {\n evtCssMod.info(\"Failed to read the 'cssRules' from '\" + CSSStyleSheet.href + \"'.\");\n continue;\n }\n // Add to the stylesheed\n if (!evtCssMod.stylesheet[uid]) {\n evtCssMod.stylesheet.push({\n id: uid,\n reference: CSSStyleSheet,\n rulelist: evtCssMod.parseRuleList(cssRules)\n });\n }\n }\n },\n\n // Replace a CSSStyleRule\n //\n replaceStyleRule: function replaceStyleRule(CSSGroupingRule, cssText, index) {\n CSSGroupingRule.deleteRule(index);\n CSSGroupingRule.insertRule(cssText, index);\n },\n\n // Update RuleList base on event\n //\n updateRuleList: function updateRuleList(CSSGroupingRule, rulelist) {\n for (var i = 0; i < rulelist.length; i++) {\n var rule = rulelist[i];\n\n // CSSMediaRule\n if (rule.type == 'CSSMediaRule') {\n evtCssMod.updateRuleList(CSSGroupingRule.cssRules[rule.index], rule.rulelist);\n }\n\n // CSSStyleRule\n else if (rule.type == 'CSSStyleRule') {\n // Apply touch modified selector\n if (evtCssMod.eventState == \"touch\") {\n evtCssMod.replaceStyleRule(CSSGroupingRule, rule.css.touch, rule.index);\n }\n // Restore original (base) selector\n else {\n evtCssMod.replaceStyleRule(CSSGroupingRule, rule.css.base, rule.index);\n }\n }\n }\n },\n\n // Update CSS Rules base on event for each stylesheet\n //\n update: function update() {\n for (var i = 0; i < evtCssMod.stylesheet.length; i++) {\n var stylesheet = evtCssMod.stylesheet[i];\n if (stylesheet.rulelist.length > 0) {\n evtCssMod.updateRuleList(stylesheet.reference, stylesheet.rulelist);\n }\n }\n },\n\n // Update CSS Rules base on event\n //\n updateEvent: function updateEvent(eventState) {\n // Save the event state\n evtCssMod.eventState = eventState;\n // Update\n evtCssMod.update();\n },\n\n // Touch Start\n //\n onTouchStart: function onTouchStart(evt) {\n // Update if not the \"touch\" state\n if (evtCssMod.eventState != \"touch\" && evtCssMod.eventInitiate == false) {\n evtCssMod.updateEvent(\"touch\");\n }\n // Flag to prevent event execution in \"mouse move\"\n evtCssMod.eventInitiate = true;\n },\n\n onMouseMove: function onMouseMove(evt) {\n // Update if not the \"base\" state\n if (evtCssMod.eventState != \"base\" && evtCssMod.eventInitiate == false) {\n evtCssMod.updateEvent(\"base\");\n }\n // Flag to restore event execution in \"mouse move\"\n if (evtCssMod.eventInitiate) {\n evtCssMod.eventInitiate = false;\n }\n },\n\n // Init\n //\n init: function init() {\n // Parse stylesheet to build new rule\n evtCssMod.parseStyleSheet();\n // If device support touch, \n // there's a high chance it's a mobile (touch).\n // Transform the CSS by anticipation.\n if ('ontouchstart' in window) {\n evtCssMod.updateEvent(\"touch\");\n };\n // Listen for event\n document.addEventListener(\"touchstart\", evtCssMod.onTouchStart, false);\n document.addEventListener(\"mousemove\", evtCssMod.onMouseMove, false);\n }\n};\n\n// Expose the \"eventCssModifier\" to be used\n// has an API\nmodule.exports = {\n init: evtCssMod.init,\n update: evtCssMod.update\n};\n\n/***/ })\n\n});\n\n\n// WEBPACK FOOTER //\n// 2b264dcfe0c70f40a726.js","/**\n * Event CSS Modifier\n * \n * Remove / Add :hover pseudo-class from selector text\n * base on event use for interaction.\n * \n * On mobile, we don't want :hover state because they always\n * show up, but we need them on desktop. There is also a need\n * for computer having both touch and mouse event.\n * \n * This JS remove :hover selector when using touch event.\n * If a mouse event is use, the default selector is restored.\n */\n\n// This object is \"private\" and should not be expose\nvar evtCssMod = {\n\n //\n // Variables\n //\n\n // Default selector, matching nothing, if a selectorText\n // is empty after modification.\n emptySelectorText: \"#evtCssModEmpty\",\n\n // Unique ID prefix\n uidPrefix: \"evtCssMod\",\n\n // Unique ID counter\n uidCount: 0,\n\n // Current event state applied to CSS modification\n eventState: \"base\",\n\n // Boolean mentionning if an event is currently initiated\n eventInitiate: false,\n\n // StyleSheet\n stylesheet: [],\n\n\n\n //\n // Functions\n //\n\n\n // Throw error\n //\n error: function (msg) {\n throw \"Event CSS Modifier : \" + msg;\n },\n\n\n // Console log information\n //\n info: function (msg) {\n console.info(\"Event CSS Modifier : \" + msg);\n },\n\n\n // Apply and return a unique ID for the CSSStyleSheet\n //\n uid: function (CSSStyleSheet) {\n if (CSSStyleSheet && CSSStyleSheet.ownerNode) {\n if (CSSStyleSheet.ownerNode.id != \"\") {\n return CSSStyleSheet.ownerNode.id;\n }\n else {\n evtCssMod.uidCount = evtCssMod.uidCount + 1;\n return evtCssMod.uidPrefix + evtCssMod.uidCount;\n }\n }\n return false;\n },\n\n\n // Return a \"cssText\" without :hover pseudo-class\n //\n touchCssText: function (cssText, selectorText) {\n\n // Build the new selector text without :hover\n //\n var arr = selectorText.split(\",\");\n var newSelectorText = \"\";\n\n for (var i = 0; i < arr.length; i++) {\n var selector = arr[i].trim();\n if (selector.match(\":hover\")) {\n continue;\n } else {\n if (newSelectorText != \"\") {\n newSelectorText = newSelectorText + \", \";\n }\n newSelectorText = newSelectorText + selector;\n }\n }\n\n // If new selector text is empty, \n // assign a selector matching nothing\n if (newSelectorText == \"\") {\n newSelectorText = evtCssMod.emptySelectorText;\n }\n\n // Replace selector of cssTest\n cssText = cssText.replace(selectorText, newSelectorText);\n\n return cssText;\n },\n\n\n // Parse rule list (recursive)\n //\n parseRuleList: function (CSSRuleList) {\n var rulelist = [];\n\n if (CSSRuleList) {\n // Loop through each rule in sheet\n for (var i = 0; i < CSSRuleList.length; i++) {\n\n // CSSStyleRule or CSSMediaRule\n var rule = CSSRuleList[i];\n // Temporary object with rulelist info\n var tmp = {\n index: i\n };\n\n // CSSMediaRule\n if (rule.cssRules) {\n // Store object name\n tmp.type = 'CSSMediaRule';\n // Recursion\n tmp.rulelist = evtCssMod.parseRuleList(rule.cssRules);\n // Push to array (if not empty)\n if (tmp.rulelist.length > 0) {\n rulelist.push(tmp);\n }\n }\n // CSSStyleRule\n else {\n // Store object name\n tmp.type = 'CSSStyleRule';\n // If selector text contain :hover pseudo-class\n if (rule.selectorText && rule.selectorText.match(\":hover\")) {\n // Store information about the selector\n // Base : It's the original\n // Touch : Modified for touch event\n tmp.css = {};\n tmp.css.base = rule.cssText;\n tmp.css.touch = evtCssMod.touchCssText(rule.cssText, rule.selectorText);\n // Push to array\n rulelist.push(tmp);\n }\n }\n\n }\n }\n\n return rulelist;\n },\n\n\n // Parse all stylesheet\n //\n parseStyleSheet: function () {\n // Loop through each stylesheet\n for (var i = 0; i < document.styleSheets.length; i++) {\n var CSSStyleSheet = document.styleSheets[i];\n // Apply a unique ID to the stylesheet (if none)\n if (CSSStyleSheet.ownerNode.id == \"\") {\n var uid = CSSStyleSheet.ownerNode.id = evtCssMod.uid(CSSStyleSheet);\n }\n // Retreive the ID (if exist)\n else if (CSSStyleSheet.ownerNode.id) {\n var uid = CSSStyleSheet.ownerNode.id;\n }\n // Can't assign or retreive ID\n else {\n evtCssMod.error(\"Impossible to assing unique ID to stylesheet.\");\n continue;\n }\n // Try to retreive the cssRules\n try {\r\n var cssRules = CSSStyleSheet.cssRules;\r\n }\r\n catch (err) {\n evtCssMod.info(\"Failed to read the 'cssRules' from '\" + CSSStyleSheet.href + \"'.\");\r\n continue;\r\n }\n // Add to the stylesheed\n if (!evtCssMod.stylesheet[uid]) {\n evtCssMod.stylesheet.push({\n id: uid,\n reference: CSSStyleSheet,\n rulelist: evtCssMod.parseRuleList(cssRules)\n });\n }\n }\n },\n\n\n // Replace a CSSStyleRule\n //\n replaceStyleRule: function (CSSGroupingRule, cssText, index) {\n CSSGroupingRule.deleteRule(index);\n CSSGroupingRule.insertRule(cssText, index);\n },\n\n\n // Update RuleList base on event\n //\n updateRuleList: function (CSSGroupingRule, rulelist) {\n for (var i = 0; i < rulelist.length; i++) {\n var rule = rulelist[i];\n\n // CSSMediaRule\n if (rule.type == 'CSSMediaRule') {\n evtCssMod.updateRuleList(CSSGroupingRule.cssRules[rule.index], rule.rulelist);\n }\n\n // CSSStyleRule\n else if (rule.type == 'CSSStyleRule') {\n // Apply touch modified selector\n if (evtCssMod.eventState == \"touch\") {\n evtCssMod.replaceStyleRule(CSSGroupingRule, rule.css.touch, rule.index);\n }\n // Restore original (base) selector\n else {\n evtCssMod.replaceStyleRule(CSSGroupingRule, rule.css.base, rule.index);\n }\n }\n }\n },\n\n\n // Update CSS Rules base on event for each stylesheet\n //\n update: function () {\n for (var i = 0; i < evtCssMod.stylesheet.length; i++) {\n var stylesheet = evtCssMod.stylesheet[i];\n if (stylesheet.rulelist.length > 0) {\n evtCssMod.updateRuleList(stylesheet.reference, stylesheet.rulelist);\n }\n }\n },\n\n\n // Update CSS Rules base on event\n //\n updateEvent: function (eventState) {\n // Save the event state\n evtCssMod.eventState = eventState;\n // Update\n evtCssMod.update();\n },\n\n\n // Touch Start\n //\n onTouchStart: function (evt) {\n // Update if not the \"touch\" state\n if (evtCssMod.eventState != \"touch\" && evtCssMod.eventInitiate == false) {\n evtCssMod.updateEvent(\"touch\");\n }\n // Flag to prevent event execution in \"mouse move\"\n evtCssMod.eventInitiate = true;\n },\n\n onMouseMove: function (evt) {\n // Update if not the \"base\" state\n if (evtCssMod.eventState != \"base\" && evtCssMod.eventInitiate == false) {\n evtCssMod.updateEvent(\"base\");\n }\n // Flag to restore event execution in \"mouse move\"\n if (evtCssMod.eventInitiate) {\n evtCssMod.eventInitiate = false;\n }\n },\n\n\n // Init\n //\n init: function () {\n // Parse stylesheet to build new rule\n evtCssMod.parseStyleSheet();\n // If device support touch, \n // there's a high chance it's a mobile (touch).\n // Transform the CSS by anticipation.\n if ('ontouchstart' in window) {\n evtCssMod.updateEvent(\"touch\");\n };\n // Listen for event\n document.addEventListener(\"touchstart\", evtCssMod.onTouchStart, false);\n document.addEventListener(\"mousemove\", evtCssMod.onMouseMove, false);\n }\n};\n\n// Expose the \"eventCssModifier\" to be used\n// has an API\nmodule.exports = {\n init: evtCssMod.init,\n update: evtCssMod.update\n}\n\n\n\n// WEBPACK FOOTER //\n// ./LeLab.Web/src/common/com-event-css-modifier/event-css-modifier.js"],"sourceRoot":""}