diff --git a/config/jsdoc/api/template/static/scripts/main.js b/config/jsdoc/api/template/static/scripts/main.js index 5d682626db..827c9c11b0 100644 --- a/config/jsdoc/api/template/static/scripts/main.js +++ b/config/jsdoc/api/template/static/scripts/main.js @@ -36,7 +36,7 @@ $(function () { } // If everything else is equal, prefer shorter names, and prefer classes over modules let weight = 10000 + matchedItem.dataset.longname.length - name.length * 100; - if (name.match(re.begin)) { + if (re.begin.test(name)) { weight += 10000; if (re.baseName.test(name)) { weight += 10000; @@ -79,6 +79,7 @@ $(function () { $currentItem: currentItem ? $(currentItem) : undefined, lastSearchTerm: undefined, lastState: {}, + lastClasses: undefined, getClassList: function () { return $classItems || ($classItems = $navList.find('li.item')); }, @@ -143,9 +144,9 @@ $(function () { if (state === 'search-empty' && search.$currentItem) { search.manualToggle(search.$currentItem, true); } + search.lastClasses = undefined; } else { search.changeStateClass('searching'); - searchTerm = searchTerm.toLowerCase(); const beginOnly = searchTerm.length < minInputForFullText; const getSearchWeight = getWeightFunction(searchTerm, allowRegex); const re = constructRegex(searchTerm, function (searchTerm) { @@ -197,13 +198,14 @@ $(function () { li.classList.add('match'); } }); + classes.sort(function (a, b) { + return b.weight - a.weight; + }); clearOldMatches(search.lastState, searchState); search.lastState = searchState; + search.lastClasses = classes; - classes.sort(function (a, b) { - return a.weight - b.weight; - }); - for (let i = classes.length - 1; i >= 0; --i) { + for (let i = 0, ii = classes.length; i < ii; ++i) { navList.appendChild(classes[i].item); } } @@ -217,15 +219,24 @@ $(function () { key = setTimeout(function () { key = undefined; - const searchTerm = searchInput.value; - doSearch(searchTerm); + doSearch(searchInput.value); }, 0); } } // Search Items searchInput.addEventListener('input', queueSearch); + searchInput.addEventListener('keydown', function(e) { + if (e.key === 'Enter') { + doSearch(searchInput.value); + const first = search.lastClasses ? search.lastClasses[0].item : null; + if (first) { + window.location.href = first.querySelector('.title a').href; + } + } + }); doSearch(searchInput.value); + searchInput.focus(); // Toggle when click an item element search.$navList.on('click', '.toggle', function (e) { @@ -237,10 +248,8 @@ $(function () { search.manualToggle(clsItem, show); }); - - var currentVersion = document.getElementById('package-version').innerHTML; - // warn about outdated version + var currentVersion = document.getElementById('package-version').innerHTML; var packageUrl = 'https://raw.githubusercontent.com/openlayers/openlayers.github.io/build/package.json'; fetch(packageUrl).then(function(response) { return response.json(); @@ -265,15 +274,4 @@ $(function () { } } }); - - // create source code links to github - var srcLinks = $('div.tag-source'); - srcLinks.each(function(i, el) { - var textParts = el.innerHTML.trim().split(', '); - var link = 'https://github.com/openlayers/openlayers/blob/v' + currentVersion + '/src/ol/' + - textParts[0]; - el.innerHTML = '' + textParts[0] + ', ' + - '' + - textParts[1] + ''; - }); }); diff --git a/config/jsdoc/api/template/static/styles/jaguar.css b/config/jsdoc/api/template/static/styles/jaguar.css index 13494f2af0..247bdeba04 100644 --- a/config/jsdoc/api/template/static/styles/jaguar.css +++ b/config/jsdoc/api/template/static/styles/jaguar.css @@ -335,8 +335,8 @@ span.type-signature.static { } .main .nameContainer { position: relative; - margin-top: 20px; - padding-top: 5px; + margin-top: 1.2rem; + padding-top: 1.2rem; border-top: 2px solid #1F6B75; } .main .nameContainer .inherited { @@ -354,7 +354,7 @@ span.type-signature.static { @media (min-width: 768px) { .main .nameContainer .tag-source { position: absolute; - top: 0.2rem; + top: 1.2rem; right: 0; font-size: 0.8rem; } diff --git a/config/jsdoc/api/template/tmpl/container.tmpl b/config/jsdoc/api/template/tmpl/container.tmpl index f9d86d6757..c69663bed9 100644 --- a/config/jsdoc/api/template/tmpl/container.tmpl +++ b/config/jsdoc/api/template/tmpl/container.tmpl @@ -54,11 +54,15 @@
- +
+ +
- +
+ +
diff --git a/config/jsdoc/api/template/tmpl/layout.tmpl b/config/jsdoc/api/template/tmpl/layout.tmpl index 2cd151aede..ee2de77e8f 100644 --- a/config/jsdoc/api/template/tmpl/layout.tmpl +++ b/config/jsdoc/api/template/tmpl/layout.tmpl @@ -4,6 +4,7 @@ var version = obj.packageInfo.version; + - OpenLayers v<?js= version ?> API - <?js= title ?> diff --git a/config/jsdoc/api/template/tmpl/method.tmpl b/config/jsdoc/api/template/tmpl/method.tmpl index 9ff68aa638..509d6e0057 100644 --- a/config/jsdoc/api/template/tmpl/method.tmpl +++ b/config/jsdoc/api/template/tmpl/method.tmpl @@ -1,10 +1,16 @@
+
-

@@ -16,11 +22,12 @@ var self = this;

- , + , + line
-
+