From 0f93ffcc2be1202d86906a9904c790df64e04d8a Mon Sep 17 00:00:00 2001 From: Robert Lord Date: Sun, 22 Jun 2014 02:41:16 -0700 Subject: [PATCH] More js cleanup for #80 --- source/javascripts/app/search.js | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/source/javascripts/app/search.js b/source/javascripts/app/search.js index 374094a..16cbce0 100644 --- a/source/javascripts/app/search.js +++ b/source/javascripts/app/search.js @@ -14,8 +14,8 @@ $(populate); $(bind); - function populate () { - $('h1').each(function () { + function populate() { + $('h1').each(function() { var title = $(this); var body = title.nextUntil('h1'); var wrapper = $('
'); @@ -31,7 +31,7 @@ }); } - function bind () { + function bind() { content = $('.content'); darkBox = $('.dark-box'); searchInfo = $('.search-info'); @@ -42,24 +42,24 @@ .on('blur', inactive); } - function refToHeader (itemRef) { + function refToHeader(itemRef) { return $('.tocify-item[data-unique=' + itemRef + ']').closest('.tocify-header'); } - function sortDescending (obj2, obj1) { + function sortDescending(obj2, obj1) { var s1 = parseInt(obj1.id.replace(/[^\d]/g, ''), 10); var s2 = parseInt(obj2.id.replace(/[^\d]/g, ''), 10); return s1 === s2 ? 0 : s1 < s2 ? -1 : 1; } - function resetHeaderLocations () { + function resetHeaderLocations() { var headers = $(".tocify-header").sort(sortDescending); $.each(headers, function (index, item) { $(item).insertBefore($("#toc ul:first-child")); }); } - function search (event) { + function search(event) { var sections = $('section, #toc .tocify-header'); searchInfo.hide(); @@ -110,20 +110,20 @@ $global.triggerHandler('resize'); } - function active () { + function active() { search.call(this, {}); } - function inactive () { + function inactive() { unhighlight(); searchInfo.hide(); } - function highlight () { + function highlight() { if (this.value) content.highlight(this.value, highlightOpts); } - function unhighlight () { + function unhighlight() { content.unhighlight(highlightOpts); }