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