Set 'base' consistently from photo-lightbox, photo-thumbnail, and ketr-photos

Signed-off-by: James Ketrenos <james_git@ketrenos.com>
This commit is contained in:
James Ketr 2018-10-23 18:56:21 -07:00
parent 87ffebd737
commit 7f8650b0cf
2 changed files with 3 additions and 8 deletions

View File

@ -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;
}
});
</script>

View File

@ -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 = "/";
}