Browse Source

bit more hacking to make search blazingly fast :)

flowchartTest
Alex de Mulder 9 years ago
parent
commit
b0ca320b8c
3 changed files with 15 additions and 15 deletions
  1. +2
    -2
      docs/js/main.js
  2. +13
    -12
      docs/js/tipuesearch.js
  3. +0
    -1
      docs/network/edges.html

+ 2
- 2
docs/js/main.js View File

@ -5,7 +5,6 @@ $(document).ready(function() {
vis.initKeywords(); vis.initKeywords();
$("#tipue_search_input").keyup(checkInput) $("#tipue_search_input").keyup(checkInput)
vis.typingTimeout = 0; vis.typingTimeout = 0;
}); });
@ -13,7 +12,7 @@ $(document).ready(function() {
function checkInput() { function checkInput() {
if (document.getElementById("tipue_search_input").value.length > 3) { if (document.getElementById("tipue_search_input").value.length > 3) {
clearTimeout(vis.typingTimeout); clearTimeout(vis.typingTimeout);
vis.typingTimeout = setTimeout(vis.initSiteSearch(true),300);
vis.typingTimeout = setTimeout(function () {vis.initSiteSearch(true)},200);
} }
else { else {
document.getElementById("search-results-wrapper").style.display = "none"; document.getElementById("search-results-wrapper").style.display = "none";
@ -77,6 +76,7 @@ vis.initSiteSearch = function(dynamic) { // Added dynamic flag for live update ~
"show": 3, "show": 3,
},dynamic); },dynamic);
var hasSearchMessage = $("#tipue_search_content").children().length > 0; var hasSearchMessage = $("#tipue_search_content").children().length > 0;
if(hasSearchMessage) { if(hasSearchMessage) {
// show result panel // show result panel

+ 13
- 12
docs/js/tipuesearch.js View File

@ -4,12 +4,16 @@ Tipue Search 5.0
Copyright (c) 2015 Tipue Copyright (c) 2015 Tipue
Tipue Search is released under the MIT License Tipue Search is released under the MIT License
http://www.tipue.com/search 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( { var set = $.extend( {
'show' : 7, 'show' : 7,
@ -30,17 +34,14 @@ http://www.tipue.com/search
if (dynamic === undefined) { if (dynamic === undefined) {
dynamic = false; dynamic = false;
} }
return this.each(function() { return this.each(function() {
var tipuesearch_in = {
pages: []
};
$.ajaxSetup({ $.ajaxSetup({
async: false async: false
}); });
var tipuesearch_t_c = 0; 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++) for (var i = 0; i < tipuesearch_pages.length; i++)
{ {
@ -73,7 +74,7 @@ http://www.tipue.com/search
}); });
} }
} }
if (set.mode == 'json') if (set.mode == 'json')
{ {
$.getJSON(set.contentLocation) $.getJSON(set.contentLocation)
@ -506,7 +507,7 @@ http://www.tipue.com/search
$('#tipue_search_content').hide(); $('#tipue_search_content').hide();
$('#tipue_search_content').html(out); $('#tipue_search_content').html(out);
$('#tipue_search_content').slideDown(200);
$('#tipue_search_content').slideDown(0);
$('#tipue_search_replaced').click(function() $('#tipue_search_replaced').click(function()
{ {
@ -519,8 +520,8 @@ http://www.tipue.com/search
var id_a = id_v.split('_'); var id_a = id_v.split('_');
getTipueSearch(parseInt(id_a[0]), id_a[1]); getTipueSearch(parseInt(id_a[0]), id_a[1]);
});
}
});
}
}); });
}; };

+ 0
- 1
docs/network/edges.html View File

@ -670,7 +670,6 @@ var options: {
<!-- Bootstrap core JavaScript <!-- Bootstrap core JavaScript
================================================== --> ================================================== -->
<!-- Placed at the end of the document so the pages load faster --> <!-- Placed at the end of the document so the pages load faster -->
<script src="../js/keycharm.js"></script>
<script src="../js/jquery.min.js"></script> <script src="../js/jquery.min.js"></script>
<script src="../js/bootstrap.min.js"></script> <script src="../js/bootstrap.min.js"></script>
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->

Loading…
Cancel
Save