From b0ca320b8cb5f2a1381b77c8f35e83b3034072b2 Mon Sep 17 00:00:00 2001 From: Alex de Mulder Date: Thu, 16 Jul 2015 17:20:07 +0200 Subject: [PATCH] bit more hacking to make search blazingly fast :) --- docs/js/main.js | 4 ++-- docs/js/tipuesearch.js | 25 +++++++++++++------------ docs/network/edges.html | 1 - 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/docs/js/main.js b/docs/js/main.js index 67f624d1..08758420 100644 --- a/docs/js/main.js +++ b/docs/js/main.js @@ -5,7 +5,6 @@ $(document).ready(function() { vis.initKeywords(); $("#tipue_search_input").keyup(checkInput) - vis.typingTimeout = 0; }); @@ -13,7 +12,7 @@ $(document).ready(function() { function checkInput() { if (document.getElementById("tipue_search_input").value.length > 3) { clearTimeout(vis.typingTimeout); - vis.typingTimeout = setTimeout(vis.initSiteSearch(true),300); + vis.typingTimeout = setTimeout(function () {vis.initSiteSearch(true)},200); } else { document.getElementById("search-results-wrapper").style.display = "none"; @@ -77,6 +76,7 @@ vis.initSiteSearch = function(dynamic) { // Added dynamic flag for live update ~ "show": 3, },dynamic); + var hasSearchMessage = $("#tipue_search_content").children().length > 0; if(hasSearchMessage) { // show result panel diff --git a/docs/js/tipuesearch.js b/docs/js/tipuesearch.js index 2c0e79e4..98b7c17a 100644 --- a/docs/js/tipuesearch.js +++ b/docs/js/tipuesearch.js @@ -4,12 +4,16 @@ Tipue Search 5.0 Copyright (c) 2015 Tipue Tipue Search is released under the MIT License http://www.tipue.com/search -*/ -(function($) { +Also altered by @AlexDM0 for live updating :) +*/ +var tipuesearch_in = { + pages: [] + }; - $.fn.tipuesearch = function(options,dynamic) { +(function($) { + $.fn.tipuesearch = function(options,dynamic,query) { var set = $.extend( { 'show' : 7, @@ -30,17 +34,14 @@ http://www.tipue.com/search if (dynamic === undefined) { dynamic = false; } + return this.each(function() { - var tipuesearch_in = { - pages: [] - }; $.ajaxSetup({ async: false }); var tipuesearch_t_c = 0; - - if (set.mode == 'live') + if (set.mode == 'live' && tipuesearch_in.pages.length == 0) { for (var i = 0; i < tipuesearch_pages.length; i++) { @@ -73,7 +74,7 @@ http://www.tipue.com/search }); } } - + if (set.mode == 'json') { $.getJSON(set.contentLocation) @@ -506,7 +507,7 @@ http://www.tipue.com/search $('#tipue_search_content').hide(); $('#tipue_search_content').html(out); - $('#tipue_search_content').slideDown(200); + $('#tipue_search_content').slideDown(0); $('#tipue_search_replaced').click(function() { @@ -519,8 +520,8 @@ http://www.tipue.com/search var id_a = id_v.split('_'); getTipueSearch(parseInt(id_a[0]), id_a[1]); - }); - } + }); + } }); }; diff --git a/docs/network/edges.html b/docs/network/edges.html index 3f65118b..a71f54c2 100644 --- a/docs/network/edges.html +++ b/docs/network/edges.html @@ -670,7 +670,6 @@ var options: { -