Host-customized fork of https://github.com/tecnovert/basicswap/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.6 KiB
45 lines
1.6 KiB
<!DOCTYPE html><html lang="en"> |
|
<head> |
|
<meta charset="UTF-8"> |
|
{% if refresh %} |
|
<meta http-equiv="refresh" content="{{ refresh }}"> |
|
{% endif %} |
|
<link type="text/css" media="all" href="/static/css/simple/style.css" rel="stylesheet"> |
|
<link rel=icon sizes="32x32" type="image/png" href="/static/images/favicon-32.png"> |
|
<title>{{ title }}</title> |
|
</head> |
|
<body> |
|
{% if h2 %} |
|
<h2>{{ h2 }}</h2> |
|
{% endif %} |
|
|
|
{% if ws_url %} |
|
<script> |
|
var ws = new WebSocket("{{ ws_url }}"), |
|
floating_div = document.createElement('div'); |
|
floating_div.classList.add('floatright'); |
|
messages = document.createElement('ul'); |
|
messages.setAttribute('id', 'ul_updates'); |
|
ws.onmessage = function (event) { |
|
let json = JSON.parse(event.data); |
|
|
|
let event_message = 'Unknown event'; |
|
if (json['event'] == 'new_offer') { |
|
event_message = '<a href=/offer/' + json['offer_id'] + '>New offer</a>'; |
|
} else |
|
if (json['event'] == 'new_bid') { |
|
event_message = '<a href=/bid/' + json['bid_id'] + '>New bid</a> on offer <a href=/offer/' + json['offer_id'] + '>' + json['offer_id'] + '</a>'; |
|
} else |
|
if (json['event'] == 'bid_accepted') { |
|
event_message = '<a href=/bid/' + json['bid_id'] + '>Bid accepted</a>'; |
|
} |
|
|
|
let messages = document.getElementById('ul_updates'), |
|
message = document.createElement('li'); |
|
message.innerHTML = event_message; |
|
messages.appendChild(message); |
|
}; |
|
floating_div.appendChild(messages); |
|
document.body.appendChild(floating_div); |
|
</script> |
|
{% endif %}
|
|
|