subroutineasset_fdoc_js
subroutine asset_fdoc_js(b)
The contents of assets/fdoc.js.
Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
| b | type(buffer_t) | inout | where they go |
Calls
Source
Show the code
subroutine asset_fdoc_js(b)
type(buffer_t), intent(inout) :: b !! where they go
call add(b, &
'(function () {'//NL//' var root = document.documentElement;'//NL//' var saved = null;'//NL//' try { saved ' &
//'= localStorage.getItem("fdoc-theme"); } catch (e) {}'//NL//' if (saved) root.setAttribute("data-theme", save' &
//'d);'//NL//' document.addEventListener("DOMContentLoaded", function () {'//NL//' var button = document.que' &
//'rySelector(".theme");'//NL//' if (button) button.addEventListener("click", function () {'//NL//' var ' &
//'dark = root.getAttribute("data-theme") ? root.getAttribute("data-theme") === "dark"'//NL//' : window.m' &
//'atchMedia("(prefers-color-scheme: dark)").matches;'//NL//' var next = dark ? "light" : "dark";'//NL//' ' &
//' root.setAttribute("data-theme", next);'//NL//' try { localStorage.setItem("fdoc-theme", next); } cat' &
//'ch (e) {}'//NL//' });'//NL//' document.querySelectorAll(".codehilite").forEach(function (block) {'//NL//' ' &
//' if (!navigator.clipboard) return;'//NL//' var copy = document.createElement("button");'//NL//' ' &
//' copy.className = "copy";'//NL//' copy.textContent = "Copy";'//NL//' copy.addEventListener("click",' &
//' function () {'//NL//' navigator.clipboard.writeText(block.querySelector("pre").innerText).then(functi' &
//'on () {'//NL//' copy.textContent = "Copied";'//NL//' setTimeout(function () { copy.textCont' &
//'ent = "Copy"; }, 1200);'//NL//' });'//NL//' });'//NL//' block.appendChild(copy);'//NL//' ' &
//'});'//NL//' });'//NL//'})();'//NL//'(function () {'//NL//' var script = document.currentScript;'//NL//' va' &
//'r root = script ? script.src.replace(/js\/fdoc\.js.*$/, "") : "";'//NL//' var loaded = false, entries = null' &
//', waiting = [];'//NL//NL//' function load(then) {'//NL//' if (entries) { then(); return; }'//NL//' wai' &
//'ting.push(then);'//NL//' if (loaded) return;'//NL//' loaded = true;'//NL//' var tag = document.creat' &
//'eElement("script");'//NL//' tag.src = root + "search/index.js";'//NL//' tag.onload = function () {'//NL &
//' entries = window.FDOC_INDEX || [];'//NL//' entries.forEach(function (e) { e.low = e.t.toLowerCase(' &
//'); e.text = (e.s || "").toLowerCase(); });'//NL//' waiting.forEach(function (f) { f(); });'//NL//' };' &
//NL//' document.head.appendChild(tag);'//NL//' }'//NL//NL//' function score(entry, words) {'//NL//' var' &
//' total = 0;'//NL//' for (var i = 0; i < words.length; i++) {'//NL//' var w = words[i], at = entry.low' &
//'.indexOf(w);'//NL//' if (entry.low === w) total += 100;'//NL//' else if (at === 0) total += 50;'//NL &
//' else if (at > 0) total += 25;'//NL//' else if (entry.text.indexOf(w) >= 0) total += 5;'//NL//' ' &
//' else return 0;'//NL//' }'//NL//' return total - entry.low.length / 100;'//NL//' }'//NL//NL//' // ed' &
//'it distance with transpositions, giving up once it exceeds `most`'//NL//' function distance(a, b, most) {'//NL &
//' if (Math.abs(a.length - b.length) > most) return most + 1;'//NL//' var before = null, last = [], row =' &
//' [], i, j;'//NL//' for (j = 0; j <= b.length; j++) last[j] = j;'//NL//' for (i = 1; i <= a.length; i++)' &
//' {'//NL//' row = [i];'//NL//' var best = i;'//NL//' for (j = 1; j <= b.length; j++) {'//NL//' ' &
//' var cost = a[i - 1] === b[j - 1] ? 0 : 1;'//NL//' row[j] = Math.min(last[j] + 1, row[j - 1] + 1' &
//', last[j - 1] + cost);'//NL//' if (before && i > 1 && j > 1 && a[i - 1] === b[j - 2] && a[i - 2] === b' &
//'[j - 1]) {'//NL//' row[j] = Math.min(row[j], before[j - 2] + 1);'//NL//' }'//NL//' bes' &
//'t = Math.min(best, row[j]);'//NL//' }'//NL//' if (best > most) return most + 1;'//NL//' before' &
//' = last;'//NL//' last = row;'//NL//' }'//NL//' return last[b.length];'//NL//' }'//NL//NL//' func' &
//'tion parts(text) { return text.split(/[^a-z0-9]+/).filter(Boolean); }'//NL//NL//' // a typo: the word is clo' &
//'se to some run of parts of the name, or to how such a run starts'//NL//' function typo(tokens, word) {'//NL//' ' &
//' if (word.length < 3) return 0;'//NL//' var size = parts(word).length, plain = parts(word).join("_"), mo' &
//'st = word.length < 8 ? 1 : 2;'//NL//' var result = 0;'//NL//' for (var i = 0; i + size <= tokens.length' &
//'; i++) {'//NL//' var run = tokens.slice(i, i + size).join("_");'//NL//' var d = distance(plain, run' &
//', most);'//NL//' if (d > most) d = distance(plain, run.slice(0, plain.length), most);'//NL//' if (d' &
//' <= most) result = Math.max(result, 3 - d);'//NL//' }'//NL//' return result;'//NL//' }'//NL//NL//' //' &
//' the word is in the initials of the parts of the name, as `jvcs` for json_value_create_string'//NL//' functi' &
//'on initials(tokens, word) {'//NL//' if (word.length < 2) return 0;'//NL//' return subsequence(tokens.ma' &
//'p(function (t) { return t[0]; }).join(""), word) ? 2.5 : 0;'//NL//' }'//NL//NL//' function subsequence(text' &
//', word) {'//NL//' var at = -1;'//NL//' for (var i = 0; i < word.length; i++) {'//NL//' at = text.i' &
//'ndexOf(word[i], at + 1);'//NL//' if (at < 0) return false;'//NL//' }'//NL//' return true;'//NL//' ' &
//' }'//NL//NL//' // the letters of the word are in order and close together'//NL//' function letters(low, wor' &
//'d) {'//NL//' if (word.length < 3) return 0;'//NL//' var best = 0;'//NL//' for (var start = low.index' &
//'Of(word[0]); start >= 0; start = low.indexOf(word[0], start + 1)) {'//NL//' var at = start;'//NL//' ' &
//' for (var i = 1; i < word.length && at >= 0; i++) at = low.indexOf(word[i], at + 1);'//NL//' if (at < 0)' &
//' break;'//NL//' var span = at - start + 1;'//NL//' if (span <= word.length * 2) best = Math.max(bes' &
//'t, word.length / span);'//NL//' }'//NL//' return best;'//NL//' }'//NL//NL//' function fuzzy(entry, wo' &
//'rds) {'//NL//' if (!entry.tokens) entry.tokens = parts(entry.low);'//NL//' var total = 0;'//NL//' fo' &
//'r (var i = 0; i < words.length; i++) {'//NL//' var w = words[i];'//NL//' var s = entry.low.indexOf(' &
//'w) >= 0 ? 3 : Math.max(typo(entry.tokens, w), initials(entry.tokens, w), letters(entry.low, w));'//NL//' ' &
//' if (s <= 0) return 0;'//NL//' total += s;'//NL//' }'//NL//' return total - entry.low.length / 100' &
//'0;'//NL//' }'//NL//NL//' function search(query, limit) {'//NL//' var words = query.toLowerCase().split(/' &
//'\s+/).filter(Boolean);'//NL//' if (!words.length) return [];'//NL//' var found = [], rest = [];'//NL//' ' &
//' entries.forEach(function (e) {'//NL//' var s = score(e, words);'//NL//' if (s > 0) found.push([s' &
//', e]); else rest.push(e);'//NL//' });'//NL//' found.sort(function (a, b) { return b[0] - a[0]; });'//NL &
//' if (found.length < limit) {'//NL//' // fuzzy matches only fill in below exact ones'//NL//' var ' &
//'near = [];'//NL//' rest.forEach(function (e) { var s = fuzzy(e, words); if (s > 0) near.push([s, e]); })' &
//';'//NL//' near.sort(function (a, b) { return b[0] - a[0]; });'//NL//' found = found.concat(near);'//NL &
//' }'//NL//' return found.slice(0, limit).map(function (f) { return f[1]; });'//NL//' }'//NL//NL//' fun' &
//'ction row(entry) {'//NL//' var a = document.createElement("a");'//NL//' a.href = root + entry.u;'//NL//' ' &
//' var title = document.createElement("b");'//NL//' title.textContent = entry.t;'//NL//' var kind = doc' &
//'ument.createElement("span");'//NL//' kind.className = "badge";'//NL//' kind.textContent = entry.k;'//NL &
//' a.appendChild(title);'//NL//' a.appendChild(kind);'//NL//' if (entry.s) {'//NL//' var text = d' &
//'ocument.createElement("small");'//NL//' text.textContent = entry.s;'//NL//' a.appendChild(text);'//NL &
//' }'//NL//' return a;'//NL//' }'//NL//NL//' function fill(box, results) {'//NL//' box.textContent =' &
//' "";'//NL//' results.forEach(function (e) { box.appendChild(row(e)); });'//NL//' }'//NL//NL//' document.' &
//'addEventListener("DOMContentLoaded", function () {'//NL//' var input = document.querySelector(".search inp' &
//'ut");'//NL//' if (!input) return;'//NL//' var box = document.querySelector(".search .results");'//NL//' ' &
//' var selected = -1;'//NL//' function mark() {'//NL//' var rows = box.children;'//NL//' for (va' &
//'r i = 0; i < rows.length; i++) rows[i].className = i === selected ? "on" : "";'//NL//' }'//NL//' input.' &
//'addEventListener("input", function () {'//NL//' load(function () {'//NL//' fill(box, input.value ' &
//'? search(input.value, 12) : []);'//NL//' selected = -1;'//NL//' box.style.display = box.childre' &
//'n.length ? "block" : "none";'//NL//' });'//NL//' });'//NL//' input.addEventListener("keydown", fun' &
//'ction (event) {'//NL//' var n = box.children.length;'//NL//' if (event.key === "ArrowDown" && n) { ' &
//'selected = (selected + 1) % n; mark(); event.preventDefault(); }'//NL//' else if (event.key === "ArrowUp' &
//'" && n) { selected = (selected + n - 1) % n; mark(); event.preventDefault(); }'//NL//' else if (event.ke' &
//'y === "Escape") { box.style.display = "none"; input.blur(); }'//NL//' else if (event.key === "Enter") {'//NL &
//' if (selected >= 0) box.children[selected].click();'//NL//' else location.href = root + "search' &
//'.html?q=" + encodeURIComponent(input.value);'//NL//' }'//NL//' });'//NL//' document.addEventListen' &
//'er("click", function (event) {'//NL//' if (!event.target.closest(".search")) box.style.display = "none";' &
//NL//' });'//NL//' document.addEventListener("keydown", function (event) {'//NL//' if (event.key ===' &
//' "/" && document.activeElement !== input) { input.focus(); event.preventDefault(); }'//NL//' });'//NL//' ' &
//' var page = document.querySelector(".search-page");'//NL//' if (page) {'//NL//' var query = new URLS' &
//'earchParams(location.search).get("q") || "";'//NL//' input.value = query;'//NL//' load(function () ' &
//'{'//NL//' var results = search(query, 200);'//NL//' fill(page, results);'//NL//' documen' &
//'t.querySelector(".search-count").textContent = results.length + " results for “" + query + "”";'//NL//' ' &
//' });'//NL//' }'//NL//' });'//NL//'})();'//NL//'(function () {'//NL//' document.addEventListener("DOMC' &
//'ontentLoaded", function () {'//NL//' // what the colours of `add_node` in fdoc_graphs.f90 mean: keep the t' &
//'wo the same'//NL//' var COLOURS = [["#3657c9", "Module"], ["#5a78de", "Submodule"], ["#a61e69", "Program"]' &
//', ["#1d7a55", "Subroutine"],'//NL//' ["#0b7285", "Function"], ["#6a4fb3", "Interface"], ["#a15c00", "Der' &
//'ived type"], ["#7a6a2d", "Type-bound procedure"],'//NL//' ["#5c6f2d", "Source file"], ["#646d7e", "Exter' &
//'nal, or other"], ["#8a93a5", "Not documented"]];'//NL//NL//' // a button that shows what is in this drawin' &
//'g, under it, as a short drawing can''t hold a popup'//NL//' function addKey(box, svg, zoom) {'//NL//' ' &
//' var key = document.createElement("div");'//NL//' key.className = "graph-key";'//NL//' key.hidden =' &
//' true;'//NL//' function entry(mark, text) {'//NL//' var item = document.createElement("span");'//NL)
call add(b, &
' item.className = "graph-key-item";'//NL//' item.appendChild(mark);'//NL//' item.appendC' &
//'hild(document.createTextNode(text));'//NL//' key.appendChild(item);'//NL//' }'//NL//' functi' &
//'on swatch(style) {'//NL//' var mark = document.createElement("span");'//NL//' mark.className = ' &
//'"graph-key-mark";'//NL//' Object.keys(style).forEach(function (name) { mark.style[name] = style[name];' &
//' });'//NL//' return mark;'//NL//' }'//NL//' COLOURS.forEach(function (c) {'//NL//' if' &
//' (svg.querySelector(''rect[fill="'' + c[0] + ''"], path[fill="'' + c[0] + ''"]'')) entry(swatch({ background:' &
//' c[0] }), c[1]);'//NL//' });'//NL//' if (svg.querySelector(''rect[stroke="#f0a868"]'')) entry(swatc' &
//'h({ border: "2px solid #f0a868" }), "This page");'//NL//' if (svg.querySelector("path[stroke-dasharray]"' &
//')) {'//NL//' entry(swatch({ height: "0", borderRadius: "0", borderTop: "2px dashed #8a93a5" }), "Compo' &
//'nent of a type");'//NL//' }'//NL//' var button = document.createElement("button");'//NL//' but' &
//'ton.textContent = "?";'//NL//' button.title = "Key to the colours";'//NL//' button.setAttribute("ar' &
//'ia-label", "Key to the colours");'//NL//' button.setAttribute("aria-expanded", "false");'//NL//' bu' &
//'tton.addEventListener("click", function () {'//NL//' key.hidden = !key.hidden;'//NL//' button.s' &
//'etAttribute("aria-expanded", String(!key.hidden));'//NL//' });'//NL//' zoom.appendChild(button);'//NL &
//' box.parentNode.insertBefore(key, box.nextSibling);'//NL//' }'//NL//NL//' document.querySelectorAl' &
//'l(".graph").forEach(function (box) {'//NL//' var svg = box.querySelector("svg");'//NL//' if (!svg) ' &
//'return;'//NL//' var width = svg.width.baseVal.value, height = svg.height.baseVal.value, scale = 1;'//NL//' ' &
//' function set(value) {'//NL//' scale = Math.max(0.25, Math.min(6, value));'//NL//' box.clas' &
//'sList.add("zoomed");'//NL//' svg.style.width = width * scale + "px";'//NL//' svg.style.height =' &
//' height * scale + "px";'//NL//' }'//NL//' var zoom = document.createElement("div");'//NL//' zo' &
//'om.className = "zoom";'//NL//' [["+", 1.3], ["\u2212", 1 / 1.3]].forEach(function (b) {'//NL//' v' &
//'ar button = document.createElement("button");'//NL//' button.textContent = b[0];'//NL//' button' &
//'.setAttribute("aria-label", b[1] > 1 ? "Zoom in" : "Zoom out");'//NL//' button.addEventListener("click' &
//'", function () { set(scale * b[1]); });'//NL//' zoom.appendChild(button);'//NL//' });'//NL//' ' &
//' box.insertBefore(zoom, svg);'//NL//' addKey(box, svg, zoom);'//NL//' var fit = box.clientWidth / ' &
//'width;'//NL//' if (fit > 0 && fit < 0.75) set(0.75);'//NL//' var start = null;'//NL//' box.add' &
//'EventListener("mousedown", function (event) {'//NL//' if (event.target.closest("a, button")) return;'//NL &
//' start = [event.clientX, event.clientY, box.scrollLeft, box.scrollTop];'//NL//' box.classList.a' &
//'dd("dragging");'//NL//' });'//NL//' window.addEventListener("mousemove", function (event) {'//NL//' ' &
//' if (!start) return;'//NL//' box.scrollLeft = start[2] - (event.clientX - start[0]);'//NL//' ' &
//' box.scrollTop = start[3] - (event.clientY - start[1]);'//NL//' });'//NL//' window.addEventListe' &
//'ner("mouseup", function () { start = null; box.classList.remove("dragging"); });'//NL//' });'//NL//' });'//NL &
//'})();'//NL//NL//'// a link to something inside a closed section opens the section'//NL//'function openTarget(' &
//') {'//NL//' var id = decodeURIComponent(location.hash.slice(1));'//NL//' var target = id && document.getEle' &
//'mentById(id);'//NL//' var section = target && target.closest(''details'');'//NL//' if (section) { section.o' &
//'pen = true; target.scrollIntoView(); }'//NL//'}'//NL//'window.addEventListener(''hashchange'', openTarget);'//NL &
//'window.addEventListener(''DOMContentLoaded'', openTarget);'//NL//NL//'// clicking a heading of a sortable tab' &
//'le sorts it by that column'//NL//'window.addEventListener(''DOMContentLoaded'', function () {'//NL//' docume' &
//'nt.querySelectorAll(''table.sortable'').forEach(function (table) {'//NL//' var headings = table.querySelec' &
//'torAll(''thead th'');'//NL//' headings.forEach(function (th, column) {'//NL//' th.addEventListener(''' &
//'click'', function () {'//NL//' var body = table.tBodies[0];'//NL//' var numeric = th.classList.' &
//'contains(''num'');'//NL//' var up = th.hasAttribute(''aria-sort'') ? th.getAttribute(''aria-sort'') ==' &
//'= ''descending'' : !numeric;'//NL//' var key = function (row) {'//NL//' var cell = row.cells[' &
//'column];'//NL//' return numeric ? Number(cell.dataset.sort) : cell.textContent.toLowerCase();'//NL//' ' &
//' };'//NL//' var rows = Array.prototype.slice.call(body.rows);'//NL//' rows.sort(function ' &
//'(a, b) {'//NL//' var x = key(a), y = key(b);'//NL//' return (x < y ? -1 : x > y ? 1 : 0) * ' &
//'(up ? 1 : -1);'//NL//' });'//NL//' rows.forEach(function (row) { body.appendChild(row); });'//NL &
//' headings.forEach(function (other) { other.removeAttribute(''aria-sort''); });'//NL//' th.setAt' &
//'tribute(''aria-sort'', up ? ''ascending'' : ''descending'');'//NL//' });'//NL//' });'//NL//' });'//NL &
//'});'//NL//NL//'// the sidebar holds all of the list of this page, and shows where this page is in it'//NL//'(' &
//'function () {'//NL//' var script = document.currentScript;'//NL//' var root = script ? script.src.replace(/' &
//'js\/fdoc\.js.*$/, "") : "";'//NL//NL//' document.addEventListener("DOMContentLoaded", function () {'//NL//' ' &
//' var side = document.querySelector("aside.side");'//NL//' if (!side) return;'//NL//' var headings = s' &
//'ide.querySelectorAll("h4"), height = 0;'//NL//' headings.forEach(function (h) { h.style.top = height + "px' &
//'"; height += h.offsetHeight; });'//NL//' headings.forEach(function (h) { height -= h.offsetHeight; h.style' &
//'.bottom = height + "px"; });'//NL//' var list = side.querySelector("ul[data-list]");'//NL//' if (!list ' &
//'|| !window.FDOC_SIDEBAR) return;'//NL//' list.innerHTML = (window.FDOC_SIDEBAR[list.dataset.list] || "").r' &
//'eplace(/href="@/g, ''href="'' + root);'//NL//' var here = location.href.split("#")[0];'//NL//' var link' &
//'s = list.querySelectorAll("a");'//NL//' for (var k = 0; k < links.length; k++) {'//NL//' if (links[k]' &
//'.href !== here) continue;'//NL//' links[k].classList.add("current");'//NL//' links[k].setAttribute(' &
//'"aria-current", "page");'//NL//' side.scrollTop = links[k].offsetTop - side.clientHeight / 2;'//NL//' ' &
//' return;'//NL//' }'//NL//' });'//NL//'})();'//NL)
end subroutine asset_fdoc_js