diff options
Diffstat (limited to 'docs/release/scripts/minimaws/lib/assets')
8 files changed, 131 insertions, 37 deletions
diff --git a/docs/release/scripts/minimaws/lib/assets/common.js b/docs/release/scripts/minimaws/lib/assets/common.js index a9d1991e499..baedcf3940d 100644 --- a/docs/release/scripts/minimaws/lib/assets/common.js +++ b/docs/release/scripts/minimaws/lib/assets/common.js @@ -1,55 +1,119 @@ // license:BSD-3-Clause // copyright-holders:Vas Crabb -function sort_table(tbl, col, dir, numeric) +function make_collapsible(heading, section) { - var tbody = tbl.tBodies[0]; - var trows = Array.prototype.slice.call(tbody.rows, 0).sort( - function (x, y) + var hidden = false; + var display = section.style.display; + var icon = heading.insertBefore(document.createElement('img'), heading.firstChild); + icon.setAttribute('src', assetsurl + '/disclosedown.svg'); + icon.setAttribute('class', 'disclosure'); + icon.addEventListener( + 'click', + function (event) { - if (numeric) - return dir * (parseFloat(x.cells[col].textContent) - parseFloat(y.cells[col].textContent)); + hidden = !hidden; + if (hidden) + { + icon.setAttribute('src', assetsurl + '/discloseup.svg'); + section.style.display = 'none'; + } else - return dir * x.cells[col].textContent.localeCompare(y.cells[col].textContent); - }) - trows.forEach(function (row) { tbody.appendChild(row); }); + { + icon.setAttribute('src', assetsurl + '/disclosedown.svg'); + section.style.display = display; + var headingtop = 0; + for (var element = heading; element !== null; element = element.offsetParent) + headingtop += element.offsetTop; + var sectionbot = section.offsetHeight; + for (var element = section; element !== null; element = element.offsetParent) + sectionbot += element.offsetTop; + if ((window.pageYOffset + window.innerHeight) < sectionbot) + { + if ((sectionbot - headingtop) > window.innerHeight) + heading.scrollIntoView(true); + else + window.scroll(window.pageXOffset, sectionbot - window.innerHeight); + } + } + }); } function make_table_sortable(tbl) { - var headers = tbl.tHead.rows[0].cells; - for (var i = 0; i < headers.length; i++) + var sorticons = new Array(tbl.tHead.rows[0].cells.length); + + function TableSortHelper(i) { - (function (col) - { - var dir = 1; - var sorticon = document.createElement('img'); - sorticon.setAttribute('src', assetsurl + '/sortind.png'); - sorticon.style.cssFloat = 'right'; - sorticon.style.marginLeft = '0.5em'; - headers[col].appendChild(sorticon); - headers[col].addEventListener( - 'click', - function (event) + this.column = i; + this.header = tbl.tHead.rows[0].cells[i]; + this.sorted = false; + this.direction = 1; + + var container = this.header.appendChild(document.createElement('div')); + container.setAttribute('class', 'sorticon'); + + this.icon = container.appendChild(document.createElement('img')); + this.icon.setAttribute('src', assetsurl + '/sortind.svg'); + this.icon.addEventListener('click', this.icon_click.bind(this)); + } + + TableSortHelper.prototype = (function () + { + function set_unsorted(obj) + { + obj.sorted = false; + obj.icon.setAttribute('src', assetsurl + '/sortind.svg'); + } + + function sort_table(obj) + { + var c = obj.header.cellIndex; + var numeric = obj.header.getAttribute('class') == 'numeric'; + var tbody = tbl.tBodies[0]; + var trows; + if (numeric) { - var imgsrc = sorticon.getAttribute('src'); - imgsrc = imgsrc.substr(imgsrc.lastIndexOf('/') + 1); - if (imgsrc != 'sortind.png') - dir = -dir; - if (dir < 0) - sorticon.setAttribute('src', assetsurl + '/sortdesc.png'); + trows = Array.prototype.slice.call(tbody.rows, 0).sort( + function (x, y) + { + return obj.direction * (parseFloat(x.cells[c].textContent) - parseFloat(y.cells[c].textContent)); + }); + } + else + { + trows = Array.prototype.slice.call(tbody.rows, 0).sort( + function (x, y) + { + return obj.direction * x.cells[c].textContent.localeCompare(y.cells[c].textContent); + }); + } + trows.forEach(function (row) { tbody.appendChild(row); }); + } + + return { + icon_click : function (event) + { + if (this.sorted) + this.direction = -this.direction; + if (this.direction < 0) + this.icon.setAttribute('src', assetsurl + '/sortdesc.svg'); else - sorticon.setAttribute('src', assetsurl + '/sortasc.png'); - for (var i = 0; i < headers.length; i++) + this.icon.setAttribute('src', assetsurl + '/sortasc.svg'); + this.sorted = true; + for (var i = 0; i < sorticons.length; i++) { - if (i != col) - headers[i].lastChild.setAttribute('src', assetsurl + '/sortind.png'); + if (i != this.column) + set_unsorted(sorticons[i]); } - sort_table(tbl, col, dir, headers[col].getAttribute('class') == 'numeric'); - }); - }(i)); - } + sort_table(this); + } + }; + })(); + + for (var i = 0; i < sorticons.length; i++) + sorticons[i] = new TableSortHelper(i); } diff --git a/docs/release/scripts/minimaws/lib/assets/disclosedown.svg b/docs/release/scripts/minimaws/lib/assets/disclosedown.svg new file mode 100644 index 00000000000..ddf75e25f0f --- /dev/null +++ b/docs/release/scripts/minimaws/lib/assets/disclosedown.svg @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="16" width="16"> + <path d="m 0,0 h 16 l -8,16 z" /> +</svg> diff --git a/docs/release/scripts/minimaws/lib/assets/discloseup.svg b/docs/release/scripts/minimaws/lib/assets/discloseup.svg new file mode 100644 index 00000000000..51e2bea9863 --- /dev/null +++ b/docs/release/scripts/minimaws/lib/assets/discloseup.svg @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="16" width="16"> + <path d="m 0,0 v 16 l 16,-8 z" /> +</svg> diff --git a/docs/release/scripts/minimaws/lib/assets/romident.js b/docs/release/scripts/minimaws/lib/assets/romident.js index e42daf875cf..599b0674007 100644 --- a/docs/release/scripts/minimaws/lib/assets/romident.js +++ b/docs/release/scripts/minimaws/lib/assets/romident.js @@ -132,6 +132,7 @@ function add_unmatched(names, crc, sha1) heading.textContent = 'Unmatched'; table = div.appendChild(document.createElement('table')); table.setAttribute('id', 'table-unmatched'); + make_collapsible(heading, table); } var content; if (crc === null) @@ -160,8 +161,10 @@ function add_issues(name) var list; if (!div.hasChildNodes()) { - div.appendChild(document.createElement('h2')).textContent = 'Potential Issues'; + var heading = div.appendChild(document.createElement('h2')); + heading.textContent = 'Potential Issues'; list = div.appendChild(document.createElement('dl')); + make_collapsible(heading, list); } else { @@ -229,6 +232,7 @@ function get_machine_table(shortname, description) var table = div.appendChild(document.createElement('table')); machine_info[shortname] = table; add_matches(table, matched_names, null); + make_collapsible(heading, table); return table; } } diff --git a/docs/release/scripts/minimaws/lib/assets/sortasc.svg b/docs/release/scripts/minimaws/lib/assets/sortasc.svg new file mode 100644 index 00000000000..c2ff41afccb --- /dev/null +++ b/docs/release/scripts/minimaws/lib/assets/sortasc.svg @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="16" width="30"> + <path d="m 14,16 h 16 l -8,-16 z" /> +</svg> diff --git a/docs/release/scripts/minimaws/lib/assets/sortdesc.svg b/docs/release/scripts/minimaws/lib/assets/sortdesc.svg new file mode 100644 index 00000000000..4a10b3f6e47 --- /dev/null +++ b/docs/release/scripts/minimaws/lib/assets/sortdesc.svg @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="16" width="30"> + <path d="m 14,0 h 16 l -8,16 z" /> +</svg> diff --git a/docs/release/scripts/minimaws/lib/assets/sortind.svg b/docs/release/scripts/minimaws/lib/assets/sortind.svg new file mode 100644 index 00000000000..6e351b6a6fb --- /dev/null +++ b/docs/release/scripts/minimaws/lib/assets/sortind.svg @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="16" width="30"> + <path d="m 0,16 h 16 l -8,-16 z" /> + <path d="m 14,0 h 16 l -8,16 z" /> +</svg> diff --git a/docs/release/scripts/minimaws/lib/assets/style.css b/docs/release/scripts/minimaws/lib/assets/style.css index 1e6ebd57ec0..9ba6631a783 100644 --- a/docs/release/scripts/minimaws/lib/assets/style.css +++ b/docs/release/scripts/minimaws/lib/assets/style.css @@ -5,6 +5,11 @@ th { text-align: left; background-color: #ddd; padding: 0.25em } td { padding-left: 0.25em; padding-right: 0.25em } +img[class=disclosure] { height: 0.7em; margin-right: 0.25em; vertical-align: baseline } + +div[class=sorticon] { float: right; height: 100%; margin-left: 0.5em } +div[class=sorticon] img { height: 0.7em; vertical-align: baseline } + table[class=sysinfo] th { text-align: right } div[class=dropzone] { padding: 0 1em; border-width: 2px; border-radius: 1em; border-style: dashed } |