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