deploy: 6f01030c4e
This commit is contained in:
1 parent
cf8df97ba7
commit
eeea067a72
566 files changed
+15370
-2688
No files matched your search
@@ -1,7 +1,8 @@
|
||||
/*
|
||||
* Marks links that leave the site with the class "nj-external", which brand.css turns into a small icon in front of
|
||||
* the link. A link is external when its host is neither the current one nor the production site. Links in the page
|
||||
* actions (edit, raw), buttons, header anchors, and links that only wrap an image (badges) are left alone.
|
||||
* actions (edit, raw), buttons, header anchors, a blog post's byline, and links that only wrap an image (badges) are
|
||||
* left alone.
|
||||
* Runs through Material's document$ (navigation.instant), so it also applies after an instant page switch.
|
||||
*/
|
||||
(function () {
|
||||
@@ -17,7 +18,7 @@
|
||||
if (a.protocol !== "http:" && a.protocol !== "https:") {
|
||||
continue;
|
||||
}
|
||||
if (a.matches(".md-button, .md-content__button, .headerlink") || a.querySelector("img, svg")) {
|
||||
if (a.matches(".md-button, .md-content__button, .headerlink, .nj-byline a") || a.querySelector("img, svg")) {
|
||||
continue;
|
||||
}
|
||||
a.classList.add("nj-external");
|
||||
|
||||
@@ -104,3 +104,72 @@
|
||||
init();
|
||||
}
|
||||
})();
|
||||
|
||||
/* figures: the tooltips of the heatmaps in home/blog/how_3_13_0_got_faster.md (perf_blog_usecases_*.svg). Each
|
||||
cell is a focusable <g data-tip>: its lines (the first one the heading) are shown on hover, keyboard focus or tap.
|
||||
Without JS, the figure's <desc> and the tables in the appendix carry the same numbers. */
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
var tip = null;
|
||||
var current = null;
|
||||
|
||||
function show(cell) {
|
||||
if (!tip) {
|
||||
tip = document.createElement("div");
|
||||
tip.className = "nj-heat-tip";
|
||||
tip.setAttribute("role", "tooltip");
|
||||
tip.hidden = true;
|
||||
document.body.appendChild(tip);
|
||||
}
|
||||
if (current) current.classList.remove("nj-heat-on");
|
||||
current = cell;
|
||||
cell.classList.add("nj-heat-on");
|
||||
var lines = (cell.getAttribute("data-tip") || "").split("\n");
|
||||
tip.textContent = "";
|
||||
lines.forEach(function (line, i) {
|
||||
var el = document.createElement(i === 0 ? "strong" : "div");
|
||||
el.textContent = line;
|
||||
tip.appendChild(el);
|
||||
});
|
||||
tip.hidden = false;
|
||||
var r = cell.getBoundingClientRect();
|
||||
var w = tip.offsetWidth, h = tip.offsetHeight;
|
||||
var x = Math.min(Math.max(8, r.left + r.width / 2 - w / 2), document.documentElement.clientWidth - w - 8);
|
||||
var y = r.bottom + 8 + h > window.innerHeight ? r.top - h - 8 : r.bottom + 8;
|
||||
tip.style.left = (x + window.scrollX) + "px";
|
||||
tip.style.top = (y + window.scrollY) + "px";
|
||||
}
|
||||
|
||||
function hide() {
|
||||
if (current) current.classList.remove("nj-heat-on");
|
||||
current = null;
|
||||
if (tip) tip.hidden = true;
|
||||
}
|
||||
|
||||
function init() {
|
||||
hide();
|
||||
Array.prototype.forEach.call(document.querySelectorAll("svg.nj-charts--heat .nj-heat-cell"), function (cell) {
|
||||
if (cell.dataset.njHeatReady) return;
|
||||
cell.dataset.njHeatReady = "1";
|
||||
cell.addEventListener("mouseenter", function () { show(cell); });
|
||||
cell.addEventListener("mouseleave", hide);
|
||||
cell.addEventListener("focus", function () { show(cell); });
|
||||
cell.addEventListener("blur", hide);
|
||||
// a tap also focuses the cell; a tap elsewhere or Escape hides the tooltip
|
||||
cell.addEventListener("click", function (ev) { ev.stopPropagation(); show(cell); });
|
||||
});
|
||||
}
|
||||
|
||||
document.addEventListener("click", hide);
|
||||
document.addEventListener("keydown", function (ev) { if (ev.key === "Escape") hide(); });
|
||||
window.addEventListener("scroll", hide, { passive: true });
|
||||
|
||||
if (typeof document$ !== "undefined" && document$ && typeof document$.subscribe === "function") {
|
||||
document$.subscribe(init);
|
||||
} else if (document.readyState === "loading") {
|
||||
document.addEventListener("DOMContentLoaded", init);
|
||||
} else {
|
||||
init();
|
||||
}
|
||||
})();
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
/* figures: jsonview -- stepper for the edit frames on features/json_view.md.
|
||||
/* figures: jsonview -- stepper for the edit frames on features/json_view/editing.md.
|
||||
Without JS the frames (.nj-jsonview-step) show one below the other; with JS one frame at a time, with
|
||||
previous/next and one button per step. Never advances on its own. */
|
||||
(function () {
|
||||
|
||||
Reference in new issue
Block a user