Skip to content

Commit

Permalink
updating code to make it work with local url
Browse files Browse the repository at this point in the history
  • Loading branch information
cmakler committed Jul 24, 2024
1 parent 1d42c2d commit 41afa95
Show file tree
Hide file tree
Showing 7 changed files with 143,213 additions and 12 deletions.
3 changes: 2 additions & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@ email: [email protected]
description: >- # this means to ignore newlines until "baseurl:"
A template repository for creating standalone KineticGraphs
repository: "graph-template" # the name of your repository
baseurl: "graph-template" # the subpath of your site, e.g. /blog
baseurl: "/graph-template" # the subpath of your site, e.g. /blog
url: "" # the base hostname & protocol for your site, e.g. http://example.com
github_username: cmakler

# Build settings
markdown: kramdown
theme: minima
plugins:
- jekyll-feed

Expand Down
27 changes: 16 additions & 11 deletions _layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,41 @@
<title>Graph</title>
</head>
<body>
<div id="graph" class="kg-container">
<div id="kg-graph" class="kg-container">
(loading. please wait)
</div>
<button style="float:right" onclick="KG.resetAllParams()">Reset Graph</button>
<button id="kg-reset" style="float:right; display:none" onclick="KG.resetAllParams()">Reset Graph</button>
</body>
<script>
// Get details of requested graph and options from URL parameters
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);

// Get location of graph, set URL in graph div
const category = urlParams.get('folder');
const graph = urlParams.get('graph');
const path = "{{site.baseurl}}/graphs/" + category + "/" + graph + ".yml";
document.getElementById("kg-graph").setAttribute("src", path);

// Get KGJS version, set JS and CSS to point to appropriate paths
const version = urlParams.get('version') || "0.3.2";

const kgjspath = "https://kineticgraphs.org/js/kg3d."+ version + ".js";
const kgjspath = "{{site.baseurl}}/static/js/kg3d."+ version + ".js";
let kgjs=document.createElement("script");
kgjs.setAttribute("src", kgjspath);
document.body.appendChild(kgjs);

// Add reset button
const allowReset = urlParams.get('allowReset');
if(allowReset) {
document.getElementById("kg-reset").setAttribute("style","float:right; display:block");
}

const kgcsspath = "https://kineticgraphs.org/css/kg."+ version + ".css";
const kgcsspath = "{{site.baseurl}}/static/css/kg."+ version + ".css";
let kgcss=document.createElement("link");
kgcss.setAttribute("href", kgcsspath);
kgcss.setAttribute("rel", "stylesheet");
kgcss.setAttribute("type", "text/css");
document.head.appendChild(kgcss);

// Get location of graph, set URL in graph div
const category = urlParams.get('folder');
const graph = urlParams.get('graph');
const path = "./graphs/" + category + "/" + graph + ".yml";
document.getElementById("graph").setAttribute("src", path);

</script>
</html>
178 changes: 178 additions & 0 deletions static/css/kg-tufte.0.3.2.css

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions static/css/kg-tufte.css

Large diffs are not rendered by default.

176 changes: 176 additions & 0 deletions static/css/kg.0.3.2.css

Large diffs are not rendered by default.

71,401 changes: 71,401 additions & 0 deletions static/js/kg.0.3.2.js

Large diffs are not rendered by default.

71,435 changes: 71,435 additions & 0 deletions static/js/kg3d.0.3.2.js

Large diffs are not rendered by default.

0 comments on commit 41afa95

Please sign in to comment.