MDL-67654 mod_forum: formchangechecker for discussion inline replies.
[moodle.git] / mod / forum / amd / build / posts_list.min.js.map
... / ...
CommitLineData
1{"version":3,"sources":["../src/posts_list.js"],"names":["define","$","Templates","Notification","Pending","Y","Selectors","InPageReply","registerEventListeners","root","on","post","inpageReplyLink","e","preventDefault","window","location","hash","url","href","split","history","pushState","document","title","pending","currentTarget","parents","forumCoreContent","currentSubject","find","forumSubject","currentRoot","forumContent","context","postid","data","attr","sesskey","M","cfg","parentsubject","canreplyprivately","postformat","CONTENT_FORMATS","MOODLE","inpageReplyContent","length","render","then","html","js","appendNodeContents","slideToggle","resolve","focus","use","core_formchangechecker","init","formid","fail","exception","form","is"],"mappings":"AA2BAA,OAAM,wBAAC,CACC,QADD,CAEC,gBAFD,CAGC,mBAHD,CAIC,cAJD,CAKC,UALD,CAMC,qBAND,CAOC,wBAPD,CAAD,CAQC,SACCC,CADD,CAECC,CAFD,CAGCC,CAHD,CAICC,CAJD,CAKCC,CALD,CAMCC,CAND,CAOCC,CAPD,CAQD,CAEF,GAAIC,CAAAA,CAAsB,CAAG,SAASC,CAAT,CAAe,CACxCA,CAAI,CAACC,EAAL,CAAQ,OAAR,CAAiBJ,CAAS,CAACK,IAAV,CAAeC,eAAhC,CAAiD,SAASC,CAAT,CAAY,CACzDA,CAAC,CAACC,cAAF,GAMA,GAAIC,MAAM,CAACC,QAAP,CAAgBC,IAApB,CAA0B,CAEtB,GAAIC,CAAAA,CAAG,CAAGH,MAAM,CAACC,QAAP,CAAgBG,IAAhB,CAAqBC,KAArB,CAA2B,GAA3B,EAAgC,CAAhC,CAAV,CACAC,OAAO,CAACC,SAAR,CAAkB,EAAlB,CAAsBC,QAAQ,CAACC,KAA/B,CAAsCN,CAAtC,CACH,CAXwD,GAYrDO,CAAAA,CAAO,CAAG,GAAIrB,CAAAA,CAAJ,CAAY,cAAZ,CAZ2C,CAarDsB,CAAa,CAAGzB,CAAC,CAACY,CAAC,CAACa,aAAH,CAAD,CAAmBC,OAAn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B,KADjD,EAEV,CAPL,EAQKN,IARL,CAQU,UAAW,CAEb5C,CAAC,CAACmD,GAAF,CAAM,+BAAN,CAAuC,UAAM,CACzCjB,CAAC,CAACkB,sBAAF,CAAyBC,IAAzB,CAA8B,CAACC,MAAM,wBAAkBzB,CAAO,CAACC,MAA1B,CAAP,CAA9B,CACH,CAFD,CAIH,CAdL,EAeKyB,IAfL,CAeUzD,CAAY,CAAC0D,SAfvB,CAgBH,CAjBD,IAiBO,CACH,GAAIC,CAAAA,CAAI,CAAG9B,CAAW,CAACF,IAAZ,CAAiBxB,CAAS,CAACK,IAAV,CAAemC,kBAAhC,CAAX,CACAgB,CAAI,CAACT,WAAL,CAAiB,GAAjB,CAAsB5B,CAAO,CAAC6B,OAA9B,EACA,GAAIQ,CAAI,CAACC,EAAL,CAAQ,UAAR,CAAJ,CAAyB,CACrBD,CAAI,CAAChC,IAAL,CAAU,UAAV,EAAsByB,KAAtB,EACH,CACJ,CACJ,CAjDD,CAkDH,CAnDD,CAqDA,MAAO,CACHG,IAAI,CAAE,cAASjD,CAAT,CAAe,CACjBD,CAAsB,CAACC,CAAD,CAAtB,CACAF,CAAW,CAACmD,IAAZ,CAAiBjD,CAAjB,CACH,CAJE,CAMV,CA7EK,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 * This module is the highest level module for the calendar. It is\n * responsible for initialising all of the components required for\n * the calendar to run. It also coordinates the interaction between\n * components by listening for and responding to different events\n * triggered within the calendar UI.\n *\n * @module mod_forum/posts_list\n * @package mod_forum\n * @copyright 2019 Peter Dias\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine([\n 'jquery',\n 'core/templates',\n 'core/notification',\n 'core/pending',\n 'core/yui',\n 'mod_forum/selectors',\n 'mod_forum/inpage_reply',\n ], function(\n $,\n Templates,\n Notification,\n Pending,\n Y,\n Selectors,\n InPageReply\n ) {\n\n var registerEventListeners = function(root) {\n root.on('click', Selectors.post.inpageReplyLink, function(e) {\n e.preventDefault();\n // After adding a reply a url hash is being generated that scrolls (points) to the newly added reply.\n // The hash being present causes this scrolling behavior to the particular reply to persists even when\n // another, non-related in-page replay link is being clicked which ultimately causes a bad user experience.\n // A particular solution for this problem would be changing the browser's history state when a url hash is\n // present.\n if (window.location.hash) {\n // Remove the fragment identifier from the url.\n var url = window.location.href.split('#')[0];\n history.pushState({}, document.title, url);\n }\n var pending = new Pending('inpage-reply');\n var currentTarget = $(e.currentTarget).parents(Selectors.post.forumCoreContent);\n var currentSubject = currentTarget.find(Selectors.post.forumSubject);\n var currentRoot = $(e.currentTarget).parents(Selectors.post.forumContent);\n var context = {\n postid: $(currentRoot).data('post-id'),\n \"reply_url\": $(e.currentTarget).attr('href'),\n sesskey: M.cfg.sesskey,\n parentsubject: currentSubject.data('replySubject'),\n canreplyprivately: $(e.currentTarget).data('can-reply-privately'),\n postformat: InPageReply.CONTENT_FORMATS.MOODLE\n };\n\n if (!currentRoot.find(Selectors.post.inpageReplyContent).length) {\n Templates.render('mod_forum/inpage_reply', context)\n .then(function(html, js) {\n return Templates.appendNodeContents(currentTarget, html, js);\n })\n .then(function() {\n return currentRoot.find(Selectors.post.inpageReplyContent)\n .slideToggle(300, pending.resolve).find('textarea').focus();\n })\n .then(function() {\n // Load formchangechecker module.\n Y.use('moodle-core-formchangechecker', () => {\n M.core_formchangechecker.init({formid: `inpage-reply-${context.postid}`});\n });\n return;\n })\n .fail(Notification.exception);\n } else {\n var form = currentRoot.find(Selectors.post.inpageReplyContent);\n form.slideToggle(300, pending.resolve);\n if (form.is(':visible')) {\n form.find('textarea').focus();\n }\n }\n });\n };\n\n return {\n init: function(root) {\n registerEventListeners(root);\n InPageReply.init(root);\n }\n };\n});\n"],"file":"posts_list.min.js"}