Updated: animated spinner logic

This commit is contained in:
bergware
2020-02-10 03:21:54 +01:00
parent 9402420229
commit 8dbb62a97d
3 changed files with 16 additions and 7 deletions

View File

@@ -3,8 +3,8 @@ Tag="navicon"
Markdown="false"
---
<?PHP
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,
@@ -20,7 +20,10 @@ Markdown="false"
</style>
<script>
$(function(){
timers.browse = setTimeout(function(){$('div.spinner.fixed').show('slow');},150);
$.get('/webGui/include/Browse.php',{dir:"<?=addslashes(urlencode($dir))?>",path:"<?=$path?>",user:<?=strpos($dir,'/mnt/user')===0?1:0?>},function(data){
clearTimeout(timers.browse);
$('div.spinner.fixed').hide('slow');
var table = $('table.indexer');
var col = $.cookie('col')||1;
var dir = $.cookie('dir')||0;
@@ -36,6 +39,6 @@ $(function(){
</script>
<table class="indexer tablesorter shift">
<thead><tr><th>Type</th><th class='sorter-text'>Name</th><th>Size</th><th>Last Modified</th><th>Location</th></tr></thead>
<tbody><tr><td colspan="5"><div class="spinner"></div></td></tr></tbody>
<tbody><tr><td colspan="5"></td></tr></tbody>
</table>
<input type="button" value="Done" onclick="done('Browse')">

View File

@@ -4,8 +4,8 @@ Icon="icon-log"
Tag="list"
---
<?PHP
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,
@@ -84,7 +84,10 @@ function showLog(log) {
var type = $(this).attr('class').replace('label','').replace(/-/g,'');
$(this).removeClass().addClass(type+' label');
});
timers.syslog = setTimeout(function(){$('div.spinner.fixed').show('slow');},150);
$.post('/webGui/include/Syslog.php',{log:log},function(data){
clearTimeout(timers.syslog);
$('div.spinner.fixed').hide('slow');
$('pre.up').html(data);
<?if ($display['resize']):?>
resize();
@@ -92,7 +95,10 @@ function showLog(log) {
});
}
$(function() {
timers.syslog = setTimeout(function(){$('div.spinner.fixed').show('slow');},150);
$.post('/webGui/include/Syslog.php',{log:'<?=$log?>'},function(data){
clearTimeout(timers.syslog);
$('div.spinner.fixed').hide('slow');
$('pre.up').html(data);
<?if ($display['resize']):?>
resize();

View File

@@ -356,6 +356,7 @@ $(function() {
if (tab=='tab0') tab = 'tab'+$('input[name$="tabs"]').length; else if ($('#'+tab).length==0) {initab(); tab = 'tab1';}
if ($.cookie('help')=='help') {$('.inline_help').show(); $('#nav-item.HelpButton').addClass('active');}
$('#'+tab).attr('checked', true);
$('div.spinner.fixed').html(unraid_logo);
updateTime();
$.jGrowl.defaults.closeTemplate = '<i class="fa fa-close"></i>';
$.jGrowl.defaults.closerTemplate = '<?=$notify['position'][0]=='b' ? '<div>':'<div class="top">'?>[ close all notifications ]</div>';
@@ -381,6 +382,7 @@ $.ajaxPrefilter(function(s, orig, xhr){
</head>
<body>
<div id="template">
<div class="spinner fixed"></div>
<div class="upgrade_notice" style="display:none"></div>
<div id="header" class="<?=$display['banner']?>">
<div class="logo">
@@ -490,7 +492,6 @@ foreach ($pages as $page) {
unset($pages,$page,$pgs,$pg,$icon);
?>
</div></div>
<div class="spinner fixed"></div>
<form name="rebootNow" method="POST" action="/webGui/include/Boot.php"><input type="hidden" name="cmd" value="reboot"></form>
<iframe id="progressFrame" name="progressFrame" frameborder="0"></iframe>
<?
@@ -680,7 +681,6 @@ $(function() {
});
}
$('form').append($('<input>').attr({type:'hidden', name:'csrf_token', value:'<?=$var['csrf_token']?>'}));
$('div.spinner.fixed').html(unraid_logo);
setTimeout(function(){$('div.spinner').not('.fixed').each(function(){$(this).html(unraid_logo);});},150); // display animation if page loading takes longer than 150ms
watchdog.start();
});