Skip to content

Commit

Permalink
Added toolbar for toggling unchanged code display
Browse files Browse the repository at this point in the history
  • Loading branch information
shinglyu committed Dec 28, 2016
1 parent 22ffdf8 commit fe82d27
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
10 changes: 10 additions & 0 deletions etc/layout_viewer/css/main.css
Expand Up @@ -15,3 +15,13 @@
.hidden-glyphicon {
visibility:hidden;
}

#toolbar {
background: rgba(255,255,255,0.5);
box-shadow: 0.5em 0.5em 2em lightgrey;
position: fixed;
top: 1em;
right: 1em;
padding: 1em;
border-radius: 1em;
}
13 changes: 13 additions & 0 deletions etc/layout_viewer/viewer.html
Expand Up @@ -67,6 +67,11 @@ <h1> Servo Layout Viewer </h1>
</div>
</div>
</div>
<div id="toolbar">
<input type="checkbox" name="show_unchanged" id="show_unchanged" />
<label for="show_unchanged">Show unchanged code</label>
<a href="#top">Back to top</a>
</div>
</div>

<!-- jQuery -->
Expand Down Expand Up @@ -219,6 +224,13 @@ <h1> Servo Layout Viewer </h1>
});
}

function register_toggle_unchanaged_code_handler() {
var show_unchange_box = document.getElementById("show_unchanged");
show_unchange_box.addEventListener("change", function(evt){
jsondiffpatch.formatters.html.showUnchanged(show_unchange_box.checked, null, 800);
});
}

$( document ).ready(function() {
var upload = document.getElementsByTagName('input')[0];
upload.onchange = function (e) {
Expand All @@ -233,6 +245,7 @@ <h1> Servo Layout Viewer </h1>
reader.readAsText(file);
return false;
};
register_toggle_unchanaged_code_handler();
});
</script>
</body>
Expand Down

0 comments on commit fe82d27

Please sign in to comment.