Skip to content

Commit

Permalink
Support for ?presentation query param (#36)
Browse files Browse the repository at this point in the history
* Support for ?presentation query param

* Use the existing pattern for param parsing

* Add a note in the readme
  • Loading branch information
kj800x authored Jul 25, 2024
1 parent 9f506fa commit cb702e1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ Example: https://dreampuf.github.io/GraphvizOnline/?url=https://gist.githubuserc

Using https://gist.github.com/ allows you to share and version your graph definitions.

## Presentation mode

If you would like to display just the graph and not the graph input, you can add a `?presentation` query param. This can be helpful when generating links with the graph already prefilled.

# How to implement this

- [viz.js](https://github.com/mdaines/viz.js) This repo has compile graphviz(C) to javascript via [emscripten](https://github.com/kripken/emscripten).
Expand Down
16 changes: 16 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,18 @@
margin: 0 0;
}

body.presentation #editor {
display: none;
}

body.presentation #options {
left: 0;
}

body.presentation #review {
left: 0;
}

#editor {
margin: 0;
position: absolute;
Expand Down Expand Up @@ -497,6 +509,10 @@
}
}

if (params.has("presentation")) {
document.body.classList.add("presentation");
}

if (params.has('raw')) {
editor.getSession().setValue(params.get('raw'));
renderGraph();
Expand Down

0 comments on commit cb702e1

Please sign in to comment.