{"version":3,"sources":["https:\/\/vlm2.ub.ac.id\/mod\/forum\/amd\/src\/posts_list.js"],"names":["define","$","Templates","Notification","Pending","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","fail","exception","form","is","init"],"mappings":"AA2BAA,OAAM,wBAAC,CACC,QADD,CAEC,gBAFD,CAGC,mBAHD,CAIC,cAJD,CAKC,qBALD,CAMC,wBAND,CAAD,CAOC,SACCC,CADD,CAECC,CAFD,CAGCC,CAHD,CAICC,CAJD,CAKCC,CALD,CAMCC,CAND,CAOD,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,GAAIpB,CAAAA,CAAJ,CAAY,cAAZ,CAZ2C,CAarDqB,CAAa,CAAGxB,CAAC,CAACW,CAAC,CAACa,aAAH,CAAD,CAAmBC,OAAnB,CAA2BrB,CAAS,CAACK,IAAV,CAAeiB,gBAA1C,CAbqC,CAcrDC,CAAc,CAAGH,CAAa,CAACI,IAAd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AA,CAAI,CAAG1B,CAAW,CAACF,IAAZ,CAAiBxB,CAAS,CAACK,IAAV,CAAemC,kBAAhC,CAAX,CACAY,CAAI,CAACL,WAAL,CAAiB,GAAjB,CAAsB5B,CAAO,CAAC6B,OAA9B,EACA,GAAII,CAAI,CAACC,EAAL,CAAQ,UAAR,CAAJ,CAAyB,CACrBD,CAAI,CAAC5B,IAAL,CAAU,UAAV,EAAsByB,KAAtB,EACH,CACJ,CACJ,CA1CD,CA2CH,CA5CD,CA8CA,MAAO,CACHK,IAAI,CAAE,cAASnD,CAAT,CAAe,CACjBD,CAAsB,CAACC,CAAD,CAAtB,CACAF,CAAW,CAACqD,IAAZ,CAAiBnD,CAAjB,CACH,CAJE,CAMV,CApEK,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 .\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 'mod_forum\/selectors',\n 'mod_forum\/inpage_reply',\n ], function(\n $,\n Templates,\n Notification,\n Pending,\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 .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"}