spee.ch/client/build/utils/oEmbed.js
2018-07-27 15:56:56 -07:00

36 lines
No EOL
921 B
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var rel = 'alternate';
var title = 'spee.ch oEmbed profile';
var formatUrlForQuery = function formatUrlForQuery(url) {
return url.replace(/\//g, '%2F').replace(/:/g, '%3A');
};
var createJsonLinkData = function createJsonLinkData(host, canonicalUrl) {
return {
rel: rel,
type: 'application/json+oembed',
href: "".concat(host, "/api/oembed?url=").concat(formatUrlForQuery(canonicalUrl), "%2F&format=json"),
title: title
};
};
var createXmlLinkData = function createXmlLinkData(host, canonicalUrl) {
return {
rel: rel,
type: 'application/xml+oembed',
href: "".concat(host, "/api/oembed?url=").concat(formatUrlForQuery(canonicalUrl), "%2F&format=xml"),
title: title
};
};
var _default = {
json: createJsonLinkData,
xml: createXmlLinkData
};
exports.default = _default;