Fixed include object. Fixed qu's undefined URL handling.
This commit is contained in:
@@ -7,8 +7,8 @@ function include(argv) {
|
||||
photos: argv.media && argv.photos,
|
||||
poster: argv.media && argv.posters,
|
||||
posters: argv.media && argv.posters,
|
||||
releases: argv.withScenes,
|
||||
scenes: argv.withScenes,
|
||||
releases: argv.actorsScenes,
|
||||
scenes: argv.actorsScenes,
|
||||
teaser: argv.media && argv.videos && argv.teasers,
|
||||
teasers: argv.media && argv.videos && argv.teasers,
|
||||
trailer: argv.media && argv.videos && argv.trailers,
|
||||
|
||||
@@ -40,6 +40,10 @@ function formatDate(dateValue, format, inputFormat) {
|
||||
}
|
||||
|
||||
function prefixUrl(urlValue, origin, protocol = 'https') {
|
||||
if (!urlValue) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (/^http/.test(urlValue)) {
|
||||
return urlValue;
|
||||
}
|
||||
@@ -52,7 +56,11 @@ function prefixUrl(urlValue, origin, protocol = 'https') {
|
||||
return `${origin}${urlValue}`;
|
||||
}
|
||||
|
||||
return `${origin}/${urlValue}`;
|
||||
if (origin) {
|
||||
return `${origin}/${urlValue}`;
|
||||
}
|
||||
|
||||
return urlValue;
|
||||
}
|
||||
|
||||
function q(context, selector, attrArg, applyTrim = true) {
|
||||
@@ -217,7 +225,7 @@ function images(context, selector = 'img', attr, { origin, protocol = 'https' }
|
||||
function url(context, selector = 'a', attr = 'href', { origin, protocol = 'https' } = {}) {
|
||||
const urlEl = q(context, selector, attr);
|
||||
|
||||
return attr ? prefixUrl(urlEl, origin, protocol) : urlEl;
|
||||
return prefixUrl(urlEl, origin, protocol);
|
||||
}
|
||||
|
||||
function urls(context, selector = 'a', attr = 'href', { origin, protocol = 'https' } = {}) {
|
||||
|
||||
Reference in New Issue
Block a user