0
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.

Google カレンダーを画面の右端に表示したかった(備忘録)

Posted at

Google カレンダーを画面の右端に表示したかった

基本的にはリハビリのためにアレコレやってます。

こちらの記事をZennに投稿しなかったのは、
備忘録的にポイポイしてるから。

(function calenderFit() {
    // Google カレンダーを Windows のデスクトップアプリのように扱う方法 
    // https://loumo.jp/archives/18828
    // デスクトップに窓枠無しで表示できるらしいと上記の記事で把握

    // 画面の右側に表示したかった。
    // ついでに起動時に自動でセットできるようにしたかったけど、
    // そちらはWindowsのショートカットからだと現在難しいみたい?
    // アドオンとかが必須になるようなので今回は見送り

    // #region ENUM
    const WIDTH = 255;
    const WINDOW_SIZE = { w: 3000, h: 2000 };

    const DICT = {
        timeHight: styleSet(["mmsF1c", "top", "4%"]),
        dayWidth: styleSet(["WJVfWe", "width", "95%"]),
        leftBarWidth: styleSet(["QQYuzf", "width", "0%"]),
        leftVisibility: styleSet(["dwlvNd", "visibility", "hidden"]),
        dayHeight: styleSet(["YvjgZe", "flex", "0.123 0 auto"]),
        xxxTop: styleSet(["dwlvNd", "top", "50px"]),
        zzzTop: styleSet(["eh5oYe", "top", "90%"]),
        zzzFlex: styleSet(["H7IzGb", "flex", "0.3 0.3 auto"]),
    };


    // #endregion ENUM

    // #region WindowControl

    // windowsだと画面の表示倍率変更すると、
    // ピクセルの座標とか変わります
    const isWindows = window
        .navigator
        .userAgent
        .indexOf("Windows") >= 0;
    const scWidth = isWindows
        ? WINDOW_SIZE.w
        : window.screen.availWidth;
    const scHeight = isWindows
        ? WINDOW_SIZE.h
        : window.screen.availHeight;

    // ness [[ resize => move ]]
    window.resizeTo(WIDTH, scHeight);
    window.moveTo(scWidth - WIDTH, 0);

    // #endregion WindowControl


// Object.KeyValuesで回せばよかったなー
    styleSetter(DICT.timeHight);
    styleSetter(DICT.dayWidth);
    styleSetter(DICT.leftBarWidth);
    styleSetter(DICT.leftVisibility);
    styleSetter(DICT.dayHeight);
    styleSetter(DICT.xxxTop);
    styleSetter(DICT.zzzTop);
    styleSetter(DICT.zzzFlex);

    function mix(fa, fb) { return v => fb(fa(v)); }
    function styleSet(arr) { return () => arr }
    function toArr(elm) { return [...elm]; }

    function classedElms(v) {
        return document.getElementsByClassName(v)
    }

    function styleSetter(f) {
        const [elmClassName, styleName, value] = f();
        function elms(key, act) { mix(classedElms, toArr)(key).forEach(act); }
        function setStyle(k, v) { return e => e.style[k] = v; }
        elms(elmClassName, setStyle(styleName, value));
    }
})()
0
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
0
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?