github.com/piotrnar/gocoin@v0.0.0-20240512203912-faa0448c5e96/client/www/templates/wallet_off.html (about)

     1  <br>
     2  <i id="wallet_min_warning" style="color:purple;float:right" title="Modify MinValue in gocoin.conf to change it">
     3  Minimum output value to be included in wallet's balance: <b id="min_val_btc"></b> BTC</i>
     4  <div id="wal_off" style="display:none">
     5  Wallet functionality is not available at this moment.
     6  
     7  <div id="wal_oin" style="display:none"><br>It will auto enable in <b id="ais"></b>...</div>
     8  
     9  <form id="form_a" method="post" action="cfg" style="margin-top:20px;display:none">
    10  <input type="hidden" name="wallet" value="on">
    11  <input type="hidden" name="page" id="page_a">
    12  <input type="submit" id="enable_wallet_button" value="Enable wallet functionality now">
    13  </form>
    14  </div>
    15  
    16  <div id="wal_pro" style="display:none">
    17  Wallet functionality is being enabled - <b id="perc_compl"></b> complete
    18  
    19  <form id="form_b" method="post" action="cfg" style="margin-top:20px;display:none">
    20  <input type="hidden" name="wallet" value="off">
    21  <input type="hidden" name="page" id="page_b">
    22  <input type="submit" value="Abort enabling wallet functionality">
    23  </form>
    24  </div>
    25  </div>
    26  
    27  <script>
    28  
    29  function hande_stat(stat) {
    30  	if (stat.WalletON) {
    31  		location.reload()
    32  		return 0
    33  	}
    34  
    35  	if (stat.WalletProgress==0) {
    36  		wal_off.style.display = 'block'
    37  		wal_pro.style.display = 'none'
    38  
    39  		if (stat.WalletOnIn == 0) {
    40  			// disabled and not pending
    41  			wal_oin.style.display = 'none'
    42  			return 3000
    43  		}
    44  
    45  		ais.innerText = stat.WalletOnIn
    46  		wal_oin.style.display = 'block'
    47  		return 1000
    48  	}
    49  
    50  	// in progress
    51  	perc_compl.innerText = (stat.WalletProgress/10).toFixed(0) + '%'
    52  	wal_off.style.display = 'none'
    53  	wal_pro.style.display = 'block'
    54  	return 1000
    55  }
    56  
    57  function refresh_walletstatus() {
    58  	var aj = ajax()
    59  	aj.onerror=function() {
    60  		setTimeout(refresh_walletstatus, 5000)
    61  	}
    62  	aj.onload=function() {
    63  		var to = 5000
    64  		try {
    65  			to = hande_stat(JSON.parse(aj.responseText))
    66  		} catch(e) {
    67  			console.log(e)
    68  		}
    69  		if (to > 0)  setTimeout(refresh_walletstatus, to)
    70  	}
    71  	aj.open("GET","walsta.json",true)
    72  	aj.send(null)
    73  }
    74  
    75  if (!server_mode) {
    76  	page_a.value = document.location
    77  	page_b.value = document.location
    78  	form_a.style.display = 'block'
    79  	form_b.style.display = 'block'
    80  }
    81  refresh_walletstatus()
    82  
    83  var _lblo = 0
    84  blno.addEventListener("lastblock", function(e) {
    85  	if (_lblo==0) {
    86  		_lblo = e.block.Height
    87  		min_val_btc.innerText = val2str(e.block.MinValue)
    88  	}
    89  })
    90  
    91  if (!chain_in_sync) {
    92  	enable_wallet_button.disabled = true
    93  	enable_wallet_button.title = 'Cannot enable when block chain sync in progress'
    94  }
    95  
    96  </script>