Highlight

Showing posts with label bug. Show all posts
Showing posts with label bug. Show all posts

2015-10-14

My Firefox won't paste text! A workaround using AutoHotkey.

In Firefox I often find myself unable to paste into Facebook or YouTube comment boxes. I've been a Mozilla fan since 3.0, but bugs like these make Firefox a pain. Here's a workaround that works in my 64-bit Windows 7:
  1. Install AutoHotkey.
  2. Save this script as "type_clipboard.ahk":
    ; http://www.autohotkey.com/board/topic/76296-type-out-text-in-clipboard/
    ; ctrl+win+v
    ^#v::
        sendraw %clipboard%
    return
  3. Run the script and press Ctrl+Win+V to have AutoHotkey type your clipboard text into Firefox.

2014-09-10

How to freeze a Google Chrome tab

Chrome cares more about speed than user interaction. This simple bug just hung my tab while hogging one CPU core:
function isOverflowed(element){
    return element.scrollHeight > element.clientHeight || element.scrollWidth > element.clientWidth;
}

function resize_to_fit(el){
 var size = parseFloat(el.style.fontSize) || 55
 log("resizing from " + size)
 while(isOverflowed(el) && size > 8){
  el.style.fontSize = size - 1
 }
}
Press Shift+Escape, sort by CPU descending, and end the offending process to recover. Still better than Firefox.

This is what i meant to write, to resize text content to fit an HTML element like a div:
function isOverflowed(element){
 return element.scrollHeight > element.clientHeight || element.scrollWidth > element.clientWidth
}

function resizeToFit(el){
 var size = parseFloat(el.style.fontSize) || 55
 while(isOverflowed(el) && size > 8){
  size -= 1
  el.style.fontSize = size + "px"
 }
}