{"version":3,"file":"uppsala.tooltip.min.js","names":["define","$","AttrNameTextVisible","AttrNameTextHidden","init","SelectorToTooltipify","SelectorToCheck","elementToTooltipify","visibleTxt","attr","hiddenTxt","on","is"],"sources":["components/uppsala.tooltip.js"],"mappings":"AAaAA,OAAO,CAAC,WAAW,SAAUC,GAqCzB,MAnCc,CAEVC,wCAAsB,0BACtBC,sCAAqB,yBAIrBC,KAAM,SAAUC,EAAsBC,GAClC,IAAIC,EAAsBN,EAAEI,GACxBG,EAAaP,EAAEM,GAAqBE,KAAKP,qBACzCQ,EAAYT,EAAEM,GAAqBE,KAAKN,oBAE5CF,EAAEM,GAAqBI,GAAG,SAS1B,YAE8C,IAAtCV,EAAEK,GAAiBM,GAAG,YACtBX,EAAEI,GAAsBI,KAAK,QAASC,GAGtCT,EAAEI,GAAsBI,KAAK,QAASD,EAGvD,KAhBmD,IAAtCP,EAAEK,GAAiBM,GAAG,YACtBX,EAAEI,GAAsBI,KAAK,QAASD,GAGtCP,EAAEI,GAAsBI,KAAK,QAASC,EAc9C,EAIR","ignoreList":[],"sourcesContent":["/*\n * Will change the tooltip text of an element, depending on another element's display based visability state.\n *\n * Use - example:\n * \n *
...
\n * \n * tooltip.init(\n * \".js-statefull-tooltip\",\n * \".js-statefull-tooltip-check\"\n * );\n*/\n\ndefine(['jquery'], function ($) {\n\n var tooltip = {\n\n AttrNameTextVisible = \"data-js-tooltip-visible\",\n AttrNameTextHidden = \"data-js-tooltip-hidden\",\n\n /// SelectorToTooltipify: The element that recieves the tooltip text.\n /// SelectorToCheck: A selector to the element that this module should check, to determin what text should be displayed as tooltip.\n init: function (SelectorToTooltipify, SelectorToCheck) {\n var elementToTooltipify = $(SelectorToTooltipify);\n var visibleTxt = $(elementToTooltipify).attr(AttrNameTextVisible);\n var hiddenTxt = $(elementToTooltipify).attr(AttrNameTextHidden);\n\n $(elementToTooltipify).on(\"click\", updateTooltipText);\n\n if ($(SelectorToCheck).is(\":visible\") === true) {\n $(SelectorToTooltipify).attr(\"title\", visibleTxt);\n }\n else {\n $(SelectorToTooltipify).attr(\"title\", hiddenTxt);\n }\n\n function updateTooltipText() {\n // the dom has not been updated yet, so we only know what state we are going to.. Eg if its visible, it will be hidden and viceversa.\n if ($(SelectorToCheck).is(\":visible\") === true) {\n $(SelectorToTooltipify).attr(\"title\", hiddenTxt);\n }\n else {\n $(SelectorToTooltipify).attr(\"title\", visibleTxt);\n }\n\n\t\t\t}\n \n }\n };\n\n return tooltip;\n});\n"]}