diff --git a/resources/assets/src/js/utils.js b/resources/assets/src/js/utils.js index d453b766..8d406829 100644 --- a/resources/assets/src/js/utils.js +++ b/resources/assets/src/js/utils.js @@ -2,7 +2,7 @@ * @Author: printempw * @Date: 2016-07-16 09:02:32 * @Last Modified by: printempw - * @Last Modified time: 2016-09-24 18:10:03 + * @Last Modified time: 2016-09-26 22:35:35 */ $.locales = {}; @@ -145,3 +145,16 @@ function getQueryString(key) { return result[1]; } } + +// quick fix for compatibility of String.prototype.endsWith +if (!String.prototype.endsWith) { + String.prototype.endsWith = function(searchString, position) { + var subjectString = this.toString(); + if (typeof position !== 'number' || !isFinite(position) || Math.floor(position) !== position || position > subjectString.length) { + position = subjectString.length; + } + position -= searchString.length; + var lastIndex = subjectString.lastIndexOf(searchString, position); + return lastIndex !== -1 && lastIndex === position; + }; +}