aboutsummaryrefslogtreecommitdiff
path: root/bootstrap/comments/admin/views/blocklist/blocklist.js
diff options
context:
space:
mode:
Diffstat (limited to 'bootstrap/comments/admin/views/blocklist/blocklist.js')
-rw-r--r--bootstrap/comments/admin/views/blocklist/blocklist.js30
1 files changed, 30 insertions, 0 deletions
diff --git a/bootstrap/comments/admin/views/blocklist/blocklist.js b/bootstrap/comments/admin/views/blocklist/blocklist.js
new file mode 100644
index 0000000..4b04dbf
--- /dev/null
+++ b/bootstrap/comments/admin/views/blocklist/blocklist.js
@@ -0,0 +1,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);