1{"version":3,"sources":["../src/discussion.js"],"names":["define","$","CustomEvents","Selectors","PubSub","ForumEvents","String","Notification","focusPreviousPost","currentPost","prevPost","prev","post","length","replyPost","find","last","focus","parents","first","focusNextPost","siblingPost","next","parentPosts","toArray","i","ancestorSiblingPost","isElementInInPageReplySection","element","inPageReply","closest","inpageReplyContent","initAccessibilityKeyboardNav","root","posts","each","index","actions","action","firstAction","attr","events","up","down","previous","home","end","on","e","data","activeElement","document","focusPost","originalEvent","preventDefault","currentAction","target","container","actionsContainer","nextAction","stopPropagation","lastAction","subscribe","SUBSCRIPTION_TOGGLED","subscribed","subscriptionState","updateMessage","get_string","then","s","addNotification","message","type","catch","exception","init"],"mappings":"AAuBAA,OAAM,wBACN,CACI,QADJ,CAEI,gCAFJ,CAGI,qBAHJ,CAII,aAJJ,CAKI,wBALJ,CAMI,UANJ,CAOI,mBAPJ,CADM,CAUN,SACIC,CADJ,CAEIC,CAFJ,CAGIC,CAHJ,CAIIC,CAJJ,CAKIC,CALJ,CAMIC,CANJ,CAOIC,CAPJ,CAQE,IAQMC,CAAAA,CAAiB,CAAG,SAASC,CAAT,CAAsB,CAE1C,GAAIC,CAAAA,CAAQ,CAAGD,CAAW,CAACE,IAAZ,CAAiBR,CAAS,CAACS,IAAV,CAAeA,IAAhC,CAAf,CAEA,GAAIF,CAAQ,CAACG,MAAb,CAAqB,CAIjB,GAAIC,CAAAA,CAAS,CAAGJ,CAAQ,CAACK,IAAT,CAAcZ,CAAS,CAACS,IAAV,CAAeA,IAA7B,EAAmCI,IAAnC,EAAhB,CAEA,GAAIF,CAAS,CAACD,MAAd,CAAsB,CAElBC,CAAS,CAACG,KAAV,EACH,CAHD,IAGO,CAEHP,CAAQ,CAACO,KAAT,EACH,CACJ,CAbD,IAaO,CAGHR,CAAW,CAACS,OAAZ,CAAoBf,CAAS,CAACS,IAAV,CAAeA,IAAnC,EAAyCO,KAAzC,GAAiDF,KAAjD,EACH,CACJ,CA9BH,CAsCMG,CAAa,CAAG,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,CAAGtD,CAAC,CAAC+C,CAAC,CAACQ,MAAH,CADiD,CAElEC,CAAS,CAAGF,CAAa,CAACzB,OAAd,CAAsB3B,CAAS,CAACS,IAAV,CAAe8C,gBAArC,CAFsD,CAGlErB,CAAO,CAAGoB,CAAS,CAAC1C,IAAV,CAAeZ,CAAS,CAACS,IAAV,CAAe0B,MAA9B,CAHwD,CAIlEuB,CAAU,CAAGxB,CAAO,CAACrB,IAAR,EAJqD,CAMtEqB,CAAO,CAACG,IAAR,CAAa,UAAb,CAAyB,IAAzB,EACAqB,CAAU,CAACrB,IAAX,CAAgB,UAAhB,CAA4B,CAA5B,EACAqB,CAAU,CAAC5C,KAAX,GAEA+B,CAAC,CAACY,eAAF,GACAX,CAAI,CAACI,aAAL,CAAmBC,cAAnB,EACH,CAZD,EAcAlD,CAAM,CAAC0D,SAAP,CAAiBzD,CAAW,CAAC0D,oBAA7B,CAAmD,SAASd,CAAT,CAAe,IAC1De,CAAAA,CAAU,CAAGf,CAAI,CAACgB,iBADwC,CAE1DC,CAAa,CAAGF,CAAU,CAAG,sBAAH,CAA4B,wBAFI,CAG9D1D,CAAM,CAAC6D,UAAP,CAAkBD,CAAlB,CAAiC,OAAjC,EACKE,IADL,CACU,SAASC,CAAT,CAAY,CACd,MAAO9D,CAAAA,CAAY,CAAC+D,eAAb,CAA6B,CAChCC,OAAO,CAAEF,CADuB,CAEhCG,IAAI,CAAE,MAF0B,CAA7B,CAIV,CANL,EAOKC,KAPL,CAOWlE,CAAY,CAACmE,SAPxB,CAQH,CAXD,CAYH,CAnPH,CAqPE,MAAO,CACHC,IAAI,CAAE,cAAS1C,CAAT,CAAe,CACjBD,CAA4B,CAACC,CAAD,CAC/B,CAHE,CAKV,CA5QK,CAAN","sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Module for viewing a discussion.\n *\n * @module mod_forum/discussion_list\n * @package mod_forum\n * @copyright 2019 Ryan Wyllie <ryan@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(\n[\n 'jquery',\n 'core/custom_interaction_events',\n 'mod_forum/selectors',\n 'core/pubsub',\n 'mod_forum/forum_events',\n 'core/str',\n 'core/notification',\n],\nfunction(\n $,\n CustomEvents,\n Selectors,\n PubSub,\n ForumEvents,\n String,\n Notification\n) {\n\n /**\n * Set the focus on the previous post in the list. Previous post is calculated\n * based on position in list as viewed top to bottom.\n *\n * @param {Object} currentPost The post that currently has focus\n */\n var focusPreviousPost = function(currentPost) {\n // See if there is a previous sibling post.\n var prevPost = currentPost.prev(Selectors.post.post);\n\n if (prevPost.length) {\n // The previous post might have replies that appear visually between\n // it and the current post (see nested view) so if that's the case\n // then the last reply will be the previous post in the list.\n var replyPost = prevPost.find(Selectors.post.post).last();\n\n if (replyPost.length) {\n // Focus the last reply.\n replyPost.focus();\n } else {\n // No replies so we can focus straight on the sibling.\n prevPost.focus();\n }\n } else {\n // If there are no siblings then jump up the tree to the parent\n // post and focus the first parent post we find.\n currentPost.parents(Selectors.post.post).first().focus();\n }\n };\n\n /**\n * Set the focus on the next post in the list. Previous post is calculated\n * based on position in list as viewed top to bottom.\n *\n * @param {Object} currentPost The post that currently has focus\n */\n var focusNextPost = function(currentPost) {\n // The next post in the visual list would be the first reply to this one\n // so let's see if we have one.\n var replyPost = currentPost.find(Selectors.post.post).first();\n\n if (replyPost.length) {\n // Got a reply.\n replyPost.focus();\n } else {\n // If we don't have a reply then the next post in the visual list would\n // be a sibling post (replying to the same parent).\n var siblingPost = currentPost.next(Selectors.post.post);\n\n if (siblingPost.length) {\n siblingPost.focus();\n } else {\n // No siblings either. That means we're the lowest level reply in a thread\n // so we need to walk back up the tree of posts and find an ancestor post that\n // has a sibling post we can focus.\n var parentPosts = currentPost.parents(Selectors.post.post).toArray();\n\n for (var i = 0; i < parentPosts.length; i++) {\n var ancestorSiblingPost = $(parentPosts[i]).next(Selectors.post.post);\n\n if (ancestorSiblingPost.length) {\n ancestorSiblingPost.focus();\n break;\n }\n }\n }\n }\n };\n\n /**\n * Check if the element is inside the in page reply section.\n *\n * @param {Object} element The element to check\n * @return {Boolean}\n */\n var isElementInInPageReplySection = function(element) {\n var inPageReply = $(element).closest(Selectors.post.inpageReplyContent);\n return inPageReply.length ? true : false;\n };\n\n /**\n * Initialise the keyboard accessibility controls for the discussion.\n *\n * @param {Object} root The discussion root element\n */\n var initAccessibilityKeyboardNav = function(root) {\n var posts = root.find(Selectors.post.post);\n\n // Take each post action out of the tab index.\n posts.each(function(index, post) {\n var actions = $(post).find(Selectors.post.action);\n var firstAction = actions.first();\n actions.attr('tabindex', '-1');\n firstAction.attr('tabindex', 0);\n });\n\n CustomEvents.define(root, [\n CustomEvents.events.up,\n CustomEvents.events.down,\n CustomEvents.events.next,\n CustomEvents.events.previous,\n CustomEvents.events.home,\n CustomEvents.events.end,\n ]);\n\n root.on(CustomEvents.events.up, function(e, data) {\n var activeElement = document.activeElement;\n\n if (isElementInInPageReplySection(activeElement)) {\n // Focus is currently inside the in page reply section so don't move focus\n // to another post.\n return;\n }\n\n var focusPost = $(activeElement).closest(Selectors.post.post);\n\n if (focusPost.length) {\n focusPreviousPost(focusPost);\n } else {\n root.find(Selectors.post.post).first().focus();\n }\n\n data.originalEvent.preventDefault();\n });\n\n root.on(CustomEvents.events.down, function(e, data) {\n var activeElement = document.activeElement;\n\n if (isElementInInPageReplySection(activeElement)) {\n // Focus is currently inside the in page reply section so don't move focus\n // to another post.\n return;\n }\n\n var focusPost = $(activeElement).closest(Selectors.post.post);\n\n if (focusPost.length) {\n focusNextPost(focusPost);\n } else {\n root.find(Selectors.post.post).first().focus();\n }\n\n data.originalEvent.preventDefault();\n });\n\n root.on(CustomEvents.events.home, function(e, data) {\n if (isElementInInPageReplySection(document.activeElement)) {\n // Focus is currently inside the in page reply section so don't move focus\n // to another post.\n return;\n }\n root.find(Selectors.post.post).first().focus();\n data.originalEvent.preventDefault();\n });\n\n root.on(CustomEvents.events.end, function(e, data) {\n if (isElementInInPageReplySection(document.activeElement)) {\n // Focus is currently inside the in page reply section so don't move focus\n // to another post.\n return;\n }\n root.find(Selectors.post.post).last().focus();\n data.originalEvent.preventDefault();\n });\n\n root.on(CustomEvents.events.next, Selectors.post.action, function(e, data) {\n var currentAction = $(e.target);\n var container = currentAction.closest(Selectors.post.actionsContainer);\n var actions = container.find(Selectors.post.action);\n var nextAction = currentAction.next(Selectors.post.action);\n\n actions.attr('tabindex', '-1');\n\n if (!nextAction.length) {\n nextAction = actions.first();\n }\n\n nextAction.attr('tabindex', 0);\n nextAction.focus();\n\n data.originalEvent.preventDefault();\n });\n\n root.on(CustomEvents.events.previous, Selectors.post.action, function(e, data) {\n var currentAction = $(e.target);\n var container = currentAction.closest(Selectors.post.actionsContainer);\n var actions = container.find(Selectors.post.action);\n var nextAction = currentAction.prev(Selectors.post.action);\n\n actions.attr('tabindex', '-1');\n\n if (!nextAction.length) {\n nextAction = actions.last();\n }\n\n nextAction.attr('tabindex', 0);\n nextAction.focus();\n\n data.originalEvent.preventDefault();\n });\n\n root.on(CustomEvents.events.home, Selectors.post.action, function(e, data) {\n var currentAction = $(e.target);\n var container = currentAction.closest(Selectors.post.actionsContainer);\n var actions = container.find(Selectors.post.action);\n var firstAction = actions.first();\n\n actions.attr('tabindex', '-1');\n firstAction.attr('tabindex', 0);\n firstAction.focus();\n\n e.stopPropagation();\n data.originalEvent.preventDefault();\n });\n\n root.on(CustomEvents.events.end, Selectors.post.action, function(e, data) {\n var currentAction = $(e.target);\n var container = currentAction.closest(Selectors.post.actionsContainer);\n var actions = container.find(Selectors.post.action);\n var lastAction = actions.last();\n\n actions.attr('tabindex', '-1');\n lastAction.attr('tabindex', 0);\n lastAction.focus();\n\n e.stopPropagation();\n data.originalEvent.preventDefault();\n });\n\n PubSub.subscribe(ForumEvents.SUBSCRIPTION_TOGGLED, function(data) {\n var subscribed = data.subscriptionState;\n var updateMessage = subscribed ? 'discussionsubscribed' : 'discussionunsubscribed';\n String.get_string(updateMessage, \"forum\")\n .then(function(s) {\n return Notification.addNotification({\n message: s,\n type: \"info\"\n });\n })\n .catch(Notification.exception);\n });\n };\n\n return {\n init: function(root) {\n initAccessibilityKeyboardNav(root);\n }\n };\n});\n"],"file":"discussion.min.js"}