Skip to content


Subversion checkout URL

You can clone with
Download ZIP
tree: b1dd8631b6
Fetching contributors…

Cannot retrieve contributors at this time

121 lines (109 sloc) 3.456 kB
<title>JS Beautifier options</title>
<link rel="stylesheet" href="" />
<script src=""></script>
<style type="text/css">
body {
background: #f9f9f9;
.module {
padding: 0;
border: 1px solid #ccc;
border-radius: 5px;
background: white;
box-shadow: 0px 0px 3px rgba(0,0,0,0.1);
margin: 0 auto;
width: 300px;
.module>.content {
padding: 10px;
.module .bottom{
background-color: #eee;
border-top: 1px solid #d2d2d2;
padding: 10px 15px;
font-weight: bold;
overflow: hidden;
border-bottom-left-radius: 5px;
border-bottom-right-radius: 5px;
box-shadow: inset 0px 0px 0px 1px #fff;
.module>h1 {
font-size: 18px;
font-weight: bold;
margin: 10px 10px 0 10px;
padding: 0 0 10px 0;
.module>h1>img {
<body style="padding:20px">
<script type="text/javascript">
var booleanSettings = ['useClippy', 'jslint_happy', 'preserve_newlines'];
// Saves options to localStorage.
function save_options() {
var options = {
useClippy: $('#useClippy').is(':checked'),
jsbeautify: {
indent_size: $('#tabsize').val(),
indent_char: ' ',
preserve_newlines: $('#preserve_newlines').is(':checked'),
jslint_happy: $('#jslint_happy').is(':checked'),
brace_style: 'collapse', //$('#brace_style').val()
if (options.jsbeautify.indent_size == 1) {
options.jsbeautify.indent_char = "\t";
chrome.extension.sendRequest({method: "setOptions", options: options});
// Restores select box state to saved value from localStorage.
function restore_options() {
chrome.extension.sendRequest({method: "getOptions"}, function(options) {
$('#useClippy').attr('checked', options.useClippy);
$('#jslint_happy').attr('checked', options.jsbeautify.jslint_happy);
$('#preserve_newlines').attr('checked', options.jsbeautify.preserve_newlines);
// $('#brace_style').val(options.jsbeautify.brace_style);
<body onload="restore_options()">
<div class="module">
<img src="img/jsb-logo-48.png">
JSBeautifier for Chrome
<div class="content">
<input type="checkbox" id="useClippy"> Use clippy
<h4>JS Beautify options</h4>
<input type="checkbox" id="jslint_happy"> JSLint happy<br>
<input type="checkbox" id="preserve_newlines"> Preserve newlines<br>
<select id="tabsize">
<option value="1">indent with a tab character</option>
<option value="2">indent with 2 spaces</option>
<option value="3">indent with 3 spaces</option>
<option value="4" selected="selected">indent with 4 spaces</option>
<option value="8">indent with 8 spaces</option>
<!-- <br>
<select id="brace_style">
<option value="collapse">Braces with control statement</option>
<option value="expand">Braces on own line</option>
<option value="end-expand">End braces on own line</option>
</select> -->
<div class="bottom">
<a href="#" onclick="save_options()">Save your settings</a>
Jump to Line
Something went wrong with that request. Please try again.