-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsarasa.js
124 lines (102 loc) · 2.9 KB
/
sarasa.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
// window.onload = change();
// document.querySelectorAll('.west')
let west = document.getElementsByClassName('west');
let east = document.getElementsByClassName('east');
// let west = document.querySelectorAll('.west');
// let east = document.querySelectorAll('.east');
// let all = [].concat(west, east);
let all = [...west, ...east];
// let weightInput = document.getElementById("weight");
// let sizeInput = document.getElementById("size");
// weightInput.onPointerDown = change;
// weightInput.onPointerMove = change;
// weightInput.onPointerUp = change;
// sizeInput.onPointerDown = changer;
// sizeInput.onPointerMove = changer;
// sizeInput.onPointerUp = changer;
function change() {
let weight = document.getElementById("weight").value;
let weighted;
if ( weight === "500" ) {
weighted = "600";
}
else if ( weight === "600" ) {
weighted = "700";
}
else {
weighted = weight;
}
for ( i = 0; i < all.length; i++ ) {
all[i].style.fontWeight = weighted;
}
}
function xLight() {
weight.value = 200;
change();
}
function bold() {
weight.value = 600;
change();
}
function changer() {
let size = document.getElementById("size").value;
for ( i = 0; i < all.length; i++ ) {
all[i].style.fontSize = size + "rem";
}
}
function halfRem() {
size.value = .5;
changer();
}
function fiveRem() {
size.value = 5;
changer();
}
// let italicStore = false;
// let slabStore = false;
function italicize() {
let italic = document.getElementById("italic");
if (italic.checked === true) {
for ( i = 0; i < all.length; i++ ) {
// all[i].style.fontStyle = "italic";
all[i].classList.add('italic');
}
// italicStore = true;
}
else if (italic.checked === false) {
for ( i = 0; i < all.length; i++ ) {
// all[i].style.fontStyle = "regular";
all[i].classList.remove('italic');
}
// italicStore = false;
}
}
function slabify() {
let family = document.getElementById("slab");
if (family.checked === true) {
for ( i = 0; i < west.length; i++ ) {
// west[i].style.fontFamily = 'Sarasa Mono Slab K';
west[i].classList.add('slab');
}
}
else if (family.checked !== true) {
for ( i = 0; i < west.length; i++ ) {
// west[i].style.fontFamily = 'Sarasa Mono Slab J';
west[i].classList.remove('slab');
}
}
}
function ligature() {
let lig = document.getElementById("ligature-change");
let ligc = document.getElementById("ligature");
if (ligc.checked === true) {
// all[i].style.fontStyle = "italic";
lig.classList.remove('no-lig');
// italicStore = true;
}
else if (ligc.checked === false) {
// all[i].style.fontStyle = "regular";
lig.classList.add('no-lig');
// italicStore = false;
}
}