-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
108 lines (103 loc) · 2.47 KB
/
app.js
File metadata and controls
108 lines (103 loc) · 2.47 KB
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
var output=document.getElementById('content');
function changeFont(font){
output.style.fontFamily=font.value;
}
function changeweight(weight){
output.style.fontSize=weight.value;
}
const bol=document.getElementById('bol');
bol.addEventListener('click',function(){
bold();
});
function bold(){
var bold=output.style.fontWeight;
if(bold=='normal')
{
output.style.fontWeight="bold";
}
else
{
output.style.fontWeight="normal";
}
}
const ita=document.getElementById('ita');
ita.addEventListener('click',function(){
italic();
});
function italic(){
var ita=output.style.fontStyle;
if(ita=='normal')
{
output.style.fontStyle="italic";
}
else
{
output.style.fontStyle="normal";
}
}
const under2=document.getElementById('line');
under2.addEventListener('click',function(){
under();
});
function under(){
var under1=output.style.textDecoration;
if(under1 !=='underline')
{
output.style.textDecoration="underline";
}
else
{
output.style.textDecoration="none";
}
}
var reset=document.getElementById('reset');
reset.addEventListener('click',function(){
start();
});
function start()
{
output.style.fontStyle="normal";
output.style.textDecoration="none";
output.style.fontWeight="normal";
}
var cls=document.getElementById('clear');
cls.addEventListener('click',function(){
clar();
});
function clar()
{
output.value="";
}
// color picker for body...
var inpt=document.querySelector('#colorInput');
var hexvalue=document.querySelector('#hex');
inpt.addEventListener('input',function(){
color_picker();
});
function color_picker()
{
const color = inpt.value;
hexvalue.value = color;
document.body.style.background = color;
}
// for font....
var inputfont=document.querySelector('#colorfont');
var hexvaluefont=document.querySelector('#hexfont');
inputfont.addEventListener('input',function(){
colorfont_picker();
});
function colorfont_picker()
{
const color = inputfont.value;
hexvaluefont.value = color;
document.getElementById('content').style.background = color;
}
//download
document.getElementById('download-btn').addEventListener('click',function(){
var text =output.value;
var filename=document.getElementById('filename').value;
var blob =new Blob([text],{
type:'data:text/plain;charset=utf-8'
});
saveAs(blob,filename);
},false);