Initial commit
This commit is contained in:
commit
121d03b3d9
30 files changed
+7368
No files matched your search
+2986
File diff suppressed because it is too large.
Load diff
@@ -0,0 +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 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;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"config":{"lang":["en"],"prebuild_index":false,"separator":"[\\s\\-]+"},"docs":[{"location":"","text":"Welcome to MkDocs For full documentation visit mkdocs.org . Commands mkdocs new [dir-name] - Create a new project. mkdocs serve - Start the live-reloading docs server. mkdocs build - Build the documentation site. mkdocs help - Print this help message. Project layout mkdocs.yml # The configuration file. docs/ index.md # The documentation homepage. ... # Other markdown pages, images and other files.","title":"Home"},{"location":"#welcome-to-mkdocs","text":"For full documentation visit mkdocs.org .","title":"Welcome to MkDocs"},{"location":"#commands","text":"mkdocs new [dir-name] - Create a new project. mkdocs serve - Start the live-reloading docs server. mkdocs build - Build the documentation site. mkdocs help - Print this help message.","title":"Commands"},{"location":"#project-layout","text":"mkdocs.yml # The configuration file. docs/ index.md # The documentation homepage. ... # Other markdown pages, images and other files.","title":"Project layout"},{"location":"about/","text":"Agit dum sed ille exululat cruorem atque Aequus tanto coercuerat Cephisos de agmine scopulos Lorem markdownum fossa inanes factura? Aequore Eurydicen que vastius egit. Terrebit umbras in ignotas sub animi dum rursus effigiem enim vices niveis ponunt totiens colorem, opus solvi. Metus sub regna nec; sic laeva hic saetigerosque vidi. Nec nec amara Numicius simulasse retro placebant Sabinis dumque refovet. Et putando. Advehar sua patre Agaue, praeferrer matres. Igne rectum: natis quiescet in illic rogantem, eiectas maneas, nate signum gloria, magna. Obvia in tantum intumuit Edita Aenea alligat sopor pollicibusque dolor cogitur, arce illa repetam inpetus capienda amnem proceresque Latonia ianua simulavit ! Pectusque iam parva ne tanti perstat et iras deum exercet. Posceret succidit habeo partem Troia, non non committere heros induitur. Soror dixerat instruis aufer, ter enim: solis esse praepes abstitimus flammam nequiret orbes. Locus nec Pudetque natos pisces Iovis ,; recepit Anaxareten Echecli est evanuit ab. Capellae sed idem caelitibus, aut cavae quem rerum extemplo dedit. Horrida vae avis potest dempsisse vitibus requirere mensam, flectit. Mihi bene : carerent inposito, mota! site_ascii.ipod(macro_wireless_torrent - meta(5, faqNetworkOasis), class( archiveAddress(tebibyte_ddr_webcam), prebinding, maximize_data + hacker), heap_fat + oasis_rpm(remote)); web_parse_xp.excelSystem -= fifoHyperOperating(inputVlb, sli) - ospf * virus(frameLeopardBackside); if (baudMasterCgi) { cursorLamp = managementToken(threading, resolution); parse -= xmp; teraflops(linux, toolbarLteAta(bookmark_type_markup, dimm_contextual)); } memory(sprite(-5 + 74)); Semper ne armarat ecce caput Litore agmine, genuisse isto; est morus ferro nomen; membra, recurvas ? Et modo gratam adsiduis raptos curvarique est, axem dextra malas pruinosas expulit. Manu sparsumque colebat quare te amor iussa aquaticus huius, quartus nec: quid. Dumque sit reperta, et sint et est cras verba labori his modo fonti nemus Medea; anne tibi Terram. Structis nobis mihi mihi mutataeque eiaculatur Minyis. Est quod erat: Apis est est partes vagitus nec pondere quas agitante! Facibus exspectatoque; ad in utque ipso arguit?","title":"About"},{"location":"about/#agit-dum-sed-ille-exululat-cruorem-atque","text":"","title":"Agit dum sed ille exululat cruorem atque"},{"location":"about/#aequus-tanto-coercuerat-cephisos-de-agmine-scopulos","text":"Lorem markdownum fossa inanes factura? Aequore Eurydicen que vastius egit. Terrebit umbras in ignotas sub animi dum rursus effigiem enim vices niveis ponunt totiens colorem, opus solvi. Metus sub regna nec; sic laeva hic saetigerosque vidi. Nec nec amara Numicius simulasse retro placebant Sabinis dumque refovet. Et putando. Advehar sua patre Agaue, praeferrer matres. Igne rectum: natis quiescet in illic rogantem, eiectas maneas, nate signum gloria, magna.","title":"Aequus tanto coercuerat Cephisos de agmine scopulos"},{"location":"about/#obvia-in-tantum-intumuit","text":"Edita Aenea alligat sopor pollicibusque dolor cogitur, arce illa repetam inpetus capienda amnem proceresque Latonia ianua simulavit ! Pectusque iam parva ne tanti perstat et iras deum exercet. Posceret succidit habeo partem Troia, non non committere heros induitur. Soror dixerat instruis aufer, ter enim: solis esse praepes abstitimus flammam nequiret orbes.","title":"Obvia in tantum intumuit"},{"location":"about/#locus-nec","text":"Pudetque natos pisces Iovis ,; recepit Anaxareten Echecli est evanuit ab. Capellae sed idem caelitibus, aut cavae quem rerum extemplo dedit. Horrida vae avis potest dempsisse vitibus requirere mensam, flectit. Mihi bene : carerent inposito, mota! site_ascii.ipod(macro_wireless_torrent - meta(5, faqNetworkOasis), class( archiveAddress(tebibyte_ddr_webcam), prebinding, maximize_data + hacker), heap_fat + oasis_rpm(remote)); web_parse_xp.excelSystem -= fifoHyperOpLine truncated
|
||||
@@ -0,0 +1,128 @@
|
||||
var base_path = 'function' === typeof importScripts ? '.' : '/search/';
|
||||
var allowSearch = false;
|
||||
var index;
|
||||
var documents = {};
|
||||
var lang = ['en'];
|
||||
var data;
|
||||
|
||||
function getScript(script, callback) {
|
||||
console.log('Loading script: ' + script);
|
||||
$.getScript(base_path + script).done(function () {
|
||||
callback();
|
||||
}).fail(function (jqxhr, settings, exception) {
|
||||
console.log('Error: ' + exception);
|
||||
});
|
||||
}
|
||||
|
||||
function getScriptsInOrder(scripts, callback) {
|
||||
if (scripts.length === 0) {
|
||||
callback();
|
||||
return;
|
||||
}
|
||||
getScript(scripts[0], function() {
|
||||
getScriptsInOrder(scripts.slice(1), callback);
|
||||
});
|
||||
}
|
||||
|
||||
function loadScripts(urls, callback) {
|
||||
if( 'function' === typeof importScripts ) {
|
||||
importScripts.apply(null, urls);
|
||||
callback();
|
||||
} else {
|
||||
getScriptsInOrder(urls, callback);
|
||||
}
|
||||
}
|
||||
|
||||
function onJSONLoaded () {
|
||||
data = JSON.parse(this.responseText);
|
||||
var scriptsToLoad = ['lunr.js'];
|
||||
if (data.config && data.config.lang && data.config.lang.length) {
|
||||
lang = data.config.lang;
|
||||
}
|
||||
if (lang.length > 1 || lang[0] !== "en") {
|
||||
scriptsToLoad.push('lunr.stemmer.support.js');
|
||||
if (lang.length > 1) {
|
||||
scriptsToLoad.push('lunr.multi.js');
|
||||
}
|
||||
for (var i=0; i < lang.length; i++) {
|
||||
if (lang[i] != 'en') {
|
||||
scriptsToLoad.push(['lunr', lang[i], 'js'].join('.'));
|
||||
}
|
||||
}
|
||||
}
|
||||
loadScripts(scriptsToLoad, onScriptsLoaded);
|
||||
}
|
||||
|
||||
function onScriptsLoaded () {
|
||||
console.log('All search scripts loaded, building Lunr index...');
|
||||
if (data.config && data.config.separator && data.config.separator.length) {
|
||||
lunr.tokenizer.separator = new RegExp(data.config.separator);
|
||||
}
|
||||
if (data.index) {
|
||||
index = lunr.Index.load(data.index);
|
||||
data.docs.forEach(function (doc) {
|
||||
documents[doc.location] = doc;
|
||||
});
|
||||
console.log('Lunr pre-built index loaded, search ready');
|
||||
} else {
|
||||
index = lunr(function () {
|
||||
if (lang.length === 1 && lang[0] !== "en" && lunr[lang[0]]) {
|
||||
this.use(lunr[lang[0]]);
|
||||
} else if (lang.length > 1) {
|
||||
this.use(lunr.multiLanguage.apply(null, lang)); // spread operator not supported in all browsers: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_operator#Browser_compatibility
|
||||
}
|
||||
this.field('title');
|
||||
this.field('text');
|
||||
this.ref('location');
|
||||
|
||||
for (var i=0; i < data.docs.length; i++) {
|
||||
var doc = data.docs[i];
|
||||
this.add(doc);
|
||||
documents[doc.location] = doc;
|
||||
}
|
||||
});
|
||||
console.log('Lunr index built, search ready');
|
||||
}
|
||||
allowSearch = true;
|
||||
postMessage({allowSearch: allowSearch});
|
||||
}
|
||||
|
||||
function init () {
|
||||
var oReq = new XMLHttpRequest();
|
||||
oReq.addEventListener("load", onJSONLoaded);
|
||||
var index_path = base_path + '/search_index.json';
|
||||
if( 'function' === typeof importScripts ){
|
||||
index_path = 'search_index.json';
|
||||
}
|
||||
oReq.open("GET", index_path);
|
||||
oReq.send();
|
||||
}
|
||||
|
||||
function search (query) {
|
||||
if (!allowSearch) {
|
||||
console.error('Assets for search still loading');
|
||||
return;
|
||||
}
|
||||
|
||||
var resultDocuments = [];
|
||||
var results = index.search(query);
|
||||
for (var i=0; i < results.length; i++){
|
||||
var result = results[i];
|
||||
doc = documents[result.ref];
|
||||
doc.summary = doc.text.substring(0, 200);
|
||||
resultDocuments.push(doc);
|
||||
}
|
||||
return resultDocuments;
|
||||
}
|
||||
|
||||
if( 'function' === typeof importScripts ) {
|
||||
onmessage = function (e) {
|
||||
if (e.data.init) {
|
||||
init();
|
||||
} else if (e.data.query) {
|
||||
postMessage({ results: search(e.data.query) });
|
||||
} else {
|
||||
console.error("Worker - Unrecognized message: " + e);
|
||||
}
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user