diff --git a/pywb/static/wb.js b/pywb/static/wb.js
index e304831b..2d8b2470 100644
--- a/pywb/static/wb.js
+++ b/pywb/static/wb.js
@@ -66,7 +66,10 @@ function init_banner() {
text = "" + text + "";
- var capture_str = (wbinfo ? wbinfo.capture_str : "");
+ var capture_str = "";
+ if (wbinfo && wbinfo.timestamp) {
+ capture_str = ts_to_date(wbinfo.timestamp, true);
+ }
text += "" + capture_str + "";
@@ -75,6 +78,27 @@ function init_banner() {
document.body.insertBefore(banner, document.body.firstChild);
}
+function ts_to_date(ts, is_gmt)
+{
+ if (ts.length < 14) {
+ return ts;
+ }
+
+ var datestr = (ts.substring(0, 4) + "-" +
+ ts.substring(4, 6) + "-" +
+ ts.substring(6, 8) + "T" +
+ ts.substring(8, 10) + ":" +
+ ts.substring(10, 12) + ":" +
+ ts.substring(12, 14) + "-00:00");
+
+ var date = new Date(datestr);
+ if (is_gmt) {
+ return date.toGMTString();
+ } else {
+ return date.toLocaleString();
+ }
+}
+
function add_event(name, func, object) {
if (object.addEventListener) {
object.addEventListener(name, func);
@@ -116,7 +140,6 @@ if (wbinfo.is_frame_mp && wbinfo.canon_url &&
}
return {'labels': labels,
- 'add_event': add_event,
- 'remove_event': remove_event};
+ 'ts_to_date': ts_to_date};
})();
diff --git a/pywb/static/wb_frame.js b/pywb/static/wb_frame.js
index 16bddef8..0d7be28d 100644
--- a/pywb/static/wb_frame.js
+++ b/pywb/static/wb_frame.js
@@ -19,21 +19,6 @@ function make_inner_url(url, ts)
}
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);
@@ -94,27 +79,6 @@ function update_status(str, is_live) {
}
}
-function ts_to_date(ts, is_gmt)
-{
- if (ts.length < 14) {
- return ts;
- }
-
- var datestr = (ts.substring(0, 4) + "-" +
- ts.substring(4, 6) + "-" +
- ts.substring(6, 8) + "T" +
- ts.substring(8, 10) + ":" +
- ts.substring(10, 12) + ":" +
- ts.substring(12, 14) + "-00:00");
-
- var date = new Date(datestr);
- if (is_gmt) {
- return date.toGMTString();
- } else {
- return date.toLocaleString();
- }
-}
-
window.onpopstate = function(event) {
var curr_state = event.state;
@@ -149,15 +113,14 @@ function iframe_loaded(event) {
if (iframe.wbinfo) {
ts = iframe.wbinfo.timestamp;
is_live = iframe.wbinfo.is_live;
- capture_str = iframe.wbinfo.capture_str;
} else {
ts = extract_ts(iframe.location.href);
if (!ts) {
is_live = true;
ts = extract_ts_cookie(iframe.document.cookie);
}
- capture_str = ts_to_date(ts, true);
}
+ capture_str = _wb_js.ts_to_date(ts, true);
update_wb_url(url, ts, capture_str, is_live);
}
diff --git a/pywb/ui/frame_insert.html b/pywb/ui/frame_insert.html
index 9b8b1e51..ce8d4ccd 100644
--- a/pywb/ui/frame_insert.html
+++ b/pywb/ui/frame_insert.html
@@ -3,7 +3,6 @@