Skip to content

Commit

Permalink
Collapse on Ctrl+Click only
Browse files Browse the repository at this point in the history
  • Loading branch information
zoffixznet committed Jan 14, 2018
1 parent bddb8ab commit 4cedaeb
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 84 deletions.
5 changes: 5 additions & 0 deletions bin/q-corehackers.p6 → bin/q
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,19 @@
use lib $*PROGRAM.sibling: '../lib';
use CoreHackers::Q;

my $out := (%*ENV<COREHACKERS_Q_FILE> // 'out.html').IO.open: :w;

multi MAIN('a', *@args) {
my $*OUT := $out;
CoreHackers::Q.new.run: @args;
}

multi MAIN('o', *@args) {
my $*OUT := $out;
CoreHackers::Q.new.run: @args, :opt;
}

multi MAIN('z', *@args) {
my $*OUT := $out;
CoreHackers::Q.new.zero-run: @args, :opt;
}
87 changes: 9 additions & 78 deletions lib/CoreHackers/Q/Parser/Actions.pm6
Original file line number Diff line number Diff line change
Expand Up @@ -10,89 +10,20 @@ method TOP($/) {
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Perl 6 QAST Viewer</title>
<!-- CSS INSERT START --><style>
* {
margin: 0;
padding: 0;
}
html {
background: #ddc;
color: #333;
}
body {
width: 1200px;
margin: 20px auto;
}
li {
list-style: none;
}
li li {
padding-left: 2em;
border-left: 1px dotted #333;
}
.node-with-kids:before {
content: "[-]";
font-size: 80%;
font-family: monospace;
color: #66c;
}
.node-with-kids.collapsed:before {
content: "[+]";
}
.qast-sunk {
background: rgba(150, 150, 200, .1);
}
.qast-sunk .qast-sunk .qast-sunk .qast-sunk .qast-sunk {
background: none;
}
.qast-name-vm {
opacity: .5;
}
.qast-name-var {
color: #d0d;
}
.qast-name-wval {
color: #00a;
}
.qast-static-call {
color: green;
}
.qast-call {
color: red;
}
.qast-want-v {
color: #999;
opacity: .5;
}
</style><!-- CSS INSERT END -->
<!-- CSS INSERT START -->
<link rel="stylesheet" href="/home/zoffix/q/main.css">
<!-- CSS INSERT END -->
<script
src="https://code.jquery.com/jquery-3.2.1.min.js"
integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
crossorigin="anonymous"></script>
<!-- JS INSERT START --><script>
jQuery(function ($) {
setup_nodes();
});
function setup_nodes() {
$('body').css({'height': document.body.scrollHeight + 'px'});
$('.node-with-kids').on('click', function(e) {
e.stopPropagation();
console.log("meow");
$(this).find('> ul').toggle('fast', function() {
$(this).parent('.node-with-kids').toggleClass('collapsed');
});
});
}
<!-- JS INSERT START -->
<script src="/home/zoffix/q/main.js"></script>
<!-- JS INSERT END -->
</script><!-- JS INSERT END -->
<div id="info-panel">
<p><kbd>Ctrl+Click</kbd> to collapse/uncollapse nodes</p>
</diV>
}

Expand Down
9 changes: 8 additions & 1 deletion main.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
}

html {
background: #ddc;
background: #ddddd2;
color: #333;
}

Expand All @@ -21,6 +21,13 @@ li li {
border-left: 1px dotted #333;
}

#info-panel {
padding: 20px;
border: 1px solid #444;
margin-bottom: 20px;
background: #ddc;
}

.node-with-kids:before {
content: "[-]";
font-size: 80%;
Expand Down
12 changes: 7 additions & 5 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ jQuery(function ($) {

function setup_nodes() {
$('body').css({'height': document.body.scrollHeight + 'px'});

$('.node-with-kids').on('click', function(e) {
e.stopPropagation();
console.log("meow");
$(this).find('> ul').toggle('fast', function() {
$(this).parent('.node-with-kids').toggleClass('collapsed');
});
if (e.ctrlKey) {
e.stopPropagation();
$(this).find('> ul').toggle('fast', function() {
$(this).parent('.node-with-kids').toggleClass('collapsed');
});
}
});
}

0 comments on commit 4cedaeb

Please sign in to comment.