github.com/pachyderm/pachyderm@v1.13.4/doc/docs/master/assets/javascripts/extra.js (about) 1 (function () { 2 'use strict'; 3 /** 4 * Converts details/summary tags into working elements in browsers that don't yet support them. 5 * @return {void} 6 */ 7 var details = (function () { 8 9 var isDetailsSupported = function () { 10 // https://mathiasbynens.be/notes/html5-details-jquery#comment-35 11 // Detect if details is supported in the browser 12 var el = document.createElement("details"); 13 var fake = false; 14 15 if (!("open" in el)) { 16 return false; 17 } 18 19 var root = document.body || function () { 20 var de = document.documentElement; 21 fake = true; 22 return de.insertBefore(document.createElement("body"), de.firstElementChild || de.firstChild); 23 }(); 24 25 el.innerHTML = "<summary>a</summary>b"; 26 el.style.display = "block"; 27 root.appendChild(el); 28 var diff = el.offsetHeight; 29 el.open = true; 30 diff = diff !== el.offsetHeight; 31 root.removeChild(el); 32 33 if (fake) { 34 root.parentNode.removeChild(root); 35 } 36 37 return diff; 38 }(); 39 40 if (!isDetailsSupported) { 41 var blocks = document.querySelectorAll("details>summary"); 42 for (var i = 0; i < blocks.length; i++) { 43 var summary = blocks[i]; 44 var details = summary.parentNode; 45 46 // Apply "no-details" to for unsupported details tags 47 if (!details.className.match(new RegExp("(\\s|^)no-details(\\s|$)"))) { 48 details.className += " no-details"; 49 } 50 51 summary.addEventListener("click", function (e) { 52 var node = e.target.parentNode; 53 if (node.hasAttribute("open")) { 54 node.removeAttribute("open"); 55 } else { 56 node.setAttribute("open", "open"); 57 } 58 }); 59 } 60 } 61 }); 62 63 (function () { 64 var onReady = function onReady(fn) { 65 if (document.addEventListener) { 66 document.addEventListener("DOMContentLoaded", fn); 67 } else { 68 document.attachEvent("onreadystatechange", function () { 69 if (document.readyState === "interactive") { 70 fn(); 71 } 72 }); 73 } 74 }; 75 76 onReady(function () { 77 details(); 78 }); 79 })(); 80 81 }());