Skip to content

Instantly share code, notes, and snippets.

@ellingen
Last active November 25, 2016 09:28
Show Gist options
  • Save ellingen/f8968403f533b0cc839ce063c280206e to your computer and use it in GitHub Desktop.
Save ellingen/f8968403f533b0cc839ce063c280206e to your computer and use it in GitHub Desktop.
Colorize Waffle Board
// ==UserScript==
// @name Colorize Waffle Board
// @version 0.1
// @description Use this script to coloroize cards in Waffle depending on the source they belong to.
// @author Theo Lampert, Sven Ellingen
// @include https://waffle.io*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
// @grant none
// @updateURL https://gist.github.com/ellingen/f8968403f533b0cc839ce063c280206e/raw/acb-colorize-waffle.js
// @downloadURL https://gist.github.com/ellingen/f8968403f533b0cc839ce063c280206e/raw/acb-colorize-waffle.js
// ==/UserScript==
(function() {
'use strict';
waitForKeyElements('.card', colorCards);
var colorMap = {
'vinylmeplease': 'green'
'rbmaradio2016': '#7FBDF4',
'rbmaradio2016-iOS': '#B6F0F9',
'rbmaradio2016-android': '#BEC8FF',
};
function colorCards(jNode) {
var att = jNode.attr('data-waffle-url');
for (var key in colorMap) {
if (colorMap.hasOwnProperty(key)) {
console.log(key + " -> " + colorMap[key]);
if (att.includes(key)) {
jNode.children()[0].style.backgroundColor = colorMap[key];
jNode.children()[1].style.backgroundColor = colorMap[key];
jNode.children()[1].children[0].style.backgroundColor = 'transparent';
}
}
}
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment