Commit d857333156017f93d4773dc38176f77127b865f2
1 parent
1d3d7638
Javascript String.endsWith fix for IE browser.
Showing
1 changed file
with
5 additions
and
0 deletions
static/js/script.js
@@ -217,3 +217,8 @@ function convertHtml(str) { | @@ -217,3 +217,8 @@ function convertHtml(str) { | ||
217 | 217 | ||
218 | String.prototype.startsWith = function(str) | 218 | String.prototype.startsWith = function(str) |
219 | {return (this.match("^"+str)==str)} | 219 | {return (this.match("^"+str)==str)} |
220 | + | ||
221 | +String.prototype.endsWith = function(suffix) { | ||
222 | + if (this.length < suffix.length) return false; | ||
223 | + return this.lastIndexOf(suffix) === this.length - suffix.length; | ||
224 | +} |