1 // XXX: Should I do crazy SN.X.Y.Z.A namespace instead?
2 var SN_WHITELIST = SN_WHITELIST || {};
4 SN_WHITELIST.updateButtons = function() {
5 var lis = $('ul > li > input[name^="username[]"]');
6 if (lis.length === 1) {
7 $("ul > li > a.remove_row").hide();
9 $("ul > li > a.remove_row:first").show();
13 SN_WHITELIST.resetRow = function(row) {
14 $("input", row).val('');
15 // Make sure the default domain is the first selection
16 $("select option:first", row).val();
17 $("a.remove_row", row).show();
20 SN_WHITELIST.addRow = function() {
21 var row = $(this).closest("li");
22 var newRow = row.clone();
23 SN_WHITELIST.resetRow(newRow);
24 $(newRow).insertAfter(row).show("blind", "slow", function() {
25 SN_WHITELIST.updateButtons();
29 SN_WHITELIST.removeRow = function() {
30 $(this).closest("li").hide("blind", "slow", function() {
32 SN_WHITELIST.updateButtons();
36 $(document).ready(function() {
37 $('.add_row').live('click', SN_WHITELIST.addRow);
38 $('.remove_row').live('click', SN_WHITELIST.removeRow);