Countdown spakliness

Makes your countdown sparkly!

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

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

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name        Countdown spakliness
// @namespace   urn://https://www.georgegillams.co.uk/api/greasemonkey/countdown_spakles
// @include     *itsalmo.st*
// @exclude     none
// @version     6
// @description:en	Makes your countdown sparkly!
// @grant    		none
// @description	Makes your countdown sparkly!
// ==/UserScript==

const DURATION = 12;

function changeColor() {
  const footerElements = document.getElementsByClassName('app-footer');
  
  if(footerElements.length > 0) {
    const footer = footerElements[0];
    footer.style.display = 'none';
  }

  const r = Math.floor((Math.random() * 127));
  const g = Math.floor((Math.random() * 127));
  const b = Math.floor((Math.random() * 127));
  
  
  const backgroundElements = document.getElementsByClassName('countdown-display');
  
  if(backgroundElements.length > 0) {
  	const background = backgroundElements[0];
    background.style.transition = `all ${DURATION}s ease-in-out`;
    background.style.backgroundColor = `rgb(${r}, ${g}, ${b})`;
  }
  
  const textElements = document.getElementsByClassName('countdown-timer-wrap');
  
  if(textElements.length > 0) {
  	const text = textElements[0];
    text.style.transition = 'all 1s ease-in-out';
    const brightness = (r + g + b) / (255*3);
    text.style.color = 'white';
  }
  
}

function worker() {
  try {
    changeColor();
  } catch (e) {
    console.log(e);
  }
}

worker();
setInterval(worker, DURATION * 1000);