Last active
November 25, 2016 09:28
-
-
Save ellingen/f8968403f533b0cc839ce063c280206e to your computer and use it in GitHub Desktop.
Colorize Waffle Board
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==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