|
@@ -1,63 +1,63 @@
|
|
|
$(document).ready(function () {
|
|
|
'use strict';
|
|
|
|
|
|
- $('#switcher ').hover(function() {
|
|
|
+
|
|
|
+ $('#switcher').hover(function() {
|
|
|
$(this).addClass('hover');
|
|
|
}, function() {
|
|
|
$(this).removeClass('hover');
|
|
|
});
|
|
|
-});
|
|
|
-
|
|
|
-$(document).ready(function () {
|
|
|
- 'use strict';
|
|
|
|
|
|
+
|
|
|
var toggleSwitcher = function(event) {
|
|
|
if (!$(event.target).is('button')) {
|
|
|
$('#switcher button').toggleClass('hidden');
|
|
|
}
|
|
|
};
|
|
|
-
|
|
|
$('#switcher').on('click', toggleSwitcher);
|
|
|
+
|
|
|
+
|
|
|
$('#switcher').click();
|
|
|
|
|
|
- $('#switcher button').click(function () {
|
|
|
+
|
|
|
+
|
|
|
+ var setBodyClass = function (className) {
|
|
|
+ $('body').removeClass().addClass(className);
|
|
|
+
|
|
|
+ $('#switcher button').removeClass('selected');
|
|
|
+ $('#switcher-' + className).addClass('selected');
|
|
|
+
|
|
|
$('#switcher').off('click', toggleSwitcher);
|
|
|
|
|
|
- if (this.id === 'switcher-default') {
|
|
|
+ if (className == 'default') {
|
|
|
$('#switcher').on('click', toggleSwitcher);
|
|
|
}
|
|
|
+ };
|
|
|
|
|
|
- });
|
|
|
-});
|
|
|
-
|
|
|
-$(document).ready(function () {
|
|
|
- 'use strict';
|
|
|
+
|
|
|
$('#switcher-default').addClass('selected');
|
|
|
|
|
|
+
|
|
|
+ var triggers = {
|
|
|
+ D: 'default',
|
|
|
+ N: 'narrow',
|
|
|
+ L: 'large'
|
|
|
+ };
|
|
|
+
|
|
|
+
|
|
|
$('#switcher').click(function(event) {
|
|
|
if ($(event.target).is('button')) {
|
|
|
var bodyClass = event.target.id.split('-')[1];
|
|
|
-
|
|
|
- $('body').removeClass().addClass(bodyClass);
|
|
|
-
|
|
|
- $('#switcher button').removeClass('selected');
|
|
|
- $(event.target).addClass('selected');
|
|
|
+ setBodyClass(bodyClass);
|
|
|
}
|
|
|
});
|
|
|
-});
|
|
|
|
|
|
-$(document).ready(function () {
|
|
|
- 'use strict';
|
|
|
- var triggers = {
|
|
|
- D: 'default',
|
|
|
- N: 'narrow',
|
|
|
- L: 'large'
|
|
|
- };
|
|
|
+
|
|
|
|
|
|
$(document).keyup(function (event) {
|
|
|
var key = String.fromCharCode(event.which);
|
|
|
if (key in triggers) {
|
|
|
- $('#switcher-' + triggers[key]).click();
|
|
|
+ setBodyClass(triggers[key]);
|
|
|
}
|
|
|
});
|
|
|
});
|