Skip to content

Instantly share code, notes, and snippets.

@landbryo
Created August 23, 2019 16:02
Show Gist options
  • Select an option

  • Save landbryo/ca5c02c03d87be0b00b70670d3a58e35 to your computer and use it in GitHub Desktop.

Select an option

Save landbryo/ca5c02c03d87be0b00b70670d3a58e35 to your computer and use it in GitHub Desktop.
Window size function to be used as a Chrome bookmark
javascript: (function () {
var v = window, d = document;
v.onresize = function () {
var w = v.innerWidth ? v.innerWidth : d.documentElement.clientWidth,
h = v.innerHeight ? v.innerHeight : d.documentElement.clientHeight, s = d.getElementById('WSPlgIn'), ss;
if (!s) {
s = d.createElement('div');
s.id = 'WSPlgIn';
d.body.appendChild(s);
s.onclick = function () {
s.parentNode.removeChild(s)
};
ss = s.style;
ss.position = 'fixed';
ss.top = 0;
ss.right = 0;
ss.backgroundColor = 'black';
ss.opacity = '1';
ss.color = 'white';
ss.fontFamily = 'monospace';
ss.fontSize = '10pt';
ss.padding = '5px';
ss.textAlign = 'right';
ss.zIndex = '999999';
}
s.innerHTML = 'w ' + w + '<br />h ' + h;
};
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment