Commit 9c167115 authored by JC Brand's avatar JC Brand

Add polyfill.js with 2 polyfills.

parent c421c0fe
......@@ -84,12 +84,6 @@
};
};
// XXX: these can perhaps be moved to src/polyfills.js
String.prototype.splitOnce = function (delimiter) {
var components = this.split(delimiter);
return [components.shift(), components.join(delimiter)];
};
var converse = {
plugins: {},
templates: templates,
......
......@@ -42,6 +42,7 @@ require.config({
"typeahead": "components/typeahead.js/index",
"underscore": "components/underscore/underscore",
"utils": "src/utils",
"polyfill": "src/polyfill",
// Off-the-record-encryption
"bigint": "src/bigint",
......
define("converse-dependencies", [
"jquery",
"polyfill",
"utils",
"otr",
"moment_with_locales",
......@@ -12,7 +13,7 @@ define("converse-dependencies", [
"backbone.overview",
"jquery.browser",
"typeahead"
], function($, utils, otr, moment, Strophe) {
], function($, dummy, utils, otr, moment, Strophe) {
return _.extend({
'underscore': _,
'jQuery': $,
......
define("converse-dependencies", [
"jquery",
"utils",
"polyfill",
"moment_with_locales",
"strophe",
"strophe.disco",
......@@ -11,7 +12,7 @@ define("converse-dependencies", [
"backbone.overview",
"jquery.browser",
"typeahead"
], function($, utils, moment, Strophe) {
], function($, dummy, utils, moment, Strophe) {
return _.extend({
'underscore': _,
'jQuery': $,
......
if (!String.prototype.endsWith) {
String.prototype.endsWith = function(searchString, position) {
var subjectString = this.toString();
if (position === undefined || position > subjectString.length) {
position = subjectString.length;
}
position -= searchString.length;
var lastIndex = subjectString.indexOf(searchString, position);
return lastIndex !== -1 && lastIndex === position;
};
}
String.prototype.splitOnce = function (delimiter) {
var components = this.split(delimiter);
return [components.shift(), components.join(delimiter)];
};
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment