Skip to content

Commit c7091b0

Browse files
committed
sweeter styles, collapse toggle +/-
1 parent 49c14f7 commit c7091b0

File tree

5 files changed

+14
-5
lines changed

5 files changed

+14
-5
lines changed

build/client.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3551,6 +3551,7 @@ function toggleStitches(evt) {
35513551
function toggleCollapse(evt) {
35523552
var sectionHandle = evt.target.parentNode.attributes['data-url'].value
35533553

3554+
dom('.stitch-mark[data-url="'+sectionHandle+'"] .collapser').toggleClass('has-plus')
35543555
dom('.stitch-mark[data-url="'+sectionHandle+'"] .content').toggleClass('hidden')
35553556
}
35563557

@@ -3643,7 +3644,7 @@ function plainSubstitute (url, importedText, wholeText) {
36433644
function stitchSubstitute (treeNode, wholeText) {
36443645
var regex = new RegExp('\\+\<a href\=(\'|\")' + treeNode.url + '.*\<\/a\>', 'g')
36453646
var importedText = "<div class='stitch-mark visible' data-url='" + treeNode.url + "'>" +
3646-
"<button class='collapser'>+</button>" +
3647+
"<button class='collapser has-plus'></button>" +
36473648
"<div class='content expanded'>" + treeNode.content + "</div>" +
36483649
"<div class='content collapsed hidden'>" + treeNode.label + "</div>" +
36493650
"</div>"

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<h1>hypermarkdown</h1>
1313
</div>
1414
<div class='container controls'>
15-
<button class='toggle-stitches active'>hide stitches</button>
15+
<button class='toggle-stitches active'>toggle stitches</button>
1616
</div>
1717
<div class='container target'>
1818
<div id='loading' >

source/client.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ function toggleStitches(evt) {
5959
function toggleCollapse(evt) {
6060
var sectionHandle = evt.target.parentNode.attributes['data-url'].value
6161

62+
dom('.stitch-mark[data-url="'+sectionHandle+'"] .collapser').toggleClass('has-plus')
6263
dom('.stitch-mark[data-url="'+sectionHandle+'"] .content').toggleClass('hidden')
6364
}
6465

styles.css

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ h1 {
1515

1616
.stitch-mark div.content h1:nth-child(1) {
1717
padding-top: 0;
18-
margin-top: 0;
18+
margin-top: 10px;
1919
}
2020

2121
.stitch-mark div.content h2:nth-child(1) {
2222
padding-top: 0;
23-
margin-top: 0;
23+
margin-top: 10px;
2424
}
2525

2626
a {
@@ -71,6 +71,13 @@ main {
7171
position: absolute;
7272
}
7373

74+
button.collapser::after {
75+
content: '-';
76+
}
77+
button.collapser.has-plus::after {
78+
content: '+';
79+
}
80+
7481
.container.target {
7582
min-height: 1000px;
7683
margin-bottom: 30px;

treeToHtml.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ function plainSubstitute (url, importedText, wholeText) {
5454
function stitchSubstitute (treeNode, wholeText) {
5555
var regex = new RegExp('\\+\<a href\=(\'|\")' + treeNode.url + '.*\<\/a\>', 'g')
5656
var importedText = "<div class='stitch-mark visible' data-url='" + treeNode.url + "'>" +
57-
"<button class='collapser'>+</button>" +
57+
"<button class='collapser has-plus'></button>" +
5858
"<div class='content expanded'>" + treeNode.content + "</div>" +
5959
"<div class='content collapsed hidden'>" + treeNode.label + "</div>" +
6060
"</div>"

0 commit comments

Comments
 (0)