mirror of
https://github.com/Maks1mS/userscripts.git
synced 2024-12-23 16:22:59 +03:00
Update QuarklyUploadImageViaURL.user.js
This commit is contained in:
parent
a986a4da96
commit
c775d088a7
@ -1,7 +1,7 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name Quarkly Upload Image via URL
|
// @name Quarkly Upload Image via URL
|
||||||
// @namespace http://tampermonkey.net/
|
// @namespace http://tampermonkey.net/
|
||||||
// @version 0.1
|
// @version 0.2
|
||||||
// @description try to take over the world!
|
// @description try to take over the world!
|
||||||
// @author Maxim Slipenko
|
// @author Maxim Slipenko
|
||||||
// @match https://quarkly.io/project/*
|
// @match https://quarkly.io/project/*
|
||||||
@ -34,11 +34,17 @@
|
|||||||
const finalUrl = r.finalUrl;
|
const finalUrl = r.finalUrl;
|
||||||
// TODO: Better filename detection
|
// TODO: Better filename detection
|
||||||
const filename = url.substring(url.lastIndexOf('/')+1);
|
const filename = url.substring(url.lastIndexOf('/')+1);
|
||||||
|
var arr = r.responseHeaders.split('\r\n');
|
||||||
|
var headers = arr.reduce(function (acc, current, i){
|
||||||
|
var parts = current.split(': ');
|
||||||
|
acc[parts[0]] = parts[1];
|
||||||
|
return acc;
|
||||||
|
}, {});
|
||||||
const file = new File(
|
const file = new File(
|
||||||
[r.response],
|
[r.response],
|
||||||
filename,
|
filename,
|
||||||
{
|
{
|
||||||
type:"image/jpeg",
|
type: headers['content-type'],
|
||||||
lastModified:new Date().getTime()
|
lastModified:new Date().getTime()
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user