Prettified Code!

This commit is contained in:
seijihariki 2022-12-19 03:04:24 +00:00 committed by GitHub Action
parent c1614edf99
commit 20d8d70c51

View file

@ -3,14 +3,14 @@
/**
* Workaround for Firefox bug #733698
*
*
* https://bugzilla.mozilla.org/show_bug.cgi?id=733698
*
*
* Workaround by https://github.com/subzey on https://gist.github.com/subzey/2030480
*
*
* Replaces and handles NS_ERROR_FAILURE errors triggered by 733698.
*/
(function(){
(function () {
var FakeTextMetrics,
proto,
fontSetterNative,
@ -24,65 +24,63 @@
!(proto = window.CanvasRenderingContext2D.prototype) ||
!proto.hasOwnProperty("font") ||
!proto.hasOwnProperty("mozTextStyle") ||
typeof proto.__lookupSetter__ !== "function" ||
typeof proto.__lookupSetter__ !== "function" ||
!(fontSetterNative = proto.__lookupSetter__("font"))
){
return;
) {
return;
}
proto.__defineSetter__("font", function(value){
proto.__defineSetter__("font", function (value) {
try {
return fontSetterNative.call(this, value);
} catch (e){
if (e.name !== 'NS_ERROR_FAILURE'){
throw e;
} catch (e) {
if (e.name !== "NS_ERROR_FAILURE") {
throw e;
}
}
});
measureTextNative = proto.measureText;
FakeTextMetrics = function(){
FakeTextMetrics = function () {
this.width = 0;
this.isFake = true;
this.__proto__ = window.TextMetrics.prototype;
};
proto.measureText = function($0){
proto.measureText = function ($0) {
try {
return measureTextNative.apply(this, arguments);
} catch (e) {
if (e.name !== 'NS_ERROR_FAILURE'){
throw e;
if (e.name !== "NS_ERROR_FAILURE") {
throw e;
} else {
return new FakeTextMetrics();
return new FakeTextMetrics();
}
}
};
fillTextNative = proto.fillText;
proto.fillText = function($0, $1, $2, $3){
proto.fillText = function ($0, $1, $2, $3) {
try {
fillTextNative.apply(this, arguments);
} catch (e) {
if (e.name !== 'NS_ERROR_FAILURE'){
throw e;
if (e.name !== "NS_ERROR_FAILURE") {
throw e;
}
}
};
strokeTextNative = proto.strokeText;
proto.strokeText = function($0, $1, $2, $3){
proto.strokeText = function ($0, $1, $2, $3) {
try {
strokeTextNative.apply(this, arguments);
} catch (e) {
if (e.name !== 'NS_ERROR_FAILURE'){
throw e;
if (e.name !== "NS_ERROR_FAILURE") {
throw e;
}
}
};
})();
window.onload = startup;
var stableDiffusionData = {