Skip to content

Instantly share code, notes, and snippets.

@corsonr
Created January 30, 2018 08:42
Show Gist options
  • Save corsonr/5674ba78caa848306e74a15e450caa4c to your computer and use it in GitHub Desktop.
Save corsonr/5674ba78caa848306e74a15e450caa4c to your computer and use it in GitHub Desktop.
Humanity / Tamper monkey: disable slots when you're not available
// ==UserScript==
// @name Hide Humanity slots when not available
// @namespace https://automattic2.humanity.com
// @version 0.1
// @description Hide Humanity slots when not available
// @author @remicorson
// @grant none
// @match https://automattic2.humanity.com/app/requests/*
// @require http://code.jquery.com/jquery-latest.js
// ==/UserScript==
jQuery(function($) {
function addColumnHeader() {
$("#topMenu").append('<li class="_primNavQtip j-primNavQtipHover hide-unavailable" title="Hide Slots"><a href="#" class="lft" id="sn_dashboard" return false;"><div id="_notifycount"></div><span class="primNavQtip__inner"><i class="primNavQtip__icon icon-clear"></i><p class="primNavQtip__itemName">Hide Slots</p></span></a></li>');
}
function hideSlots() {
console.log('Humanity: Hide un-vailable slots');
$('.ResultsTable td').each(function() {
if ($(this).text().indexOf('un-available') !== -1) {
// Hide the column without affecting the table formatting
$(this).css('visibility', 'hidden');
}
});
// Hide the entire row
$('.ResultsTable tr:contains("un-available")').hide();
}
addColumnHeader();
//hideSlots();
$('.hide-unavailable').click(function() {
hideSlots();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment