From 734ee4471b06ae23f98823c22595118f187e2727 Mon Sep 17 00:00:00 2001 From: Ilya Kreymer Date: Mon, 2 Feb 2015 09:41:49 -0800 Subject: [PATCH] frame ui: pass timestamp to frame banner, fix typo in html banner: allow overriding of banner id by returning custom id --- pywb/static/wb.css | 4 ++-- pywb/static/wb.js | 18 ++++++++++++------ pywb/static/wb_frame.js | 2 +- pywb/ui/frame_insert.html | 6 +++--- 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/pywb/static/wb.css b/pywb/static/wb.css index 880f0890..f1c969d4 100644 --- a/pywb/static/wb.css +++ b/pywb/static/wb.css @@ -1,13 +1,13 @@ #_wb_plain_banner, #_wb_frame_top_banner -{ +{ display: block !important; top: 0px !important; left: 0px !important; font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif !important; width: 100% !important; font-size: 24px !important; - background-color: lightYellow !important; + background-color: lightYellow !important; color: black !important; text-align: center !important; z-index: 2147483643 !important; diff --git a/pywb/static/wb.js b/pywb/static/wb.js index 0b48ae97..a2d31ef2 100644 --- a/pywb/static/wb.js +++ b/pywb/static/wb.js @@ -19,20 +19,23 @@ This file is part of pywb, https://github.com/ikreymer/pywb function __WbJsInit() { +var bid = undefined; + function init_banner() { var PLAIN_BANNER_ID = "_wb_plain_banner"; var FRAME_BANNER_ID = "_wb_frame_top_banner"; - var bid; if (window.top != window.self) { return; } - if (wbinfo.is_frame) { - bid = FRAME_BANNER_ID; - } else { - bid = PLAIN_BANNER_ID; + if (!bid) { + if (wbinfo.is_frame) { + bid = FRAME_BANNER_ID; + } else { + bid = PLAIN_BANNER_ID; + } } if (!document || !document.body) { @@ -43,7 +46,10 @@ function init_banner() { return; } - _wb_js.create_banner_element(bid); + var res = _wb_js.create_banner_element(bid); + if (res) { + bid = res; + } } this.banner_labels = {LOADING_MSG: "Loading...", diff --git a/pywb/static/wb_frame.js b/pywb/static/wb_frame.js index b50828b4..3e599058 100644 --- a/pywb/static/wb_frame.js +++ b/pywb/static/wb_frame.js @@ -44,7 +44,7 @@ function make_inner_url(url, ts) function push_state(url, timestamp, capture_str, is_live) { if (window.frames[0].WB_wombat_location) { - curr_href = window.frames[0].WB_wombat_location.href; + var curr_href = window.frames[0].WB_wombat_location.href; // If not current url, don't update if (url != curr_href) { diff --git a/pywb/ui/frame_insert.html b/pywb/ui/frame_insert.html index 7cd04306..9417d019 100644 --- a/pywb/ui/frame_insert.html +++ b/pywb/ui/frame_insert.html @@ -1,19 +1,19 @@ - + {% include banner_html ignore missing %} - - +