const Handlebars = require('handlebars');
const config = require('../config/speechConfig.js');
module.exports = {
googleAnalytics () {
const googleApiKey = config.analytics.googleId;
const gaCode = ``;
return new Handlebars.SafeString(gaCode);
},
addOpenGraph (title, mimeType, showUrl, source, description, thumbnail) {
if (!title || title.trim() === '') {
title = 'Spee.ch';
}
if (!description || description.trim() === '') {
description = 'Open-source, decentralized image and video sharing.';
}
const ogTitle = ``;
const ogUrl = ``;
const ogSiteName = ``;
const ogDescription = ``;
const ogImageWidth = '';
const ogImageHeight = '';
const basicTags = `${ogTitle} ${ogUrl} ${ogSiteName} ${ogDescription} ${ogImageWidth} ${ogImageHeight}`;
let ogImage = ``;
let ogImageType = ``;
let ogType = ``;
if (mimeType === 'video/mp4') {
const ogVideo = ``;
const ogVideoSecureUrl = ``;
const ogVideoType = ``;
ogImage = ``;
ogImageType = ``;
ogType = ``;
return new Handlebars.SafeString(`${basicTags} ${ogImage} ${ogImageType} ${ogType} ${ogVideo} ${ogVideoSecureUrl} ${ogVideoType}`);
} else {
if (mimeType === 'image/gif') {
ogType = ``;
};
return new Handlebars.SafeString(`${basicTags} ${ogImage} ${ogImageType} ${ogType}`);
}
},
addTwitterCard (mimeType, source, embedUrl, directFileUrl) {
const basicTwitterTags = ``;
if (mimeType === 'video/mp4') {
const twitterName = '';
const twitterPlayer = ``;
const twitterPlayerWidth = '';
const twitterTextPlayerWidth = '';
const twitterPlayerHeight = '';
const twitterPlayerStream = ``;
const twitterPlayerStreamContentType = '';
return new Handlebars.SafeString(`${basicTwitterTags} ${twitterName} ${twitterPlayer} ${twitterPlayerWidth} ${twitterTextPlayerWidth} ${twitterPlayerHeight} ${twitterPlayerStream} ${twitterPlayerStreamContentType}`);
} else {
const twitterCard = '';
return new Handlebars.SafeString(`${basicTwitterTags} ${twitterCard}`);
}
},
ifConditional (varOne, operator, varTwo, options) {
switch (operator) {
case '===':
return (varOne === varTwo) ? options.fn(this) : options.inverse(this);
case '!==':
return (varOne !== varTwo) ? options.fn(this) : options.inverse(this);
case '<':
return (varOne < varTwo) ? options.fn(this) : options.inverse(this);
case '<=':
return (varOne <= varTwo) ? options.fn(this) : options.inverse(this);
case '>':
return (varOne > varTwo) ? options.fn(this) : options.inverse(this);
case '>=':
return (varOne >= varTwo) ? options.fn(this) : options.inverse(this);
case '&&':
return (varOne && varTwo) ? options.fn(this) : options.inverse(this);
case '||':
return (varOne || varTwo) ? options.fn(this) : options.inverse(this);
case 'mod3':
return ((parseInt(varOne) % 3) === 0) ? options.fn(this) : options.inverse(this);
default:
return options.inverse(this);
}
},
};