const g = Math.random() * .05
, M = {
r: Math.floor(Math.random() * 10),
g: Math.floor(Math.random() * 10),
b: Math.floor(Math.random() * 10)
};
_toDataURL = HTMLCanvasElement.prototype.toDataURL;
HTMLCanvasElement.prototype.toDataURL = function(t) {
let e = this;
let i = e.width
, f = e.height
, d = e.getContext("2d", {
willReadFrequently: !0
});
if (d !== null) {
const c = d.getImageData(0, 0, i, f)
, u = Math.max(1, Math.floor(f / 7))
, w = Math.max(1, Math.floor(i / 7));
for (let v = 0; v < f; v += u)
for (let b = 0; b < i; b += w) {
const p = (v + Math.floor(Math.random() * u)) * (i * 4) + (b + Math.floor(Math.random() * w)) * 4;
p < c.data.length && (c.data[p + 0] = c.data[p + 0] + M.r,
c.data[p + 1] = c.data[p + 1] + M.g,
c.data[p + 2] = c.data[p + 2] + M.b)
}
d.putImageData(c, 0, 0)
}
let rrr = _toDataURL.call(e, t);
// console.log(rrr);
return rrr;
}
;
;;
let canvas = document.createElement("canvas");
let ctx = canvas.getContext("2d");
let o = 'BrowserLeaks,com <canvas> 1.0';
// 设置画布属性和绘制内容
canvas.setAttribute("width", 220);
canvas.setAttribute("height", 30);
ctx.textBaseline = "top";
ctx.font = "14px 'Arial'";
ctx.textBaseline = "alphabetic";
ctx.fillStyle = "#f60";
ctx.fillRect(125, 1, 62, 20);
ctx.fillStyle = "#069";
ctx.fillText(o, 2, 15);
ctx.fillStyle = "rgba(102, 204, 0, 0.7)";
ctx.fillText(o, 4, 17);
let a = canvas.toDataURL("image/png");
console.log(a);
copy(a);