1var updatableSlug = true; 2/* jQuery because BS brings it in; trivial to remove */ 3function sluggify(str) { 4 if (!str) { 5 return ""; 6 } 7 /* we could check for the existence of a slug too */ 8 return str.toLowerCase() /* no uppercase in slug */ 9 .replace(/[^a-z0-9-]/g, "-") /* get rid of non-alphanumerics/hyphen */ 10 .replace(/--+/g, "-") /* get rid of doubled up hyphens */ 11 .replace(/-$/g, "") /* get rid of trailing hyphens */ 12 .replace(/^-/g, "") /* and leading ones too */; 13} 14function updateSlugMaybe(source) { 15 if (updatableSlug) { 16 $("#slug").val(sluggify($(source).val())) 17 } 18} 19/* if the slug box has its own value entered, don't overwrite */ 20function slugBlur(source) { 21 /* is the slug empty, or is the same as a sluggified name? if so, make it changeable */ 22 var val = $(source).val(); 23 updatableSlug = !val || (sluggify($("#name").val()) == val); 24}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.