diff --git a/src/General/Polyfill.coffee b/src/General/Polyfill.coffee index df2f7c030..6bb91c3ad 100644 --- a/src/General/Polyfill.coffee +++ b/src/General/Polyfill.coffee @@ -1,9 +1,11 @@ Polyfill = init: -> @toBlob() + $.global @toBlob + return toBlob: -> return if HTMLCanvasElement::toBlob - HTMLCanvasElement::toBlob = (cb, type='image/png', encoderOptions) -> + HTMLCanvasElement::toBlob = (cb, type='image/png', encoderOptions=null) -> url = @toDataURL type, encoderOptions data = atob url[url.indexOf(',')+1..] # DataUrl to Binary code from Aeosynth's 4chan X repo @@ -12,4 +14,4 @@ Polyfill = for i in [0...l] by 1 ui8a[i] = data.charCodeAt i cb new Blob [ui8a], {type} - $.globalEval "HTMLCanvasElement.prototype.toBlob = (#{HTMLCanvasElement::toBlob});" + return