aboutsummaryrefslogtreecommitdiff
path: root/bootstrap/comments/admin/views/blocklist/blocklist.js
blob: 4b04dbf21171853dd06a636d5c524f0f2544d502 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Wait for the page HTML to be parsed
document.addEventListener ('DOMContentLoaded', function () {
	// Get the "New Address" and "Save" buttons
	var newButton = document.getElementById ('new-button');
	var ipList = document.getElementById ('ip-list');
	var saveButton = document.getElementById ('save-button');

	newButton.onclick = function ()
	{
		// Create input and indentation
		var addresses = document.getElementsByClassName ('addresses');
		var indentation = document.createTextNode ('\n\t\t\t\t');

		// Clone the first address field
		var input = addresses[0].cloneNode (true);

		// Remove its value
		input.value = '';

		// Append indentation and input to IP address list
		ipList.appendChild (indentation);
		ipList.appendChild (input);
	};

	// Disable the "Save" button when clicked
	saveButton.onclick = function ()
	{
		this.disabled = true;
	};
}, false);