Limit jQuery attempts to 30 (3 seconds)

This commit is contained in:
ruan 2019-06-17 13:10:32 +02:00
parent 6031097f30
commit d6c1d89bd4
2 changed files with 6 additions and 6 deletions

View File

@ -68,10 +68,10 @@ $settings = $this->page->settings;
<link href="<?php echo $this->page->autoversion('inc/css/glyphicons.min.css'); ?>" rel="stylesheet">
<link href="<?php echo $this->page->autoversion('inc/css/custom.css'); ?>" rel="stylesheet">
<script type="text/javascript">
function withjQuery(f) {
function withjQuery(tries, f) {
if (window.jQuery) f();
else window.setTimeout(function () {
withjQuery(f);
else if (tries > 0) window.setTimeout(function () {
withjQuery(tries - 1, f);
}, 100);
}
</script>
@ -100,8 +100,8 @@ $settings = $this->page->settings;
));
?>
<ul class="nav navbar-nav my-2 my-lg-0">
<a href="https://www.spigotmc.org/resources/litebans.3715/"
target="_blank">&copy; LiteBans</a>
<a href="https://www.spigotmc.org/resources/litebans.3715/"
target="_blank">&copy; LiteBans</a>
</ul>
</div>
</div>

View File

@ -574,7 +574,7 @@ class Page {
function table_end($clicky = true) {
echo '</table>';
if ($clicky) {
echo "<script type=\"text/javascript\">withjQuery(function(){ $('tr').click(function(){var href=$(this).find('a').attr('href');if(href!==undefined)window.location=href;}).hover(function(){\$(this).toggleClass('hover');}); });</script>";
echo "<script type=\"text/javascript\">withjQuery(30,function(){ $('tr').click(function(){var href=$(this).find('a').attr('href');if(href!==undefined)window.location=href;}).hover(function(){\$(this).toggleClass('hover');}); });</script>";
}
}