Current Path : C:/xampp/htdocs/moodle/admin/tool/templatelibrary/amd/build/ |
Current File : C:/xampp/htdocs/moodle/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","document","location","hash","call","methodname","args","component","search","throttle","queueRefresh","callback","delay","window","clearTimeout","setTimeout","changeHandler","bind","theme","on","replace"],"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,yBAAD,CAAD,CAA2BkB,GAA3B,EAFoB,CAKpCE,QAAQ,CAACC,QAAT,CAAkBC,IAAlB,CAAyBH,CAAzB,CAEAlB,CAAI,CAACsB,IAAL,CAAU,CACN,CAACC,UAAU,CAAE,qCAAb,CACEC,IAAI,CAAE,CAACC,SAAS,CAAET,CAAZ,CAA0BU,MAAM,CAAER,CAAlC,CAA6CH,SAAS,CAAEA,CAAxD,CADR,CAEEP,IAAI,CAAEH,CAFR,CAGEO,IAAI,CAAEV,CAAY,CAACW,SAHrB,CADM,CAAV,OAMH,CAlC0D,CAoCvDc,CAAQ,CAAG,IApC4C,CA8CvDC,CAAY,CAAG,SAASC,CAAT,CAAmBC,CAAnB,CAA0B,CACzC,GAAiB,IAAb,GAAAH,CAAJ,CAAuB,CACnBI,MAAM,CAACC,YAAP,CAAoBL,CAApB,CACH,CAEDA,CAAQ,CAAGI,MAAM,CAACE,UAAP,CAAkB,UAAW,CACpCJ,CAAQ,GACRF,CAAQ,CAAG,IACd,CAHU,CAGRG,CAHQ,CAId,CAvD0D,CAyDvDI,CAAa,CAAG,UAAW,CAC3BN,CAAY,CAACd,CAAa,CAACqB,IAAd,CAAmB,IAAnB,CAAyB/B,CAAM,CAACgC,KAAhC,CAAD,CAAyC,GAAzC,CACf,CA3D0D,CA6D3DrC,CAAC,CAAC,kCAAD,CAAD,CAAoCsC,EAApC,CAAuC,QAAvC,CAAiD,4BAAjD,CAA6EH,CAA7E,EACAnC,CAAC,CAAC,kCAAD,CAAD,CAAoCsC,EAApC,CAAuC,OAAvC,CAAgD,yBAAhD,CAAyEH,CAAzE,EAEAnC,CAAC,CAAC,yBAAD,CAAD,CAA2BkB,GAA3B,CAA+BE,QAAQ,CAACC,QAAT,CAAkBC,IAAlB,CAAuBiB,OAAvB,CAA+B,GAA/B,CAAoC,EAApC,CAA/B,EACAxB,CAAa,CAACV,CAAM,CAACgC,KAAR,CAAb,CACA,MAAO,EACV,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 <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-field=\"search\"]').val();\n\n // Trigger the search.\n document.location.hash = searchStr;\n\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-field=\"search\"]', changeHandler);\n\n $('[data-field=\"search\"]').val(document.location.hash.replace('#', ''));\n refreshSearch(config.theme);\n return {};\n});\n"],"file":"search.min.js"}