Skip to content

Commit 0267871

Browse files
committed
Add anchor links
1 parent 1958753 commit 0267871

File tree

6 files changed

+105
-79
lines changed

6 files changed

+105
-79
lines changed

Gemfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
source 'https://rubygems.org'
22
gem 'github-pages'
3-
gem 'nokogiri', '1.6.7.rc3'
43
gem 'wdm', '>= 0.1.0' if Gem.win_platform?

_layouts/default.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>
3131
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootbox.js/4.3.0/bootbox.min.js"></script>
3232
<script src="{{site.github.url}}/assets/js/docs.min.js"></script>
33+
<script src="{{site.github.url}}/assets/js/script.js"></script>
3334
</head>
3435

3536
<body>

assets/css/style.css

Lines changed: 38 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,59 @@
11
.bs-docs-masthead {
2-
padding-top:50px;
3-
padding-bottom:40px;
4-
margin-bottom:20px;
2+
padding-top: 50px;
3+
padding-bottom: 40px;
4+
margin-bottom: 20px;
55
}
66

77
.bs-docs-header h1, .bs-docs-header p {
8-
margin-right:0px;
8+
margin-right: 0px;
99
}
1010

1111
.bs-docs-sidebar .nav > li > a {
12-
font-size:15px;
12+
font-size: 15px;
1313
}
14+
1415
.bs-docs-sidebar .nav .nav > li > a {
15-
font-size:14px;
16+
font-size: 14px;
1617
}
18+
1719
.back-top-top {
18-
font-size:13px;
20+
font-size: 13px;
1921
}
2022

2123
#content {
22-
position:relative;
24+
position: relative;
2325
}
26+
2427
#content:after {
25-
content:"";
26-
position:absolute;
27-
bottom:0px;
28-
right:0px;
29-
height:50px;
30-
width:30%;
31-
background:linear-gradient(135deg, transparent 50px, white 50px);
28+
content: "";
29+
position: absolute;
30+
bottom: 0px;
31+
right: 0px;
32+
height: 50px;
33+
width: 30%;
34+
min-width: 300px;
35+
background: linear-gradient(135deg, transparent 50px, white 50px);
36+
}
37+
38+
.anchor-link {
39+
opacity: 0;
40+
position: absolute;
41+
margin-left: -1em;
42+
padding-right: 1em;
43+
font-size: 0.8em;
44+
line-height: 1.3em;
45+
color: #999;
46+
transition: opacity 0.1s ease-in-out;
3247
}
3348

34-
a[data-bootbox] {
35-
cursor: pointer;
49+
.anchor-link:hover {
50+
text-decoration: none;
3651
}
3752

38-
h5 {
39-
font-weight: bold;
53+
h1:hover .anchor-link,
54+
h2:hover .anchor-link,
55+
h3:hover .anchor-link,
56+
h4:hover .anchor-link,
57+
h5:hover .anchor-link {
58+
opacity: 1;
4059
}

assets/js/docs.min.js

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,4 @@
11
$(function(){
2-
// build side menu
3-
var html = '';
4-
5-
$('.bs-docs-section').each(function() {
6-
var h1 = $(this).find('h1[id]').first(),
7-
h23 = $(this).find('h2[id], h3[id]');
8-
9-
if (h1.length) {
10-
html+= '<li><a href="#' + h1[0].id +'">'+ h1.clone().children().remove().end().text() +'</a>';
11-
12-
if (h23.length) {
13-
html+= '<ul class="nav">';
14-
h23.each(function() {
15-
html+= '<li><a href="#' + this.id +'">'+ $(this).clone().children().remove().end().text() +'</a></li>';
16-
});
17-
html+= '</ul>';
18-
}
19-
20-
html+= '</li>';
21-
}
22-
});
23-
24-
if (html == '') {
25-
$('[role=complementary]').hide();
26-
$('[role=main]').toggleClass('col-md-9 col-md-12');
27-
}
28-
else {
29-
$('.bs-docs-sidenav').html(html);
30-
}
31-
32-
$('[data-bootbox]').on('click', function() {
33-
var $target = $('#'+$(this).data('bootbox'));
34-
bootbox.alert({
35-
title: $target.attr('title'),
36-
message: $target.html(),
37-
size: $(this).data('bootbox-size')
38-
});
39-
});
40-
412
/*!
423
* JavaScript for Bootstrap's docs (http://getbootstrap.com)
434
* Copyright 2011-2014 Twitter, Inc.
@@ -46,15 +7,3 @@ $(function(){
467
*/
478
!function(a){a(function(){if(navigator.userAgent.match(/IEMobile\/10\.0/)){var b=document.createElement("style");b.appendChild(document.createTextNode("@-ms-viewport{width:auto!important}")),document.querySelector("head").appendChild(b)}{var c=a(window),d=a(document.body);a(".navbar").outerHeight(!0)+10}d.scrollspy({target:".bs-docs-sidebar"}),c.on("load",function(){d.scrollspy("refresh")}),a(".bs-docs-container [href=#]").click(function(a){a.preventDefault()}),setTimeout(function(){var b=a(".bs-docs-sidebar");b.affix({offset:{top:function(){var c=b.offset().top,d=parseInt(b.children(0).css("margin-top"),10),e=a(".bs-docs-nav").height();return this.top=c-e-d},bottom:function(){return this.bottom=a(".bs-docs-footer").outerHeight(!0)}}})},100),setTimeout(function(){a(".bs-top").affix()},100)})}(jQuery);
489
});
49-
50-
function trianglify(color1, color2) {
51-
var header = $('#content'),
52-
t = new Trianglify({
53-
cellsize: 90,
54-
noiseIntensity: 0,
55-
x_gradient: [color1, color2]
56-
}),
57-
pattern = t.generate(window.screen.width | header.outerWidth(), header.outerHeight()*1.2);
58-
59-
header.css('background-image', pattern.dataUrl);
60-
}

assets/js/script.js

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
$(function() {
2+
// build side menu
3+
var html = '';
4+
5+
$('.bs-docs-section').each(function() {
6+
var h1 = $(this).find('h1[id]').first(),
7+
h23 = $(this).find('h2[id], h3[id]:not([data-no-menu])');
8+
9+
if (h1.length) {
10+
html += '<li><a href="#' + h1[0].id + '">' + h1.clone().children().remove().end().text() + '</a>';
11+
12+
if (h23.length) {
13+
html += '<ul class="nav">';
14+
h23.each(function() {
15+
html += '<li><a href="#' + this.id + '">' + $(this).clone().children().remove().end().text() + '</a></li>';
16+
});
17+
html += '</ul>';
18+
}
19+
20+
html += '</li>';
21+
}
22+
});
23+
24+
if (html == '') {
25+
$('[role=complementary]').hide();
26+
$('[role=main]').toggleClass('col-md-9 col-md-12');
27+
}
28+
else {
29+
$('.bs-docs-sidenav').html(html);
30+
}
31+
32+
// add heading anchors
33+
$('h1[id], h2[id], h3[id], h4[id], h5[id]').each(function() {
34+
$(this).prepend('<a href="#' + this.id + '" class="anchor-link">§</i>');
35+
});
36+
37+
// enable bootbox
38+
$('[data-bootbox]').on('click', function() {
39+
var $target = $('#' + $(this).data('bootbox'));
40+
bootbox.alert({
41+
title: $target.attr('title'),
42+
message: $target.html(),
43+
size: $(this).data('bootbox-size')
44+
});
45+
});
46+
});
47+
48+
function trianglify(color1, color2) {
49+
var header = $('#content'),
50+
t = new Trianglify({
51+
cellsize: 90,
52+
noiseIntensity: 0,
53+
x_gradient: [color1, color2]
54+
}),
55+
pattern = t.generate(window.screen.width | header.outerWidth(), header.outerHeight() * 1.2);
56+
57+
header.css('background-image', pattern.dataUrl);
58+
}

index.html

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
isHome: true
66
---
77

8-
<section class="bs-docs-section clearfix">
8+
<section class="bs-docs-section">
99
<h1 id="overview" class="page-header">
1010
Overview
1111
</h1>
@@ -24,7 +24,7 @@ <h1 id="overview" class="page-header">
2424
</ul>
2525
</section>
2626

27-
<section>
27+
<section class="clearfix">
2828
<b>But let's look at a live example !</b>
2929

3030
<div class="col-md-12 col-lg-10 col-lg-offset-1">
@@ -677,15 +677,15 @@ <h4>Plugins methods</h4>
677677
</div>
678678

679679
<div class="bs-callout">
680-
<h4><code>.validate()</code></h4>
680+
<h4 id="method-validate"><code>.validate()</code></h4>
681681

682682
<p>Returns a boolean indicating whether the builder is valid or not. Use the <code>validationError</code> event to
683683
catch
684684
per-rule validation errors. If <code>display_errors</code> is enabled the invalid rules will turn red.</p>
685685
</div>
686686

687687
<div class="bs-callout">
688-
<h4><code>.getRules([options])</code></h4>
688+
<h4 id="method-getRules"><code>.getRules([options])</code></h4>
689689

690690
<p>Performs validation and returns the rules as a plain JSON object. See the <a
691691
href="{{site.github.url}}/demo.html">demo</a> for output example. The method takes an optional object of options.
@@ -739,7 +739,7 @@ <h4>Other formats</h4>
739739
</div>
740740

741741
<div class="bs-callout">
742-
<h4><code>.setRules(rules [, options])</code></h4>
742+
<h4 id="method-setRules"><code>.setRules(rules [, options])</code></h4>
743743

744744
<p>Clears the builder and sets new rules. The parameters must have the same structure as the output of <code>getRules</code>.
745745
<a data-bootbox="rules_format"> <i class="glyphicon glyphicon-info-sign"></i> See an example</a></p>
@@ -972,7 +972,7 @@ <h5>Flags</h5>
972972
</div>
973973

974974
<div class="bs-callout">
975-
<h4><code>.getModel([element])</code></h4>
975+
<h4 id="method-getModel"><code>.getModel([element])</code></h4>
976976

977977
<p>Given a group or rule DOM element, returns the associated <b>Group</b> or <b>Rule</b> object. Useful to perform
978978
manual operations on the builder (see <a href="#inside_the_box">Inside the box</a>). Without parameters it returns
@@ -987,7 +987,7 @@ <h4><code>.getModel([element])</code></h4>
987987
</div>
988988

989989
<div class="bs-callout">
990-
<h4><code>.reset()</code></h4>
990+
<h4 id="method-reset"><code>.reset()</code></h4>
991991

992992
<p>Removes all rules.</p>
993993
<!-- @formatter:off -->
@@ -998,7 +998,7 @@ <h4><code>.reset()</code></h4>
998998
</div>
999999

10001000
<div class="bs-callout">
1001-
<h4><code>.destroy()</code></h4>
1001+
<h4 id="method-destroy"><code>.destroy()</code></h4>
10021002

10031003
<p>Completely destroy the builder and it's data.</p>
10041004
<!-- @formatter:off -->

0 commit comments

Comments
 (0)