Jaap Marcus 3 лет назад
Родитель
Сommit
b299b35a0d
3 измененных файлов с 48 добавлено и 39 удалено
  1. 8 1
      web/js/pages/edit_web.js
  2. 17 16
      web/templates/footer.php
  3. 23 22
      web/templates/pages/add_firewall_ipset.php

+ 8 - 1
web/js/pages/edit_web.js

@@ -213,7 +213,14 @@ $(function () {
 		var elm = $(evt.target);
 		App.Actions.WEB.passwordChanged(elm);
 	});
-	App.Actions.WEB.toggle_letsencrypt($('input[name=v_letsencrypt]'));
+	$('input[name=v_letsencrypt]').change(function (evt) {
+		var input = $(evt.target);
+		if (input.prop('checked')) {
+			$('#ssl-details').hide();
+		} else {
+			$('#ssl-details').show();
+		}
+	});
 
 	$('select[name="v_stats"]').change(function (evt) {
 		var select = $(evt.target);

+ 17 - 16
web/templates/footer.php

@@ -74,24 +74,25 @@
 <?php if (!empty($_SESSION["error_msg"])): ?>
 	<div>
 		<script>
-			// TODO: This is broken, $ is not defined
-			$(function() {
-				$('#dialog:ui-dialog').dialog('destroy');
-				$('#dialog-message').dialog({
-					modal: true,
-					resizable: false,
-					buttons: {
-						Ok: function() {
-							$(this).dialog('close');
+			window.onload=function(){
+				$(function() {
+					$('#dialog:ui-dialog').dialog('destroy');
+					$('#dialog-message').dialog({
+						modal: true,
+						resizable: false,
+						buttons: {
+							Ok: function() {
+								$(this).dialog('close');
+							}
+						},
+						create: function() {
+							var buttonGroup = $(this).closest(".ui-dialog").find('.ui-dialog-buttonset');
+							buttonGroup.find('button:first').addClass('button submit')
+							buttonGroup.find('button:last').addClass('button button-secondary cancel');
 						}
-					},
-					create: function() {
-						var buttonGroup = $(this).closest(".ui-dialog").find('.ui-dialog-buttonset');
-						buttonGroup.find('button:first').addClass('button submit')
-						buttonGroup.find('button:last').addClass('button button-secondary cancel');
-					}
+					});
 				});
-			});
+			}
 		</script>
 		<div id="dialog-message" title="">
 			<p><?= htmlentities($_SESSION["error_msg"]) ?></p>

+ 23 - 22
web/templates/pages/add_firewall_ipset.php

@@ -91,34 +91,35 @@
 	blacklist_iplists.sort(function (a, b) {
 		return a.name > b.name;
 	});
+	window.onload = function(){
+		$(function () {
+			var targetElement = document.getElementById('datasource_list');
 
-	$(function () {
-		var targetElement = document.getElementById('datasource_list');
-
-		// Blacklist
-		var newEl = document.createElement("option");
-		newEl.text = "<?= _("BLACKLIST") ?>";
-		newEl.disabled = true;
-		targetElement.appendChild(newEl);
-
-		blacklist_iplists.forEach(iplist => {
+			// Blacklist
 			var newEl = document.createElement("option");
-			newEl.text = iplist.name;
-			newEl.value = iplist.source;
+			newEl.text = "<?= _("BLACKLIST") ?>";
+			newEl.disabled = true;
 			targetElement.appendChild(newEl);
-		});
 
-		// IPVERSE
-		var newEl = document.createElement("option");
-		newEl.text = "<?= _("IPVERSE") ?>";
-		newEl.disabled = true;
-		targetElement.appendChild(newEl);
+			blacklist_iplists.forEach(iplist => {
+				var newEl = document.createElement("option");
+				newEl.text = iplist.name;
+				newEl.value = iplist.source;
+				targetElement.appendChild(newEl);
+			});
 
-		country_iplists.forEach(iplist => {
+			// IPVERSE
 			var newEl = document.createElement("option");
-			newEl.text = iplist.name;
-			newEl.value = iplist.source;
+			newEl.text = "<?= _("IPVERSE") ?>";
+			newEl.disabled = true;
 			targetElement.appendChild(newEl);
+
+			country_iplists.forEach(iplist => {
+				var newEl = document.createElement("option");
+				newEl.text = iplist.name;
+				newEl.value = iplist.source;
+				targetElement.appendChild(newEl);
+			});
 		});
-	});
+	}
 </script>