|
|
@ -7,8 +7,7 @@ $.onmount('[data-js-theme-selector]', function() { |
|
|
|
|
|
|
|
var new_theme = $(this).val(); |
|
|
|
var selected_text = $(this).find('option:selected').text(); |
|
|
|
var $setDefaultLink = $('#button-set-default-theme'); |
|
|
|
var $formDefaultValue = $('#input-set-default-theme'); |
|
|
|
var $setDefaultButton = $('#button-set-default-theme'); |
|
|
|
|
|
|
|
// persist the new theme for the user in their cookie
|
|
|
|
document.cookie = 'theme=' + new_theme + ';' + |
|
|
@ -24,19 +23,14 @@ $.onmount('[data-js-theme-selector]', function() { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// if a non-default theme was chosen, add the class to the body
|
|
|
|
if (new_theme) { |
|
|
|
$body.addClass('theme-' + new_theme); |
|
|
|
} |
|
|
|
|
|
|
|
// set the IC hidden input with the new value
|
|
|
|
$formDefaultValue.val(new_theme); |
|
|
|
// add the class for the new theme to the body
|
|
|
|
$body.addClass('theme-' + new_theme); |
|
|
|
|
|
|
|
// set visibility of 'Set as account default' link
|
|
|
|
if (selected_text.indexOf('(account default)') !== -1) { |
|
|
|
$setDefaultLink.css('visibility', 'hidden'); |
|
|
|
// set visibility of 'Set as account default' button
|
|
|
|
if (selected_text.indexOf('account default') === -1) { |
|
|
|
$setDefaultButton.removeClass('d-none'); |
|
|
|
} else { |
|
|
|
$setDefaultLink.css('visibility', 'visible'); |
|
|
|
$setDefaultButton.addClass('d-none'); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |