summaryrefslogtreecommitdiff
path: root/website/static/base/js
diff options
context:
space:
mode:
authorMathieu Lirzin <mthl@openmailbox.org>2015-06-14 19:13:12 +0200
committerMathieu Lirzin <mthl@openmailbox.org>2015-06-17 22:08:06 +0200
commit1dd8ad0da24941f05e0830dc077316690719b75c (patch)
treee9359c7e23fdd8b32d5129fe1813e18b8947f91a /website/static/base/js
parent199408ed97d99b9606a9f1ee18af1e166b0d1be1 (diff)
downloadguix-artwork-1dd8ad0da24941f05e0830dc077316690719b75c.tar
guix-artwork-1dd8ad0da24941f05e0830dc077316690719b75c.tar.gz
website: packages: List packages.
Integrate 'build-aux/list-packages.scm' from the Guix repository in the GuixSD website instead of using an external link. Export of the package list is optional since it requires to have Guix locally. * website/static/base/css/packages.css: New file. * website/static/base/js/packages.js: Likewise. * website/www/packages.scm (lookup-gnu-package, list-join) (package->sxml, packages->sxml): New procedures. (packages-page): Use them. * website/www/shared.scm (html-page-description): Use 'packages-page'.
Diffstat (limited to 'website/static/base/js')
-rw-r--r--website/static/base/js/packages.js46
1 files changed, 46 insertions, 0 deletions
diff --git a/website/static/base/js/packages.js b/website/static/base/js/packages.js
new file mode 100644
index 0000000..c8d9fc4
--- /dev/null
+++ b/website/static/base/js/packages.js
@@ -0,0 +1,46 @@
+/* license: CC0 */
+
+function show_hide(idThing)
+{
+ if(document.getElementById && document.createTextNode) {
+ var thing = document.getElementById(idThing);
+ /* Used to change the link text, depending on whether description is
+ collapsed or expanded */
+ var thingLink = thing.previousSibling.lastChild.firstChild;
+ if (thing) {
+ if (thing.style.display == "none") {
+ thing.style.display = "";
+ thingLink.data = 'Collapse';
+ } else {
+ thing.style.display = "none";
+ thingLink.data = 'Expand';
+ }
+ }
+ }
+}
+
+/* Add controllers used for collapse/expansion of package descriptions */
+function prep(idThing)
+{
+ var tdThing = document.getElementById(idThing).parentNode;
+ if (tdThing) {
+ var aThing = tdThing.firstChild.appendChild(document.createElement('a'));
+ aThing.setAttribute('href', 'javascript:void(0)');
+ aThing.setAttribute('title', 'show/hide package description');
+ aThing.appendChild(document.createTextNode('Expand'));
+ aThing.onclick=function(){show_hide(idThing);};
+ /* aThing.onkeypress=function(){show_hide(idThing);}; */
+ }
+}
+
+/* Take n element IDs, prepare them for javascript enhanced
+ display and hide the IDs by default. */
+function prep_pkg_descs()
+{
+ if(document.getElementById && document.createTextNode) {
+ for(var i=0; i<arguments.length; i++) {
+ prep(arguments[i])
+ show_hide(arguments[i]);
+ }
+ }
+}