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/truncate.min.js.map

{"version":3,"sources":["../src/truncate.js"],"names":["define","$","charLengthAt","text","position","string","size","length","index","cuFirst","charCodeAt","cuSecond","nextIndex","len","lengthMultiByte","count","i","getSliceLength","amount","truncate","html","options","append","fn","isNaN","parseFloat","o","extend","defaults","each","self","noBreaks","find","replaceWith","ellipsisLength","ellipsis","textLength","excess","stripTags","words","sliced","slice","replaced","replace","truncated","oneWord","match","keepFirstWord","exec","contents","get","reverse","el","$el","remove","nodeType","splitAmount","splitText"],"mappings":"AAqCAA,OAAM,iBAAC,CAAC,QAAD,CAAD,CAAa,SAASC,CAAT,CAAY,IAczBC,CAAAA,CAAY,CAAG,SAASC,CAAT,CAAeC,CAAf,CAAyB,IACtCC,CAAAA,CAAM,CAAUF,CAAV,GADgC,CAEtCG,CAAI,CAAGD,CAAM,CAACE,MAFwB,CAItCC,CAAK,CAAGJ,CAAQ,EAAUA,CAAV,CAAsB,CAJA,CAK1C,GAAII,CAAK,EAAIA,CAAb,CAAoB,CAClBA,CAAK,CAAG,CACT,CAID,GAAa,CAAC,CAAV,EAAAA,CAAK,EAAUA,CAAK,EAAIF,CAA5B,CAAkC,CAChC,MAAO,EACR,CAEDE,CAAK,CAAW,CAAR,CAAAA,CAAR,CAf0C,GAiBtCC,CAAAA,CAAO,CAAGJ,CAAM,CAACK,UAAP,CAAkBF,CAAlB,CAjB4B,CAkBtCG,CAlBsC,CAmBtCC,CAAS,CAAGJ,CAAK,CAAG,CAnBkB,CAoBtCK,CAAG,CAAG,CApBgC,CAqB1C,GACa,KAAX,EAAAJ,CAAO,EAAyB,KAAX,EAAAA,CAArB,EACAH,CAAI,CAAGM,CAFT,CAGE,CACAD,CAAQ,CAAGN,CAAM,CAACK,UAAP,CAAkBE,CAAlB,CAAX,CACA,GAAgB,KAAZ,EAAAD,CAAQ,EAA0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,CAAb,EACA,QACD,CAxBD,CAyBD,CA9DM,CA+DR,CAnED,CAqEAjC,CAAC,CAACkB,QAAF,CAAWS,QAAX,CAAsB,CAGpBU,SAAS,GAHW,CAMpBC,KAAK,GANe,CAUpBQ,aAAa,GAVO,CAapBhB,QAAQ,GAbY,CAgBpBxB,MAAM,IAhBc,CAuBpB4B,QAAQ,CAAE,QAvBU,CAAtB,CA2BE,MAAO,CACHhB,QAAQ,CAAElB,CAAC,CAACkB,QADT,CAGV,CAlLK,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 * Description of import/upgrade into Moodle:\n * 1.) Download from https://github.com/pathable/truncate\n * 2.) Copy jquery.truncate.js into lib/amd/src/truncate.js\n * 3.) Edit truncate.js to return the $.truncate function as truncate\n * 4.) Apply Moodle changes from git commit 7172b33e241c4d42cff01f78bf8570408f43fdc2\n */\n\n/**\n * Module for text truncation.\n *\n * Implementation provided by Pathable (thanks!).\n * See: https://github.com/pathable/truncate\n *\n * @module     core/truncate\n * @package    core\n * @class      truncate\n * @copyright  2017 Pathable\n *             2017 Mathias Bynens\n *             2017 Ryan Wyllie <ryan@moodle.com>\n * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(['jquery'], function($) {\n\n  // Matches trailing non-space characters.\n  var chop = /(\\s*\\S+|\\s)$/;\n\n  // Matches the first word in the string.\n  var start = /^(\\S*)/;\n\n  // Matches any space characters.\n  var space = /\\s/;\n\n  // Special thanks to Mathias Bynens for the multi-byte char\n  // implementation. Much love.\n  // see: https://github.com/mathiasbynens/String.prototype.at/blob/master/at.js\n  var charLengthAt = function(text, position) {\n    var string = String(text);\n    var size = string.length;\n    // `ToInteger`\n    var index = position ? Number(position) : 0;\n    if (index != index) { // better `isNaN`\n      index = 0;\n    }\n    // Account for out-of-bounds indices\n    // The odd lower bound is because the ToInteger operation is\n    // going to round `n` to `0` for `-1 < n <= 0`.\n    if (index <= -1 || index >= size) {\n      return '';\n    }\n    // Second half of `ToInteger`\n    index = index | 0;\n    // Get the first code unit and code unit value\n    var cuFirst = string.charCodeAt(index);\n    var cuSecond;\n    var nextIndex = index + 1;\n    var len = 1;\n    if ( // Check if it’s the start of a surrogate pair.\n      cuFirst >= 0xD800 && cuFirst <= 0xDBFF && // high surrogate\n      size > nextIndex // there is a next code unit\n    ) {\n      cuSecond = string.charCodeAt(nextIndex);\n      if (cuSecond >= 0xDC00 && cuSecond <= 0xDFFF) { // low surrogate\n        len = 2;\n      }\n    }\n    return len;\n  };\n\n  var lengthMultiByte = function(text) {\n    var count = 0;\n\n    for (var i = 0; i < text.length; i += charLengthAt(text, i)) {\n      count++;\n    }\n\n    return count;\n  };\n\n  var getSliceLength = function(text, amount) {\n    if (!text.length) {\n      return 0;\n    }\n\n    var length = 0;\n    var count = 0;\n\n    do {\n      length += charLengthAt(text, length);\n      count++;\n    } while (length < text.length && count < amount);\n\n    return length;\n  };\n\n  // Return a truncated html string.  Delegates to $.fn.truncate.\n  $.truncate = function(html, options) {\n    return $('<div></div>').append(html).truncate(options).html();\n  };\n\n  // Truncate the contents of an element in place.\n  $.fn.truncate = function(options) {\n    if (!isNaN(parseFloat(options))) options = {length: options};\n    var o = $.extend({}, $.truncate.defaults, options);\n\n    return this.each(function() {\n      var self = $(this);\n\n      if (o.noBreaks) self.find('br').replaceWith(' ');\n\n      var ellipsisLength = o.ellipsis.length;\n      var text = self.text();\n      var textLength = lengthMultiByte(text);\n      var excess = textLength - o.length + ellipsisLength;\n\n      if (textLength < o.length) return;\n      if (o.stripTags) self.text(text);\n\n      // Chop off any partial words if appropriate.\n      if (o.words && excess > 0) {\n        var sliced = text.slice(0, getSliceLength(text, o.length - ellipsisLength) + 1);\n        var replaced = sliced.replace(chop, '');\n        var truncated = lengthMultiByte(replaced);\n        var oneWord = sliced.match(space) ? false : true;\n\n        if (o.keepFirstWord && truncated === 0) {\n          excess = textLength - lengthMultiByte(start.exec(text)[0]) - ellipsisLength;\n        } else if (oneWord && truncated === 0) {\n          excess = textLength - o.length + ellipsisLength;\n        } else {\n          excess = textLength - truncated - 1;\n        }\n      }\n\n      // The requested length is larger than the text. No need for ellipsis.\n      if (excess > textLength) {\n        excess = textLength - o.length;\n      }\n\n      if (excess < 0 || !excess && !o.truncated) return;\n\n      // Iterate over each child node in reverse, removing excess text.\n      $.each(self.contents().get().reverse(), function(i, el) {\n        var $el = $(el);\n        var text = $el.text();\n        var length = lengthMultiByte(text);\n\n        // If the text is longer than the excess, remove the node and continue.\n        if (length <= excess) {\n          o.truncated = true;\n          excess -= length;\n          $el.remove();\n          return;\n        }\n\n        // Remove the excess text and append the ellipsis.\n        if (el.nodeType === 3) {\n          var splitAmount = length - excess;\n          splitAmount = splitAmount >= 0 ? getSliceLength(text, splitAmount) : 0;\n          $(el.splitText(splitAmount)).replaceWith(o.ellipsis);\n          return false;\n        }\n\n        // Recursively truncate child nodes.\n        $el.truncate($.extend(o, {length: length - excess + ellipsisLength}));\n        return false;\n      });\n    });\n  };\n\n  $.truncate.defaults = {\n\n    // Strip all html elements, leaving only plain text.\n    stripTags: false,\n\n    // Only truncate at word boundaries.\n    words: false,\n\n    // When 'words' is active, keeps the first word in the string\n    // even if it's longer than a target length.\n    keepFirstWord: false,\n\n    // Replace instances of <br> with a single space.\n    noBreaks: false,\n\n    // The maximum length of the truncated html.\n    length: Infinity,\n\n    // The character to use as the ellipsis.  The word joiner (U+2060) can be\n    // used to prevent a hanging ellipsis, but displays incorrectly in Chrome\n    // on Windows 7.\n    // http://code.google.com/p/chromium/issues/detail?id=68323\n    //ellipsis: '\\u2026' // '\\u2060\\u2026'\n    ellipsis: '\\u2026' // '\\u2060\\u2026'\n\n  };\n\n    return {\n        truncate: $.truncate,\n    };\n});\n"],"file":"truncate.min.js"}