Commit b171d3c4 authored by Christopher Rogers's avatar Christopher Rogers

Organizes javascript into libraries and application code

Signed-off-by: 's avatarChristopher Rogers <chrissrogers@gmail.com>
parent adf94ffb
//= require './jquery_ui' //= require_tree ./lib
//= require_tree . //= require_tree ./app
\ No newline at end of file
(function (global) {
window.topic = topic;
var index = lunr(function () {
this.field('title', { boost: 10 });
this.field('tags', { boost: 100 });
this.field('body');
this.ref('id');
});
$(bindSearch);
function bindSearch () {
$('#search').on('keyup', function () {
if (this.value) {
var items = index.search(this.value);
$('article, nav li').hide();
items.forEach(function (item) {
$('#' + item.ref + ', #' + item.ref + '-nav').show();
});
} else {
$('article, nav li').show();
}
});
$('form').on('submit', function (event) {
event.preventDefault();
});
}
function topic (title, tags, handle) {
index.add({
id: handle,
title: title,
tags: tags,
body: $('#' + handle + '-body').text()
});
}
})(window);
...@@ -20,5 +20,5 @@ $(function() { ...@@ -20,5 +20,5 @@ $(function() {
// instead of displaying an ugly animation // instead of displaying an ugly animation
setTimeout(function() { setTimeout(function() {
toc.setOption("showEffectSpeed", 180); toc.setOption("showEffectSpeed", 180);
},50); }, 50);
}); });
//= require ./jquery_ui
/* jquery Tocify - v1.8.0 - 2013-09-16 /* jquery Tocify - v1.8.0 - 2013-09-16
* http://www.gregfranko.com/jquery.tocify.js/ * http://www.gregfranko.com/jquery.tocify.js/
* Copyright (c) 2013 Greg Franko; Licensed MIT * Copyright (c) 2013 Greg Franko; Licensed MIT
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment