Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

General Discussion

ThreehouseUX script.

I have seen from time to time on the forum that students would like to remove courses that they don't want from there home page. So I decided to work on a script for it that runs on TamperMonkey.

Here is what I have so far. I doesn't work yet, but it is a start.

If you want to contribute, please do!

// ==UserScript==
// @name         TreehouseUX
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Creates UX elements for user customization of Treehouse.
// @author       Caleb Kleveter
// @match        https://teamtreehouse.com/home
// @grant        none
// ==/UserScript==
/*global $, jQuery*/
(function() {
    'use strict';

    // Your code here...

    const newCardTopPosition = 0;
    const newCardLeftPosition = 834.15625;
    //
    var newCardId = 3;
    $(".card-list > li").each(function(i){
        $(this).attr("id", "card-" + i);
    });
    $(".card-list").css({"position": "relative"});
    $(".card-actions").append("<li class='card-action remove secondary' style='font-family: 'Gotham Rounded A', 'Gotham Rounded B', 'Gotham Rounded', 'Helvetica Neue', Helvetica, Arial, sans-serif;'>X</li>");
    $(".remove").css({
        "margin-right": "10px",
        "font-size": "20px"
    });
    $(".remove").click(function(){
        var cardActivity = $(this).parent().parent().attr("id");
        var cardId = "li#" + cardActivity;
        var css = $(cardId).css("cssText");
        $(cardId).hide();
        $("li#card-" + newCardId).css(css);
        $("li#card-" + newCardId).show();
        $("li#card-" + newCardId).css({"top": newCardTopPosition + "px", "left": newCardLeftPosition + "px", "position":"absolute"});
        //
        newCardId++;
    });
})();