Commit 02fa32f4 by 庄欣

fixbug

parent f22ae4f9
console.log("asdfasdfasdsssss fasdf");
chrome.tabs.getSelected(null, function(tab) { chrome.tabs.getSelected(null, function(tab) {
console.log("asdfasdfasdfasdf");
console.log(tab);
chrome.tabs.sendRequest(tab.id, {url: tab.url}, function(response) { chrome.tabs.sendRequest(tab.id, {url: tab.url}, function(response) {
console.log(response); // console.log(response);
}); });
}); });
...@@ -253,6 +253,8 @@ function downloadResource(url, name){ ...@@ -253,6 +253,8 @@ function downloadResource(url, name){
const url = window.URL.createObjectURL(blob); const url = window.URL.createObjectURL(blob);
var link = document.createElement('a'); var link = document.createElement('a');
link.href= url; link.href= url;
link.target = "_blank";
link.referrerpolicy = "origin";
var filename = name + ".jpg"; var filename = name + ".jpg";
link.setAttribute('download', filename); link.setAttribute('download', filename);
evt = document.createEvent('MouseEvents'); evt = document.createEvent('MouseEvents');
...@@ -260,6 +262,9 @@ function downloadResource(url, name){ ...@@ -260,6 +262,9 @@ function downloadResource(url, name){
link.dispatchEvent(evt); link.dispatchEvent(evt);
} }
}; };
xhr.onerror = function (e) {
downloadResource("https://api.mepai.me/manage/works/proxy?uri=" + url, name);
}
xhr.send(); xhr.send();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment