mirror of
https://github.com/OpenXE-org/OpenXE.git
synced 2024-11-15 12:37:14 +01:00
64 lines
1.4 KiB
JavaScript
64 lines
1.4 KiB
JavaScript
|
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();
|
||
|
});
|