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

template fixes: fix comment in head, footer, header templates

vueui fixes:
- fix error if no urls found on calendar page
- convert url to text box to allow enter new urls
- fix suport for logo, have logo link to home page
This commit is contained in:
Ilya Kreymer 2022-01-24 23:47:19 -08:00
parent 613754307c
commit 581e4601bb
8 changed files with 58 additions and 25 deletions

File diff suppressed because one or more lines are too long

View File

@ -34,7 +34,7 @@ window.banner_info = {
<link rel='stylesheet' href='{{ static_prefix }}/vue_banner.css'/>
<script src="{{ static_prefix }}/vue/vueui.js"></script>
<script>
VueUI.main("{{ static_prefix }}", "{{ url }}", "{{ wb_prefix }}", "{{ timestamp }}");
VueUI.main("{{ static_prefix }}", "{{ url }}", "{{ wb_prefix }}", "{{ timestamp }}", "{{ ui.logo }}");
</script>
{% if ui.vue_timeline_banner %}

View File

@ -1,2 +1,2 @@
## place content to be added at the very end of the <body> tag here
{# place content to be added at the very end of the <body> tag in this file below #}

View File

@ -1 +1 @@
## place optional content to be injected into the <head> of every page here
{# place optional content to be injected into the <head> of every page in this file below #}

View File

@ -1,4 +1,4 @@
## place content to be added at the very beginning of the <body> tag here
{# place content to be added at the very beginning of the <body> tag in this file below #}
<header>
{% if not err_msg and locales|length > 1 %}
<div class="language-select">

View File

@ -66,7 +66,7 @@
renderCal.init();
{% else %}
VueUI.main("{{ static_prefix }}", "{{ url }}", "{{ prefix }}", "{{ ui.logo }}");
VueUI.main("{{ static_prefix }}", "{{ url }}", "{{ prefix }}", undefined, "{{ ui.logo }}");
{% endif %}

View File

@ -2,7 +2,7 @@
<div class="app" :class="{expanded: showTimelineView}" data-app="webrecorder-replay-app">
<div class="banner">
<div class="line">
<div class="logo"><a href="/"><img :src="config.logoImg" /></a></div>
<div class="logo"><a href="/"><img :src="config.logoImg" style="max-width: 80px" /></a></div>
<div class="timeline-wrap">
<div class="line">
<div class="breadcrumbs-wrap">
@ -35,13 +35,15 @@
</div>
</div>
<div class="snapshot-title">
<div>{{ config.url }}</div>
<form @submit="gotoUrl">
<input id="theurl" type="text" :value="config.url"></input>
</form>
<div v-if="currentSnapshot && !showFullView">
<span v-if="config.title">{{ config.title }}</span>
Current capture: {{currentSnapshot.getTimeDateFormatted()}}
</div>
</div>
<CalendarYear v-if="showFullView"
<CalendarYear v-if="showFullView && currentPeriod && currentPeriod.children.length"
:period="currentPeriod"
:current-snapshot="currentSnapshot"
@goto-period="gotoPeriod">
@ -124,6 +126,13 @@ export default {
this.$emit("show-snapshot", snapshot);
this.showFullView = false;
},
gotoUrl(event) {
event.preventDefault();
const newUrl = document.querySelector("#theurl").value;
if (newUrl !== this.url) {
window.location.href = this.config.prefix + "*/" + newUrl;
}
},
init() {
this.config.url = this.config.initialView.url;
if (this.config.initialView.title) {
@ -134,8 +143,10 @@ export default {
this.showTimelineView = true;
} else {
this.showFullView = false;
this.showFullView = true;
this.setSnapshot(this.config.initialView);
this.showTimelineView = true;
if (this.currentPeriod.children.length) {
this.setSnapshot(this.config.initialView);
}
}
if (window.sessionStorage) {
const currentPeriodId = window.sessionStorage.getItem(this.sessionStorageUrlKey);
@ -242,4 +253,7 @@ export default {
font-weight: bold;
font-size: 16px;
}
#theurl {
width: 400px;
}
</style>

View File

@ -45,7 +45,7 @@ class CDXLoader {
this.opts.initialView = {url, timestamp};
this.opts.logoImg = this.staticPrefix + (this.logoUrl ? this.logoUrl : "/pywb-logo-sm.png");
this.opts.logoImg = this.staticPrefix + "/" + (this.logoUrl ? this.logoUrl : "pywb-logo-sm.png");
this.loadCDX(queryURL).then((cdxList) => {
this.app = this.initApp(cdxList, this.opts, (snapshot) => this.loadSnapshot(snapshot));
@ -60,7 +60,7 @@ class CDXLoader {
app.$set(app, "snapshots", pywbData.snapshots);
app.$set(app, "currentPeriod", pywbData.timeline);
app.$set(app, "config", {...app.config, ...config});
app.$set(app, "config", {...app.config, ...config, prefix: this.prefix});
app.$mount("#app");