Your IP : 192.168.165.1


Current Path : C:/Users/Mahmood/Desktop/moodle/lib/amd/build/
Upload File :
Current File : C:/Users/Mahmood/Desktop/moodle/lib/amd/build/auto_rows.min.js.map

{"version":3,"sources":["../src/auto_rows.js"],"names":["define","$","SELECTORS","ELEMENT","EVENTS","ROW_CHANGE","calculateRows","element","currentRows","attr","minRows","data","maxRows","height","innerHeight","scrollHeight","rows","css","changeListener","e","target","trigger","init","root","on","bind","events"],"mappings":"AAyBAA,OAAM,kBAAC,CAAC,QAAD,CAAD,CAAa,SAASC,CAAT,CAAY,IACvBC,CAAAA,CAAS,CAAG,CACZC,OAAO,CAAE,kBADG,CADW,CAKvBC,CAAM,CAAG,CACTC,UAAU,CAAE,oBADH,CALc,CAiBvBC,CAAa,CAAG,SAASC,CAAT,CAAkB,IAC9BC,CAAAA,CAAW,CAAGD,CAAO,CAACE,IAAR,CAAa,MAAb,CADgB,CAE9BC,CAAO,CAAGH,CAAO,CAACI,IAAR,CAAa,UAAb,CAFoB,CAG9BC,CAAO,CAAGL,CAAO,CAACE,IAAR,CAAa,eAAb,CAHoB,CAK9BI,CAAM,CAAGN,CAAO,CAACM,MAAR,EALqB,CAM9BC,CAAW,CAAGP,CAAO,CAACO,WAAR,EANgB,CAS9BC,CAAY,CAAGR,CAAO,CAAC,CAAD,CAAP,CAAWQ,YATI,CAU9BC,CAAI,CAAG,CAACD,CAAY,EAHVD,CAAW,CAAGD,CAGJ,CAAb,GAA4BA,CAAM,CAAGL,CAArC,CAVuB,CAclCD,CAAO,CAACU,GAAR,CAAY,QAAZ,CAAsB,EAAtB,EAEA,GAAID,CAAI,CAAGN,CAAX,CAAoB,CAChB,MAAOA,CAAAA,CACV,CAFD,IAEO,IAAIE,CAAO,EAAII,CAAI,EAAIJ,CAAvB,CAAgC,CACnC,MAAOA,CAAAA,CACV,CAFM,IAEA,CACH,MAAOI,CAAAA,CACV,CACJ,CAxC0B,CAiDvBE,CAAc,CAAG,SAASC,CAAT,CAAY,IACzBZ,CAAAA,CAAO,CAAGN,CAAC,CAACkB,CAAC,CAACC,MAAH,CADc,CAEzBV,CAAO,CAAGH,CAAO,CAACI,IAAR,CAAa,UAAb,CAFe,CAGzBH,CAAW,CAAGD,CAAO,CAACE,IAAR,CAAa,MAAb,CAHW,CAK7B,GAAuB,WAAnB,QAAOC,CAAAA,CAAX,CAAoC,CAChCH,CAAO,CAACI,IAAR,CAAa,UAAb,CAAyBH,CAAzB,CACH,CAIDD,CAAO,CAACE,IAAR,CAAa,MAAb,CAAqB,CAArB,EACA,GAAIO,CAAAA,CAAI,CAAGV,CAAa,CAACC,CAAD,CAAxB,CACAA,CAAO,CAACE,IAAR,CAAa,MAAb,CAAqBO,CAArB,EAEA,GAAIA,CAAI,EAAIR,CAAZ,CAAyB,CACrBD,CAAO,CAACc,OAAR,CAAgBjB,CAAM,CAACC,UAAvB,CACH,CACJ,CAnE0B,CAoF3B,MAAqC,CACjCiB,IAAI,CATG,QAAPA,CAAAA,IAAO,CAASC,CAAT,CAAe,CACtB,GAAItB,CAAC,CAACsB,CAAD,CAAD,CAAQZ,IAAR,CAAa,WAAb,CAAJ,CAA+B,CAC3BV,CAAC,CAACsB,CAAD,CAAD,CAAQC,EAAR,CAAW,sBAAX,CAAmCN,CAAc,CAACO,IAAf,CAAoB,IAApB,CAAnC,CACH,CAFD,IAEO,CACHxB,CAAC,CAACsB,CAAD,CAAD,CAAQC,EAAR,CAAW,sBAAX,CAAmCtB,CAAS,CAACC,OAA7C,CAAsDe,CAAc,CAACO,IAAf,CAAoB,IAApB,CAAtD,CACH,CACJ,CAEoC,CAEjCC,MAAM,CAAEtB,CAFyB,CAIxC,CAxFK,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 * Enhance a textarea with auto growing rows to fit the content.\n *\n * @module     core/auto_rows\n * @class      auto_rows\n * @package    core\n * @copyright  2016 Ryan Wyllie <ryan@moodle.com>\n * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n * @since      3.2\n */\ndefine(['jquery'], function($) {\n    var SELECTORS = {\n        ELEMENT: '[data-auto-rows]'\n    };\n\n    var EVENTS = {\n        ROW_CHANGE: 'autorows:rowchange',\n    };\n\n    /**\n     * Determine how many rows should be set for the given element.\n     *\n     * @method calculateRows\n     * @param {jQuery} element The textarea element\n     * @return {int} The number of rows for the element\n     * @private\n     */\n    var calculateRows = function(element) {\n        var currentRows = element.attr('rows');\n        var minRows = element.data('min-rows');\n        var maxRows = element.attr('data-max-rows');\n\n        var height = element.height();\n        var innerHeight = element.innerHeight();\n        var padding = innerHeight - height;\n\n        var scrollHeight = element[0].scrollHeight;\n        var rows = (scrollHeight - padding) / (height / currentRows);\n\n        // Remove the height styling to let the height be calculated automatically\n        // based on the row attribute.\n        element.css('height', '');\n\n        if (rows < minRows) {\n            return minRows;\n        } else if (maxRows && rows >= maxRows) {\n            return maxRows;\n        } else {\n            return rows;\n        }\n    };\n\n    /**\n     * Listener for change events to trigger resizing of the element.\n     *\n     * @method changeListener\n     * @param {Event} e The triggered event.\n     * @private\n     */\n    var changeListener = function(e) {\n        var element = $(e.target);\n        var minRows = element.data('min-rows');\n        var currentRows = element.attr('rows');\n\n        if (typeof minRows === \"undefined\") {\n            element.data('min-rows', currentRows);\n        }\n\n        // Reset element to single row so that the scroll height of the\n        // element is correctly calculated each time.\n        element.attr('rows', 1);\n        var rows = calculateRows(element);\n        element.attr('rows', rows);\n\n        if (rows != currentRows) {\n            element.trigger(EVENTS.ROW_CHANGE);\n        }\n    };\n\n    /**\n     * Add the event listeners for all text areas within the given element.\n     *\n     * @method init\n     * @param {jQuery|selector} root The container element of all enhanced text areas\n     * @public\n     */\n    var init = function(root) {\n        if ($(root).data('auto-rows')) {\n            $(root).on('input propertychange', changeListener.bind(this));\n        } else {\n            $(root).on('input propertychange', SELECTORS.ELEMENT, changeListener.bind(this));\n        }\n    };\n\n    return /** @module core/auto_rows */ {\n        init: init,\n        events: EVENTS,\n    };\n});\n"],"file":"auto_rows.min.js"}