Skip to content

Commit

Permalink
Rebuild, update docs with new MkDocs release (v1.0.4)
Browse files Browse the repository at this point in the history
  • Loading branch information
hfagerlund committed Sep 18, 2018
1 parent d26adf9 commit cdd554c
Show file tree
Hide file tree
Showing 11 changed files with 241 additions and 238 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ theme_dir: 'mkdocs_docskimmer'
| docSkimmer theme version(s) | MkDocs version(s) |
| :------: | :------: |
| 0.3.1 | [Template URL filter addition](https://github.com/mkdocs/mkdocs/tree/decaf6141c90b0123a4b7f03ee839d0780570bc9) |
| 0.3.1 | 1.0.4<br>[Template URL filter addition](https://github.com/mkdocs/mkdocs/tree/decaf6141c90b0123a4b7f03ee839d0780570bc9) |
| 0.3.0 | [Pages refactor](https://github.com/mkdocs/mkdocs/tree/34ef3ca6d0390959080ce93a695361eea1649272) |
| 0.2.1 | 0.17.4<br>0.17.3<br>0.17.2<br>0.17.1<br>0.17.0 |
| 0.2.0 | 0.17.0 |
Expand Down
4 changes: 2 additions & 2 deletions docs/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,9 @@ <h1>404 Page Not Found</h1>


<!--
MkDocs version : 0.17.2
MkDocs version : 1.0.4
docSkimmer theme version: 0.3.1
Build Date UTC : 2018-07-04 06:46:35
Build Date UTC : 2018-09-18 18:45:13
-->
</body>
</html>
4 changes: 2 additions & 2 deletions docs/examples/another-sample-page/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -526,9 +526,9 @@ <h2 class="page-toc__heading">On this Page:</h2>


<!--
MkDocs version : 0.17.2
MkDocs version : 1.0.4
docSkimmer theme version: 0.3.1
Build Date UTC : 2018-07-04 06:46:35
Build Date UTC : 2018-09-18 18:45:13
-->
</body>
</html>
4 changes: 2 additions & 2 deletions docs/examples/sample-page/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -528,9 +528,9 @@ <h2 class="page-toc__heading">On this Page:</h2>


<!--
MkDocs version : 0.17.2
MkDocs version : 1.0.4
docSkimmer theme version: 0.3.1
Build Date UTC : 2018-07-04 06:46:35
Build Date UTC : 2018-09-18 18:45:13
-->
</body>
</html>
8 changes: 4 additions & 4 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ <h2 id="version-compatibility">Version compatibility</h2>
<tbody>
<tr>
<td align="center">0.3.1</td>
<td align="center"><a href="https://github.com/mkdocs/mkdocs/tree/decaf6141c90b0123a4b7f03ee839d0780570bc9">Template URL filter addition</a></td>
<td align="center">1.0.4<br><a href="https://github.com/mkdocs/mkdocs/tree/decaf6141c90b0123a4b7f03ee839d0780570bc9">Template URL filter addition</a></td>
</tr>
<tr>
<td align="center">0.3.0</td>
Expand Down Expand Up @@ -286,9 +286,9 @@ <h2 class="page-toc__heading">On this Page:</h2>


<!--
MkDocs version : 0.17.2
MkDocs version : 1.0.4
docSkimmer theme version: 0.3.1
Build Date UTC : 2018-07-04 06:46:35
Build Date UTC : 2018-09-18 18:45:13
-->
</body>
</html>
</html>
4 changes: 2 additions & 2 deletions docs/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,9 @@ <h1>Search Results</h1>


<!--
MkDocs version : 0.17.2
MkDocs version : 1.0.4
docSkimmer theme version: 0.3.1
Build Date UTC : 2018-07-04 06:46:35
Build Date UTC : 2018-09-18 18:45:13
-->
</body>
</html>
190 changes: 96 additions & 94 deletions docs/search/main.js
Original file line number Diff line number Diff line change
@@ -1,94 +1,96 @@
function getSearchTermFromLocation() {
var sPageURL = window.location.search.substring(1);
var sURLVariables = sPageURL.split('&');
for (var i = 0; i < sURLVariables.length; i++) {
var sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] == 'q') {
return decodeURIComponent(sParameterName[1].replace(/\+/g, '%20'));
}
}
}

function formatResult (location, title, summary) {
return '<article><h3><a href="' + base_url + '/' + location + '">'+ title + '</a></h3><p>' + summary +'</p></article>';
}

function displayResults (results) {
var search_results = document.getElementById("mkdocs-search-results");
while (search_results.firstChild) {
search_results.removeChild(search_results.firstChild);
}
if (results.length > 0){
for (var i=0; i < results.length; i++){
var result = results[i];
var html = formatResult(result.location, result.title, result.summary);
search_results.insertAdjacentHTML('beforeend', html);
}
} else {
search_results.insertAdjacentHTML('beforeend', "<p>No results found</p>");
}
}

function doSearch () {
var query = document.getElementById('mkdocs-search-query').value;
if (query.length > 2) {
console.log('Searching with query: ' + query);
if (!window.Worker) {
displayResults(search(query));
} else {
searchWorker.postMessage({query: query});
}
} else {
// Clear results for short queries
displayResults([]);
}
}

function initSearch () {
var search_input = document.getElementById('mkdocs-search-query');
if (search_input) {
search_input.addEventListener("keyup", doSearch);
}

var term = getSearchTermFromLocation();
if (term) {
search_input.value = term;
doSearch();
}
}

function onWorkerMessage (e) {
if (e.data.results) {
var results = e.data.results;
displayResults(results);
}
}

if (!window.Worker) {
console.log('Web Worker API not supported');
// load index in main thread
$.getScript(base_url + "/search/worker.js").done(function () {
console.log('Loaded worker');
init();
}).fail(function (jqxhr, settings, exception) {
console.error('Could not load worker.js');
});
} else {
// Wrap search in a web worker
var searchWorker = new Worker(base_url + "/search/worker.js");
searchWorker.postMessage({init: true});
searchWorker.onmessage = onWorkerMessage;
}

$(function() {
var search_input = document.getElementById('mkdocs-search-query');
if (search_input) {
search_input.addEventListener("keyup", doSearch);
}

var term = getSearchTermFromLocation();
if (term) {
search_input.value = term;
doSearch();
}
});
function getSearchTermFromLocation() {
var sPageURL = window.location.search.substring(1);
var sURLVariables = sPageURL.split('&');
for (var i = 0; i < sURLVariables.length; i++) {
var sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] == 'q') {
return decodeURIComponent(sParameterName[1].replace(/\+/g, '%20'));
}
}
}

function joinUrl (base, path) {
if (path.substring(0, 1) === "/") {
// path starts with `/`. Thus it is absolute.
return path;
}
if (base.substring(base.length-1) === "/") {
// base ends with `/`
return base + path;
}
return base + "/" + path;
}

function formatResult (location, title, summary) {
return '<article><h3><a href="' + joinUrl(base_url, location) + '">'+ title + '</a></h3><p>' + summary +'</p></article>';
}

function displayResults (results) {
var search_results = document.getElementById("mkdocs-search-results");
while (search_results.firstChild) {
search_results.removeChild(search_results.firstChild);
}
if (results.length > 0){
for (var i=0; i < results.length; i++){
var result = results[i];
var html = formatResult(result.location, result.title, result.summary);
search_results.insertAdjacentHTML('beforeend', html);
}
} else {
search_results.insertAdjacentHTML('beforeend', "<p>No results found</p>");
}
}

function doSearch () {
var query = document.getElementById('mkdocs-search-query').value;
if (query.length > 2) {
if (!window.Worker) {
displayResults(search(query));
} else {
searchWorker.postMessage({query: query});
}
} else {
// Clear results for short queries
displayResults([]);
}
}

function initSearch () {
var search_input = document.getElementById('mkdocs-search-query');
if (search_input) {
search_input.addEventListener("keyup", doSearch);
}
var term = getSearchTermFromLocation();
if (term) {
search_input.value = term;
doSearch();
}
}

function onWorkerMessage (e) {
if (e.data.allowSearch) {
initSearch();
} else if (e.data.results) {
var results = e.data.results;
displayResults(results);
}
}

if (!window.Worker) {
console.log('Web Worker API not supported');
// load index in main thread
$.getScript(joinUrl(base_url, "search/worker.js")).done(function () {
console.log('Loaded worker');
init();
window.postMessage = function (msg) {
onWorkerMessage({data: msg});
};
}).fail(function (jqxhr, settings, exception) {
console.error('Could not load worker.js');
});
} else {
// Wrap search in a web worker
var searchWorker = new Worker(joinUrl(base_url, "search/worker.js"));
searchWorker.postMessage({init: true});
searchWorker.onmessage = onWorkerMessage;
}
2 changes: 1 addition & 1 deletion docs/search/search_index.json

Large diffs are not rendered by default.

Loading

0 comments on commit cdd554c

Please sign in to comment.