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.type = "twitter-ready";
media.id = d; media.id = d;
success = true; 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')) { } else if (d.match('(www.)?youtube|youtu\.be')) {
if (d.match('v=')) { if (d.match('v=')) {
media.id = VMM.Util.getUrlVars(d)["v"]; media.id = VMM.Util.getUrlVars(d)["v"];
@ -117,20 +131,6 @@ if(typeof VMM != 'undefined' && typeof VMM.MediaType == 'undefined') {
media.type = "storify"; media.type = "storify";
media.id = d; media.id = d;
success = true; 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 { } else {
trace("unknown media"); trace("unknown media");
media.type = "unknown"; media.type = "unknown";

Loading…
Cancel
Save