Merge pull request #773 from pelmers/ppp

Add a pastebin plugin
paste-quickfix
Lorenz Hübschle-Schneider 9 years ago
commit a4d0b4261b
  1. 16
      js/plugins.js
  2. 8
      test/unit/plugins.js

@ -455,6 +455,20 @@ plugins.factory('userPlugins', function() {
} }
}); });
var pastebinPlugin = new UrlPlugin('Pastebin', function(url) {
var regexp = /^http:\/\/pastebin.com\/([^.?]+)/i;
var match = url.match(regexp);
if (match) {
var id = match[1],
embedurl = "http://pastebin.com/embed_iframe/" + id,
element = angular.element('<iframe></iframe>')
.attr('src', embedurl)
.attr('width', '100%')
.attr('height', '480');
return element.prop('outerHTML');
}
});
/* match giphy links and display the assocaited gif images /* match giphy links and display the assocaited gif images
* sample input: http://giphy.com/gifs/eyes-shocked-bird-feqkVgjJpYtjy * sample input: http://giphy.com/gifs/eyes-shocked-bird-feqkVgjJpYtjy
* sample output: https://media.giphy.com/media/feqkVgjJpYtjy/giphy.gif * sample output: https://media.giphy.com/media/feqkVgjJpYtjy/giphy.gif
@ -522,7 +536,7 @@ plugins.factory('userPlugins', function() {
}); });
return { return {
plugins: [youtubePlugin, dailymotionPlugin, allocinePlugin, imagePlugin, videoPlugin, audioPlugin, spotifyPlugin, cloudmusicPlugin, googlemapPlugin, asciinemaPlugin, yrPlugin, gistPlugin, giphyPlugin, tweetPlugin, vinePlugin] plugins: [youtubePlugin, dailymotionPlugin, allocinePlugin, imagePlugin, videoPlugin, audioPlugin, spotifyPlugin, cloudmusicPlugin, googlemapPlugin, asciinemaPlugin, yrPlugin, gistPlugin, pastebinPlugin, giphyPlugin, tweetPlugin, vinePlugin]
}; };

@ -139,6 +139,14 @@ describe('filter', function() {
plugins); plugins);
})); }));
it('should recognize pastebins', inject(function(plugins) {
expectTheseMessagesToContain([
'http://pastebin.com/Wn3TetSE',
],
'Pastebin',
plugins);
}));
it('should recognize giphy gifs', inject(function(plugins) { it('should recognize giphy gifs', inject(function(plugins) {
expectTheseMessagesToContain([ expectTheseMessagesToContain([
'https://giphy.com/gifs/eyes-shocked-bird-feqkVgjJpYtjy/', 'https://giphy.com/gifs/eyes-shocked-bird-feqkVgjJpYtjy/',

Loading…
Cancel
Save