mirror of
https://github.com/webrecorder/pywb.git
synced 2025-03-24 06:59:52 +01:00
framed replay: improved url update support, ensure update url is actually
the url of the frame (ignore ajax requests)
This commit is contained in:
parent
ac3efec4bc
commit
e1c1d23a9f
@ -34,24 +34,56 @@ function make_inner_url(url, ts)
|
|||||||
}
|
}
|
||||||
|
|
||||||
function push_state(url, timestamp, capture_str) {
|
function push_state(url, timestamp, capture_str) {
|
||||||
|
var curr_href = null;
|
||||||
|
|
||||||
|
if (window.frames[0].WB_wombat_location) {
|
||||||
|
curr_href = window.frames[0].WB_wombat_location.href;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(curr_href);
|
||||||
|
console.log(url);
|
||||||
|
|
||||||
|
if (url != curr_href) {
|
||||||
|
update_status(capture_str);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!timestamp) {
|
||||||
|
timestamp = extract_ts(window.frames[0].location.href);
|
||||||
|
}
|
||||||
|
|
||||||
var state = {}
|
var state = {}
|
||||||
state.outer_url = make_outer_url(url, timestamp);
|
state.timestamp = timestamp;
|
||||||
state.inner_url = make_inner_url(url, 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.capture_str = capture_str;
|
||||||
|
|
||||||
//if (url == wbinfo.capture_url) {
|
|
||||||
// return;
|
|
||||||
//}
|
|
||||||
|
|
||||||
window.history.replaceState(state, "", state.outer_url);
|
window.history.replaceState(state, "", state.outer_url);
|
||||||
|
|
||||||
update_status(state.capture_str);
|
update_status(state.capture_str);
|
||||||
}
|
}
|
||||||
|
|
||||||
function pop_state(state) {
|
function pop_state(state) {
|
||||||
update_status(state.capture_str);
|
update_status(state.capture_str);
|
||||||
|
|
||||||
window.frames[0].src = state.outer_url;
|
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) {
|
function update_status(str) {
|
||||||
var elem = document.getElementById("_wb_capture_info");
|
var elem = document.getElementById("_wb_capture_info");
|
||||||
if (elem) {
|
if (elem) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user