Commit ab0ec730 authored by JC Brand's avatar JC Brand

Various fixes for browser that don't support ES2015

Specifically for IE11.

* Add a polyfill for String.prototype.includes
* Make sure all bundled code is transpiled
* Add IE specific fix in converse-otr.js
parent 75301d28
......@@ -4,9 +4,11 @@
mainConfigFile: 'config.js',
paths: {
"converse-bookmarks": "builds/converse-bookmarks",
"converse-chatboxes": "builds/converse-chatboxes",
"converse-chatview": "builds/converse-chatview",
"converse-controlbox": "builds/converse-controlbox",
"converse-core": "builds/converse-core",
"converse-disco": "builds/converse-disco",
"converse-dragresize": "builds/converse-dragresize",
"converse-headline": "builds/converse-headline",
"converse-inverse": "builds/converse-inverse",
......
......@@ -4,9 +4,11 @@
mainConfigFile: 'config.js',
paths: {
"converse-bookmarks": "builds/converse-bookmarks",
"converse-chatboxes": "builds/converse-chatboxes",
"converse-chatview": "builds/converse-chatview",
"converse-controlbox": "builds/converse-controlbox",
"converse-core": "builds/converse-core",
"converse-disco": "builds/converse-disco",
"converse-dragresize": "builds/converse-dragresize",
"converse-headline": "builds/converse-headline",
"converse-inverse": "builds/converse-inverse",
......@@ -22,7 +24,8 @@
"converse-rosterview": "builds/converse-rosterview",
"converse-singleton": "builds/converse-singleton",
"converse-vcard": "builds/converse-vcard",
"utils": "builds/utils"
"utils": "builds/utils",
"form-utils": "builds/form-utils"
},
wrap: {
startFile: "start.frag",
......
......@@ -21,9 +21,10 @@
const { Strophe, utils, b64_sha1, _ } = converse.env;
const HAS_CSPRNG = ((!_.isUndefined(crypto)) &&
((_.isFunction(crypto.randomBytes)) || (_.isFunction(crypto.getRandomValues))
));
const HAS_CSPRNG = _.isUndefined(window.crypto) ? false : (
_.isFunction(window.crypto.randomBytes) ||
_.isFunction(window.crypto.getRandomValues)
);
const HAS_CRYPTO = HAS_CSPRNG && (
(!_.isUndefined(otr.OTR)) &&
......
define(['lodash', 'lodash.converter', 'converse-core'], function (_, lodashConverter, converse) {
const fp = lodashConverter(_.runInContext());
var fp = lodashConverter(_.runInContext());
converse.env.fp = fp;
return fp;
});
if (!String.prototype.includes) {
String.prototype.includes = function(search, start) {
'use strict';
if (typeof start !== 'number') {
start = 0;
}
if (start + search.length > this.length) {
return false;
} else {
return this.indexOf(search, start) !== -1; // eslint-disable-line lodash/prefer-includes
}
};
}
if (!String.prototype.endsWith) {
String.prototype.endsWith = function (searchString, position) {
var subjectString = this.toString();
......
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