1
0
mirror of https://github.com/webrecorder/pywb.git synced 2025-03-15 00:03:28 +01:00

rewrite: for WB_wombat_top rewriting, select next-to-top instead of self

This commit is contained in:
Ilya Kreymer 2014-06-16 19:42:15 -07:00
parent e1c1d23a9f
commit 22a2da6e0c
2 changed files with 16 additions and 14 deletions

View File

@ -561,20 +561,17 @@ WB_wombat_init = (function() {
var created = orig.apply(this, arguments);
if (created.tagName == "IFRAME"
//|| created.tagName == "IMG"
//|| created.tagName == "SCRIPT"
) {
if (created.tagName == "IFRAME") {
if (created.contentWindow) {
created.contentWindow.window.WB_wombat_location = created.contentWindow.window.location;
}
override_attr(created, "src");
} else if (created.tagName == "A") {
override_attr(created, "href");
}
// } else if (created.tagName == "A") {
// override_attr(created, "href");
// }
return created;
}
@ -704,14 +701,22 @@ WB_wombat_init = (function() {
}
var is_framed = (window.top.wbinfo && window.top.wbinfo.is_frame);
function find_next_top(win) {
while ((win.parent != win) && (win.parent != win.top)) {
win = win.parent;
}
return win;
}
if (window.self.location != window.top.location) {
if (is_framed) {
window.top.WB_wombat_location = window.WB_wombat_location;
window.WB_wombat_top = window.self;
window.WB_wombat_top = find_next_top(window.self);
} else {
window.top.WB_wombat_location = new WombatLocation(window.top.location);
window.WB_wombat_top = window.top;
}
} else {

View File

@ -39,10 +39,7 @@ function push_state(url, timestamp, capture_str) {
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;