Skip to content

Instantly share code, notes, and snippets.

@blimpage
Last active August 29, 2015 14:05
Show Gist options
  • Save blimpage/440c7fc143db83b6d605 to your computer and use it in GitHub Desktop.
Save blimpage/440c7fc143db83b6d605 to your computer and use it in GitHub Desktop.
trellotaire.user.js
// ==UserScript==
// @name Trellotaire
// @namespace http://twitter.com/blimpage
// @version 1.0
// @description Converts Trello boards into much more convincing solitaire boards.
// @include /https?:\/\/(www\.)?trello.com\/b\//
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js
// @grant GM_setValue
// @copyright 2014 Pat McKenna. Please send cheques via express post.
// ==/UserScript==
var deal_me_in = function() {
$("#deal-me-in").remove();
$("body").css("background", "#008001");
$(".list-card").each(function() {
var pos_x = "-" + ( Math.round( Math.random() * 13 ) * 235.2 ) + "px";
var pos_y = "-" + ( Math.round( Math.random() * 4 ) * 631 ) + "px";
var card = $("<div class='playing-card'></div>").css({
"height": "316px",
"background-image": "url(http://www.blimpage.com/pants/classic-playing-cards.png)",
"background-size": "3060px",
"background-position-x": pos_x,
"background-position-y": pos_y
});
$(this).prepend(card);
});
};
var add_button = function() {
if ( $(".header-user").length > 0 ) {
$(".header-user:first").prepend("<a class='header-btn' id='deal-me-in' href='#'><span class='header-btn-text'>Deal me in</span></a>");
$("#deal-me-in").on("click", deal_me_in);
$("body").off("mouseenter.trellotaire");
}
};
$("body").on("mouseenter.trellotaire", add_button);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment