OpenXE/classes/Modules/SendCloud/www/js/sendcloud.js

64 lines
1.4 KiB
JavaScript
Raw Normal View History

2021-05-21 08:49:41 +02:00
var SendCloud = (function ($) {
'use strict';
var me = {
isInitialized: false,
storage: {
$country: $('#land'),
$usStatesSelect: $('#us-states'),
$stateInput: $('#states')
},
/**
* @return void
*/
init: function () {
if (me.isInitialized === true) {
return;
}
me.registerEvents();
me.isInitialized = true;
},
/**
* @return {void}
*/
registerEvents: function () {
$(document).ready(function() {
if(me.storage.$country.val() === 'US'){
me.storage.$usStatesSelect.show();
me.storage.$stateInput.hide();
}else{
me.storage.$stateInput.show();
me.storage.$usStatesSelect.hide();
}
});
me.storage.$country.on('change', function () {
if(me.storage.$country.val() === 'US'){
me.storage.$usStatesSelect.show();
me.storage.$stateInput.hide();
}else{
me.storage.$usStatesSelect.hide();
me.storage.$stateInput.show();
}
});
},
};
return {
init: me.init,
};
})(jQuery);
$(document).ready(function () {
SendCloud.init();
});