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

banner: fixes for framed replay with new default banner

This commit is contained in:
Ilya Kreymer 2014-10-17 08:40:57 -07:00
parent 0efa2dc0ad
commit 1c23e12c06
4 changed files with 15 additions and 9 deletions

View File

@ -25,10 +25,6 @@ This file is part of pywb.
_wb_js.create_banner_element = function(banner_id)
{
var banner_labels = {LOADING_MSG: "Loading...",
REPLAY_MSG: "This is an <b>archived</b> page from ",
LIVE_MSG: "This is a <b>live</b> page loaded on "};
var banner = document.createElement("wb_div");
banner.setAttribute("id", banner_id);
banner.setAttribute("lang", "en");
@ -36,11 +32,11 @@ _wb_js.create_banner_element = function(banner_id)
var text;
if (wbinfo.is_frame) {
text = banner_labels.LOADING_MSG;
text = _wb_js.banner_labels.LOADING_MSG;
} else if (wbinfo.is_live) {
text = banner_labels.LIVE_MSG;
text = _wb_js.banner_labels.LIVE_MSG;
} else {
text = banner_labels.REPLAY_MSG;
text = _wb_js.banner_labels.REPLAY_MSG;
}
text = "<span id='_wb_label'>" + text + "</span>";

View File

@ -42,6 +42,10 @@ function init_banner() {
_wb_js.create_banner_element(bid);
}
this.banner_labels = {LOADING_MSG: "Loading...",
REPLAY_MSG: "This is an <b>archived</b> page from ",
LIVE_MSG: "This is a <b>live</b> page loaded on "};
this.create_banner_element = function() {
// No banner by default
return null;

View File

@ -84,9 +84,9 @@ function set_state(state) {
var label = document.getElementById("_wb_label");
if (label) {
if (state.is_live) {
label.innerHTML = _wb_js.labels.LIVE_MSG;
label.innerHTML = _wb_js.banner_labels.LIVE_MSG;
} else {
label.innerHTML = _wb_js.labels.REPLAY_MSG;
label.innerHTML = _wb_js.banner_labels.REPLAY_MSG;
}
}
@ -147,3 +147,8 @@ function update_wb_url(url, ts, is_live) {
push_state(url, ts, capture_str, is_live);
}
// Load Banner
if (_wb_js) {
_wb_js.load();
}

View File

@ -8,6 +8,7 @@
wbinfo.is_frame = true;
</script>
<script src='{{ wbrequest.host_prefix }}/{{ static_path }}/wb.js'> </script>
<script src='{{ wbrequest.host_prefix }}/{{ static_path }}/default_banner.js'> </script>
<script src='{{ wbrequest.host_prefix }}/{{ static_path }}/wb_frame.js'> </script>
<link rel='stylesheet' href='{{ wbrequest.host_prefix }}/{{ static_path }}/wb.css'/>
<!-- End WB Insert -->