Added affiliate parameters to scene URL.
This commit is contained in:
@@ -2,10 +2,13 @@
|
||||
<div class="page">
|
||||
<div class="header">
|
||||
<a
|
||||
:href="entity.url"
|
||||
:href="entityUrl"
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
class="link link-child"
|
||||
:data-umami-event="entity.affiliate ? 'entity-click-aff' : 'entity-click'"
|
||||
:data-umami-event-aff-id="entity.affiliate?.id"
|
||||
:data-umami-event-entity="entity.slug"
|
||||
>
|
||||
<template v-if="entity.hasLogo">
|
||||
<img
|
||||
@@ -113,6 +116,23 @@ const children = ref(null);
|
||||
const expanded = ref(false);
|
||||
|
||||
const scrollable = computed(() => children.value?.scrollWidth > children.value?.clientWidth);
|
||||
|
||||
const entityUrl = (() => {
|
||||
if (!entity.url) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!entity.affiliate?.parameters) {
|
||||
return entity.url;
|
||||
}
|
||||
|
||||
const newParams = new URLSearchParams({
|
||||
...Object.fromEntries(new URL(entity.url).searchParams),
|
||||
...Object.fromEntries(new URLSearchParams(entity.affiliate.parameters)),
|
||||
});
|
||||
|
||||
return `${entity.url}?${newParams}`;
|
||||
})();
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
@@ -92,7 +92,7 @@
|
||||
</div>
|
||||
|
||||
<Link
|
||||
:href="scene.url"
|
||||
:href="scene.watchUrl"
|
||||
:title="scene.date ? formatDate(scene.date.toISOString(), 'y-MM-dd hh:mm') : `Release date unknown, added ${formatDate(scene.createdAt, 'y-MM-dd')}`"
|
||||
target="_blank"
|
||||
class="date nolink"
|
||||
@@ -142,10 +142,13 @@
|
||||
-->
|
||||
|
||||
<Link
|
||||
v-if="scene.url"
|
||||
:href="scene.url"
|
||||
v-if="scene.watchUrl"
|
||||
:href="scene.watchUrl"
|
||||
target="_blank"
|
||||
class="button button-primary watch nolink"
|
||||
:data-umami-event="scene.affiliate ? 'watch-click-aff' : 'watch-click'"
|
||||
:data-umami-event-aff-id="scene.affiliate?.id"
|
||||
:data-umami-event-scene-id="scene.id"
|
||||
>Watch full video</Link>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user