Browse Source

Use URL property from upload response

This updates the extension to work with the latest Snap.as API and fixes
the copy-to-clipboard functionality that broke with recent API changes.
tags/v1.0.1
Matt Baer 3 years ago
parent
commit
feb27007eb
1 changed files with 2 additions and 8 deletions
  1. +2
    -8
      uploader.js

+ 2
- 8
uploader.js View File

@@ -41,14 +41,8 @@ Dropzone.options.uploader = {
dictDefaultMessage: 'Drop a file here',
init: function() {
this.on("success", function(file, resp) {
var fp = file.name.split(/\./);
var ext = '';
if (fp.length > 0) {
ext = '.' + fp[fp.length - 1];
}
var env = JSON.parse(resp);
var url = 'https://i.snap.as/' + env.data + ext;
copyToClipboard('![](' + url + ')');
var data = resp;
copyToClipboard('![](' + data.data.url + ')');
chrome.runtime.sendMessage({success: true}, function(response) { });
window.close();
});


Loading…
Cancel
Save