Sindbad~EG File Manager
{"version":3,"file":"usertours.min.js","sources":["../src/usertours.js"],"sourcesContent":["/**\n * User tour control library.\n *\n * @module tool_usertours/usertours\n * @copyright 2016 Andrew Nicols <andrew@nicols.co.uk>\n */\ndefine(\n['core/ajax', 'tool_usertours/tour', 'jquery', 'core/templates', 'core/str', 'core/log', 'core/notification'],\nfunction(ajax, BootstrapTour, $, templates, str, log, notification) {\n var usertours = {\n tourId: null,\n\n currentTour: null,\n\n /**\n * Initialise the user tour for the current page.\n *\n * @method init\n * @param {Array} tourDetails The matching tours for this page.\n * @param {Array} filters The names of all client side filters.\n */\n init: function(tourDetails, filters) {\n let requirements = [];\n for (var req = 0; req < filters.length; req++) {\n requirements[req] = 'tool_usertours/filter_' + filters[req];\n }\n require(requirements, function() {\n // Run the client side filters to find the first matching tour.\n let matchingTour = null;\n for (let key in tourDetails) {\n let tour = tourDetails[key];\n for (let i = 0; i < filters.length; i++) {\n let filter = arguments[i];\n if (filter.filterMatches(tour)) {\n matchingTour = tour;\n } else {\n // If any filter doesn't match, move on to the next tour.\n matchingTour = null;\n break;\n }\n }\n // If all filters matched then use this tour.\n if (matchingTour) {\n break;\n }\n }\n\n if (matchingTour === null) {\n return;\n }\n\n // Only one tour per page is allowed.\n usertours.tourId = matchingTour.tourId;\n\n let startTour = matchingTour.startTour;\n if (typeof startTour === 'undefined') {\n startTour = true;\n }\n\n if (startTour) {\n // Fetch the tour configuration.\n usertours.fetchTour(usertours.tourId);\n }\n\n usertours.addResetLink();\n // Watch for the reset link.\n $('body').on('click', '[data-action=\"tool_usertours/resetpagetour\"]', function(e) {\n e.preventDefault();\n usertours.resetTourState(usertours.tourId);\n });\n });\n },\n\n /**\n * Fetch the configuration specified tour, and start the tour when it has been fetched.\n *\n * @method fetchTour\n * @param {Number} tourId The ID of the tour to start.\n */\n fetchTour: function(tourId) {\n M.util.js_pending('admin_usertour_fetchTour' + tourId);\n $.when(\n ajax.call([\n {\n methodname: 'tool_usertours_fetch_and_start_tour',\n args: {\n tourid: tourId,\n context: M.cfg.contextid,\n pageurl: window.location.href,\n }\n }\n ])[0],\n templates.render('tool_usertours/tourstep', {})\n )\n .then(function(response, template) {\n // If we don't have any tour config (because it doesn't need showing for the current user), return early.\n if (!response.hasOwnProperty('tourconfig')) {\n return;\n }\n\n return usertours.startBootstrapTour(tourId, template[0], response.tourconfig);\n })\n .always(function() {\n M.util.js_complete('admin_usertour_fetchTour' + tourId);\n\n return;\n })\n .fail(notification.exception);\n },\n\n /**\n * Add a reset link to the page.\n *\n * @method addResetLink\n */\n addResetLink: function() {\n var ele;\n M.util.js_pending('admin_usertour_addResetLink');\n\n // Append the link to the most suitable place on the page\n // with fallback to legacy selectors and finally the body\n // if there is no better place.\n if ($('.tool_usertours-resettourcontainer').length) {\n ele = $('.tool_usertours-resettourcontainer');\n } else if ($('.logininfo').length) {\n ele = $('.logininfo');\n } else if ($('footer').length) {\n ele = $('footer');\n } else {\n ele = $('body');\n }\n templates.render('tool_usertours/resettour', {})\n .then(function(html, js) {\n templates.appendNodeContents(ele, html, js);\n\n return;\n })\n .always(function() {\n M.util.js_complete('admin_usertour_addResetLink');\n\n return;\n })\n .fail();\n },\n\n /**\n * Start the specified tour.\n *\n * @method startBootstrapTour\n * @param {Number} tourId The ID of the tour to start.\n * @param {String} template The template to use.\n * @param {Object} tourConfig The tour configuration.\n * @return {Object}\n */\n startBootstrapTour: function(tourId, template, tourConfig) {\n if (usertours.currentTour) {\n // End the current tour, but disable end tour handler.\n tourConfig.onEnd = null;\n usertours.currentTour.endTour();\n delete usertours.currentTour;\n }\n\n // Normalize for the new library.\n tourConfig.eventHandlers = {\n afterEnd: [usertours.markTourComplete],\n afterRender: [usertours.markStepShown],\n };\n\n // Sort out the tour name.\n tourConfig.tourName = tourConfig.name;\n delete tourConfig.name;\n\n // Add the template to the configuration.\n // This enables translations of the buttons.\n tourConfig.template = template;\n\n tourConfig.steps = tourConfig.steps.map(function(step) {\n if (typeof step.element !== 'undefined') {\n step.target = step.element;\n delete step.element;\n }\n\n if (typeof step.reflex !== 'undefined') {\n step.moveOnClick = !!step.reflex;\n delete step.reflex;\n }\n\n if (typeof step.content !== 'undefined') {\n step.body = step.content;\n delete step.content;\n }\n\n return step;\n });\n\n usertours.currentTour = new BootstrapTour(tourConfig);\n return usertours.currentTour.startTour();\n },\n\n /**\n * Mark the specified step as being shownd by the user.\n *\n * @method markStepShown\n */\n markStepShown: function() {\n var stepConfig = this.getStepConfig(this.getCurrentStepNumber());\n $.when(\n ajax.call([\n {\n methodname: 'tool_usertours_step_shown',\n args: {\n tourid: usertours.tourId,\n context: M.cfg.contextid,\n pageurl: window.location.href,\n stepid: stepConfig.stepid,\n stepindex: this.getCurrentStepNumber(),\n }\n }\n ])[0]\n ).fail(log.error);\n },\n\n /**\n * Mark the specified tour as being completed by the user.\n *\n * @method markTourComplete\n */\n markTourComplete: function() {\n var stepConfig = this.getStepConfig(this.getCurrentStepNumber());\n $.when(\n ajax.call([\n {\n methodname: 'tool_usertours_complete_tour',\n args: {\n tourid: usertours.tourId,\n context: M.cfg.contextid,\n pageurl: window.location.href,\n stepid: stepConfig.stepid,\n stepindex: this.getCurrentStepNumber(),\n }\n }\n ])[0]\n ).fail(log.error);\n },\n\n /**\n * Reset the state, and restart the the tour on the current page.\n *\n * @method resetTourState\n * @param {Number} tourId The ID of the tour to start.\n */\n resetTourState: function(tourId) {\n $.when(\n ajax.call([\n {\n methodname: 'tool_usertours_reset_tour',\n args: {\n tourid: tourId,\n context: M.cfg.contextid,\n pageurl: window.location.href,\n }\n }\n ])[0]\n ).then(function(response) {\n if (response.startTour) {\n usertours.fetchTour(response.startTour);\n }\n return;\n }).fail(notification.exception);\n }\n };\n\n return /** @alias module:tool_usertours/usertours */ {\n /**\n * Initialise the user tour for the current page.\n *\n * @method init\n * @param {Number} tourId The ID of the tour to start.\n * @param {Bool} startTour Attempt to start the tour now.\n */\n init: usertours.init,\n\n /**\n * Reset the state, and restart the the tour on the current page.\n *\n * @method resetTourState\n * @param {Number} tourId The ID of the tour to restart.\n */\n resetTourState: usertours.resetTourState\n };\n});\n"],"names":["define","ajax","BootstrapTour","$","templates","str","log","notification","usertours","tourId","currentTour","init","tourDetails","filters","requirements","req","length","require","matchingTour","key","tour","i","filter","arguments","filterMatches","startTour","fetchTour","addResetLink","on","e","preventDefault","resetTourState","M","util","js_pending","when","call","methodname","args","tourid","context","cfg","contextid","pageurl","window","location","href","render","then","response","template","hasOwnProperty","startBootstrapTour","tourconfig","always","js_complete","fail","exception","ele","html","js","appendNodeContents","tourConfig","onEnd","endTour","eventHandlers","afterEnd","markTourComplete","afterRender","markStepShown","tourName","name","steps","map","step","element","target","reflex","moveOnClick","content","body","stepConfig","this","getStepConfig","getCurrentStepNumber","stepid","stepindex","error"],"mappings":"AAMAA,kCACA,CAAC,YAAa,sBAAuB,SAAU,iBAAkB,WAAY,WAAY,sBACzF,SAASC,KAAMC,cAAeC,EAAGC,UAAWC,IAAKC,IAAKC,kBAC9CC,UAAY,CACZC,OAAQ,KAERC,YAAa,KASbC,KAAM,SAASC,YAAaC,iBACpBC,aAAe,GACVC,IAAM,EAAGA,IAAMF,QAAQG,OAAQD,MACpCD,aAAaC,KAAO,yBAA2BF,QAAQE,KAE3DE,QAAQH,cAAc,eAEdI,aAAe,SACd,IAAIC,OAAOP,YAAa,SACrBQ,KAAOR,YAAYO,KACdE,EAAI,EAAGA,EAAIR,QAAQG,OAAQK,IAAK,KACjCC,OAASC,UAAUF,OACnBC,OAAOE,cAAcJ,MAElB,CAEHF,aAAe,WAHfA,aAAeE,QAQnBF,sBAKa,OAAjBA,cAKJV,UAAUC,OAASS,aAAaT,WAE5BgB,UAAYP,aAAaO,eACJ,IAAdA,YACPA,WAAY,GAGZA,WAEAjB,UAAUkB,UAAUlB,UAAUC,QAGlCD,UAAUmB,eAEVxB,EAAE,QAAQyB,GAAG,QAAS,gDAAgD,SAASC,GAC3EA,EAAEC,iBACFtB,UAAUuB,eAAevB,UAAUC,gBAW/CiB,UAAW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