In-page TOC, adds jquery.min

pull/43/head
John Mulhausen 2016-02-10 12:51:29 -08:00
parent bb3d985a24
commit b8f0ef04dd
14 changed files with 121 additions and 9 deletions

1
_includes/pagetoc.html Normal file
View File

@ -0,0 +1 @@
<div id="pageTOC" style="padding-top:15px; font-weight: bold; width: auto;"></div>

View File

@ -6,6 +6,8 @@
<link href='https://fonts.googleapis.com/css?family=Roboto:400,100,100italic,300,300italic,400italic,500,500italic,700,700italic,900,900italic' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="/css/styles.css"/>
<script src="/js/script.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<script src="/js/non-mini.js"></script>
<title>Kubernetes - {{ page.title }}</title>
</head>
<body>

File diff suppressed because one or more lines are too long

View File

@ -6,6 +6,8 @@
<link href='https://fonts.googleapis.com/css?family=Roboto:400,100,100italic,300,300italic,400italic,500,500italic,700,700italic,900,900italic' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="/css/styles.css"/>
<script src="/js/script.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<script src="/js/non-mini.js"></script>
<title>Kubernetes - Index test</title>
</head>
<body>
@ -69,12 +71,12 @@
<li><a href="//samples">SAMPLES</a></li>
<li><a href="//support">SUPPORT</a></li>
</ul>
<input type="text" id="search" placeholder="Search the docs">
<div class="dropdown">
<div class="readout"></div>
<a href="/v1.1">Version 1.1</a>
<a href="/v1.0">Version 1.0</a>
</div>
<input type="text" id="search" placeholder="Search the docs">
</div>
</section>

46
_site/js/non-mini.js Normal file
View File

@ -0,0 +1,46 @@
// credit to: http://jsfiddle.net/s8m2t/8/
var buildRec;
buildRec = function(headingNodes, $elm, lv) {
var cnt, curLv, li, node;
node = headingNodes.splice(0, 1);
if (node && node.length > 0) {
curLv = parseInt(node[0].tagName.substring(1));
if (curLv === lv) {
cnt = 0;
} else if (curLv < lv) {
cnt = 0;
while (true) {
$elm = $elm.parent().parent();
cnt--;
if (!(cnt > (curLv - lv))) {
break;
}
}
} else if (curLv > lv) {
cnt = 0;
while (true) {
li = $elm.children().last();
if (!($elm.children().last().length > 0)) {
$elm.append($("<li>"));
li = $elm.children().last();
}
li.append($('<ul style="list-style-type: none;">'));
$elm = li.children().last();
cnt++;
if (!(cnt < (curLv - lv))) {
break;
}
}
}
$elm.append($("<li>"));
li = $elm.children().last();
li.html("<a href=#" + node[0].id + ">" + node[0].innerHTML + "</a>");
return buildRec(headingNodes, $elm, lv + cnt);
}
};
$(document).ready(function(){
var headingNodes = $('#docsContent').children().filter(":header");
var result = $('<ul style="list-style-type: none; padding-left:0px;">');
buildRec(headingNodes,result,1);
$("#pageTOC").append(result);
});

File diff suppressed because one or more lines are too long

View File

@ -6,6 +6,8 @@
<link href='https://fonts.googleapis.com/css?family=Roboto:400,100,100italic,300,300italic,400italic,500,500italic,700,700italic,900,900italic' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="/css/styles.css"/>
<script src="/js/script.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<script src="/js/non-mini.js"></script>
<title>Kubernetes - Doc test</title>
</head>
<body>
@ -69,12 +71,12 @@
<li><a href="/v1.1/samples">SAMPLES</a></li>
<li><a href="/v1.1/support">SUPPORT</a></li>
</ul>
<input type="text" id="search" placeholder="Search the docs">
<div class="dropdown">
<div class="readout"></div>
<a href="/v1.1">Version 1.1</a>
<a href="/v1.0">Version 1.0</a>
</div>
<input type="text" id="search" placeholder="Search the docs">
</div>
</section>

View File

@ -6,6 +6,8 @@
<link href='https://fonts.googleapis.com/css?family=Roboto:400,100,100italic,300,300italic,400italic,500,500italic,700,700italic,900,900italic' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="/css/styles.css"/>
<script src="/js/script.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<script src="/js/non-mini.js"></script>
<title>Kubernetes - Doc test</title>
</head>
<body>
@ -69,12 +71,12 @@
<li><a href="/v1.1/samples">SAMPLES</a></li>
<li><a href="/v1.1/support">SUPPORT</a></li>
</ul>
<input type="text" id="search" placeholder="Search the docs">
<div class="dropdown">
<div class="readout"></div>
<a href="/v1.1">Version 1.1</a>
<a href="/v1.0">Version 1.0</a>
</div>
<input type="text" id="search" placeholder="Search the docs">
</div>
</section>

View File

@ -6,6 +6,8 @@
<link href='https://fonts.googleapis.com/css?family=Roboto:400,100,100italic,300,300italic,400italic,500,500italic,700,700italic,900,900italic' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="/css/styles.css"/>
<script src="/js/script.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<script src="/js/non-mini.js"></script>
<title>Kubernetes - kubectl for docker users</title>
</head>
<body>
@ -69,12 +71,12 @@
<li><a href="/v1.1/samples">SAMPLES</a></li>
<li><a href="/v1.1/support">SUPPORT</a></li>
</ul>
<input type="text" id="search" placeholder="Search the docs">
<div class="dropdown">
<div class="readout"></div>
<a href="/v1.1">Version 1.1</a>
<a href="/v1.0">Version 1.0</a>
</div>
<input type="text" id="search" placeholder="Search the docs">
</div>
</section>
@ -158,6 +160,8 @@
<p><strong>Table of Contents</strong></p>
<div id="pageTOC" style="padding-top:15px; font-weight: bold; width: auto;"></div>
<h4 id="docker-run">docker run</h4>
<p>How do I run an nginx container and expose it to the world? Checkout <a href="kubectl/kubectl_run.html">kubectl run</a>.</p>

View File

@ -6,6 +6,8 @@
<link href='https://fonts.googleapis.com/css?family=Roboto:400,100,100italic,300,300italic,400italic,500,500italic,700,700italic,900,900italic' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="/css/styles.css"/>
<script src="/js/script.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<script src="/js/non-mini.js"></script>
<title>Kubernetes - Doc test</title>
</head>
<body>
@ -69,12 +71,12 @@
<li><a href="/v1.1/samples">SAMPLES</a></li>
<li><a href="/v1.1/support">SUPPORT</a></li>
</ul>
<input type="text" id="search" placeholder="Search the docs">
<div class="dropdown">
<div class="readout"></div>
<a href="/v1.1">Version 1.1</a>
<a href="/v1.0">Version 1.0</a>
</div>
<input type="text" id="search" placeholder="Search the docs">
</div>
</section>

View File

@ -6,6 +6,8 @@
<link href='https://fonts.googleapis.com/css?family=Roboto:400,100,100italic,300,300italic,400italic,500,500italic,700,700italic,900,900italic' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="/css/styles.css"/>
<script src="/js/script.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<script src="/js/non-mini.js"></script>
<title>Kubernetes - Doc test</title>
</head>
<body>
@ -69,12 +71,12 @@
<li><a href="/v1.1/samples">SAMPLES</a></li>
<li><a href="/v1.1/support">SUPPORT</a></li>
</ul>
<input type="text" id="search" placeholder="Search the docs">
<div class="dropdown">
<div class="readout"></div>
<a href="/v1.1">Version 1.1</a>
<a href="/v1.0">Version 1.0</a>
</div>
<input type="text" id="search" placeholder="Search the docs">
</div>
</section>

View File

@ -6,6 +6,8 @@
<link href='https://fonts.googleapis.com/css?family=Roboto:400,100,100italic,300,300italic,400italic,500,500italic,700,700italic,900,900italic' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="/css/styles.css"/>
<script src="/js/script.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<script src="/js/non-mini.js"></script>
<title>Kubernetes - Doc test</title>
</head>
<body>
@ -69,12 +71,12 @@
<li><a href="/v1.1/samples">SAMPLES</a></li>
<li><a href="/v1.1/support">SUPPORT</a></li>
</ul>
<input type="text" id="search" placeholder="Search the docs">
<div class="dropdown">
<div class="readout"></div>
<a href="/v1.1">Version 1.1</a>
<a href="/v1.0">Version 1.0</a>
</div>
<input type="text" id="search" placeholder="Search the docs">
</div>
</section>

46
js/non-mini.js Normal file
View File

@ -0,0 +1,46 @@
// credit to: http://jsfiddle.net/s8m2t/8/
var buildRec;
buildRec = function(headingNodes, $elm, lv) {
var cnt, curLv, li, node;
node = headingNodes.splice(0, 1);
if (node && node.length > 0) {
curLv = parseInt(node[0].tagName.substring(1));
if (curLv === lv) {
cnt = 0;
} else if (curLv < lv) {
cnt = 0;
while (true) {
$elm = $elm.parent().parent();
cnt--;
if (!(cnt > (curLv - lv))) {
break;
}
}
} else if (curLv > lv) {
cnt = 0;
while (true) {
li = $elm.children().last();
if (!($elm.children().last().length > 0)) {
$elm.append($("<li>"));
li = $elm.children().last();
}
li.append($('<ul style="list-style-type: none;">'));
$elm = li.children().last();
cnt++;
if (!(cnt < (curLv - lv))) {
break;
}
}
}
$elm.append($("<li>"));
li = $elm.children().last();
li.html("<a href=#" + node[0].id + ">" + node[0].innerHTML + "</a>");
return buildRec(headingNodes, $elm, lv + cnt);
}
};
$(document).ready(function(){
var headingNodes = $('#docsContent').children().filter(":header");
var result = $('<ul style="list-style-type: none; padding-left:0px;">');
buildRec(headingNodes,result,1);
$("#pageTOC").append(result);
});

View File

@ -6,6 +6,7 @@ In this doc, we introduce the Kubernetes command line for interacting with the a
**Table of Contents**
{% include pagetoc.html %}
#### docker run