Skip to content

Commit

Permalink
make same chagnes from #682 into our branch and src file here
Browse files Browse the repository at this point in the history
  • Loading branch information
tw2113 committed Sep 18, 2024
1 parent 52876d4 commit 7cbbd48
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions assets/js/ctct-plugin-admin/optins.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ window.CTCT_OptIns = {};
app.cache = () => {
app.cache = {
optinNoConn: document.querySelectorAll( '#cmb2-metabox-ctct_1_optin_metabox #_ctct_opt_in_not_connected' ),
list: document.querySelectorAll('#cmb2-metabox-ctct_0_list_metabox .attached-posts-wrap .attached li'),
list: document.querySelectorAll('#cmb2-metabox-ctct_0_list_metabox .attached-posts-wrap .retrieved li'),
title: document.querySelectorAll( '#cmb2-metabox-ctct_1_optin_metabox .cmb2-id-email-optin-title' ),
optin: document.querySelectorAll( '#cmb2-metabox-ctct_1_optin_metabox .cmb2-id--ctct-opt-in' ),
instruct: document.querySelectorAll( '#cmb2-metabox-ctct_1_optin_metabox .cmb2-id--ctct-opt-in-instructions' )
Expand All @@ -37,10 +37,8 @@ window.CTCT_OptIns = {};
*/
app.bindEvents = () => {

// Only fire show/hide if we have the normal checkbox.
if ( app.cache.optinNoConn.length ) {

// Fire once to get our loaded state set up.
app.toggleNoConnectionFields();

// Bind to fire when needed.
Expand All @@ -49,11 +47,7 @@ window.CTCT_OptIns = {};
app.toggleNoConnectionFields();
});
});
}

// Only fire show/hide if we have the normal checkbox.
if ( app.cache.list.length ) {

} else {
// Fire once to get our loaded state set up.
app.toggleConnectionFields();

Expand All @@ -63,7 +57,6 @@ window.CTCT_OptIns = {};
app.toggleConnectionFields();
});
})

}
};

Expand Down Expand Up @@ -94,7 +87,7 @@ window.CTCT_OptIns = {};
app.toggleConnectionFields = () => {

// If checked, show them, else hide it.
if ( 0 <= app.cache.list.length ) {
if ( 0 < app.cache.list.length ) {
Array.from(app.cache.title).forEach((item) => {
item.style.display = 'block';
});
Expand Down

0 comments on commit 7cbbd48

Please sign in to comment.