spee.ch/client/build/utils/oEmbed.js

36 lines
921 B
JavaScript
Raw Normal View History

2018-07-28 00:36:55 +02:00
"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) {
2018-07-28 00:56:56 +02:00
return url.replace(/\//g, '%2F').replace(/:/g, '%3A');
2018-07-28 00:36:55 +02:00
};
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',
2018-07-28 00:56:56 +02:00
href: "".concat(host, "/api/oembed?url=").concat(formatUrlForQuery(canonicalUrl), "%2F&format=xml"),
2018-07-28 00:36:55 +02:00
title: title
};
};
var _default = {
json: createJsonLinkData,
xml: createXmlLinkData
};
exports.default = _default;