Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,6 @@
"unicorn/prefer-array-find": "off",
"unicorn/prefer-add-event-listener": "off",
"unicorn/text-encoding-identifier-case": "off",
"unicorn/prefer-includes": "off",
"unicorn/prefer-modern-dom-apis": "off",
"unicorn/prefer-string-replace-all": "off",
"unicorn/no-useless-promise-resolve-reject": "off"
},
Expand Down
4 changes: 2 additions & 2 deletions js/admin/legacy-views.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@

function setDefaultPostStatus() {
const urlQuery = window.location.search.substring( 1 );
if ( urlQuery.indexOf( 'action=edit' ) === -1 ) {
if ( ! urlQuery.includes( 'action=edit' ) ) {
document.getElementById( 'post-visibility-display' ).textContent = frmAdminJs.private_label;
document.getElementById( 'hidden-post-visibility' ).value = 'private';
document.getElementById( 'visibility-radio-private' ).checked = true;
Expand Down Expand Up @@ -364,7 +364,7 @@
}
c = id;

if ( id.indexOf( '-search-input' ) !== -1 ) {
if ( id.includes( '-search-input' ) ) {
return;
}

Expand Down
8 changes: 4 additions & 4 deletions js/formidable.js
Original file line number Diff line number Diff line change
Expand Up @@ -1099,9 +1099,9 @@ function frmFrontFormJS() {
function maybeSlideOut( oldContent, newContent ) {
let c,
newClass = 'frm_slideout';
if ( newContent.indexOf( ' frm_slide' ) !== -1 ) {
if ( newContent.includes( ' frm_slide' ) ) {
c = oldContent.children();
if ( newContent.indexOf( ' frm_going_back' ) !== -1 ) {
if ( newContent.includes( ' frm_going_back' ) ) {
newClass += ' frm_going_back';
}
c.removeClass( 'frm_going_back' );
Expand Down Expand Up @@ -1173,7 +1173,7 @@ function frmFrontFormJS() {
if ( input ) {
if ( ! describedBy ) {
describedBy = id;
} else if ( describedBy.indexOf( id ) === -1 && describedBy.indexOf( 'frm_error_field_' ) === -1 ) {
} else if ( ! describedBy.includes( id ) && ! describedBy.includes( 'frm_error_field_' ) ) {
const errorFirst = input.dataset.errorFirst;
if ( errorFirst === '0' ) {
describedBy = describedBy + ' ' + id;
Expand Down Expand Up @@ -1902,7 +1902,7 @@ function frmFrontFormJS() {
uniqueIDInput.value = getUniqueKey();
object.append( uniqueIDInput );

if ( classList.indexOf( 'frm_ajax_submit' ) > -1 ) {
if ( classList.includes( 'frm_ajax_submit' ) ) {
const fileInputs = object.querySelectorAll( 'input[type="file"]' );
hasFileFields = Array.from( fileInputs ).filter( input => !! input.value ).length;
if ( hasFileFields < 1 ) {
Expand Down
32 changes: 16 additions & 16 deletions js/src/admin/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ window.frmAdminBuildJS = function() {
if ( cont.length && typeof target !== 'undefined' ) {
const className = target.parentElement.className;
if ( 'string' === typeof className ) {
if ( className.indexOf( 'frm_email_icons' ) > -1 || className.indexOf( 'frm_toggle' ) > -1 ) {
if ( className.includes( 'frm_email_icons' ) || className.includes( 'frm_toggle' ) ) {
// clicking on delete icon shouldn't open it
event.stopPropagation();
return;
Expand Down Expand Up @@ -706,7 +706,7 @@ window.frmAdminBuildJS = function() {
}

jQuery( b ).closest( '.frm_field_box' ).siblings().find( '.widget-inside' ).slideUp( 'fast' );
if ( ( typeof b.className !== 'undefined' && b.className.indexOf( 'widget-action' ) !== -1 ) || jQuery( b ).closest( '.start_divider' ).length < 1 ) {
if ( ( typeof b.className !== 'undefined' && b.className.includes( 'widget-action' ) ) || jQuery( b ).closest( '.start_divider' ).length < 1 ) {
return;
}

Expand Down Expand Up @@ -2812,7 +2812,7 @@ window.frmAdminBuildJS = function() {
}
}

if ( msg.indexOf( 'frm-collapse-page' ) !== -1 ) {
if ( msg.includes( 'frm-collapse-page' ) ) {
renumberPageBreaks();
}

Expand Down Expand Up @@ -5548,7 +5548,7 @@ window.frmAdminBuildJS = function() {
option.setAttribute( 'value', newValue );
option.textContent = newLabel;

if ( fieldIds.indexOf( logicId ) === -1 ) {
if ( ! fieldIds.includes( logicId ) ) {
fieldIds.push( logicId );
}
}
Expand Down Expand Up @@ -6266,7 +6266,7 @@ window.frmAdminBuildJS = function() {
function addRadioCheckboxOpt( type, opt, fieldId, fieldKey, isProduct, classes ) {
let other,
single = '',
isOther = opt.key.indexOf( 'other' ) !== -1,
isOther = opt.key.includes( 'other' ),
id = 'field_' + fieldKey + '-' + opt.key,
inputType = type === 'scale' ? 'radio' : type;

Expand Down Expand Up @@ -6314,7 +6314,7 @@ window.frmAdminBuildJS = function() {

for ( let i = 0; i < opts.length; i++ ) {
let label = opts[ i ].label,
isOther = opts[ i ].key.indexOf( 'other' ) !== -1;
isOther = opts[ i ].key.includes( 'other' );

if ( hasPlaceholder && label !== '' ) {
addBlankSelectOption( field, placeholder );
Expand Down Expand Up @@ -6344,7 +6344,7 @@ window.frmAdminBuildJS = function() {
opt.value = '';
opt.innerHTML = placeholder;
if ( firstChild !== null ) {
field.insertBefore( opt, firstChild );
firstChild.before( opt );
field.selectedIndex = 0;
} else {
field.append( opt );
Expand Down Expand Up @@ -7648,10 +7648,10 @@ window.frmAdminBuildJS = function() {
function clickAction( obj ) {
const $thisobj = jQuery( obj );

if ( obj.className.indexOf( 'selected' ) !== -1 ) {
if ( obj.className.includes( 'selected' ) ) {
return;
}
if ( obj.className.indexOf( 'edit_field_type_end_divider' ) !== -1 && $thisobj.closest( '.edit_field_type_divider' ).hasClass( 'no_repeat_section' ) ) {
if ( obj.className.includes( 'edit_field_type_end_divider' ) && $thisobj.closest( '.edit_field_type_divider' ).hasClass( 'no_repeat_section' ) ) {
return;
}

Expand Down Expand Up @@ -8517,7 +8517,7 @@ window.frmAdminBuildJS = function() {
if ( moreIcon.tagName === 'use' ) {
moreIcon = moreIcon.firstElementChild;

if ( getSVGHref( moreIcon ).indexOf( 'frm_close_icon' ) === -1 ) {
if ( ! getSVGHref( moreIcon ).includes( 'frm_close_icon' ) ) {
showShortcodeBox( moreIcon, 'nofocus' );
}
} else if ( ! moreIcon.classList.contains( 'frm_close_icon' ) ) {
Expand Down Expand Up @@ -8650,7 +8650,7 @@ window.frmAdminBuildJS = function() {
classes = getSVGHref( moreIcon );
}

if ( classes.indexOf( 'frm_close_icon' ) !== -1 ) {
if ( classes.includes( 'frm_close_icon' ) ) {
hideShortcodes( box );
} else {
updateShortcodesPopupPosition( moreIcon );
Expand Down Expand Up @@ -8921,7 +8921,7 @@ window.frmAdminBuildJS = function() {
function toggleAllowedHTML( input ) {
let b,
id = input.id;
if ( typeof id === 'undefined' || id.indexOf( '-search-input' ) !== -1 ) {
if ( typeof id === 'undefined' || id.includes( '-search-input' ) ) {
return;
}

Expand Down Expand Up @@ -9215,7 +9215,7 @@ window.frmAdminBuildJS = function() {
const multiple = s.indexOf( '|' );
jQuery( 'input[name="type[]"]' ).each( function() {
this.checked = false;
if ( s.indexOf( this.value ) >= 0 ) {
if ( s.includes( this.value ) ) {
this.disabled = false;
if ( multiple === -1 ) {
this.checked = true;
Expand Down Expand Up @@ -9545,7 +9545,7 @@ window.frmAdminBuildJS = function() {
items[ i ].classList.remove( 'frm_hidden' );
}
items[ i ].classList.remove( 'frm-search-result' );
} else if ( ( regEx && new RegExp( searchText ).test( innerText ) ) || innerText.indexOf( searchText ) >= 0 || textMatchesPlural( innerText, searchText ) ) {
} else if ( ( regEx && new RegExp( searchText ).test( innerText ) ) || innerText.includes( searchText ) || textMatchesPlural( innerText, searchText ) ) {
if ( itemCanBeShown && checkContextualShortcode( items[ i ] ) ) {
items[ i ].classList.remove( 'frm_hidden' );
}
Expand Down Expand Up @@ -9582,7 +9582,7 @@ window.frmAdminBuildJS = function() {
return false;
}

return ( text + 's' ).indexOf( searchText ) >= 0;
return ( text + 's' ).includes( searchText );
}

/**
Expand Down Expand Up @@ -10181,7 +10181,7 @@ window.frmAdminBuildJS = function() {
data: $hiddenForm.serialize() + '&action=frm_forms_preview'
} ).done( function( data ) {
const message = jQuery( data ).find( '.frm_message' ).text().trim();
if ( message.indexOf( 'Thanks!' ) === -1 ) {
if ( ! message.includes( 'Thanks!' ) ) {
handleEmailAddressError( 'invalid' );
return;
}
Expand Down
2 changes: 1 addition & 1 deletion js/src/core/ui/addProgressToCardBoxes.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function addProgressToCardBoxes( cardBoxes ) {
className: 'frm-card-box-progress-bar',
child: progressBar
} );
element.insertAdjacentElement( 'afterbegin', progressBarContainer );
element.prepend( progressBarContainer );
} );
}

Expand Down
4 changes: 2 additions & 2 deletions stripe/js/frmstrp.js
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@
let i;
let data;
const price = getPriceFields();
let run = price.indexOf( fieldId ) > -1 || price.indexOf( field.id ) > -1;
let run = price.includes( fieldId ) || price.includes( field.id );
if ( ! run ) {
for ( i = 0; i < price.length; i++ ) {
if ( field.id.indexOf( price[ i ] ) === 0 ) {
Expand Down Expand Up @@ -669,7 +669,7 @@
* @return {void}
*/
function replaceEmailField( emailField, emailInput, authenticationMountTarget ) {
emailField.insertBefore( authenticationMountTarget, emailInput );
emailInput.before( authenticationMountTarget );
emailInput.type = 'hidden';
const emailLabel = emailField.querySelector( '.frm_primary_label' );

Expand Down
Loading