Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions css/explaingit.css
Original file line number Diff line number Diff line change
Expand Up @@ -135,18 +135,20 @@ span.cmd {
top: 3px;
}

.control-box button {
.control-box .button {
font-family: Courier New;
font-size: 12px;
margin-right: 5px;
margin-bottom: 5px;
position: absolute;
top: 30px;
}

.control-box .log {
overflow-y: auto;
position: absolute;
background: #000;
top: 30px;
top: 60px;
bottom: 20px;
left: 0;
right: 0;
Expand Down
21 changes: 19 additions & 2 deletions js/controlbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,13 @@ function(_yargs, d3, demos) {

render: function(container) {
var cBox = this,
cBoxContainer, log, input, selector;
cBoxContainer, log, input, selector, exportbtn;

cBoxContainer = container.append('div')
.classed('control-box', true);

selector = cBoxContainer.append('select')
.classed('scenario-chooser', true)
.classed('scenario-chooser', true);

demos.forEach(function (demo) {
var opt = selector.append('option')
Expand All @@ -129,6 +129,23 @@ function(_yargs, d3, demos) {
}
})

exportbtn = cBoxContainer.append('input')
.attr('type', 'button')
.attr('value', 'Export')
.classed("button", true);


exportbtn.on('click', function () {
var text = "test",
blob = new Blob([window.localStorage.getItem('git-viz-snapshot')], { type: 'text/plain' }),
anchor = document.createElement('a');

anchor.download = "export.json";
anchor.href = (window.webkitURL || window.URL).createObjectURL(blob);
anchor.dataset.downloadurl = ['text/plain', anchor.download, anchor.href].join(':');
anchor.click();
})

log = cBoxContainer.append('div')
.classed('log', true);

Expand Down