(function () {
'use strict';
var selector = {
$button: document.querySelector('a'),
$one: document.querySelector('.one'),
$two: document.querySelector('.two')
};
selector.$button.addEventListener('click', function (event) {
event.preventDefault();
if (isHidden(selector.$one)) {
changeDisplay(selector.$one, 'block');
changeDisplay(selector.$two, 'none');
} else {
changeDisplay(selector.$one, 'none');
changeDisplay(selector.$two, 'block');
}
});
function changeDisplay($node, value) {
$node.style.display = value;
return $node;
}
function isHidden($node) {
return window.getComputedStyle($node).display === 'none';
}
}());