set antialising automatically, cleanup config area
This commit is contained in:
parent
85489b4372
commit
3023f8cde1
26
index.css
26
index.css
|
@ -60,24 +60,19 @@ section {
|
|||
flex-shrink: 0;
|
||||
}
|
||||
section.config {
|
||||
min-height: 30px;
|
||||
font-size: 10px;
|
||||
background: #eee;
|
||||
flex: 0;
|
||||
padding: 10px 10px 0 10px;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
}
|
||||
section.config:last-of-type {
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
section.config + section.config {
|
||||
padding-top: 0;
|
||||
padding: 10px;
|
||||
display: grid;
|
||||
grid-column-gap: 5px;
|
||||
grid-row-gap: 5px;
|
||||
grid-template-columns: auto auto auto auto;
|
||||
}
|
||||
section.config > * {
|
||||
flex: 1;
|
||||
text-align: center;
|
||||
padding: 0;
|
||||
white-space: nowrap;
|
||||
}
|
||||
section.select-list {
|
||||
overflow: auto;
|
||||
|
@ -164,7 +159,7 @@ section.select-list .details {
|
|||
}
|
||||
footer {
|
||||
flex: 0;
|
||||
padding: 6px 10px;
|
||||
padding: 5px 10px;
|
||||
font-size: 10px;
|
||||
text-align: center;
|
||||
background: #e4e4e4;
|
||||
|
@ -190,7 +185,7 @@ select {
|
|||
all: unset;
|
||||
width: 9em;
|
||||
padding: 0 .5ex;
|
||||
border: 1px solid transparent;
|
||||
border: 1px solid #e4e4e4;
|
||||
border-radius: 3px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
|
@ -206,14 +201,15 @@ input[type="number"] {
|
|||
width: 4em;
|
||||
margin-left: .5ex;
|
||||
padding: 0 .5ex;
|
||||
border: 1px solid transparent;
|
||||
border: 1px solid #e4e4e4;
|
||||
border-radius: 3px;
|
||||
text-align: left;
|
||||
}
|
||||
input[type="number"]:hover,
|
||||
input[type="number"]:focus,
|
||||
select:hover,
|
||||
select:focus {
|
||||
border-color: #e4e4e4;
|
||||
border-color: #777;
|
||||
}
|
||||
pre,
|
||||
textarea,
|
||||
|
|
|
@ -100,16 +100,9 @@
|
|||
<input onchange="setSize()" type="number" id="size" value="16" min="1" max="32" step="1">
|
||||
</p>
|
||||
<p>
|
||||
<label for="spacing">Spacing</label>
|
||||
<label for="spacing">/</label>
|
||||
<input onchange="setSpacing()" type="number" id="spacing" value="1.4" min="1" max="2" step="0.1">
|
||||
</p>
|
||||
<p>
|
||||
<label for="aliasing">AA</label>
|
||||
<input onchange="setAntialiasing()" type="checkbox" id="aliasing" checked>
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<section class="config">
|
||||
<p class="select">
|
||||
<button class="nav-button" id="theme-previous">↑</button>
|
||||
<button class="nav-button" id="theme-next">↓</button>
|
||||
|
|
22
index.js
22
index.js
|
@ -33,7 +33,11 @@ function selectFont() {
|
|||
font = 'input';
|
||||
}
|
||||
|
||||
console.log(font_data[font]);
|
||||
if (font_data[font].rendering === 'bitmap') {
|
||||
$('.CodeMirror').addClass('no-smooth');
|
||||
} else {
|
||||
$('.CodeMirror').removeClass('no-smooth');
|
||||
}
|
||||
|
||||
if (font === 'input') {
|
||||
$('pre').css({ fontFamily: 'Input Mono, monospace' });
|
||||
|
@ -64,15 +68,6 @@ function setSpacing() {
|
|||
$('.CodeMirror').css({ lineHeight: spacing });
|
||||
document.cookie = 'spacing=' + spacing + ';max-age=172800';
|
||||
}
|
||||
function setAntialiasing() {
|
||||
if ($('#aliasing').is(':checked')) {
|
||||
$('.CodeMirror').removeClass('no-smooth');
|
||||
document.cookie = 'antialiasing=smooth;max-age=172800';
|
||||
} else {
|
||||
$('.CodeMirror').addClass('no-smooth');
|
||||
document.cookie = 'antialiasing=no-smooth;max-age=172800';
|
||||
}
|
||||
}
|
||||
function selectLanguage() {
|
||||
var lang = $('#select-language').val();
|
||||
|
||||
|
@ -199,7 +194,6 @@ function decreaseFontSize() {
|
|||
$(document).ready(function() {
|
||||
var cookieValueSpacing = document.cookie.replace(/(?:(?:^|.*;\s*)spacing\s*=\s*([^;]*).*$)|^.*$/, '$1');
|
||||
var cookieValueSize = document.cookie.replace(/(?:(?:^|.*;\s*)size\s*=\s*([^;]*).*$)|^.*$/, '$1');
|
||||
var cookieValueAntialiasing = document.cookie.replace(/(?:(?:^|.*;\s*)antialiasing\s*=\s*([^;]*).*$)|^.*$/, '$1');
|
||||
var cookieValueTheme = document.cookie.replace(/(?:(?:^|.*;\s*)theme\s*=\s*([^;]*).*$)|^.*$/, '$1');
|
||||
var cookieValueLanguage = document.cookie.replace(/(?:(?:^|.*;\s*)language\s*=\s*([^;]*).*$)|^.*$/, '$1');
|
||||
|
||||
|
@ -209,11 +203,6 @@ $(document).ready(function() {
|
|||
if (cookieValueSize !== '') {
|
||||
$('#size').val(cookieValueSize);
|
||||
}
|
||||
if (cookieValueAntialiasing === 'smooth') {
|
||||
$('#aliasing').prop('checked', true);
|
||||
} else if (cookieValueAntialiasing === 'no-smooth') {
|
||||
$('#aliasing').prop('checked', false);
|
||||
}
|
||||
if (cookieValueTheme !== '') {
|
||||
$('#select-theme').val(cookieValueTheme);
|
||||
}
|
||||
|
@ -224,7 +213,6 @@ $(document).ready(function() {
|
|||
selectTheme();
|
||||
setSize();
|
||||
setSpacing();
|
||||
setAntialiasing();
|
||||
selectLanguage();
|
||||
renderSelectList();
|
||||
|
||||
|
|
Loading…
Reference in New Issue