diff --git a/README.md b/README.md index d3e6d094..2aef4659 100644 --- a/README.md +++ b/README.md @@ -89,6 +89,8 @@ gulp gh-pages ## Change log +The production version [icn3d-1.3.10](https://www.ncbi.nlm.nih.gov/Structure/icn3d/icn3d-1.3.10.zip) was release on October 27, 2017. The "Save File" issue in Chrome 60 and after was fixed. + The production version [icn3d-1.3.9](https://www.ncbi.nlm.nih.gov/Structure/icn3d/icn3d-1.3.9.zip) was release on September 5, 2017. The handling of residues with insertion codes was fixed in structure alignment. The production version [icn3d-1.3.8](https://www.ncbi.nlm.nih.gov/Structure/icn3d/icn3d-1.3.8.zip) was release on August 7, 2017. The handling of residues with insertion codes was fixed. diff --git a/icn3d.html b/icn3d.html index 4f8a7fea..5bd707d8 100644 --- a/icn3d.html +++ b/icn3d.html @@ -1520,6 +1520,9 @@

API Documents of the advanced UI library iCn3DUI

Change Log:back to top

+The production version icn3d-1.3.10 was release on October 27, 2017. The "Save File" issue in Chrome 60 and after was fixed. +

+ The production version icn3d-1.3.9 was release on September 5, 2017. The handling of residues with insertion codes was fixed in structure alignment.

diff --git a/package.json b/package.json index 2eee0924..ef1e85d6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "icn3d", - "version": "1.3.9", + "version": "1.3.10", "description": "iCn3D Structure Viewer", "main": "index.html", "scripts": { diff --git a/src/icn3dui/common.js b/src/icn3dui/common.js index 6764de2b..3d102300 100644 --- a/src/icn3dui/common.js +++ b/src/icn3dui/common.js @@ -173,8 +173,8 @@ if (!$.ui.dialog.prototype._makeDraggableBase) { iCn3DUI.prototype.saveFile = function(filename, type, text) { var me = this; //Save file - if(me.isIE()) { // IE - if(window.navigator.msSaveBlob){ + var blob; +// if(me.isIE() && window.navigator.msSaveBlob){ if(type === 'command') { var dataStr = ''; for(var i = 0, il = me.icn3d.commands.length; i < il; ++i) { @@ -194,30 +194,43 @@ if (!$.ui.dialog.prototype._makeDraggableBase) { } var data = decodeURIComponent(dataStr); - var blob = new Blob([data],{ type: "text;charset=utf-8;"}); - navigator.msSaveBlob(blob, filename); + blob = new Blob([data],{ type: "text;charset=utf-8;"}); } else if(type === 'png') { - me.icn3d.render(); - var blob = me.icn3d.renderer.domElement.msToBlob(); - - navigator.msSaveBlob(blob, filename); + me.icn3d.render(); + if(me.isIE()) { + blob = me.icn3d.renderer.domElement.msToBlob(); + } + else { + me.icn3d.renderer.domElement.toBlob(function(data) { + blob = data; + + var link = document.createElement('a'); + link.href = window.URL.createObjectURL(blob); + link.setAttribute('download', filename); + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); + }); + + return; + } } else if(type === 'html') { var dataStr = text; var data = decodeURIComponent(dataStr); - var blob = new Blob([data],{ type: "text/html;charset=utf-8;"}); - navigator.msSaveBlob(blob, filename); + blob = new Blob([data],{ type: "text/html;charset=utf-8;"}); } else if(type === 'text') { var dataStr = text; var data = decodeURIComponent(dataStr); - var blob = new Blob([data],{ type: "text;charset=utf-8;"}); - navigator.msSaveBlob(blob, filename); + blob = new Blob([data],{ type: "text;charset=utf-8;"}); } - } + + //navigator.msSaveBlob(blob, filename); +/* } else { var data; @@ -259,6 +272,21 @@ if (!$.ui.dialog.prototype._makeDraggableBase) { window.open(data, '_blank'); } +*/ + + //https://github.com/mholt/PapaParse/issues/175 + //IE11 & Edge + if(me.isIE() && window.navigator.msSaveBlob){ + navigator.msSaveBlob(blob, filename); + } else { + //In FF link must be added to DOM to be clicked + var link = document.createElement('a'); + link.href = window.URL.createObjectURL(blob); + link.setAttribute('download', filename); + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); + } }; iCn3DUI.prototype.isMobile = function() {