Your IP : 216.73.216.95


Current Path : /var/www/ljmtc/cbt/admin/tool/usertours/amd/build/
Upload File :
Current File : /var/www/ljmtc/cbt/admin/tool/usertours/amd/build/usertours.min.js.map

{"version":3,"sources":["../src/usertours.js"],"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","getStepConfig","getCurrentStepNumber","stepid","stepindex","error"],"mappings":"AAQAA,OAAM,4BACN,CAAC,WAAD,CAAc,qBAAd,CAAqC,QAArC,CAA+C,gBAA/C,CAAiE,UAAjE,CAA6E,UAA7E,CAAyF,mBAAzF,CADM,CAEN,SAASC,CAAT,CAAeC,CAAf,CAA8BC,CAA9B,CAAiCC,CAAjC,CAA4CC,CAA5C,CAAiDC,CAAjD,CAAsDC,CAAtD,CAAoE,CAChE,GAAIC,CAAAA,CAAS,CAAG,CACZC,MAAM,CAAE,IADI,CAGZC,WAAW,CAAE,IAHD,CAYZC,IAAI,CAAE,cAASC,CAAT,CAAsBC,CAAtB,CAA+B,CAEjC,OADIC,CAAAA,CAAY,CAAG,EACnB,CAASC,CAAG,CAAG,CAAf,CAAkBA,CAAG,CAAGF,CAAO,CAACG,MAAhC,CAAwCD,CAAG,EAA3C,CAA+C,CAC3CD,CAAY,CAACC,CAAD,CAAZ,CAAoB,yBAA2BF,CAAO,CAACE,CAAD,CACzD,CACDE,OAAO,CAACH,CAAD,CAAe,UAAW,CAE7B,GAAII,CAAAA,CAAY,CAAG,IAAnB,CACA,IAAK,GA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AL,EALV,CAFV,CADM,CAAV,EAWG,CAXH,CADJ,EAaE3B,IAbF,CAaOlD,CAAG,CAACgF,KAbX,CAcH,CA1OW,CAkPZvD,cAAc,CAAE,wBAAStB,CAAT,CAAiB,CAC7BN,CAAC,CAACgC,IAAF,CACIlC,CAAI,CAACmC,IAAL,CAAU,CACN,CACIC,UAAU,CAAE,2BADhB,CAEIC,IAAI,CAAE,CACFC,MAAM,CAAM9B,CADV,CAEF+B,OAAO,CAAKR,CAAC,CAACS,GAAF,CAAMC,SAFhB,CAGFC,OAAO,CAAKC,MAAM,CAACC,QAAP,CAAgBC,IAH1B,CAFV,CADM,CAAV,EASG,CATH,CADJ,EAWEE,IAXF,CAWO,SAASC,CAAT,CAAmB,CACtB,GAAIA,CAAQ,CAACxB,SAAb,CAAwB,CACpBjB,CAAS,CAACkB,SAAV,CAAoBuB,CAAQ,CAACxB,SAA7B,CACH,CAEJ,CAhBD,EAgBG+B,IAhBH,CAgBQjD,CAAY,CAACkD,SAhBrB,CAiBH,CApQW,CAAhB,CAuQA,MAAqD,CAQjD9C,IAAI,CAAEH,CAAS,CAACG,IARiC,CAgBjDoB,cAAc,CAAEvB,CAAS,CAACuB,cAhBuB,CAkBxD,CA5RK,CAAN","sourcesContent":["/**\n * User tour control library.\n *\n * @module     tool_usertours/usertours\n * @class      usertours\n * @package    tool_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"],"file":"usertours.min.js"}