2011年11月29日火曜日

Google Calendar Header and Navigation Switcherを 最新のGoogleカレンダーに対応

FirefoxのGreasemonkeyで、Googleカレンダーのサイドバーと上部コントロールを非表示にしてカレンダー部分を広くできる便利な「Google Calendar Header and Navigation Switcher」というのがあるが、これがGoogle+風の新しいGoogleカレンダーのデザインだと機能しない。

Userscripts.orgにこれの解決策が書いてあった。

Broken with new look - Userscripts.org

Fixed it.    Change line 88 to: var head = new DisplaySwitcher("head", "#vr-proto-header,#topBar,#cornerBookmarks,#gbar,#gbarl,#guser,#ft+.s,.gbh", (#vr-proto-header is the new header) and add after line 45 (or pretty much anywhere inside DisplaySwitcher.prototype.toggle declaration) the following line: if (this.id=="navi") { document.getElementById("mainbody").style.marginLeft = hide ? "0px" : "210px"; } (to fix the white space that the hidden sidebar leaves)

要約すると、
  • 88行目で指定する隠す対象の指定(後述)を変更する
  • 45行目あたりに、下記のif文を追加する(サイドバーを非表示にした時に空白のスペースが残るのを防ぐため)
    if (this.id=="navi") { document.getElementById("mainbody").style.marginLeft = hide ? "0px" : "210px"; }

88行目で指定する、隠す要素の指定についてはいろんな意見が出てる。
  • #vr-proto-header,#topBar,#cornerBookmarks,#gbar,#gbarl,#guser,#ft+.s,.gbh
  • #onegoogbar,#vr-proto-header,#vr-proto-nav,#topBar,#cornerBookmarks,#gbar,#gbarl,#guser,#ft+.s,.gbh
  • #onegoogbar,#vr-proto-header,#vr-nav,#vr-header,#vr-proto-nav,#topBar,#cornerBookmarks,#gbar,#gbarl,#guser,#ft+.s,.gbh

3番目のahbiさんのやつが一番指定要素が多いので一番シンプルになる。

ただ、自分の場合はアカウントの切り替えができるOne Google Barは残したいので、88行目を下記のようにした。
  var head = new DisplaySwitcher("head", "#vr-proto-header,#vr-header,#vr-proto-nav,#topBar,#cornerBookmarks,#gbar,#gbarl,#guser,#ft+.s,.gbh",
refleshCal);

うん、快適。

0 件のコメント:

ブログ アーカイブ

tags