The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/app/spotify/lib/client/widget.js

16 lines
604 B

import { Template } from 'meteor/templating';
Template.registerHelper('replace', function(source, find, replace, option) {
if (option.hash.regex === true) {
find = new RegExp(find);
}
return source.replace(find, replace);
});
Template.registerHelper('match', (source, regex) => new RegExp(regex).test(source));
Template.oembedBaseWidget.onCreated(function() {
if (this.data && (this.data.meta && /^(music\.song|music\.album)$/.test(this.data.meta.ogType)) && this.data.parsedUrl && this.data.parsedUrl.host === 'open.spotify.com') {
this.data._overrideTemplate = 'oembedSpotifyWidget';
}
});