PluginProbe
HTTP Headers / 1.2.0
HTTP Headers v1.2.0
1.19.5 trunk 1.0.0 1.1.0 1.1.1 1.1.2 1.10.0 1.10.1 1.10.2 1.10.3 1.10.4 1.10.5 1.11.0 1.12.0 1.12.1 1.12.2 1.13.0 1.13.1 1.13.2 1.13.3 1.13.4 1.14.0 1.14.1 1.14.2 1.15.0 All 60 releases
← All changes | assets/scripts.js +7 -195 1.14.01.2.0 View file →
@@ -3,68 +3,21 @@
3 3 "use strict";
4 4
5 5 $(document).on('change', 'select[name="hh_x_frame_options_value"]', function () {
6 6 var $el = $('input[name="hh_x_frame_options_domain"]'),
7 - readOnly = $(this).find('option:selected').val() != 'allow-from';
7 + disabled = $(this).find('option:selected').val() != 'allow-from' || this.disabled;
8 8 if ($el.length) {
9 - $el.prop('readOnly', readOnly).toggle(!readOnly);
9 + $el.prop('disabled', disabled).toggle(!disabled);
10 10 }
11 - }).on('change', 'select[name="hh_x_xxs_protection_value"]', function (e) {
12 - var $el = $('input[name="hh_x_xxs_protection_uri"]'),
13 - readOnly = $(this).find('option:selected').val() != '1; report=';
14 - if ($el.length) {
15 - $el.prop('readOnly', readOnly).toggle(!readOnly);
16 - }
17 - }).on('change', 'select[name="hh_x_powered_by_option"]', function () {
18 - var $el = $('input[name="hh_x_powered_by_value"]'),
19 - readOnly = $(this).find('option:selected').val() != 'set';
20 - if ($el.length) {
21 - $el.prop('readOnly', readOnly).toggle(!readOnly);
22 - }
23 - }).on("change", "input[name^='hh_vary_value[']", function () {
24 -
25 - if (this.name === "hh_vary_value[*]") {
26 - if (this.checked) {
27 - $("input[name^='hh_vary_value[']").not(this).prop("checked", false);
28 - }
29 - } else {
30 - if (this.checked) {
31 - $("input[name='hh_vary_value[*]']").prop("checked", false);
32 - }
33 - }
34 -
35 - }).on("change", "input[name^='hh_access_control_allow_methods_value[']", function () {
36 -
37 - if (this.name === "hh_access_control_allow_methods_value[*]") {
38 - if (this.checked) {
39 - $("input[name^='hh_access_control_allow_methods_value[']").not(this).prop("checked", false);
40 - }
41 - } else {
42 - if (this.checked) {
43 - $("input[name='hh_access_control_allow_methods_value[*]']").prop("checked", false);
44 - }
45 - }
46 -
47 11 }).on('change', 'select[name="hh_access_control_allow_origin_value"]', function () {
48 12 var $el = $('input[name="hh_access_control_allow_origin_url"]'),
49 - readOnly = $(this).find('option:selected').val() != 'origin';
13 + disabled = $(this).find('option:selected').val() != 'origin' || this.disabled;
50 14 if ($el.length) {
51 - $el.prop('readOnly', readOnly);//.toggle(!readOnly);
15 + $el.prop('disabled', disabled).toggle(!disabled);
52 16 }
53 - if (readOnly) {
54 - $(".hh-acao").addClass("hh-hidden");
55 - } else {
56 - $(".hh-acao").removeClass("hh-hidden");
57 - }
58 - }).on('change', 'select[name="hh_timing_allow_origin_value"]', function () {
59 - var $el = $('input[name="hh_timing_allow_origin_url"]'),
60 - readOnly = $(this).find('option:selected').val() != 'origin';
61 - if ($el.length) {
62 - $el.prop('readOnly', readOnly).toggle(!readOnly);
63 - }
64 17 }).on('change', '.http-header', function () {
65 18 var $this = $(this),
66 - $el = $this.closest('table').find('.http-header-value');
19 + $el = $this.closest('tr').find('.http-header-value');
67 20
68 21 if (!$el.length) {
69 22 return;
70 23 }
@@ -69,156 +22,15 @@
69 22 return;
70 23 }
71 24
72 25 if (Number($this.val()) === 1) {
73 - $el.prop('readOnly', false).removeAttr('readonly').removeClass('readonly');
26 + $el.prop('disabled', false);
74 27 } else {
75 - $el.prop('readOnly', true).addClass('readonly');
28 + $el.prop('disabled', true);
76 29 }
77 30 }).on('change', 'input[name="hh_x_frame_options"]', function () {
78 31 $('select[name="hh_x_frame_options_value"]').trigger('change');
79 - }).on('change', 'input[name="hh_x_powered_by"]', function () {
80 - $('select[name="hh_x_powered_by_option"]').trigger('change');
81 32 }).on('change', 'input[name="hh_access_control_allow_origin"]', function () {
82 33 $('select[name="hh_access_control_allow_origin_value"]').trigger('change');
83 - }).on('change', 'input[name="hh_timing_allow_origin"]', function () {
84 - $('select[name="hh_timing_allow_origin_value"]').trigger('change');
85 - }).on('submit', '#frmIspect', function (e) {
86 - e.preventDefault();
87 - var $this = $(this),
88 - $box = $('#hh-result').empty();
89 - $.post($this.attr('action'), $this.serialize()).done(function (data) {
90 - $box.html(data);
91 - });
92 - return false;
93 - }).on('change', '#authentication', function () {
94 - var $a = $('#box-authentication');
95 - if (this.checked) {
96 - $a.show();
97 - } else {
98 - $a.hide();
99 - }
100 - }).on('click', '#hh-btn-add-header', function () {
101 - $(this).closest('tr').before('<tr> \
102 - <td><input type="text" name="hh_custom_headers_value[name][]" class="http-header-value" placeholder="X-Custom-Name"></td> \
103 - <td><input type="text" name="hh_custom_headers_value[value][]" class="http-header-value" placeholder="' + hh.lbl_value + '"></td> \
104 - <td><button type="button" class="button button-small hh-btn-delete-header" title="' + hh.lbl_delete + '">x</button></td> \
105 - </tr>');
106 - }).on('click', '#hh-btn-add-endpoint', function () {
107 - var $this = $(this),
108 - index = Math.ceil(Math.random() * 9999),
109 - $table = $this.closest("table"),
110 - $clone = $table.find("tr:nth-child(2)").clone(),
111 - name = $table.find("tr:nth-last-child(2)").find(":input:first").attr("name"),
112 - m = name.match(/^hh_report_to_value\[(\d+)\]/),
113 - index = Number(m[1]) + 1;
114 -
115 - $clone.find('input[type="text"]').val("");
116 - $clone.find('input[type="checkbox"]').prop("checked", false);
117 - $clone.find("option:first").prop("selected", true);
118 - $clone.find("td:last").html('<button type="button" class="button button-small hh-btn-delete-endpoint" title="' + hh.lbl_delete + '">x</button>');
119 - $clone.find(":input").each(function () {
120 - this.name = this.name.replace('[0]', '[' + index + ']');
121 - });
122 -
123 - $this.closest('tr').before($clone);
124 - }).on('click', '.hh-btn-delete-header, .hh-btn-delete-endpoint, .hh-btn-delete-origin, .hh-btn-delete-user, .hh-btn-delete-ac', function () {
125 - $(this).closest('tr').remove();
126 - }).on("click", ".hh-btn-add-ac", function () {
127 - var $this = $(this);
128 - $this.closest('tr').before('<tr> \
129 - <td><input type="text" name="' + $this.data("name") + '" class="http-header-value" size="35" /></td> \
130 - <td><button type="button" class="button button-small hh-btn-delete-ac" title="' + hh.lbl_delete + '">x</button></td> \
131 - </tr>');
132 - }).on("click", ".hh-btn-add-origin", function () {
133 - $(this).closest('tr').before('<tr class="hh-acao"> \
134 - <td>&nbsp;</td> \
135 - <td><input type="text" name="hh_access_control_allow_origin_url[]" class="http-header-value" placeholder="http://domain.com" size="35" /></td> \
136 - <td><button type="button" class="button button-small hh-btn-delete-origin" title="' + hh.lbl_delete + '">x</button></td> \
137 - </tr>');
138 - }).on("click", ".hh-btn-add-user", function () {
139 - $(this).closest('tr').before('<tr> \
140 - <td>&nbsp;</td> \
141 - <td><input type="text" name="hh_www_authenticate_user[]" class="http-header-value" /></td> \
142 - <td><input type="text" name="hh_www_authenticate_pswd[]" class="http-header-value" /></td> \
143 - <td><button type="button" class="button button-small hh-btn-delete-user" title="' + hh.lbl_delete + '">x</button></td> \
144 - </tr>');
145 - }).on("click", ".hh-btn-import-choose", function () {
146 - $("#hh-import-file").trigger("click");
147 - }).on("change", "#hh-import-file", function () {
148 - $("#hh-import-name").html(this.files[0].name);
149 - }).on("change", 'select[name^="hh_feature_policy_value"]', function () {
150 - var $this = $(this),
151 - value = $this.find("option:selected").val(),
152 - $input = $this.siblings('input[name^="hh_feature_policy_origin"]');
153 - if (value === "'self'" || value === "origin(s)") {
154 - $input.show();
155 - } else {
156 - $input.hide();
157 - }
158 - }).on("change", 'input[name^="hh_content_security_policy_value"]', function () {
159 -
160 - var $this = $(this);
161 -
162 - if (this.checked) {
163 - if (/\[\*\]$/.test(this.name)) {
164 - $this.closest("td").find('input[type="checkbox"]').not(this).prop("checked", false);
165 - $this.closest("p").siblings("p").hide();
166 - } else {
167 - $this.closest("td").find('input[type="checkbox"][name$="[*]"]').prop("checked", false);
168 - }
169 - } else {
170 - if (/\[\*\]$/.test(this.name)) {
171 - $this.closest("p").siblings("p").show();
172 - }
173 - }
174 - }).on("change", 'input[type="checkbox"][name="hh_cookie_security_value[SameSite]"]', function () {
175 - if (this.checked) {
176 - $(".hh-csv-value")
177 - .removeClass("hh-hidden")
178 - .find('input[type="radio"]')
179 - .prop("disabled", false)
180 - .filter(":first")
181 - .prop("checked", true);
182 - } else {
183 - $(".hh-csv-value")
184 - .addClass("hh-hidden")
185 - .find('input[type="radio"]')
186 - .prop("disabled", true);
187 - }
188 - });
189 -
190 - $('.hh-tabs').on('click', 'ul a', function (e) {
191 - e.preventDefault();
192 -
193 - var $this = $(this);
194 - $($this.attr('href'))
195 - .removeClass('hh-hidden').addClass('hh-tab-active').attr('aria-hidden', 'false').attr('aria-expanded', 'true')
196 - .siblings('div').addClass('hh-hidden').removeClass('hh-tab-active').attr('aria-hidden', 'true').attr('aria-expanded', 'false');
197 - $this.closest('li')
198 - .addClass('hh-active').attr('aria-selected', 'true').attr('tabindex', 0)
199 - .siblings('li').removeClass('hh-active').attr('aria-selected', 'false').attr('tabindex', -1);
200 - }).each(function () {
201 - var $this = $(this),
202 - $ul = $this.children('ul').attr('role', 'tablist'),
203 - $li = $ul.children('li').attr('role', 'tab')
204 - .not(':first').attr('aria-selected', 'false').attr('tabindex', -1)
205 - .end().eq(0).attr('aria-selected', 'true').attr('tabindex', 0)
206 - .end(),
207 - $a = $li.find('a').attr('role', 'presentation').attr('tabindex', -1),
208 - $div = $this.children('div').attr('role', 'tabpanel')
209 - .not(':first').attr('aria-hidden', 'true').attr('aria-expanded', 'false')
210 - .end().eq(0).attr('aria-hidden', 'false').attr('aria-expanded', 'true')
211 - .end();
212 -
213 - $li.each(function (i) {
214 - var $this = $(this),
215 - id = 'hh-tabs-' + Math.ceil(Math.random() * 999999) + '-' + i,
216 - $a = $this.attr('aria-labelledby', id).find('a').attr('id', id),
217 - href = $a.attr('href');
218 - $this.attr('aria-controls', href.substring(1)).attr('aria-labelledby', id);
219 - $(href).attr('aria-labelledby', id);
220 - });
221 -
222 34 });
223 35 });
224 36 })(jQuery);