diff --git a/js/plugins.js b/js/plugins.js
index ba6fa87..c2c26cd 100644
--- a/js/plugins.js
+++ b/js/plugins.js
@@ -206,11 +206,14 @@ plugins.factory('userPlugins', function() {
if (url) {
url = url[0]; /* Actually parse one url per message */
- if (url.match(/png$|gif$|jpg$|jpeg$/)) {
+ if (url.match(/\.(png|gif|jpg|jpeg)$/)) {
/* A fukung.net URL may end by an image extension but is not a direct link. */
- if (url.indexOf("fukung.net/v/") != -1) {
+ if (url.indexOf("^https?://fukung.net/v/") != -1) {
url = url.replace(/.*\//, "http://media.fukung.net/imgs/");
+ } else if (url.match(/^http:\/\/(i\.)?imgur\.com\//i)) {
+ // remove protocol specification to load over https if used by g-b
+ url = url.replace(/http:/, "");
}
content = '';
@@ -232,12 +235,12 @@ plugins.factory('userPlugins', function() {
var url = match[0];
/* SoundCloud http://help.soundcloud.com/customer/portal/articles/247785-what-widgets-can-i-use-from-soundcloud- */
- if (url.indexOf("soundcloud.com") != -1) {
+ if (url.match(/^https?:\/\/soundcloud.com\//)) {
return '';
}
/* MixCloud */
- if (url.indexOf("mixcloud.com") != -1) {
+ if (url.match(/^https?:\/\/([a-z]+\.)?mixcloud.com\//)) {
return '';
}
}
@@ -256,8 +259,7 @@ plugins.factory('userPlugins', function() {
if (match) {
var url = match[0];
- /* SoundCloud http://help.soundcloud.com/customer/portal/articles/247785-what-widgets-can-i-use-from-soundcloud- */
- if (url.match(/google.*maps/)) {
+ if (url.match(/^https?:\/\/maps\.google\./i) || url.match(/^https?:\/\/([^\w]+\.)?google\.[^\w]+\/maps/i)) {
return '';
}
}
@@ -271,7 +273,7 @@ plugins.factory('userPlugins', function() {
*/
var asciinemaPlugin = new Plugin(function(message) {
- var regexp = /http(s){0,1}:\/\/(www\.){0,1}asciinema.org\/a\/(\d+)/;
+ var regexp = /^https?:\/\/(www\.)?asciinema.org\/a\/(\d+)/;
var match = message.match(regexp);
if (match) {
var id = match[3];