1
0
mirror of https://github.com/webrecorder/pywb.git synced 2025-03-23 22:52:25 +01:00
pywb/pywb/ui/frame_insert.html
Ilya Kreymer fcbc2c2966 replay ui: improvements to framed replay messages.
'is_live' added to live rewrite to allow for different message for live replay
vs archived replay to be used.
When using framed replay, default initial message to 'Loading...'
default index.html: list non-replay access points in default home page
2014-07-20 16:46:30 -07:00

117 lines
2.7 KiB
HTML

<html>
<head>
<!-- Start WB Insert -->
<script>
wbinfo = {}
wbinfo.capture_str = " ";
wbinfo.is_embed = false;
wbinfo.prefix = "{{ wbrequest.wb_prefix }}";
wbinfo.capture_url = "{{ url }}";
wbinfo.is_frame = true;
</script>
<script src='{{ wbrequest.host_prefix }}/{{ static_path }}/wb.js'> </script>
<script>
var update_wb_url = push_state;
function make_outer_url(url, ts)
{
if (ts) {
return wbinfo.prefix + ts + "/" + url;
} else {
return wbinfo.prefix + url;
}
}
function make_inner_url(url, ts)
{
if (ts) {
return wbinfo.prefix + ts + "mp_/" + url;
} else {
return wbinfo.prefix + "mp_/" + url;
}
}
function push_state(url, timestamp, capture_str, is_live) {
var curr_href = null;
if (window.frames[0].WB_wombat_location) {
curr_href = window.frames[0].WB_wombat_location.href;
}
if (url != curr_href) {
update_status(capture_str, is_live);
return;
}
if (!timestamp) {
timestamp = extract_ts(window.frames[0].location.href);
}
var state = {}
state.timestamp = timestamp;
state.outer_url = make_outer_url(url, state.timestamp);
state.inner_url = make_inner_url(url, state.timestamp);
state.url = url;
state.capture_str = capture_str;
state.is_live = is_live;
window.history.replaceState(state, "", state.outer_url);
update_status(state.capture_str, is_live);
}
function pop_state(state) {
update_status(state.capture_str, state.is_live);
window.frames[0].src = state.outer_url;
}
function extract_ts(url)
{
var inx = url.indexOf("mp_");
if (inx < 0) {
return "";
}
url = url.substring(0, inx);
inx = url.lastIndexOf("/");
if (inx <= 0) {
return "";
}
return url.substring(inx + 1);
}
function update_status(str, is_live) {
var capture_info = document.getElementById("_wb_capture_info");
if (capture_info) {
capture_info.innerHTML = str;
}
var label = document.getElementById("_wb_label");
if (label) {
if (is_live) {
label.innerHTML = _wb_js.labels.LIVE_MSG;
} else {
label.innerHTML = _wb_js.labels.REPLAY_MSG;
}
}
}
window.onpopstate = function(event) {
var curr_state = event.state;
if (curr_state) {
pop_state(curr_state);
}
}
</script>
<link rel='stylesheet' href='{{ wbrequest.host_prefix }}/{{ static_path }}/wb.css'/>
<!-- End WB Insert -->
<body style="margin: 0px; padding: 0px;">
<div class="wb_iframe_div">
<iframe src="{{ wbrequest.wb_prefix + embed_url }}" seamless="seamless" frameborder="0" scrolling="yes" class="wb_iframe"/>
</div>
</body>
</html>