Zachman61

Toggle Sidebar Content

Sep 27th, 2014
865
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name        Toggle Sidebar Content
  3. // @namespace   com.zeesixtyone.7s
  4. // @include     http://www.se7ensins.com/forums/
  5. // @version     1
  6. // @grant       none
  7. // ==/UserScript==
  8. $(document).ready(function () {
  9.   $('.widget > h3').append('<i class=\'pull-right slider fa fa-toggle-up\'></i>');
  10.   $('.widget > h3').click(function () {
  11.     // Changes the icon.
  12.     switch ($(this).find(".slider").hasClass("fa-toggle-up")) {
  13.       case true:
  14.          $(this).find(".slider").removeClass( "fa-toggle-up" ).addClass( "fa-toggle-down" );
  15.         break;
  16.       case false:
  17.         $(this).find(".slider").removeClass( "fa-toggle-down" ).addClass( "fa-toggle-up" );
  18.         break;
  19.     }
  20.     // Hides the potential content of each widget.
  21.     $(this).parent().find('#container').slideToggle();
  22.     $(this).parent().find('.avatarList').slideToggle();
  23.     $(this).parent().find('.userList').slideToggle();
  24.     $(this).parent().find('.pairsJustified').slideToggle();
  25.     $(this).parent().find('.statusPoster').slideToggle();
  26.     $(this).parent().find('.nonInitial').slideToggle();
  27.   });
  28. });
Advertisement
Add Comment
Please, Sign In to add comment