Fix links and navigation
This commit is contained in:
@@ -30,7 +30,11 @@ $(function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Show an item related a current documentation automatically
|
// Show an item related a current documentation automatically
|
||||||
var filename = $('.page-title').data('filename').replace(/\.[a-z]+$/, '');
|
var filename = $('.page-title').data('filename')
|
||||||
|
.replace(/\.[a-z]+$/, '')
|
||||||
|
.replace('module-', 'module:')
|
||||||
|
.replace(/_/g, '/')
|
||||||
|
.replace(/-/g, '~');
|
||||||
var $currentItem = $('.navigation .item[data-name*="' + filename + '"]:eq(0)');
|
var $currentItem = $('.navigation .item[data-name*="' + filename + '"]:eq(0)');
|
||||||
|
|
||||||
if ($currentItem.length) {
|
if ($currentItem.length) {
|
||||||
@@ -97,7 +101,8 @@ $(function () {
|
|||||||
var anchors = $('.anchor');
|
var anchors = $('.anchor');
|
||||||
var _onHashChange = function () {
|
var _onHashChange = function () {
|
||||||
var activeHash = window.document.location.hash
|
var activeHash = window.document.location.hash
|
||||||
.replace(/\./g, '\\.'); // Escape dot in element id
|
.replace(/\./g, '\\.') // Escape dot in element id
|
||||||
|
.replace(/\~/g, '\\~'); // Escape tilde in element id
|
||||||
|
|
||||||
anchors.removeClass('highlighted');
|
anchors.removeClass('highlighted');
|
||||||
|
|
||||||
@@ -108,4 +113,9 @@ $(function () {
|
|||||||
|
|
||||||
$(window).on('hashchange', _onHashChange);
|
$(window).on('hashchange', _onHashChange);
|
||||||
_onHashChange();
|
_onHashChange();
|
||||||
|
|
||||||
|
// Make links that JSDoc forgot clickable
|
||||||
|
$('p').each(function(i, p) {
|
||||||
|
p.innerHTML = anchorme(p.innerHTML);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ var version = obj.packageInfo.version;
|
|||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>OpenLayers v<?js= version ?> API - <?js= title ?></title>
|
<title>OpenLayers v<?js= version ?> API - <?js= title ?></title>
|
||||||
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=fetch"></script>
|
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=fetch"></script>
|
||||||
|
<script src="https://cdn.jsdelivr.net/gh/alexcorvi/anchorme.js@f9933f299279974caf7df4733d8fb58f8acd492e/dist-browser/anchorme.min.js"></script>
|
||||||
<script src="scripts/prettify/prettify.js"> </script>
|
<script src="scripts/prettify/prettify.js"> </script>
|
||||||
<script src="scripts/prettify/lang-css.js"> </script>
|
<script src="scripts/prettify/lang-css.js"> </script>
|
||||||
<script src="scripts/jquery.min.js"> </script>
|
<script src="scripts/jquery.min.js"> </script>
|
||||||
|
|||||||
Reference in New Issue
Block a user