[Asm] 纯文本查看 复制代码
~~~js
// ==UserScript==
// @name csdn去除水印
// @namespace https://greasyfork.org/scripts/465212
// @version 0.1
// @description csdn去除水印
// @author zl20110000
// @match ://editor.csdn.net/
// @icon https://g.csdnimg.cn/static/logo/favicon32.ico
// ==/UserScript==
(function() {
"use strict";
! function (e, t) {
function a(e) {
return Object.prototype.toString.call(e).match(/[object (.*?)]/)[zxsq-anti-bbcode-1]
}
function r(e) {
function r(e) {
return new Promise(function (a, r) {
t.ajax({
url: "https://imgservice.csdn.net/direct/v1.0/image/upload",
type: "get",
contentType: "application/json",
dataType: "json",
data: {
watermark: o,
type: l,
rtype: p
},
headers: {
"x-image-app": s,
"x-image-dir": c,
"x-image-suffix": e.name.split(".")[e.name.split(".").length - 1]
},
xhrFields: {
withCredentials: !0
},
success: function (t) {
if (200 === t.code && t.data) {
var i = t.data,
c = new FormData,
s = {
key: "" + i.filePath,
policy: i.policy,
OSSAccessKeyId: i.accessId,
success_action_status: 200,
signature: i.signature,
callback: i.callbackUrl,
file: e
};
for (var o in s) Object.hasOwnProperty.call(s, o) && c.set(o, s[zxsq-anti-bbcode-o]);
n(c, i.host, a, r)
} else r(t)
},
error: function (e) {
r(e)
}
})
})
}
function n(e, a, r, n) {
t.ajax({
url: a,
type: "post",
contentType: !1,
processData: !1,
dataType: "json",
mimeType: "multipart/form-data",
data: e,
xhrFields: {
withCredentials: !0
},
success: function (e) {
console.log(e);
if (200 === e.code && e.data && e.data.imageUrl) {
e.data.imageUrl+="?_.gif"
}
console.log(e);
r(e)
},
error: function (e) {
n(e)
}
})
}
var i, c = e.dir,
s = e.app,
o = "",
l = e.type,
p = e.rtype;
console.log(e);
return i = "FileList" !== a(e.file) && "Array" !== a(e.file) ? [e.file] : Array.prototype.slice.call(e.file),
function (e) {
return Promise.all(e.map(function (e) {
return r(e)
}))
}(i)
}
e.csdn = e.csdn || {}, e.csdn.uploadSource = r
console.log("替换完成",e.csdn.uploadSource);
}(window, jQuery);
})();
~~~
}(window, jQuery);
})();
~~~