Skip to content

Commit

Permalink
Update js/
Browse files Browse the repository at this point in the history
  • Loading branch information
Davit Barbakadze committed Feb 2, 2017
1 parent 54867d1 commit 1c78edd
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 33 deletions.
6 changes: 3 additions & 3 deletions bin/js/moxie.dev.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
;var MXI_DEBUG = true;
/**
* mOxie - multi-runtime File API & XMLHttpRequest L2 Polyfill
* v1.5.2
* v1.5.3
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*
* Date: 2016-11-23
* Date: 2017-02-02
*/
/**
* Inline development version. Only to be used while developing since it uses document.write to load scripts.
Expand Down Expand Up @@ -189,4 +189,4 @@
writeScripts();
})(this);

// $hash: ad1f9b2036ed667bbf336d7d8f46af14
// $hash: fce78750a6e5e45e0cee1233d55aa032
53 changes: 29 additions & 24 deletions bin/js/moxie.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
;var MXI_DEBUG = true;
/**
* mOxie - multi-runtime File API & XMLHttpRequest L2 Polyfill
* v1.5.2
* v1.5.3
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*
* Date: 2016-11-23
* Date: 2017-02-02
*/
;(function (global, factory) {
var extract = function() {
Expand Down Expand Up @@ -3336,7 +3336,7 @@ define("moxie/core/utils/Mime", [

// convert extensions to mime types list
for (i = 0; i < filters.length; i++) {
ext = filters[i].extensions.split(/\s*,\s*/);
ext = filters[i].extensions.toLowerCase().split(/\s*,\s*/);

for (ii = 0; ii < ext.length; ii++) {

Expand All @@ -3346,13 +3346,12 @@ define("moxie/core/utils/Mime", [
}

type = self.mimes[ext[ii]];
if (type && Basic.inArray(type, mimes) === -1) {
mimes.push(type);
}

// future browsers should filter by extension, finally
if (addMissingExtensions && /^\w+$/.test(ext[ii])) {
mimes.push('.' + ext[ii]);
} else if (type && Basic.inArray(type, mimes) === -1) {
mimes.push(type);
} else if (!type) {
// if we have no type in our map, then accept all
return [];
Expand All @@ -3367,6 +3366,8 @@ define("moxie/core/utils/Mime", [
var self = this, exts = [];

Basic.each(mimes, function(mime) {
mime = mime.toLowerCase();

if (mime === '*') {
exts = [];
return false;
Expand Down Expand Up @@ -4372,10 +4373,10 @@ define('moxie/core/utils/Url', [], function() {
https: 443
}
, uri = {}
, regex = /^(?:([^:\/?#]+):)?(?:\/\/()(?:(?:()(?:([^:@\/]*):?([^:@\/]*))?@)?([^:\/?#]*)(?::(\d*))?))?()(?:(()(?:(?:[^?#\/]*\/)*)()(?:[^?#]*))(?:\\?([^#]*))?(?:#(.*))?)/
, regex = /^(?:([^:\/?#]+):)?(?:\/\/()(?:(?:()(?:([^:@\/]*):?([^:@\/]*))?@)?(\[[\da-fA-F:]+\]|[^:\/?#]*)(?::(\d*))?))?()(?:(()(?:(?:[^?#\/]*\/)*)()(?:[^?#]*))(?:\\?([^#]*))?(?:#(.*))?)/
, m = regex.exec(url || '')
;

while (i--) {
if (m[i]) {
uri[key[i]] = m[i];
Expand Down Expand Up @@ -4410,8 +4411,8 @@ define('moxie/core/utils/Url', [], function() {

if (!uri.port) {
uri.port = ports[uri.scheme] || 80;
}
}

uri.port = parseInt(uri.port, 10);

if (!uri.path) {
Expand Down Expand Up @@ -4453,11 +4454,11 @@ define('moxie/core/utils/Url', [], function() {
function origin(url) {
return [url.scheme, url.host, url.port].join('/');
}

if (typeof url === 'string') {
url = parseUrl(url);
}
}

return origin(parseUrl()) === origin(url);
};

Expand Down Expand Up @@ -6214,9 +6215,7 @@ define("moxie/image/Image", [
if (!Env.can('create_canvas')) {
throw new x.RuntimeError(x.RuntimeError.NOT_SUPPORTED_ERR);
}

var runtime = this.connectRuntime(this.ruid);
return runtime.exec.call(this, 'Image', 'getAsCanvas');
return this.exec('Image', 'getAsCanvas');
},

/**
Expand Down Expand Up @@ -6379,7 +6378,7 @@ define("moxie/image/Image", [
});

imgCopy.bind("Load", function() {
imgCopy.downsize(opts);
this.downsize(opts);
});

// if embedded thumb data is available and dimensions are big enough, use it
Expand All @@ -6406,6 +6405,10 @@ define("moxie/image/Image", [
this.getRuntime().exec.call(this, 'Image', 'destroy');
this.disconnectRuntime();
}
if (this.meta && this.meta.thumb) {
// thumb is blob, make sure we destroy it first
this.meta.thumb.data.destroy();
}
this.unbindAll();
}
});
Expand Down Expand Up @@ -6435,6 +6438,7 @@ define("moxie/image/Image", [
if (this.name === '') {
this.name = info.name;
}

return true;
} catch(ex) {
this.trigger('error', ex.code);
Expand Down Expand Up @@ -9158,7 +9162,7 @@ define("moxie/runtime/html5/image/Image", [

Basic.extend(this, {
loadFromBlob: function(blob) {
var comp = this, I = comp.getRuntime()
var I = this.getRuntime()
, asBinary = arguments.length > 1 ? arguments[1] : true
;

Expand All @@ -9177,7 +9181,7 @@ define("moxie/runtime/html5/image/Image", [
if (asBinary) {
_binStr = _toBinary(dataUrl);
}
_preload.call(comp, dataUrl);
_preload.call(this, dataUrl);
});
}
},
Expand All @@ -9201,6 +9205,7 @@ define("moxie/runtime/html5/image/Image", [
_imgInfo = new ImageInfo(_binStr);
}

// this stuff below is definitely having fun with itself
info = {
width: _getImg().width || 0,
height: _getImg().height || 0,
Expand All @@ -9213,7 +9218,7 @@ define("moxie/runtime/html5/image/Image", [
if (_preserveHeaders) {
info.meta = _imgInfo && _imgInfo.meta || this.meta || {};

// store thumbnail data as blob
// if data was taken from ImageInfo it will be a binary string, so we convert it to blob
if (info.meta && info.meta.thumb && !(info.meta.thumb.data instanceof Blob)) {
info.meta.thumb.data = new Blob(null, {
type: 'image/jpeg',
Expand Down Expand Up @@ -9419,14 +9424,14 @@ define("moxie/runtime/html5/image/Image", [
if (window.FileReader) {
fr = new FileReader();
fr.onload = function() {
callback(this.result);
callback.call(comp, this.result);
};
fr.onerror = function() {
comp.trigger('error', x.ImageError.WRONG_FORMAT);
};
fr.readAsDataURL(file);
} else {
return callback(file.getAsDataURL());
return callback.call(this, file.getAsDataURL());
}
}

Expand Down Expand Up @@ -10247,7 +10252,7 @@ define("moxie/runtime/flash/image/Image", [
, info = self.shimExec.call(this, 'Image', 'getInfo')
;

if (info.meta && info.meta.thumb && !(info.meta.thumb.data instanceof Blob)) {
if (info.meta && info.meta.thumb && info.meta.thumb.data && !(self.meta.thumb.data instanceof Blob)) {
info.meta.thumb.data = new Blob(self.uid, info.meta.thumb.data);
}
return info;
Expand Down Expand Up @@ -10794,7 +10799,7 @@ define("moxie/runtime/silverlight/image/Image", [
});

// save thumb data as blob
if (info.meta && info.meta.thumb && !(info.meta.thumb.data instanceof Blob)) {
if (info.meta && info.meta.thumb && info.meta.thumb.data && !(self.meta.thumb.data instanceof Blob)) {
info.meta.thumb.data = new Blob(self.uid, info.meta.thumb.data);
}
}
Expand Down
Loading

0 comments on commit 1c78edd

Please sign in to comment.