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

Add polyfill.js with 2 polyfills.

parent c421c0fe
...@@ -84,12 +84,6 @@ ...@@ -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 = { var converse = {
plugins: {}, plugins: {},
templates: templates, templates: templates,
......
...@@ -42,6 +42,7 @@ require.config({ ...@@ -42,6 +42,7 @@ require.config({
"typeahead": "components/typeahead.js/index", "typeahead": "components/typeahead.js/index",
"underscore": "components/underscore/underscore", "underscore": "components/underscore/underscore",
"utils": "src/utils", "utils": "src/utils",
"polyfill": "src/polyfill",
// Off-the-record-encryption // Off-the-record-encryption
"bigint": "src/bigint", "bigint": "src/bigint",
......
define("converse-dependencies", [ define("converse-dependencies", [
"jquery", "jquery",
"polyfill",
"utils", "utils",
"otr", "otr",
"moment_with_locales", "moment_with_locales",
...@@ -12,7 +13,7 @@ define("converse-dependencies", [ ...@@ -12,7 +13,7 @@ define("converse-dependencies", [
"backbone.overview", "backbone.overview",
"jquery.browser", "jquery.browser",
"typeahead" "typeahead"
], function($, utils, otr, moment, Strophe) { ], function($, dummy, utils, otr, moment, Strophe) {
return _.extend({ return _.extend({
'underscore': _, 'underscore': _,
'jQuery': $, 'jQuery': $,
......
define("converse-dependencies", [ define("converse-dependencies", [
"jquery", "jquery",
"utils", "utils",
"polyfill",
"moment_with_locales", "moment_with_locales",
"strophe", "strophe",
"strophe.disco", "strophe.disco",
...@@ -11,7 +12,7 @@ define("converse-dependencies", [ ...@@ -11,7 +12,7 @@ define("converse-dependencies", [
"backbone.overview", "backbone.overview",
"jquery.browser", "jquery.browser",
"typeahead" "typeahead"
], function($, utils, moment, Strophe) { ], function($, dummy, utils, moment, Strophe) {
return _.extend({ return _.extend({
'underscore': _, 'underscore': _,
'jQuery': $, '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