jekyll-graph 0.0.7 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4ed0feb31f2a12640c7ba6611b2768a0d2424fff77a5d6909876e5f1b586abd0
4
- data.tar.gz: 856133d37f0c83fc570ea8437edea51a4181d5b43f8e832b310ea17a08966a4c
3
+ metadata.gz: 66875092a5dcc753a34bb074f399ec0e5de3cbaa9a25fa154fc585420bce6007
4
+ data.tar.gz: '0423681fcf78d2fc0487d318c02d52b8cfe9f93d4be79747bfa72b7a3ae00be5'
5
5
  SHA512:
6
- metadata.gz: 7cff6886e6391bb8920746f0f248fb13ed8f795841c66c714f0c91b158afa0c16253d82249941fee5b2b4e018a2d715af2fd4527509ab3af7d0626f415c52d68
7
- data.tar.gz: cbd240e478d07b67f92c8da3d8a31c261e3a3ea58a9052838b7fd4bb30da830dc37092c72453db65e2aab293a9bdf38d022f522cba227008947d3c45bfeb2275
6
+ metadata.gz: d2439f89e5287ab1c298e9e4e42563b43961debe93200b69c2cf9f2768bb70ce97c9084c58c34f14ad331e1f3f414d07b54f66688047ff8764cebccba846addb
7
+ data.tar.gz: 4b9eec6d0e335d670714fb128736f2883d53d38d2c066acb3f2901fb3ba002d854276778c35ab18b4c707ae7ef74c34eaa66e47f667fb887c3c5127a7f29082e
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## [0.0.8] - 2022-03-03
2
+ ### Change
3
+ - Update javascript setup instructions in README.
4
+ ### Fix
5
+ - Check 'visited' localstorage variable is not null.
1
6
  ## [0.0.7] - 2022-01-27
2
7
  ### Change
3
8
  - Bump jekyll-wikilinks version number (0.0.11).
data/README.md CHANGED
@@ -37,7 +37,7 @@ Follow the instructions for installing a [jekyll plugin](https://jekyllrb.com/do
37
37
  ```javascript
38
38
  import JekyllGraph from './jekyll-graph.js';
39
39
 
40
- export default class JekyllGraphSubClass extends JekyllGraph {
40
+ class JekyllGraphSubClass extends JekyllGraph {
41
41
 
42
42
  constructor() {
43
43
  super();
@@ -49,10 +49,27 @@ export default class JekyllGraphSubClass extends JekyllGraph {
49
49
  }
50
50
  ```
51
51
 
52
- Call `this.drawNetWeb()` and `this.drawTree()` to actually draw the graph. You could do this simply on initialization or on a button click, etc.
52
+ The import should point to the `jekyll-graph.js` javascript file generated by the plugin. Unless otherwise configured (see `path` vars below), the `jekyll-graph.js` file will be generated into `_site/assets/js/`. The sample javascript snippet above is presumed to be generated into `_site/assets/js/` as well.
53
53
 
54
- Unless otherwise configured (see `path` vars below), the `jekyll-graph.js` file will be generated into `_site/assets/js/`.
54
+ 4. Create a class instance:
55
55
 
56
+ ```javascript
57
+ var graph = new JekyllGraphSubClass();
58
+ ```
59
+
60
+ 5. Call `drawNetWeb()` and/or `drawTree()` to actually draw the graph. You could do this simply on initialization or on a button click, etc.
61
+
62
+ ```javascript
63
+ // on page load
64
+ (() => {
65
+ graph.drawNetWeb();
66
+ });
67
+
68
+ // on button click
69
+ this.graphBtn.addEventListener('click', () => {
70
+ graph.drawTree();
71
+ });
72
+ ```
56
73
  ## Configuration
57
74
 
58
75
  Default configs look like this:
@@ -14,12 +14,12 @@ export default class JekyllGraph {
14
14
  // neighbors: replace ids with full object
15
15
  data.nodes.forEach(node => {
16
16
  let neighborNodes = [];
17
- node.neighbors.nodes.forEach(nNodeId => {
18
- neighborNodes.push(data.nodes.find(node => node.id === nNodeId));
17
+ node.neighbors.nodes.forEach(nodeId => {
18
+ neighborNodes.push(data.nodes.find(node => node.id === nodeId));
19
19
  });
20
20
  let neighborLinks = [];
21
- node.neighbors.links.forEach(nLink => {
22
- neighborLinks.push(data.links.find(link => link.source === nLink.source && link.target === nLink.target));
21
+ node.neighbors.links.forEach(linkIds => {
22
+ neighborLinks.push(data.links.find(link => link.source === linkIds.source && link.target === linkIds.target));
23
23
  });
24
24
  node.neighbors.nodes = neighborNodes;
25
25
  node.neighbors.links = neighborLinks;
@@ -131,15 +131,15 @@ export default class JekyllGraph {
131
131
  data.nodes.forEach(node => {
132
132
  // lineage
133
133
  let lineageNodes = [];
134
- node.lineage.nodes.forEach(nNodeId => {
135
- lineageNodes.push(data.nodes.find(node => node.id === nNodeId));
134
+ node.lineage.nodes.forEach(nodeId => {
135
+ lineageNodes.push(data.nodes.find(node => node.id === nodeId));
136
136
  });
137
- let relativeLinks = [];
138
- node.lineage.links.forEach(nLink => {
139
- relativeLinks.push(data.links.find(link => link.source === nLink.source && link.target === nLink.target));
137
+ let lineageLinks = [];
138
+ node.lineage.links.forEach(linkIds => {
139
+ lineageLinks.push(data.links.find(link => link.source === linkIds.source && link.target === linkIds.target));
140
140
  });
141
141
  node.lineage.nodes = lineageNodes;
142
- node.lineage.links = relativeLinks;
142
+ node.lineage.links = lineageLinks;
143
143
  // siblings
144
144
  this.numSiblingsLeft[node.parent] = node.siblings.length;
145
145
  });
@@ -338,8 +338,10 @@ export default class JekyllGraph {
338
338
  isVisitedPage(node) {
339
339
  if (!this.isMissingPage(node)) {
340
340
  var visited = JSON.parse(localStorage.getItem('visited'));
341
- for (let i = 0; i < visited.length; i++) {
342
- if (visited[i]['url'] === node.url) return true;
341
+ if (visited !== null) {
342
+ for (let i = 0; i < visited.length; i++) {
343
+ if (visited[i]['url'] === node.url) return true;
344
+ }
343
345
  }
344
346
  }
345
347
  return false;
@@ -3,7 +3,7 @@
3
3
  module Jekyll
4
4
  module Graph
5
5
 
6
- VERSION = "0.0.7"
6
+ VERSION = "0.0.8"
7
7
 
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-graph
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - manunamz
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-01-27 00:00:00.000000000 Z
11
+ date: 2022-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll