Sha256: 70e12bc590f74d816512f18ac4c9893cea04a3917fd6bfc6146b2dd0f6594cfc
Contents?: true
Size: 1.49 KB
Versions: 2
Compression:
Stored size: 1.49 KB
Contents
--- --- import JekyllGraph from './jekyll-graph.js'; export default class GraphNav extends JekyllGraph { constructor() { super(); // 'this.graph' + 'this.graphDiv' set in JekyllGraph this.graphKindCheckBox = document.getElementById('graph-kind-checkbox'); this.graphKindEmojiSpan = document.getElementById('graph-kind-emoji-span'); this.init(); // this.graphKind set in initgraphKind(); } init() { this.initGraphKind(); this.bindEvents(); this.draw(); } bindEvents() { this.graphKindCheckBox.addEventListener('click', () => { this.updateGraphkind(); this.draw(); }); } // draw draw() { // redraw new chart if (this.graphKindCheckBox.checked) { this.drawTree(); } else { this.drawWeb(); } } redraw() { this.updateGraphkind(); this.draw(); } // type initGraphKind() { this.graphKind = localStorage.getItem('graph-kind'); if (this.graphKind !== "tree" && this.graphKind !== "web") { this.graphKind = '{{ site.bonsai.nav.graph.kind }}'; } this.graphKindCheckBox.checked = (this.graphKind === "tree"); this.updateGraphkind(); } updateGraphkind() { if (this.graphKindCheckBox.checked) { this.graphKindEmojiSpan.innerText = "{{ site.data.emoji.web }}"; this.graphKind = "tree"; } else { this.graphKindEmojiSpan.innerText = "{{ site.data.emoji.tree }}"; this.graphKind = "web"; } localStorage.setItem('graph-kind', this.graphKind); } }
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
jekyll-garden-0.0.12 | assets/js/graph.js |
jekyll-wikibonsai-0.0.11 | assets/js/graph.js |