Your IP : 216.73.216.95


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

{"version":3,"sources":["../src/search.js"],"names":["define","$","ajax","log","notification","templates","config","reloadListTemplate","templateList","render","done","result","js","replaceNode","fail","exception","refreshSearch","themename","componentStr","val","searchStr","removeClass","addClass","call","methodname","args","component","search","throttle","queueRefresh","callback","delay","window","clearTimeout","setTimeout","changeHandler","bind","theme","on"],"mappings":"AAuBAA,OAAM,+BAAC,CAAC,QAAD,CAAW,WAAX,CAAwB,UAAxB,CAAoC,mBAApC,CAAyD,gBAAzD,CAA2E,aAA3E,CAAD,CACC,SAASC,CAAT,CAAYC,CAAZ,CAAkBC,CAAlB,CAAuBC,CAAvB,CAAqCC,CAArC,CAAgDC,CAAhD,CAAwD,IAQvDC,CAAAA,CAAkB,CAAG,SAASC,CAAT,CAAuB,CAC5CH,CAAS,CAACI,MAAV,CAAiB,qCAAjB,CAAwD,CAACJ,SAAS,CAAEG,CAAZ,CAAxD,EACKE,IADL,CACU,SAASC,CAAT,CAAiBC,CAAjB,CAAqB,CACvBP,CAAS,CAACQ,WAAV,CAAsBZ,CAAC,CAAC,iCAAD,CAAvB,CAA0DU,CAA1D,CAAkEC,CAAlE,CACH,CAHL,EAGOE,IAHP,CAGYV,CAAY,CAACW,SAHzB,CAIH,CAb0D,CAqBvDC,CAAa,CAAG,SAASC,CAAT,CAAoB,IAChCC,CAAAA,CAAY,CAAGjB,CAAC,CAAC,4BAAD,CAAD,CAA8BkB,GAA9B,EADiB,CAEhCC,CAAS,CAAGnB,CAAC,CAAC,0DAAD,CAAD,CAA0DkB,GAA1D,EAFoB,CAIpC,GAAkB,EAAd,GAAAC,CAAJ,CAAsB,CAClBnB,CAAC,CAAC,gEAAD,CAAD,CAAgEoB,WAAhE,CAA4E,QAA5E,CACH,CAFD,IAEO,CACHpB,CAAC,CAAC,gEAAD,CAAD,CAAg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ACA,MAAO,EACV,CA5EK,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 adds ajax search functions to the template library page.\n *\n * @module     tool_templatelibrary/search\n * @package    tool_templatelibrary\n * @copyright  2015 Damyon Wiese <damyon@moodle.com>\n * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(['jquery', 'core/ajax', 'core/log', 'core/notification', 'core/templates', 'core/config'],\n       function($, ajax, log, notification, templates, config) {\n\n    /**\n     * The ajax call has returned with a new list of templates.\n     *\n     * @method reloadListTemplate\n     * @param {String[]} templateList List of template ids.\n     */\n    var reloadListTemplate = function(templateList) {\n        templates.render('tool_templatelibrary/search_results', {templates: templateList})\n            .done(function(result, js) {\n                templates.replaceNode($('[data-region=\"searchresults\"]'), result, js);\n            }).fail(notification.exception);\n    };\n\n    /**\n     * Get the current values for the form inputs and refresh the list of matching templates.\n     *\n     * @method refreshSearch\n     * @param {String} themename The naeme of the theme.\n     */\n    var refreshSearch = function(themename) {\n        var componentStr = $('[data-field=\"component\"]').val();\n        var searchStr = $('[data-region=\"list-templates\"] [data-region=\"input\"]').val();\n\n        if (searchStr !== '') {\n            $('[data-region=\"list-templates\"] [data-action=\"clearsearch\"]').removeClass('d-none');\n        } else {\n            $('[data-region=\"list-templates\"] [data-action=\"clearsearch\"]').addClass('d-none');\n        }\n\n        // Trigger the search.\n        ajax.call([\n            {methodname: 'tool_templatelibrary_list_templates',\n              args: {component: componentStr, search: searchStr, themename: themename},\n              done: reloadListTemplate,\n              fail: notification.exception}\n        ], true, false);\n    };\n\n    var throttle = null;\n\n    /**\n     * Call the specified function after a delay. If this function is called again before the function is executed,\n     * the function will only be executed once.\n     *\n     * @method queueRefresh\n     * @param {function} callback\n     * @param {Number} delay The time in milliseconds to delay.\n     */\n    var queueRefresh = function(callback, delay) {\n        if (throttle !== null) {\n            window.clearTimeout(throttle);\n        }\n\n        throttle = window.setTimeout(function() {\n            callback();\n            throttle = null;\n        }, delay);\n    };\n\n    var changeHandler = function() {\n        queueRefresh(refreshSearch.bind(this, config.theme), 400);\n    };\n    // Add change handlers to refresh the list.\n    $('[data-region=\"list-templates\"]').on('change', '[data-field=\"component\"]', changeHandler);\n    $('[data-region=\"list-templates\"]').on('input', '[data-region=\"input\"]', changeHandler);\n    $('[data-action=\"clearsearch\"]').on('click', function() {\n        $('[data-region=\"input\"]').val('');\n        refreshSearch(config.theme);\n        $(this).addClass('d-none');\n    });\n\n    refreshSearch(config.theme);\n    return {};\n});\n"],"file":"search.min.js"}