Skip to content

Instantly share code, notes, and snippets.

@smeevil
Last active August 29, 2015 14:15
Show Gist options
  • Save smeevil/a9ba307332dcf4110375 to your computer and use it in GitHub Desktop.
Save smeevil/a9ba307332dcf4110375 to your computer and use it in GitHub Desktop.
Toggle irccloud cruft
// ==UserScript==
// @name Minimal Irc Cloud
// @namespace http://govannon.nl/
// @version 0.1
// @description Add a button to toggle minimal mode for irc cloud
// @author Smeevil
// @match https://www.irccloud.com
// @grant none
// ==/UserScript==
setTimeout(function() {
var button, insertAt, mainwrapperPadding, sidebar;
insertAt = $('#uploadContextMenu ul.actions');
li = $('<li/>')
link = $('<a/>').html('toggle mini').addClass('.toggle-mini-mode')
link.appendTo(li);
li.prependTo(insertAt);
sidebar = $('#sidebarwrapper');
containerMinWidth=$('#container').css('min-width');
mainwrapper=$('#mainwrapper');
mainwrapperPaddingLeft = mainwrapper.css('padding-left');
mainwrapperPaddingRight = mainwrapper.css('padding-right');
timecontainer=$('#timeContainer');
timecontainerLeft = timecontainer.css('left');
return link.bind('click', (function(_this) {
return function() {
if (sidebar.is(':visible')) {
$('#mainwrapper').css({
'padding-left': 0,
'padding-right': 0,
});
$('#timeContainer').css({
'left': '0px'
});
$('#container').css({
'min-width': 0
});
} else {
$('#mainwrapper').css({
'padding-left': mainwrapperPaddingLeft,
'padding-right': mainwrapperPaddingRight
});
$('#container').css('min-width', containerMinWidth);
$('#timeContainer').css({
'left': timecontainerLeft
});
}
sidebar.toggle();
$('#headercell').toggle();
$('td.statuscell').toggle();
window.resizeBy(1)
return null;
};
})(this));
}, 5000);
@peterchoo
Copy link

version++

// ==UserScript==
// @name         Minimal Irc Cloud
// @namespace    http://govannon.nl/
// @version      0.1
// @description  Add a button to toggle minimal mode for irc cloud
// @author       Smeevil
// @match        https://www.irccloud.com
// @grant        none
// ==/UserScript==
setTimeout(function() {
  var button, insertAt, mainwrapperPadding, sidebar;
  insertAt = $('td.viewportcell');
  button = $('<button/>').addClass('.toggle-mini-mode').css({
    position: 'absolute',
    right: '-1px',
    top: '-2px',
    'background-color': 'white'
  });
  $('<span/>').html('toggle mini').appendTo(button);
  button.appendTo(insertAt);
  sidebar = $('#sidebarwrapper');
  mainwrapper=$('#mainwrapper');
  mainwrapperPaddingLeft = mainwrapper.css('padding-left');
  mainwrapperPaddingRight = mainwrapper.css('padding-right');
  timecontainer=$('#timeContainer');
  timecontainerLeft = timecontainer.css('left');
  return button.bind('click', (function(_this) {
    return function() {
      if (sidebar.is(':visible')) {
        $('#mainwrapper').css({
          'padding-left': 0,
          'padding-right': 0,
        });
        $('#timeContainer').css({
          'left': '0px'
        });
      } else {
        $('#mainwrapper').css({
          'padding-left': mainwrapperPaddingLeft,
          'padding-right': mainwrapperPaddingRight
        });
        $('#timeContainer').css({
            'left': timecontainerLeft
        });
      }
      sidebar.toggle();
      $('#headercell').toggle();
      $('td.statuscell').toggle();
      window.resizeBy(1)
      return null;
    };
  })(this));
}, 5000);

// ---
// generated by coffee-script 1.9.0

@smeevil
Copy link
Author

smeevil commented Feb 24, 2015

Updated the main one with your changes, also moved the toggle into the file upload popup at the right of the chat input bar :) Also toggling the min width property of the chat window so you can resize your window to be even smaller :D example :

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment