automatically assign the video tag for youtube.com urls
This commit is contained in:
parent
600b1c2b93
commit
66917339cc
|
@ -113,14 +113,21 @@
|
||||||
Lobsters.previewStory($(this).parents("form").first());
|
Lobsters.previewStory($(this).parents("form").first());
|
||||||
});
|
});
|
||||||
|
|
||||||
/* if the url looks like a pdf, select the pdf tag */
|
|
||||||
$("#story_url").unbind().live("blur", function() {
|
$("#story_url").unbind().live("blur", function() {
|
||||||
|
/* if the url looks like a pdf, assign the pdf tag */
|
||||||
if ($("#story_url").val().match(/\.pdf$/i)) {
|
if ($("#story_url").val().match(/\.pdf$/i)) {
|
||||||
var ta = $("#story_tags_a").data("select2");
|
var ta = $("#story_tags_a").data("select2");
|
||||||
|
|
||||||
if (ta.getVal().indexOf("pdf") < 0)
|
if (ta.getVal().indexOf("pdf") < 0)
|
||||||
ta.addSelectedChoice({ id: "pdf" });
|
ta.addSelectedChoice({ id: "pdf" });
|
||||||
}
|
}
|
||||||
|
/* if the url looks like a youtube url, assign the video tag */
|
||||||
|
else if ($("#story_url").val().match(/[\/\.]youtube\.com\//i)) {
|
||||||
|
var ta = $("#story_tags_a").data("select2");
|
||||||
|
|
||||||
|
if (ta.getVal().indexOf("video") < 0)
|
||||||
|
ta.addSelectedChoice({ id: "video" });
|
||||||
|
}
|
||||||
});
|
});
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue