The Sexy Button

Allow The Button to change colour

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         The Sexy Button
// @namespace    http://www.reddit.com/r/thebutton
// @version      0.1
// @description  Allow The Button to change colour
// @author       Ray57
// @match        http://www.reddit.com/r/thebutton
// @match        http://www.reddit.com/r/thebutton/
// @grant        none
// ==/UserScript==

(function(){var colorblind = document.createElement('span');
colorblind.className = 'thebutton-colorblind';
$('.thebutton-counter').prepend(colorblind);
colorTimer = window.setInterval(function(){ 
var s = r.thebutton._msgSecondsLeft, ring = $('#thebutton'), color = '';
ring.css('-webkit-transition', 'background-color 0.4s')
    .css('-moz-transition', 'background-color 0.4s')
    .css('-ms-transition', 'background-color 0.4s')
    .css('-o-transition', 'background-color 0.4s')
    .css('transition', 'background-color 0.4s')
if (s < 12) { ring.css('background-color', '#e50000'); color = 'red' } else
if (s < 22) { ring.css('background-color', '#e59500'); color = 'orange' } else
if (s < 32) { ring.css('background-color', '#e5d900'); color = 'yellow' } else
if (s < 42) { ring.css('background-color', '#02be01'); color = 'green' } else
if (s < 52) { ring.css('background-color', '#0083c7'); color = 'blue' } else
{ ring.css('background-color', '#820080'); color = 'purple' }
$('.thebutton-colorblind').text(color + ' - ')}, 10);})();