aboutsummaryrefslogtreecommitdiff
path: root/phttps___stallman.org_.json
blob: 62c00264a091a308944d2f7b2f0181c318600cb2 (about) (plain)
1
[{"sSParse layout generator":{"url":"","hash":"","text":"/*\n\tGenerate simple yet clean single-page site(oids)\n\t\n\tCopyright © 2021 jahoti (jahoti@tilde.team)\n\t\n\tLicensed under the Apache License, Version 2.0 (the \"License\");\n\tyou may not use this file except in compliance with the License.\n\tYou may obtain a copy of the License at\n\t\n\t   http://www.apache.org/licenses/LICENSE-2.0\n\t\n\tUnless required by applicable law or agreed to in writing, software\n\tdistributed under the License is distributed on an \"AS IS\" BASIS,\n\tWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\tSee the License for the specific language governing permissions and\n\tlimitations under the License.\n*/\n\nfunction Sparse(navItems, opts) {\n\topts = opts || {};\n\tvar width = opts.width || 10,\n\t    text = opts.text || 'black',\n\t    bg = opts.bgcolor || opts.background || 'yellow',\n\t    pagebg = opts.tabcolor || 'white';\n\t    gap = opts.gap || '10px';\n\t\n\tvar body = document.createElement('body'),\n\t    nav = document.createElement('nav'),\n\t    style = document.createElement('style');\n\t\n\tvar link, activeLink, paneWidths;\n\t\n\tstyle.innerText = `\n\tbody {\n\t\tdisplay: grid;\n\t\tgrid-column-gap: ${gap};\n\t\tcolumn-gap: ${gap};\n\t\tgrid-template-columns: ${width}%;\n\t}\n\t\n\tnav {\n\t\tgrid-column: 1;\n\t\tposition: sticky;\n\t\ttop: 0;\n\t}\n\t\n\tnav > a:not([href]) {\n\t\tcolor: ${text};\n\t\tfont-weight: bold;\n\t}\n\t\n\tbody, nav { background-color: ${bg}; }\n\tbody > * { grid-row: 1; }\n\tbody > *:not(nav) { background-color: ${pagebg} }\n\t`\n\t\n\tbody.append(style);\n\tbody.append(nav);\n\t\n\tfunction onLinkClick(e) {\n\t\tvar link;\n\t\tif (activeLink) {\n\t\t\tlink = activeLink.inactive\n\t\t\tnav.replaceChild(link, activeLink);\n\t\t\tfor (pane of link.panes) body.removeChild(pane);\n\t\t\t\n\t\t\tdelete activeLink.inactive;\n\t\t}\n\t\t\n\t\tlink = e.target;\n\t\tactiveLink = document.createElement('span');\n\t\tactiveLink.innerText = link.textContent;\n\t\tactiveLink.inactive = link;\n\t\tnav.replaceChild(activeLink, link);\n\t\t\n\t\tlink.panes.forEach((pane, i) => {\n\t\t\tpane.style.gridColumn = (i + 2).toString();\n\t\t\tbody.append(pane);\n\t\t});\n\t}\n\t\n\tfor (var item of navItems) {\n\t\tlink = document.createElement('a');\n\t\tif (typeof item === 'string') link.innerText = item;\n\t\telse {\n\t\t\tlink.innerText = item.shift();\n\t\t\tif (typeof item[0] === 'string') link.href = item[0];\n\t\t\telse {\n\t\t\t\tlink.onclick = onLinkClick;\n\t\t\t\tlink.href = '#';\n\t\t\t\tlink.panes = item;\n\t\t\t}\n\t\t\t\n\t\t\tif (link.textContent.startsWith('* ')) {\n\t\t\t\tlink.innerText = link.textContent.substr(2);\n\t\t\t\t\n\t\t\t\tvar bullet = document.createElement('a');\n\t\t\t\tbullet.innerText = '• ';\n\t\t\t\tnav.append(bullet);\n\t\t\t}\n\t\t}\n\t\t\n\t\tnav.append(link);\n\t\tnav.append(document.createElement('br'));\n\t}\n\t\n\tdocument.body.parentNode.replaceChild(body, document.body);\n\tnav.querySelector('a[href]').click();\n}"}},{"sstallman.org":{"url":"","hash":"","text":"/*\n\tCopyright © 2021 jahoti (jahoti@tilde.team)\n\t\n\tLicensed under the Apache License, Version 2.0 (the \"License\");\n\tyou may not use this file except in compliance with the License.\n\tYou may obtain a copy of the License at\n\t\n\t   http://www.apache.org/licenses/LICENSE-2.0\n\t\n\tUnless required by applicable law or agreed to in writing, software\n\tdistributed under the License is distributed on an \"AS IS\" BASIS,\n\tWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\tSee the License for the specific language governing permissions and\n\tlimitations under the License.\n*/\n\nvar div1 = document.querySelector('.column1'),\n    div2 = document.querySelector('.column2'),\n    div3 = document.querySelector('.column3'),\n    rest = document.querySelector('.rest'),\n    head = document.body;\n\nhead.removeChild(div1);\nhead.removeChild(div2);\nhead.removeChild(div3);\nhead.removeChild(rest);\n\nvar wrapper, chaseHeader = div1.querySelector('#urgent');\nvar urgent = chaseHeader.parentNode.nextElementSibling;\nchaseHeader.parentNode.removeChild(chaseHeader);\nurgent.parentNode.removeChild(urgent);\n\nwrapper = document.createElement('div');\nchaseHeader = document.createElement('h3');\nchaseHeader.innerText = 'Urgent action items';\nwrapper.append(chaseHeader);\nwrapper.append(urgent);\nurgent = wrapper;\n\nvar chaseHeader = div1.querySelector('#oughttobe');\nvar oughttobe = chaseHeader.parentNode.nextElementSibling;\nvar oughttobe_more = oughttobe.nextElementSibling;\nchaseHeader.parentNode.removeChild(chaseHeader);\noughttobe.parentNode.removeChild(oughttobe)\noughttobe_more.parentNode.removeChild(oughttobe_more)\n\nwrapper = document.createElement('div');\nchaseHeader = document.createElement('h3');\noughttobe_more.innerText = 'There Ought to Be a Law';\nchaseHeader.append(oughttobe_more);\nwrapper.append(chaseHeader);\nwrapper.append(oughttobe);\noughttobe = wrapper;\n\ndiv1.style.width = '100%';\n\nvar polnotes = div2.querySelector('iframe');\npolnotes.parentNode.removeChild(polnotes);\n\nSparse([\n\t'stallman.org',\n\t['Home', urgent, polnotes],\n\t['* Urgent Action', urgent],\n\t['* Political Notes', polnotes],\n\t['Needed Laws', oughttobe],\n\t['Miscellaneous', div1],\n\t'Miscellaneous',\n\t['* Misc. 2', div2],\n\t['* Misc. 3', div3],\n\t['* Misc. 4', rest],\n\t['* Misc. 5', head]\n]);"}},{"bstallman.org":[["s","SParse layout generator"],["s","stallman.org"]]},{"phttps://stallman.org/":{"components":["b","stallman.org"],"allow":false}}]