Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix conflict with Revolution Slider #87

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions admin/js/modules/SyncCountriesChoice.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { FieldOnlyCountries } from './Fields/FieldOnlyCountries.js'
import { FieldPrefferedCountries } from './Fields/FieldPrefferedCountries.js'
import { FieldExcludeCountries } from './Fields/FieldExcludeCountries.js'
import { codesISO2European, codesISO2 } from '../utils.js'
import { codesISO2European, codesISO2, nfspnRemoveValue } from '../utils.js'

const $ = jQuery

Expand Down Expand Up @@ -77,7 +77,7 @@ export class SyncCountriesChoice {
FieldOnly.setFieldValue('all', true)
} else if (currentValue.includes('european')) {
let onlyCountries = [...codesISO2European]
onlyCountries = onlyCountries.concat(FieldOnly.getOptions('selected', 'value').remove('european'))
onlyCountries = onlyCountries.concat(nfspnRemoveValue(FieldOnly.getOptions('selected', 'value'), 'european'))

// Handle Field Only
FieldOnly.disableOptions(codesISO2European, true)
Expand Down
5 changes: 0 additions & 5 deletions admin/js/ninja-forms-spn-addon-admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@

import { SyncCountriesChoice } from './modules/SyncCountriesChoice.js'

/* eslint no-extend-native: ["error", { "exceptions": ["Array"] }] */
Array.prototype.remove = function (value) {
return this.filter(function (element) { return element !== value })
};

/**
* SyncCountriesChoice
*/
Expand Down
6 changes: 5 additions & 1 deletion admin/js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,8 @@ function propSelected ($selector, value) {
}
}

export { propDisabled, propSelected, codesISO2, codesISO2European }
function nfspnRemoveValue (obj, value) {
return obj.filter(function (element) { return element !== value })
}

export { propDisabled, propSelected, nfspnRemoveValue, codesISO2, codesISO2European }
2 changes: 1 addition & 1 deletion dist/admin/spn-back-main.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/public/spn-front-main.min.js

Large diffs are not rendered by default.

11 changes: 3 additions & 8 deletions public/js/modules/ITIInitializer.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @since 1.2.0
*/

import { codesISO2European } from '../utils.js'
import { codesISO2European, nfspnRemoveValue } from '../utils.js'
import $ from 'jquery'
import intlTelInput from 'intl-tel-input'
import intlTelInputUtils from 'intl-tel-input/build/js/utils.js'
Expand Down Expand Up @@ -109,10 +109,10 @@ class IntlTelInputInitializer {
})

if (onlyCountries.includes('all')) {
onlyCountries = onlyCountries.remove('all')
onlyCountries = nfspnRemoveValue(onlyCountries, 'all')
onlyCountries = onlyCountries.concat(codesISO2)
} else if (onlyCountries.includes('european')) {
onlyCountries = onlyCountries.remove('european')
onlyCountries = nfspnRemoveValue(onlyCountries, 'european')
onlyCountries = onlyCountries.concat(codesISO2European)
}
return {
Expand Down Expand Up @@ -182,9 +182,4 @@ class IntlTelInputInitializer {
* @returns {Array} New Array without given value
*/

/* eslint no-extend-native: ["error", { "exceptions": ["Array"] }] */
Array.prototype.remove = function (value) {
return this.filter(function (element) { return element !== value })
}

export { IntlTelInputInitializer }
6 changes: 5 additions & 1 deletion public/js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,8 @@ const codesISO2European = [
'si', 'es', 'se', 'ch', 'ua', 'gb'
]

export { codesISO2European }
function nfspnRemoveValue (obj, value) {
return obj.filter(function (element) { return element !== value })
}

export { codesISO2European, nfspnRemoveValue }