1<?php 2 3use Fisharebest\Webtrees\I18N; 4use Fisharebest\Webtrees\View; 5 6?> 7 8<form method="post" action="<?= e(route('module', ['module' => 'descendancy', 'action' => 'Descendants', 'ged' => $tree->name()])) ?>" onsubmit="return false;"> 9 <input type="search" name="sb_desc_name" id="sb_desc_name" placeholder="<?= I18N::translate('Search') ?>"> 10</form> 11 12<div id="sb_desc_content"> 13 <ul> 14 <?= $individual_list ?> 15 </ul> 16</div> 17 18<?php View::push('javascript') ?> 19<script> 20 function dsearchQ() { 21 var query = $("#sb_desc_name").val(); 22 if (query.length>1) { 23 $("#sb_desc_content").load(<?= json_encode(route('module', ['module' => 'descendancy', 'action' => 'Search', 'ged' => $tree->name()])) ?> + "&search=" + encodeURIComponent(query)); 24 } 25 } 26 27 $("#sb_desc_name").focus(function(){this.select();}); 28 $("#sb_desc_name").blur(function(){if (this.value === "") this.value="<?= I18N::translate('Search') ?>";}); 29 var dtimerid = null; 30 $("#sb_desc_name").keyup(function(e) { 31 if (dtimerid) window.clearTimeout(dtimerid); 32 dtimerid = window.setTimeout("dsearchQ()", 500); 33 }); 34 35 $("#sb_desc_content").on("click", ".sb_desc_indi", function() { 36 var self = $(this), 37 state = self.children(".plusminus"), 38 target = self.siblings("div"); 39 if(state.hasClass("icon-plus")) { 40 if (jQuery.trim(target.html())) { 41 target.show("fast"); // already got content so just show it 42 } else if (self.attr("href") !== "#") { 43 target 44 .hide() 45 .load(self.attr("href"), function(response, status, xhr) { 46 if(status === "success" && response !== "") { 47 target.show("fast"); 48 } 49 }) 50 } 51 } else { 52 target.hide("fast"); 53 } 54 state.toggleClass("icon-minus icon-plus"); 55 return false; 56 }); 57</script> 58<?php View::endpush() ?> 59