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
コメント 0