GitHub Halloween

Experience Halloween every day

נכון ליום 02-11-2016. ראה הגרסה האחרונה.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         GitHub Halloween
// @namespace    https://github.com/KeyWeeUsr/Userscripts
// @version      0.1
// @description  Experience Halloween every day
// @author       Peter Badida
// @copyright    2016+, Peter Badida
// @license      GNU GPLv3
// @homepage     https://github.com/KeyWeeUsr/Userscripts/tree/master/GitHubHalloween
// @supportURL   https://github.com/KeyWeeUsr/Userscripts/issues
// @icon         https://github.com/favicon.ico
// @include      https://*github.com/*
// @require      http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
// @contributionURL https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=ACVM74AYCXVWQ
// ==/UserScript==
/* jshint -W097 */
'use strict';
(function () {
    var items = document.getElementsByClassName("day");
    var dc;
    var max = 0;
    var second;
    var third;
    var fourth;
    for (var i=0; i<items.length; i++) {
        dc = parseInt($(items[i]).attr('data-count'));
        if (max < dc) {
            max = dc;
        }
    }
    second = Math.round(max / 2.0);
    third = Math.round(second / 2.0);
    for (var i=0; i<items.length; i++) {
        dc = parseInt($(items[i]).attr('data-count'));
        if (dc == max) {
            $(items[i]).attr('fill', '#03001C');
        } else if (second <= dc && dc <= max - 1) {
            $(items[i]).attr('fill', '#FE9600');
        } else if (third <= dc && dc < second) {
            $(items[i]).attr('fill', '#FFC501');
        } else if (0 < dc && dc < third) {
            $(items[i]).attr('fill', '#FFEE4A');
        } else if (dc == 0) {
            $(items[i]).attr('fill', '#EEEEEE');
        }
    }
})();
/*
Notify me if there's something missing/undesirable.
*/