1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

スマブラSPの今開催されているトーナメントが大乱闘なのか1on1なのか判定するスクリプトを作った

Last updated at Posted at 2020-11-01

気になったらいつでも判定できるようにブックマークレットにした。

javascript:(
  function(){
    let basis = new Date(2020, 9, 31, 15, 0, 0);
    let now = new Date();
    let elapsed = now - basis;
    let range = 48 * 60 * 60 * 1000;
    let quotient = elapsed / range;
    let digit = Math.floor(quotient) % 2;
    let result = '1 on 1';
    if (!digit) {
      result = '大乱闘';
    }
    let remainder = elapsed % range;
    let until = new Date(now.getTime() + range - remainder);
    let day = ['Sun.', 'Mon.', 'Tue.', 'Wed.', 'Thu.', 'Fri.', 'Sat.'];
    result += ` until: ${until.getMonth() + 1}/${until.getDate()} (${day[until.getDay()]}) ${until.getHours()}:${('0'+until.getMinutes()).slice(-2)}`;
    alert(result);
  }
)();

実行するとこんな↓感じ。
Capture.PNG
満足。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?