Guest User

Untitled

a guest
Aug 14th, 2015
1,171
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <script>
  2. $(window).on('action:widgets.loaded', function() {
  3.   if (!$('li.lights-out').length) {
  4.     var panel = $('<li class="lights-out"><a title="" href="#" data-original-title="Dark Theme"><i class="fa fa-fw fa-lightbulb-o"></i><span class="visible-xs-inline">Dark Theme</span></a></li>');
  5.     $('ul#logged-in-menu').prepend(panel);
  6.     $('ul#logged-out-menu').prepend(panel);
  7.     panel.on('click', function() {
  8.     enabled = !$('body').hasClass('lights-out');
  9.     $('body').toggleClass('lights-out',  enabled);
  10.     localStorage.setItem('user:theme', enabled ?  'lights-out' : '');
  11.     });      
  12.   }
  13. });
  14. </script>
  15.  
  16.  
  17. <script>
  18. $('document').ready(function() {
  19.     var theme = localStorage.getItem('user:theme');
  20.     if (theme) {
  21.         $('body').addClass(theme );
  22.     }
  23. });
  24. </script>
RAW Paste Data