-
Notifications
You must be signed in to change notification settings - Fork 1
Layout
Russell edited this page Sep 23, 2020
·
10 revisions
Welcome to the bookmarklets wiki!
Opens a prompt dialog box and expects a number. You could go higher than 1, but 0-1 should be suitable for most cases.
javascript:(function(meta){ if(document.getElementById('metaview')){ document.head.removeChild(document.getElementById('metaview')); } var io = prompt('Viewport Scale Between 0 and 1'), meta.id = 'metaview'; meta.name = 'viewport'; meta.content = 'width=device-width, initial-scale=' + io + ', minimum-scale='+io+', maximum-scale='+io+', user-scalable=no'; window.document.head.appendChild(meta); })(document.createElement('meta'));
/*
* Dynamic Viewport
*/
(function(meta){
function isNumber(obj) {
return !!(obj === 0 || (obj && obj.toExponential && obj.toFixed));
}
if(document.getElementById('metaview')){
document.head.removeChild(document.getElementById('metaview'));
}
// var io = parseInt(prompt('Viewport Scale Between 0 and 1'));
var io = prompt('Viewport Scale Between 0 and 1');
if(!isNumber(io)){
alert('Requires a number');
return false;
}
meta.id = 'metaview';
meta.name = 'viewport';
meta.content = 'width=device-width, initial-scale=' + io + ', minimum-scale='+io+', maximum-scale='+io+', user-scalable=no';
// top will likely throw an error
// window.top.document.head.appendChild(meta);
// might get away with parent
// window.parent.document.head.appendChild(meta);
// this should work if it is executed in the url, not an embedded window
window.document.head.appendChild(meta);
})(document.createElement('meta'));I haven't got this down to 1 step yet.
Dynamically injected from CDN, the developer section has a script pointed at the CDN. The script to load is screen.js.
The library is BigScreen.
Define Object properties of the parameter passed in the function.
Attach webkitfullscreen events to the document
Background color should be set or the screen will be mostly black.
https://assets.codepen.io/1674766/screen.js