From f297b2176cb2c431c6ffa03b6b74ad04615d97be Mon Sep 17 00:00:00 2001 From: Robert Buels Date: Sat, 3 Nov 2012 18:06:25 -0400 Subject: [PATCH] add a "Save" button to the bottom of the export view dialog, so people can save the data if they want after they view it --- src/JBrowse/View/Track/ExportMixin.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/JBrowse/View/Track/ExportMixin.js b/src/JBrowse/View/Track/ExportMixin.js index 0992c4e9b5..6209f77a4a 100644 --- a/src/JBrowse/View/Track/ExportMixin.js +++ b/src/JBrowse/View/Track/ExportMixin.js @@ -113,10 +113,26 @@ return { readonly: true }); text.value = output; + var content = text; + if( ! (has('ie') < 10) ) { // data URL download doesn't work on IE < 10 + var actionBar = dojo.create( 'div', { + className: 'dijitDialogPaneActionBar' + }); + var saveButton = new dijitButton( + { + iconClass: 'dijitIconSave', + label: 'Save', + onClick: dojo.hitch(this, function() { + exportView.hide(); + window.location.href="data:application/x-"+format.toLowerCase()+","+escape(output); + }) + }).placeAt(actionBar); + content = [ content, actionBar ]; + } var exportView = new dijitDialog({ className: 'export-view-dialog', title: format + ' export - '+ region+' ('+Util.humanReadableNumber(output.length)+'b)', - content: text + content: [ text, actionBar ] }); aspect.after( exportView, 'hide', function() { text.parentNode.removeChild( text ); // manually unhook and free the (possibly huge) text area