GitHub Halloween

Experience Halloween every day

目前為 2016-11-02 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

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