Skip to content

Commit

Permalink
modify manifest.json
Browse files Browse the repository at this point in the history
  • Loading branch information
madneal committed Jun 4, 2017
1 parent 7af6d96 commit 17348b8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 42 deletions.
3 changes: 2 additions & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
],
"browser_action": {
"default_title": "Export to Markdown",
"default_icon": "icons/icon-19.png"
"default_icon": "icons/icon-19.png",
"default_popup": "popup.html"
},
"manifest_version": 2,
"homepage_url": "https://github.com/neal1991"
Expand Down
41 changes: 0 additions & 41 deletions scripts/widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,44 +188,3 @@ function createMarkupsArray(markups) {
}
return markups_array;
}

function doExportToDisk(savedFileEntry) {
if (savedFileEntry) {
exportToFileEntry(savedFileEntry);
} else {
chrome.fileSystem.chooseEntry({
type: 'saveFile',
accepts: [{description: 'Markdown files (*.md)',
extensions: ['txt']}],
acceptsAllTypes: true
}, exportToFileEntry);
}
}

function exportToFileEntry(fileEntry) {
savedFileEntry = fileEntry;

chrome.fileSystem.getDisplayPath(fileEntry, function(path) {
fileDisplayPath = path;
});

fileEntry.createWriter(function(fileWriter) {
let truncated = false;
let blob = new Blob([contents]);

fileWriter.onwriteend = function(e) {
if (!truncated) {
truncated = true;
this.truncate(blob.size);
return;
}
console.log('Export to ' + fileDisplayPath + ' completed');
};

fileWriter.onerror = function(e) {
console.error('Export failed: ' + e.toString());
};

fileWriter.write(blob);
})
}

0 comments on commit 17348b8

Please sign in to comment.