Add AnchorJS logic for header links (#10155)
* Add AnchorJS JavaScript * Remove existing inpage_heading logic * Remove underline from anchor tags * Use single icon and add touch visibility * Use paragraph link icon for AnchorJS * Update Sass to use code formatting in docsContent headers * Update header size coverage to H3-H6
This commit is contained in:
committed by
k8s-ci-robot
parent
c038d8909c
commit
9ce0cd0906
@@ -800,8 +800,6 @@ dd
|
|||||||
&:after
|
&:after
|
||||||
transform: rotate(-45deg)
|
transform: rotate(-45deg)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#docsContent
|
#docsContent
|
||||||
position: relative
|
position: relative
|
||||||
float: right
|
float: right
|
||||||
@@ -895,7 +893,6 @@ dd
|
|||||||
overflow-x: auto
|
overflow-x: auto
|
||||||
|
|
||||||
h1 code, h2 code, h3 code, h4 code, h5 code, h6 code
|
h1 code, h2 code, h3 code, h4 code, h5 code, h6 code
|
||||||
font-family: inherit
|
|
||||||
font-size: inherit
|
font-size: inherit
|
||||||
background-color: transparent
|
background-color: transparent
|
||||||
|
|
||||||
@@ -999,10 +996,6 @@ dd
|
|||||||
img
|
img
|
||||||
max-width: 100%
|
max-width: 100%
|
||||||
|
|
||||||
a
|
|
||||||
//font-weight: 700
|
|
||||||
text-decoration: underline
|
|
||||||
|
|
||||||
#TableOfContents > ul > li { list-style: none; }
|
#TableOfContents > ul > li { list-style: none; }
|
||||||
#TableOfContents
|
#TableOfContents
|
||||||
ul, li
|
ul, li
|
||||||
|
|||||||
@@ -48,22 +48,5 @@
|
|||||||
</div>
|
</div>
|
||||||
{{ partialCached "footer.html" . }}
|
{{ partialCached "footer.html" . }}
|
||||||
{{ partialCached "footer-scripts.html" . }}
|
{{ partialCached "footer-scripts.html" . }}
|
||||||
<script>
|
|
||||||
// This script turns in-page headers into clickable and shareable
|
|
||||||
(function addHeadingLinks(){
|
|
||||||
var article = document.getElementById('docsContent');
|
|
||||||
var headings = article.querySelectorAll('h1, h2, h3, h4, h5, h6');
|
|
||||||
headings.forEach(function(heading){
|
|
||||||
if(heading.id){
|
|
||||||
var a = document.createElement('a');
|
|
||||||
a.innerHTML = heading.innerHTML;
|
|
||||||
a.href = '#'+heading.id;
|
|
||||||
a.classList.add('inpage_heading');
|
|
||||||
heading.innerHTML = '';
|
|
||||||
heading.appendChild(a);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
})();
|
|
||||||
</script>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
<meta property="og:image" content="{{ index . 0 | replaceRE ".*src=\"(.+?)\".*" "$1" }}" />
|
<meta property="og:image" content="{{ index . 0 | replaceRE ".*src=\"(.+?)\".*" "$1" }}" />
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
<script src="{{ "js/anchor-4.1.1.min.js" | relURL }}"></script>
|
||||||
<script src="{{ "js/jquery-3.2.1.min.js" | relURL }}"></script>
|
<script src="{{ "js/jquery-3.2.1.min.js" | relURL }}"></script>
|
||||||
<script src="{{ "js/jquery-ui-1.12.1.min.js" | relURL }}"></script>
|
<script src="{{ "js/jquery-ui-1.12.1.min.js" | relURL }}"></script>
|
||||||
<script src="{{ "js/bootstrap-3.3.7.min.js" | relURL }}"></script>
|
<script src="{{ "js/bootstrap-3.3.7.min.js" | relURL }}"></script>
|
||||||
|
|||||||
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
@@ -1 +1 @@
|
|||||||
{"Target":"css/styles.min.55d1e72cc5418eace24df1a4450abe45a6ee9111f9814269bc6540e8c49d2399.css","MediaType":"text/css","Data":{"Integrity":"sha256-VdHnLMVBjqziTfGkRQq+RabukRH5gUJpvGVA6MSdI5k="}}
|
{"Target":"css/styles.min.ece7e7b8765fe37209670b4fdb98dc7c18c77ce66f423368a943e602cf2ab436.css","MediaType":"text/css","Data":{"Integrity":"sha256-7OfnuHZf43IJZwtP25jcfBjHfOZvQjNoqUPmAs8qtDY="}}
|
||||||
-1937
File diff suppressed because it is too large
Load Diff
@@ -1 +0,0 @@
|
|||||||
{"Target":"css/styles.css","MediaType":"text/css","Data":{}}
|
|
||||||
+1
-1
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
|||||||
{"Target":"css/styles.min.995606e495d8e0e2b5bf4b5293e26c01bac4635d30a956f7da45de66c66f6619.css","MediaType":"text/css","Data":{"Integrity":"sha256-mVYG5JXY4OK1v0tSk+JsAbrEY10wqVb32kXeZsZvZhk="}}
|
{"Target":"css/styles.min.36e2d5e7b70bfce1c48918362c1c1fc87ea3c820c5a8e9985d1f9b09c0bf737a.css","MediaType":"text/css","Data":{"Integrity":"sha256-NuLV57cL/OHEiRg2LBwfyH6jyCDFqOmYXR+bCcC/c3o="}}
|
||||||
@@ -55,13 +55,3 @@
|
|||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* In-page section heading permalinks */
|
|
||||||
a.inpage_heading {
|
|
||||||
color: #000;
|
|
||||||
text-decoration: none !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
a.inpage_heading:hover {
|
|
||||||
text-decoration: underline !important;
|
|
||||||
opacity: .8;
|
|
||||||
}
|
|
||||||
|
|||||||
Vendored
+6
File diff suppressed because one or more lines are too long
+11
-1
@@ -1,4 +1,12 @@
|
|||||||
//modal close button
|
function addAnchorTags() {
|
||||||
|
anchors.options = {
|
||||||
|
visible: 'touch'
|
||||||
|
}
|
||||||
|
|
||||||
|
anchors.add('#docsContent h2, #docsContent h3, #docsContent h4, #docsContent h5, #docsContent h6');
|
||||||
|
}
|
||||||
|
|
||||||
|
//modal close button
|
||||||
(function(){
|
(function(){
|
||||||
//π.modalCloseButton = function(closingFunction){
|
//π.modalCloseButton = function(closingFunction){
|
||||||
// return π.button('pi-modal-close-button', null, null, closingFunction);
|
// return π.button('pi-modal-close-button', null, null, closingFunction);
|
||||||
@@ -506,6 +514,8 @@ var pushmenu = (function(){
|
|||||||
})();
|
})();
|
||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
|
addAnchorTags();
|
||||||
|
|
||||||
|
|
||||||
// Make global nav be active based on pathname
|
// Make global nav be active based on pathname
|
||||||
if ((location.pathname.split("/")[1]) !== ""){
|
if ((location.pathname.split("/")[1]) !== ""){
|
||||||
|
|||||||
Reference in New Issue
Block a user