Skip to content

Instantly share code, notes, and snippets.

@csarven
Created March 6, 2015 22:54
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/5e05f29fbca9650d27e3 to your computer and use it in GitHub Desktop.
Save csarven/5e05f29fbca9650d27e3 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()) {
var s = $('<link>').prop({type: 'text/css', rel: 'stylesheet', href: $(this).prop('href'), title: $(this).prop('title')});
}
else {
var s = $('<link>').prop({type: 'text/css', rel: 'stylesheet alternate', href: $(this).prop('href'), title: $(this).prop('title')});
}
$(this).replaceWith(s.get(0), stylesheet);
});
$('#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