files_reader/js/lib/blob.js
Frank de Lange b190e180ef - Migrated from https://github.com/Yetangitu/owncloud-apps
- substantial bit rot accrued in 4 years of non-maintenance which made Reader unusable
 - Reader now works reliably on public pages - or at least it _Works For Me™_

 - Refactored a substantial part of the code to comply to the "current" (ha ha) Nextcloud API
 - Dropped Owncloud compatibility for lack of a testing installation
 - Dropped IE (<11) support
 - Dropped compatibility with older (<20) Nextcloud versions
 - Dropped app-specific ajax code, now handled by SettingsController
 - Updated dependencies where applicable
2022-09-24 00:00:03 +00:00

31 lines
947 B
JavaScript

Blob = (function() {
var nativeBlob = Blob;
// Add unprefixed slice() method.
if (Blob.prototype.webkitSlice) {
Blob.prototype.slice = Blob.prototype.webkitSlice;
}
else if (Blob.prototype.mozSlice) {
Blob.prototype.slice = Blob.prototype.mozSlice;
}
// Temporarily replace Blob() constructor with one that checks support.
return function(parts, properties) {
try {
// Restore native Blob() constructor, so this check is only evaluated once.
Blob = nativeBlob;
return new Blob(parts || [], properties || {});
}
catch (e) {
// If construction fails provide one that uses BlobBuilder.
Blob = function (parts, properties) {
var bb = new (WebKitBlobBuilder || MozBlobBuilder), i;
for (i in parts) {
bb.append(parts[i]);
}
return bb.getBlob(properties && properties.type ? properties.type : undefined);
};
}
};
}());