Browse Source

move check for blockquote and iframe to top of media type analysis (and check for tags not just strings) so as to not incorrectly try to pluck media out from the iframe or the blockquote. Closes #605

pull/605/merge
Joe Germuska 11 years ago
parent
commit
dde67610fd
  1. 28
      source/js/Core/Media/VMM.MediaType.js

28
source/js/Core/Media/VMM.MediaType.js

@ -23,6 +23,20 @@ if(typeof VMM != 'undefined' && typeof VMM.MediaType == 'undefined') {
media.type = "twitter-ready";
media.id = d;
success = true;
} else if (d.match('<blockquote')) {
media.type = "quote";
media.id = d;
success = true;
} else if (d.match('<iframe')) {
media.type = "iframe";
trace("IFRAME")
regex = /src=['"](\S+?)['"]\s/;
group = d.match(regex);
if (group) {
media.id = group[1];
}
trace( "iframe url: " + media.id );
success = Boolean(media.id);
} else if (d.match('(www.)?youtube|youtu\.be')) {
if (d.match('v=')) {
media.id = VMM.Util.getUrlVars(d)["v"];
@ -117,20 +131,6 @@ if(typeof VMM != 'undefined' && typeof VMM.MediaType == 'undefined') {
media.type = "storify";
media.id = d;
success = true;
} else if (d.match('blockquote')) {
media.type = "quote";
media.id = d;
success = true;
} else if (d.match('iframe')) {
media.type = "iframe";
trace("IFRAME")
regex = /src=['"](\S+?)['"]\s/;
group = d.match(regex);
if (group) {
media.id = group[1];
}
trace( "iframe url: " + media.id );
success = Boolean(media.id);
} else {
trace("unknown media");
media.type = "unknown";

Loading…
Cancel
Save