Rated 4 out of 5 stars

@McGWD: nice work, but the viewport is actually content.document.documentElement.clientWidth

document.documentElement.clientWidth in that case returns the size of the whole program window. Seems the addon is not working in the document window scope by default.