1
1
mirror of https://github.com/rsms/inter.git synced 2025-01-07 08:46:28 +03:00

website/lab: minor tweaks

This commit is contained in:
Rasmus Andersson 2017-10-01 10:57:54 -07:00
parent 90bb9b789d
commit 33364f2d5f

View File

@ -967,9 +967,6 @@ samples {
sample .glyphlist.hideNames g span.name { sample .glyphlist.hideNames g span.name {
display:none; display:none;
} }
/*sample .glyphlist.hideNames g span.glyph {
margin-top:0;
}*/
body.secondarySampleDisabled .showOnlyWithSecondarySample { body.secondarySampleDisabled .showOnlyWithSecondarySample {
display: none; display: none;
@ -1103,13 +1100,15 @@ document.head.appendChild(fontCSS)
<label style="display:inline-block; margin-left:4px"><input type="checkbox" name="italic"> <em>Italic</em></label> <label style="display:inline-block; margin-left:4px"><input type="checkbox" name="italic"> <em>Italic</em></label>
</label> </label>
<label class="label-and-value repertoireOrder"> <div class="checkbox-group repertoireControl">
<span>Repertoire order:</span> <label class="label-and-value">
<select name="repertoireOrder"> <span>Repertoire order:</span>
<option value="" selected>Original</option> <select name="repertoireOrder">
<option value="u">Unicode</option> <option value="" selected>Original</option>
</select> <option value="u">Unicode</option>
</label> </select>
</label>
</div>
<label class="label-and-value"> <label class="label-and-value">
<span>Anti-alias:</span> <span>Anti-alias:</span>
@ -1465,11 +1464,30 @@ function main() {
const primaryFontElements = const primaryFontElements =
Array.prototype.slice.call(document.querySelectorAll('.primaryFont')) Array.prototype.slice.call(document.querySelectorAll('.primaryFont'))
const repertoireOrderControl = document.querySelector('label.repertoireOrder') const repertoireControl = document.querySelector('.repertoireControl')
const samplesElement = document.querySelector('samples') const samplesElement = document.querySelector('samples')
let sizeVar = null let sizeVar = null
function forEachGlyphlist(fn) {
let elements = samplesElement.querySelectorAll('.glyphlist')
if (elements) {
for (let i = 0; i < elements.length; ++i) {
fn(elements[i], i)
}
}
}
function setGlyphlistClass(className, add) {
forEachGlyphlist(gl => {
if (add) {
gl.classList.add(className)
} else {
gl.classList.remove(className)
}
})
}
// sample text // sample text
const samplesSelect = document.querySelector('select[name="sample"]') const samplesSelect = document.querySelector('select[name="sample"]')
for (let [k,v] of samples) { for (let [k,v] of samples) {
@ -1489,9 +1507,9 @@ function main() {
} }
if (v == 'Repertoire') { if (v == 'Repertoire') {
repertoireOrderControl.style.display = null repertoireControl.style.display = null
} else { } else {
repertoireOrderControl.style.display = 'none' repertoireControl.style.display = 'none'
} }
if (typeof sampleText == 'object' && sampleText.toHTML) { if (typeof sampleText == 'object' && sampleText.toHTML) {
@ -1573,16 +1591,7 @@ function main() {
sizeVar = vars.bind('size', (e, v) => { sizeVar = vars.bind('size', (e, v) => {
boxes.style.display = (v > 20) ? 'none' : null boxes.style.display = (v > 20) ? 'none' : null
setCSSProp('font-size', v + 'px') setCSSProp('font-size', v + 'px')
let glyphlists = samplesElement.querySelectorAll('.glyphlist') setGlyphlistClass('hideNames', v < 36)
if (glyphlists && glyphlists.length) {
for (let i = 0; i < glyphlists.length; ++i) {
if (v >= 36) {
glyphlists[i].classList.remove('hideNames')
} else {
glyphlists[i].classList.add('hideNames')
}
}
}
// setCSSProp('line-height', Math.ceil(v * 1.5) + 'px') // setCSSProp('line-height', Math.ceil(v * 1.5) + 'px')
}) })