Advertisement
Shiny_

Untitled

Oct 19th, 2014
449
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name              Wykop - Fullscreen Mikro
  3. // @namespace         Dunno.
  4. // @description       Mikroblog na całą szerokość ekranu.
  5. // @author            Patryk "Linux__Shines" N.
  6. // @version           1.0.0.0
  7. // @include           http://*wykop.pl/mikroblog*
  8. // @include           http://*wykop.pl/moj*
  9. // @include           http://*wykop.pl/wpis*
  10. // @include           http://*wykop.pl/tag*
  11. // ==/UserScript==
  12.  
  13. var main = $("<li><a id='ChangeBar' title='Przełącz belkę'>Przełącz belkę</a></li>").insertBefore($("openNaturalSearch").parent());
  14. var bar = $(".grid-right");
  15. var grid = $(".grid-main");
  16. var wrap = grid.parent();
  17. var action = "click";
  18. var vis = "visible";
  19. var invis = "invisible";
  20.  
  21. var steering = {
  22.     Show: function() {
  23.         bar.show();
  24.         grid.css("width", "auto");
  25.         wrap.css("padding-right", "4px");
  26.         localStorage.BarStatus = vis;
  27.     },
  28.     Hide: function() {
  29.         bar.hide();
  30.         grid.css("width", "100%");
  31.         wrap.css("padding-right", 0);
  32.         localStorage.BarStatus = invis;
  33.     }
  34. };
  35. localStorage.BarStatus = localStorage.BarStatus || vis;
  36.  
  37. switch(localStorage.BarStatus) {
  38.     case vis: {
  39.         steering.Hide();
  40.         break;
  41.     }
  42. }
  43. main.on(action, function() {
  44.     switch(localStorage.BarStatus) {
  45.         case vis: {
  46.             steering.Hide();
  47.             break;
  48.         }
  49.         case invis: {
  50.             steering.Show();
  51.             break;
  52.         }
  53.     }
  54. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement