SSブログ

Fix SearchBoxをメンテ [Firefox]

長年愛用しつつもgoogleの仕様変更でたびたび使えなくなるGreasemonkey[Fix SearchBox]をメンテ。

記事投稿日を見ると歴史を感じます('-'*
Googleの検索ボックスをページ上方に固定するGreasemonkey


// ==UserScript==
// @name Fix SearchBox
// @description fix search box on google search
// @namespace http://d.hatena.ne.jp/hysa/
// @include http://www.google.co.jp/search*
// @include http://www.google.com/search*
// @include https://www.google.co.jp/search*
// @include https://www.google.com/search*
// ==/UserScript==
(function() {
  // Initialize
  var header = document.getElementById('tsf');
  header.style.top = '0';
  header.style.width = '100%';
  header.style.backgroundColor = '#f5f5f5';
  header.style.zIndex = '254';

  // Fix Header Element
  function fix() {
    header.style.position = 'fixed';
    header.style.borderBottom = '2px solid #6B90DA';
  }

  // Unfix Header Element
  function unfix() {
    header.style.position = 'static';
    header.style.borderBottom = '0';
  }
  var defaultValue = window.getComputedStyle(document.getElementById('tsf'), null).height.replace(/px/, '');
  var threshold = defaultValue || 34;
  var currentPosition = document.documentElement;

  document.addEventListener('scroll',
                            function() {
                              if (currentPosition.scrollTop > threshold) fix();
                              else unfix();
                            }, false);
})();




タグ:Greasemonkey
nice!(1)  コメント(0)  トラックバック(0) 
共通テーマ:パソコン・インターネット

nice! 1

コメント 0

コメントを書く

お名前:
URL:
コメント:
画像認証:
下の画像に表示されている文字を入力してください。

※ブログオーナーが承認したコメントのみ表示されます。
   芝生を生やす人は刈りますよぉ~('-'*

トラックバック 0

トラックバックの受付は締め切りました

この広告は前回の更新から一定期間経過したブログに表示されています。更新すると自動で解除されます。