Skip to content

Instantly share code, notes, and snippets.

@csarven
Last active August 29, 2015 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save csarven/73179c36248087df409f to your computer and use it in GitHub Desktop.
Save csarven/73179c36248087df409f to your computer and use it in GitHub Desktop.
$('#views.lr button').on('click', function(event) {
var selected = $(this);
$('head link[rel~="stylesheet"]:not([href$="lr.css"])').each(function(i, stylesheet) {
if ($(this).prop('title').toLowerCase() == selected.text().toLowerCase()) {
$(this).prop('rel', 'stylesheet');
}
else {
$(this).prop('rel', 'stylesheet alternate');
}
stylesheet.parentNode.replaceChild(stylesheet, $(this).get(0));
});
$('#views.lr button:disabled').removeAttr('disabled');
$(this).attr('disabled', 'disabled');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment