GitHub Halloween

Experience Halloween every day

Versione datata 02/11/2016. Vedi la nuova versione l'ultima versione.

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

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

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==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.
*/