Skip to content

Commit c87cc5e

Browse files
committed
Edits JavaScript files for formatting and linting
1 parent cee743d commit c87cc5e

File tree

2 files changed

+41
-43
lines changed

2 files changed

+41
-43
lines changed

js/hidecss.js

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
11
/* show/hide on checkbox click */
2-
function showMe (box) {
3-
4-
var chboxs = document.getElementsByName("mc_nuke_all_styles");
5-
var vis = "none";
6-
for(var i=0;i<chboxs.length;i++) {
7-
if(chboxs[i].checked){
8-
vis = "none";
9-
}
10-
else{
11-
var vis = "";
12-
vis = "";
13-
}
14-
}
15-
document.getElementById(box).style.display = vis;
16-
17-
18-
}
2+
// eslint-disable-next-line no-unused-vars -- used on window on click
3+
function showMe(box) {
4+
const chboxs = document.getElementsByName('mc_nuke_all_styles');
5+
let vis = 'none';
6+
for (let i = 0; i < chboxs.length; i++) {
7+
if (chboxs[i].checked) {
8+
vis = 'none';
9+
} else {
10+
vis = '';
11+
}
12+
}
13+
document.getElementById(box).style.display = vis;
14+
}

js/mailchimp.js

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,40 @@
11
/* Form submission functions for the MailChimp Widget */
2-
;(function($){
3-
$(function($) {
4-
// Change our submit type from HTML (default) to JS
5-
$('#mc_submit_type').val('js');
6-
7-
// Attach our form submitter action
8-
$('#mc_signup_form').ajaxForm({
9-
url: mailchimpSF.ajax_url,
10-
type: 'POST',
11-
dataType: 'text',
12-
beforeSubmit: mc_beforeForm,
13-
success: mc_success
14-
});
15-
});
16-
17-
function mc_beforeForm(){
2+
(function ($) {
3+
function mc_beforeForm() {
184
// Disable the submit button
19-
$('#mc_signup_submit').attr("disabled","disabled");
5+
$('#mc_signup_submit').attr('disabled', 'disabled');
206
}
21-
function mc_success(data){
7+
8+
function mc_success(data) {
229
// Re-enable the submit button
23-
$('#mc_signup_submit').removeAttr("disabled");
24-
10+
$('#mc_signup_submit').removeAttr('disabled');
11+
2512
// Put the response in the message div
2613
$('#mc_message').html(data);
27-
14+
2815
// See if we're successful, if so, wipe the fields
29-
var reg = new RegExp("class='mc_success_msg'", 'i');
30-
if (reg.test(data)){
31-
$('#mc_signup_form').each(function(){
16+
const reg = /class="|'mc_success_msg"|'/i;
17+
18+
if (reg.test(data)) {
19+
$('#mc_signup_form').each(function () {
3220
this.reset();
3321
});
3422
$('#mc_submit_type').val('js');
3523
}
36-
$.scrollTo('#mc_signup', {offset: {top: -28}});
24+
$.scrollTo('#mc_signup', { offset: { top: -28 } });
3725
}
38-
})(jQuery);
26+
27+
$(function ($) {
28+
// Change our submit type from HTML (default) to JS
29+
$('#mc_submit_type').val('js');
30+
31+
// Attach our form submitter action
32+
$('#mc_signup_form').ajaxForm({
33+
url: window.mailchimpSF.ajax_url,
34+
type: 'POST',
35+
dataType: 'text',
36+
beforeSubmit: mc_beforeForm,
37+
success: mc_success,
38+
});
39+
});
40+
})(window.jQuery);

0 commit comments

Comments
 (0)