Skip to content

Instantly share code, notes, and snippets.

@kkrico
Created August 5, 2016 15:30
Show Gist options
  • Save kkrico/02742d685217f5a745ff06b556b58945 to your computer and use it in GitHub Desktop.
Save kkrico/02742d685217f5a745ff06b556b58945 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Trello Filter
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Add filter to trello
// @author kkrico (Daniel Ramos)
// @match https://trello.com/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
$(document).ajaxStop(function(){
console.log("Ajax done");
});
function addGlobalStyle(css) {
var head, style;
head = document.getElementsByTagName('head')[0];
if (!head) { return; }
style = document.createElement('style');
style.type = 'text/css';
style.innerHTML = css;
head.appendChild(style);
}
addGlobalStyle('.ativo { background: #298fca !important; border-color: #298fca #298fca #026aa7 !important; color: #fff; !important} .ativo span { color: #fff; !important }');
var sidebar = $(".window-sidebar");
$(sidebar).prepend(function() {
var titulo = $("<h3>Filtrar"+
"<div class='window-module u-clearfix'>"+
"</div>"+
"</h3>");
var anexos = $("<a class='button-link js-filtro-anexo' href='#'><span class='icon-sm icon-member'></span> Anexos</a>");
titulo.append(anexos);
var excluidos = $("<a class='button-link js-filtro-excluidos' href='#'><span class='icon-sm icon-member'></span> Excluidos</a>");
titulo.append(excluidos);
return titulo;
});
$(sidebar).on("click", ".js-filtro-anexo", function(event) {
event.preventDefault();
$(this).toggleClass("ativo");
$(".phenom.mod-attachment-type").toggle();
});
$(sidebar).on("click", ".js-filtro-excluidos", function(event) {
event.preventDefault();
$(this).toggleClass("ativo");
$(".phenom.mod-other-type").toggle();
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment