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

default_banner fix: save last state for use with 'title' event changes -- use previous url, timestamp when changing title (#327)

This commit is contained in:
Ilya Kreymer 2018-05-21 11:56:03 -07:00 committed by GitHub
parent 18cc71af3b
commit a8bb3cfce6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -88,6 +88,8 @@ This file is part of pywb, https://github.com/webrecorder/pywb
return; return;
} }
var last_state = {};
window.addEventListener("load", function() { window.addEventListener("load", function() {
if (window.wbinfo) { if (window.wbinfo) {
init("_wb_plain_banner"); init("_wb_plain_banner");
@ -107,8 +109,10 @@ This file is part of pywb, https://github.com/webrecorder/pywb
if (type == "load" || type == "replace-url") { if (type == "load" || type == "replace-url") {
state = event.data; state = event.data;
last_state = state;
title = event.data.title || title; title = event.data.title || title;
} else if (type == "title") { } else if (type == "title") {
state = last_state;
title = event.data.title; title = event.data.title;
} else { } else {
return; return;