Skip to content

Instantly share code, notes, and snippets.

@oflow
Created May 22, 2015 04:50
Show Gist options
  • Save oflow/69100e60f4cfed6b66c3 to your computer and use it in GitHub Desktop.
Save oflow/69100e60f4cfed6b66c3 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name searchbar-panel-one-offs height
// @description 49px固定だと高さズレるんだよ!
// @version 1.0
// @author oflow
// @compatibility Firefox 38
// ==/UserScript==
(function() {
var popup = document.getElementById('PopupSearchAutoComplete'),
searchbar = document.getElementById('searchbar');
popup.addEventListener('popupshowing', function() {
let list = document.getAnonymousElementByAttribute(popup, 'anonid', 'search-panel-one-offs'),
len = searchbar.engines.length,
width = parseInt(popup.clientWidth),
row = Math.floor(width / 27);
height = Math.ceil(len / row) * 25 + 10;
list.setAttribute('height', height + 'px');
}, false);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment