Skip to content

Instantly share code, notes, and snippets.

@extratone
Created July 14, 2025 07:06
Show Gist options
  • Save extratone/d4338456f40a1256bd8df4f8400e2b92 to your computer and use it in GitHub Desktop.
Save extratone/d4338456f40a1256bd8df4f8400e2b92 to your computer and use it in GitHub Desktop.
Hypothes.is embed source.
!(function () {
"use strict";
var s = {
"scripts/annotator.bundle.js": "scripts/annotator.bundle.js?541759",
"scripts/ui-playground.bundle.js": "scripts/ui-playground.bundle.js?6e1315",
"styles/annotator.css": "styles/annotator.css?c1d2f9",
"styles/annotator.css.map": "styles/annotator.css.map?9aaee7",
"styles/highlights.css": "styles/highlights.css?470b72",
"styles/highlights.css.map": "styles/highlights.css.map?d94fe5",
"styles/katex.min.css": "styles/katex.min.css?921c28",
"styles/katex.min.css.map": "styles/katex.min.css.map?e7e03f",
"styles/pdfjs-overrides.css": "styles/pdfjs-overrides.css?c95edf",
"styles/pdfjs-overrides.css.map": "styles/pdfjs-overrides.css.map?1d8ac6",
"styles/sidebar.css": "styles/sidebar.css?1f7127",
"styles/sidebar.css.map": "styles/sidebar.css.map?e41de7",
"styles/ui-playground.css": "styles/ui-playground.css?7a65b5",
"styles/ui-playground.css.map": "styles/ui-playground.css.map?9d01bf",
"scripts/sidebar.bundle.js": "scripts/sidebar.bundle.js?84305c",
"scripts/annotator.bundle.js.map": "scripts/annotator.bundle.js.map?18cd77",
"scripts/ui-playground.bundle.js.map": "scripts/ui-playground.bundle.js.map?2ab38e",
"scripts/sidebar.bundle.js.map": "scripts/sidebar.bundle.js.map?92c3a2",
};
function e(s) {
s.setAttribute("data-hypothesis-asset", "");
}
function t(s, t) {
var r = s.createElement("link");
(r.rel = "stylesheet"), (r.type = "text/css"), (r.href = t), e(r), s.head.appendChild(r);
}
function r(s, t) {
var r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {},
n = r.esModule,
o = void 0 === n || n,
a = r.forceReload,
i = void 0 !== a && a,
l = s.createElement("script");
o && (l.type = "module"),
i && (t += "#ts=".concat(Date.now())),
(l.src = t),
(l.async = !1),
e(l),
s.head.appendChild(l);
}
function n(s, t, r, n) {
var o = s.createElement("link");
(o.rel = t), (o.href = n), (o.type = "application/annotator+".concat(r)), e(o), s.head.appendChild(o);
}
function o(s, t, r) {
var n = s.createElement("link");
(n.rel = "preload"),
(n.as = t),
(n.href = r),
"fetch" === t && (n.crossOrigin = "anonymous"),
e(n),
s.head.appendChild(n);
}
function a(s, e) {
return s.assetRoot + "build/" + s.manifest[e];
}
function i(s) {
var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : document;
if (-1 === s.indexOf("{")) return s;
var t = (function () {
var s,
e,
t = (arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : document).currentScript;
return t
? ((s = t.src), (e = s.match(/(https?):\/\/([^:/]+)/)) ? { protocol: e[1], hostname: e[2] } : null)
: null;
})(e);
if (!t) throw new Error("Could not process URL template because script origin is unknown");
return (s = (s = s.replace("{current_host}", t.hostname)).replace("{current_scheme}", t.protocol));
}
if (
(function () {
var s = [
() => Object.fromEntries([]),
() => new URL(document.location.href),
() => new Request("https://hypothes.is"),
() => Element.prototype.attachShadow,
() => CSS.supports("display: grid"),
() => (document.evaluate("/html/body", document, null, XPathResult.ANY_TYPE, null), !0),
];
try {
return s.every((s) => s());
} catch (s) {
return !1;
}
})()
) {
var l = (function (s) {
for (var e = {}, t = s.querySelectorAll("script.js-hypothesis-config"), r = 0; r < t.length; r++) {
var n = void 0;
try {
n = JSON.parse(t[r].textContent || "");
} catch (s) {
console.warn("Could not parse settings from js-hypothesis-config tags", s), (n = {});
}
Object.assign(e, n);
}
return e;
})(document),
c = i(l.assetRoot || "https://cdn.hypothes.is/hypothesis/1.1667.0/");
if (document.querySelector("hypothesis-app")) {
!(function (s, e) {
o(s, "fetch", e.apiUrl), o(s, "fetch", e.apiUrl + "links");
for (var n = 0, i = ["scripts/sidebar.bundle.js"]; n < i.length; n++) r(s, a(e, i[n]), { esModule: !0 });
for (var l = 0, c = ["styles/katex.min.css", "styles/sidebar.css"]; l < c.length; l++) t(s, a(e, c[l]));
})(document, { assetRoot: c, manifest: s, apiUrl: l.apiUrl });
} else {
var p = (function () {
var s;
return null === (s = (arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : window).chrome) ||
void 0 === s ||
null === (s = s.runtime) ||
void 0 === s
? void 0
: s.id;
})();
if (
p &&
!(function (s) {
return !!(arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : document).querySelector(
"script.js-hypothesis-config[data-extension-id=".concat(s, "]")
);
})(p)
)
throw new Error("Could not start Hypothesis extension as configuration is missing");
var d = l,
u = i(d.notebookAppUrl || "https://hypothes.is/notebook"),
h = i(d.profileAppUrl || "https://hypothes.is/user-profile"),
y = i(d.sidebarAppUrl || "https://hypothes.is/app.html");
!(function (s, e) {
if (!s.querySelector('link[type="application/annotator+html"]')) {
n(s, "sidebar", "html", e.sidebarAppUrl),
n(s, "notebook", "html", e.notebookAppUrl),
n(s, "profile", "html", e.profileAppUrl),
o(s, "style", a(e, "styles/annotator.css")),
n(s, "hypothesis-client", "javascript", e.assetRoot + "build/boot.js");
for (var i = 0, l = ["scripts/annotator.bundle.js"]; i < l.length; i++)
r(s, a(e, l[i]), { esModule: !1 });
var c = [];
void 0 !== window.PDFViewerApplication && c.push("styles/pdfjs-overrides.css"),
c.push("styles/highlights.css");
for (var p = 0, d = c; p < d.length; p++) t(s, a(e, d[p]));
}
})(document, { assetRoot: c, manifest: s, notebookAppUrl: u, profileAppUrl: h, sidebarAppUrl: y });
}
} else
console.warn(
"The Hypothesis annotation tool is not supported in this browser. See https://web.hypothes.is/help/which-browsers-are-supported-by-hypothesis/."
);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment