CmdUtils.CreateCommand({ name: "page-width", author: { name: "Jacky See"}, license: "GPL", description: "Limit the page width by a given parameter, align it to center", help: "e.g. page-width 400", takes: {"input": noun_arb_text}, preview: function( pblock, input ) { var template = "Setting page to width ${w} (default is 500)"; var width = 500; //default width try{ width = parseInt(input.text); }catch(ex){} pblock.innerHTML = CmdUtils.renderTemplate(template, {"w": width}); }, execute: function(input) { var body = Application.activeWindow.activeTab.document.body; var width = 500; //default width try{ width = parseInt(input.text); }catch(ex){} if(body){ body.style.width = width + "px"; body.style.margin = "0 auto"; } } });