2020-07-10 10:34:06 +00:00
|
|
|
const constants = require("../constants")
|
2020-01-18 15:38:14 +00:00
|
|
|
const collectors = require("../collectors")
|
2020-01-26 14:56:59 +00:00
|
|
|
const TimelineBaseMethods = require("./TimelineBaseMethods")
|
2020-07-10 10:34:06 +00:00
|
|
|
const {compile} = require("pug")
|
2020-01-18 15:38:14 +00:00
|
|
|
require("../testimports")(collectors)
|
|
|
|
|
2020-07-10 10:34:06 +00:00
|
|
|
const rssImageTemplate = compile(`
|
|
|
|
img(src=constants.website_origin+entry.getDisplayUrlP() alt=entry.getAlt() width=entry.data.dimensions.width height=entry.data.dimensions.height)
|
|
|
|
`)
|
|
|
|
const rssVideoTemplate = compile(`
|
|
|
|
video(src=constants.website_origin+entry.getVideoUrlP() controls preload="auto" width=entry.data.dimensions.width height=entry.data.dimensions.height)
|
|
|
|
`)
|
|
|
|
|
2020-01-26 14:56:59 +00:00
|
|
|
class TimelineChild extends TimelineBaseMethods {
|
2020-01-18 15:38:14 +00:00
|
|
|
/**
|
2020-01-26 14:56:59 +00:00
|
|
|
* @param {import("../types").GraphChildAll} data
|
2020-01-18 15:38:14 +00:00
|
|
|
*/
|
|
|
|
constructor(data) {
|
2020-01-26 14:56:59 +00:00
|
|
|
super()
|
2020-01-18 15:38:14 +00:00
|
|
|
this.data = data
|
|
|
|
}
|
2020-07-10 10:34:06 +00:00
|
|
|
|
|
|
|
getFeedItem() {
|
|
|
|
if (this.data.video_url) {
|
|
|
|
return rssVideoTemplate({entry: this, constants})
|
|
|
|
} else {
|
|
|
|
return rssImageTemplate({entry: this, constants})
|
|
|
|
}
|
|
|
|
}
|
2020-01-18 15:38:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = TimelineChild
|