mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
24 lines
565 B
JavaScript
24 lines
565 B
JavaScript
//On page load
|
|
replace_ids = function(s){
|
|
var new_id = new Date().getTime();
|
|
return s.replace(/NEW_RECORD/g, new_id);
|
|
}
|
|
|
|
$(function() {
|
|
$('a[id*=nested]').click(function() {
|
|
var template = $(this).attr('href').replace(/.*#/, '');
|
|
html = replace_ids(eval(template));
|
|
$('#ul-' + $(this).attr('id')).append(html);
|
|
update_remove_links();
|
|
});
|
|
update_remove_links();
|
|
})
|
|
|
|
var update_remove_links = function() {
|
|
$('.remove').click(function() {
|
|
$(this).prevAll(':first').val(1);
|
|
$(this).parent().hide();
|
|
return false;
|
|
});
|
|
};
|