auto assign ask/show tags when story title has "(show|ask) lobsters"

and strip out that segment from the title since it is redundant
This commit is contained in:
joshua stein 2014-01-30 09:42:58 -06:00
parent 6ef2596eed
commit 479c02415e

View file

@ -346,6 +346,16 @@ $(document).ready(function() {
}
});
$(document).on("blur", "#story_title", function() {
var m;
if (m = $("#story_title").val().match(/^(show|ask) lobste\.?rs:? (.+)$/i)) {
var ta = $("#story_tags_a").data("select2");
if (ta.getVal().indexOf(m[1].toLowerCase()) < 0)
ta.addSelectedChoice({ id: m[1].toLowerCase() });
$("#story_title").val(m[2]);
}
});
$(document).on("click", "#story_guidelines_toggler", function() {
$("#story_guidelines").toggle();
return false;