1
0
mirror of https://github.com/webrecorder/pywb.git synced 2025-03-24 15:09:54 +01:00
pywb/pywb/templates/head_insert.html
Tessa Walsh 815ea92fc2
Rewrite: Support target rewriting, open new windows in top-frame instead (#767)
* Bump wombat to 3.3.9

* Set target attributes to iframe name
2022-10-05 20:55:12 -04:00

71 lines
2.0 KiB
HTML

{% autoescape false %}
<!-- WB Insert -->
<script>
{% set urlsplit = cdx.url | urlsplit %}
wbinfo = {};
wbinfo.top_url = "{{ top_url }}";
{% if is_framed %}
// Fast Top-Frame Redirect
if (window == window.top && wbinfo.top_url) {
var loc = window.location.href.replace(window.location.hash, "");
loc = decodeURI(loc);
if (loc != decodeURI(wbinfo.top_url)) {
window.location.href = wbinfo.top_url + window.location.hash;
}
}
{% endif %}
wbinfo.url = "{{ cdx.url }}";
wbinfo.timestamp = "{{ cdx.timestamp }}";
wbinfo.request_ts = "{{ wb_url.timestamp }}";
wbinfo.prefix = decodeURI("{{ wb_prefix }}");
wbinfo.mod = "{{ replay_mod }}";
wbinfo.is_framed = {{ is_framed | tobool }};
wbinfo.is_live = {{ is_live | tobool }};
wbinfo.coll = "{{ coll }}";
wbinfo.proxy_magic = "{{ env.pywb_proxy_magic }}";
wbinfo.static_prefix = "{{ static_prefix }}/";
wbinfo.enable_auto_fetch = {{ config.enable_auto_fetch | tobool }};
wbinfo.target_frame = "___wb_replay_top_frame";
</script>
{% if env.pywb_proxy_magic %}
{% set whichWombat = 'wombatProxyMode.js' %}
{% else %}
{% set whichWombat = 'wombat.js' %}
{% endif %}
{% if not wb_url.is_banner_only or (env.pywb_proxy_magic and (config.enable_auto_fetch or config.proxy.enable_wombat)) %}
<script src='{{ static_prefix }}/{{ whichWombat }}'> </script>
<script>
wbinfo.wombat_ts = "{{ wombat_ts }}";
wbinfo.wombat_sec = "{{ wombat_sec }}";
wbinfo.wombat_scheme = "{{ urlsplit.scheme }}";
wbinfo.wombat_host = "{{ urlsplit.netloc }}";
wbinfo.wombat_opts = {};
if (window && window._WBWombatInit) {
window._WBWombatInit(wbinfo);
}
</script>
{% else %}
<script>
window.devicePixelRatio = 1;
</script>
{% endif %}
{% if config.enable_flash_video_rewrite or config.transclusions_version == 1 %}
<script src='{{ static_prefix }}/vidrw.js'> </script>
{% elif config.transclusions_version == 2 %}
<script src="{{ static_prefix }}/transclusions.js"> </script>
{% endif %}
{{ banner_html }}
{% endautoescape %}
<!-- End WB Insert -->