From 7f8650b0cfbda30916e4ccc042bd980bbe0868fb Mon Sep 17 00:00:00 2001 From: James Ketrenos Date: Tue, 23 Oct 2018 18:56:21 -0700 Subject: [PATCH] Set 'base' consistently from photo-lightbox, photo-thumbnail, and ketr-photos Signed-off-by: James Ketrenos --- frontend/elements/photo-lightbox.html | 9 ++------- frontend/elements/photo-thumbnail.html | 2 +- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/frontend/elements/photo-lightbox.html b/frontend/elements/photo-lightbox.html index 6d7ca9e..db27c0a 100644 --- a/frontend/elements/photo-lightbox.html +++ b/frontend/elements/photo-lightbox.html @@ -355,15 +355,10 @@ Polymer({ attached: function() { var base = document.querySelector("base"); if (base) { - base = new URL(base.href).pathname.replace(/\/$/, ""); /* Remove trailing slash if there */ + this.base = new URL(base.href).pathname.replace(/\/$/, "") + "/"; /* Make sure there is a trailing slash */ } else { - base = ""; + this.base = "/"; } - /* If base is configured, add a trailing slash */ - if (base.length) { - base += "/"; - } - this.base = base; } }); diff --git a/frontend/elements/photo-thumbnail.html b/frontend/elements/photo-thumbnail.html index e4b8520..39f9a8c 100755 --- a/frontend/elements/photo-thumbnail.html +++ b/frontend/elements/photo-thumbnail.html @@ -188,7 +188,7 @@ attached: function() { var base = document.querySelector("base"); if (base) { - this.base = new URL(base.href).pathname.replace(/\/$/, "") + "/"; /* Ensure trailing slash */ + this.base = new URL(base.href).pathname.replace(/\/$/, "") + "/"; /* Make sure there is a trailing slash */ } else { this.base = "/"; }