Skip to content

Instantly share code, notes, and snippets.

@spetterman66
Created July 2, 2023 09:25
Show Gist options
  • Save spetterman66/27d6331cf19ba04fa6ed46bc47709a5f to your computer and use it in GitHub Desktop.
Save spetterman66/27d6331cf19ba04fa6ed46bc47709a5f to your computer and use it in GitHub Desktop.
Make Google Sites work in TenFourFox/IWPPC again (with Firefox 78 or higher user agent):
// ==UserScript==
// @name Google Sites
// @namespace https://sites.google.com/*
// @include https://sites.google.com/*
// @run-at document-start
// @version 1
// @grant none
// ==/UserScript==
!function () {
return function e(t, r, n) {
function i(s, a) {
if (!r[s]) {
if (!t[s]) {
var c = 'function' == typeof require && require;
if (!a && c) return c(s, !0);
if (o) return o(s, !0);
var u = new Error('Cannot find module \'' + s + '\'');
throw u.code = 'MODULE_NOT_FOUND',
u
}
var f = r[s] = {
exports: {
}
};
t[s][0].call(f.exports, function (e) {
return i(t[s][1][e] || e)
}, f, f.exports, e, t, r, n)
}
return r[s].exports
}
for (var o = 'function' == typeof require && require, s = 0; s < n.length; s++) i(n[s]);
return i
}
}() ({
1: [
function (e, t, r) {
'use strict';
Object.defineProperty(r, '__esModule', {
value: !0
});
r.ContentRect = function (e) {
if ('getBBox' in e) {
var t = e.getBBox();
return Object.freeze({
height: t.height,
left: 0,
top: 0,
width: t.width
})
}
var r = window.getComputedStyle(e);
return Object.freeze({
height: parseFloat(r.height || '0'),
left: parseFloat(r.paddingLeft || '0'),
top: parseFloat(r.paddingTop || '0'),
width: parseFloat(r.width || '0')
})
}
},
{
}
],
2: [
function (e, t, r) {
'use strict';
Object.defineProperty(r, '__esModule', {
value: !0
});
var n = e('./ContentRect'),
i = function () {
function e(e) {
this.target = e,
this.$$broadcastWidth = this.$$broadcastHeight = 0
}
return Object.defineProperty(e.prototype, 'broadcastWidth', {
get: function () {
return this.$$broadcastWidth
},
enumerable: !0,
configurable: !0
}),
Object.defineProperty(e.prototype, 'broadcastHeight', {
get: function () {
return this.$$broadcastHeight
},
enumerable: !0,
configurable: !0
}),
e.prototype.isActive = function () {
var e = n.ContentRect(this.target);
return !!e && (e.width !== this.broadcastWidth || e.height !== this.broadcastHeight)
},
e
}();
r.ResizeObservation = i
},
{
'./ContentRect': 1
}
],
3: [
function (e, t, r) {
'use strict';
Object.defineProperty(r, '__esModule', {
value: !0
});
var n = e('./ResizeObservation'),
i = e('./ResizeObserverEntry'),
o = [
],
s = function () {
function e(e) {
this.$$observationTargets = [
],
this.$$activeTargets = [
],
this.$$skippedTargets = [
];
var t = function (e) {
if (void 0 === e) return 'Failed to construct \'ResizeObserver\': 1 argument required, but only 0 present.';
if ('function' != typeof e) return 'Failed to construct \'ResizeObserver\': The callback provided as parameter 1 is not a function.'
}(e);
if (t) throw TypeError(t);
this.$$callback = e
}
return e.prototype.observe = function (e) {
var t,
r = c('observe', e);
if (r) throw TypeError(r);
u(this.$$observationTargets, e) >= 0 || (this.$$observationTargets.push(new n.ResizeObservation(e)), t = this, o.indexOf(t) < 0 && (o.push(t), b()))
},
e.prototype.unobserve = function (e) {
var t = c('unobserve', e);
if (t) throw TypeError(t);
var r = u(this.$$observationTargets, e);
r < 0 || (this.$$observationTargets.splice(r, 1), 0 === this.$$observationTargets.length && a(this))
},
e.prototype.disconnect = function () {
this.$$observationTargets = [
],
this.$$activeTargets = [
],
a(this)
},
e
}();
function a(e) {
var t = o.indexOf(e);
t >= 0 && (o.splice(t, 1), $())
}
function c(e, t) {
return void 0 === t ? 'Failed to execute \'' + e + '\' on \'ResizeObserver\': 1 argument required, but only 0 present.' : t && t.nodeType === window.Node.ELEMENT_NODE ? void 0 : 'Failed to execute \'' + e + '\' on \'ResizeObserver\': parameter 1 is not of type \'Element\'.'
}
function u(e, t) {
for (var r = 0; r < e.length; r += 1) if (e[r].target === t) return r;
return - 1
}
r.ResizeObserver = s;
var f,
v = function (e) {
o.forEach(function (t) {
t.$$activeTargets = [
],
t.$$skippedTargets = [
],
t.$$observationTargets.forEach(function (r) {
r.isActive() && (h(r.target) > e ? t.$$activeTargets.push(r) : t.$$skippedTargets.push(r))
})
})
},
d = function () {
var e = 1 / 0;
return o.forEach(function (t) {
if (t.$$activeTargets.length) {
var r = [
];
t.$$activeTargets.forEach(function (t) {
var n = new i.ResizeObserverEntry(t.target);
r.push(n),
t.$$broadcastWidth = n.contentRect.width,
t.$$broadcastHeight = n.contentRect.height;
var o = h(t.target);
o < e && (e = o)
}),
t.$$callback(r, t),
t.$$activeTargets = [
]
}
}),
e
},
h = function (e) {
for (var t = 0; e.parentNode; ) e = e.parentNode,
t += 1;
return t
},
p = function () {
var e,
t = 0;
for (v(t); o.some(function (e) {
return !!e.$$activeTargets.length
}); ) t = d(),
v(t);
o.some(function (e) {
return !!e.$$skippedTargets.length
}) && (e = new window.ErrorEvent('ResizeLoopError', {
message: 'ResizeObserver loop completed with undelivered notifications.'
}), window.dispatchEvent(e))
},
b = function () {
f || g()
},
g = function e() {
f = window.requestAnimationFrame(function () {
p(),
e()
})
},
$ = function () {
f && !o.some(function (e) {
return !!e.$$observationTargets.length
}) && (window.cancelAnimationFrame(f), f = void 0)
};
r.install = function () {
return window.ResizeObserver = s
}
},
{
'./ResizeObservation': 2,
'./ResizeObserverEntry': 4
}
],
4: [
function (e, t, r) {
'use strict';
Object.defineProperty(r, '__esModule', {
value: !0
});
var n = e('./ContentRect'),
i = function () {
return function (e) {
this.target = e,
this.contentRect = n.ContentRect(e)
}
}();
r.ResizeObserverEntry = i
},
{
'./ContentRect': 1
}
],
5: [
function (e, t, r) {
'use strict';
Object.defineProperty(r, '__esModule', {
value: !0
}),
e('./ResizeObserver').install()
},
{
'./ResizeObserver': 3
}
]
}, {
}, [
5
]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment