Skip to content

Commit

Permalink
Edits JavaScript files for formatting and linting
Browse files Browse the repository at this point in the history
  • Loading branch information
nateconley committed Jun 6, 2024
1 parent cee743d commit c87cc5e
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 43 deletions.
30 changes: 13 additions & 17 deletions js/hidecss.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
/* show/hide on checkbox click */
function showMe (box) {

var chboxs = document.getElementsByName("mc_nuke_all_styles");
var vis = "none";
for(var i=0;i<chboxs.length;i++) {
if(chboxs[i].checked){
vis = "none";
}
else{
var vis = "";
vis = "";
}
}
document.getElementById(box).style.display = vis;


}
// eslint-disable-next-line no-unused-vars -- used on window on click
function showMe(box) {
const chboxs = document.getElementsByName('mc_nuke_all_styles');
let vis = 'none';
for (let i = 0; i < chboxs.length; i++) {
if (chboxs[i].checked) {
vis = 'none';
} else {
vis = '';
}
}
document.getElementById(box).style.display = vis;
}
54 changes: 28 additions & 26 deletions js/mailchimp.js
Original file line number Diff line number Diff line change
@@ -1,38 +1,40 @@
/* Form submission functions for the MailChimp Widget */
;(function($){
$(function($) {
// Change our submit type from HTML (default) to JS
$('#mc_submit_type').val('js');

// Attach our form submitter action
$('#mc_signup_form').ajaxForm({
url: mailchimpSF.ajax_url,
type: 'POST',
dataType: 'text',
beforeSubmit: mc_beforeForm,
success: mc_success
});
});

function mc_beforeForm(){
(function ($) {
function mc_beforeForm() {
// Disable the submit button
$('#mc_signup_submit').attr("disabled","disabled");
$('#mc_signup_submit').attr('disabled', 'disabled');
}
function mc_success(data){

function mc_success(data) {
// Re-enable the submit button
$('#mc_signup_submit').removeAttr("disabled");
$('#mc_signup_submit').removeAttr('disabled');

// Put the response in the message div
$('#mc_message').html(data);

// See if we're successful, if so, wipe the fields
var reg = new RegExp("class='mc_success_msg'", 'i');
if (reg.test(data)){
$('#mc_signup_form').each(function(){
const reg = /class="|'mc_success_msg"|'/i;

if (reg.test(data)) {
$('#mc_signup_form').each(function () {
this.reset();
});
$('#mc_submit_type').val('js');
}
$.scrollTo('#mc_signup', {offset: {top: -28}});
$.scrollTo('#mc_signup', { offset: { top: -28 } });
}
})(jQuery);

$(function ($) {
// Change our submit type from HTML (default) to JS
$('#mc_submit_type').val('js');

// Attach our form submitter action
$('#mc_signup_form').ajaxForm({
url: window.mailchimpSF.ajax_url,
type: 'POST',
dataType: 'text',
beforeSubmit: mc_beforeForm,
success: mc_success,
});
});
})(window.jQuery);

0 comments on commit c87cc5e

Please sign in to comment.