FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Web-Development/Button_CSS_Generator/script.js at main · codemistic/Web-Development · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
codemistic
/
Web-Development
Public
Notifications
You must be signed in to change notification settings
Fork
327
Star
349
Code
Issues
73
Pull requests
45
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
Web-Development
/
Button_CSS_Generator
/
script.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
249 lines (231 loc) · 6.95 KB
Breadcrumbs
Web-Development
/
Button_CSS_Generator
/
script.js
Copy path
File metadata and controls
249 lines (231 loc) · 6.95 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
// output button
var
OutputBtn
=
document
.
querySelector
(
"#btn"
)
;
//INPUT FIELDS
// colors
var
bgColor
=
document
.
querySelector
(
"#BGCOLOR"
)
;
var
fColor
=
document
.
querySelector
(
"#FCOLOR"
)
;
var
brColor
=
document
.
querySelector
(
"#BRCOLOR"
)
;
//size
var
brSize
=
document
.
querySelector
(
"#BRSIZE"
)
;
var
fSize
=
document
.
querySelector
(
"#FSIZE"
)
;
//border-style
var
BorderStyle
=
document
.
getElementsByName
(
"borderStyle"
)
;
// var radios = document.querySelectorAll()
//margin
var
tMargin
=
document
.
querySelector
(
"#TMARGIN"
)
;
var
rMargin
=
document
.
querySelector
(
"#RMARGIN"
)
;
var
bMargin
=
document
.
querySelector
(
"#BMARGIN"
)
;
var
lMargin
=
document
.
querySelector
(
"#LMARGIN"
)
;
//padding
var
tPadding
=
document
.
querySelector
(
"#TPADDING"
)
;
var
rPadding
=
document
.
querySelector
(
"#RPADDING"
)
;
var
bPadding
=
document
.
querySelector
(
"#BPADDING"
)
;
var
lPadding
=
document
.
querySelector
(
"#LPADDING"
)
;
//borderRadius
var
tlRadius
=
document
.
querySelector
(
"#TLRADIUS"
)
;
var
trRadius
=
document
.
querySelector
(
"#TRRADIUS"
)
;
var
brRadius
=
document
.
querySelector
(
"#BRRADIUS"
)
;
var
blRadius
=
document
.
querySelector
(
"#BLRADIUS"
)
;
var
copyBtn
=
document
.
querySelector
(
".copyToClipboard"
)
;
var
valObj
=
{
bgColor
:
"#2d63c8"
,
fColor
:
"#ffffff"
,
brColor
:
"#2d63c8"
,
brSize
:
"1"
,
fSize
:
"25"
,
BorderStyle
:
"solid"
,
tMargin
:
"0"
,
rMargin
:
"0"
,
bMargin
:
"0"
,
lMargin
:
"0"
,
tPadding
:
"15"
,
rPadding
:
"40"
,
bPadding
:
"15"
,
lPadding
:
"40"
,
tlRadius
:
"0"
,
trRadius
:
"0"
,
brRadius
:
"0"
,
blRadius
:
"0"
,
}
;
bgColor
.
addEventListener
(
"change"
,
function
(
)
{
valObj
.
bgColor
=
bgColor
.
value
;
updateBtn
(
)
;
updateText
(
)
;
}
)
;
fColor
.
addEventListener
(
"change"
,
function
(
)
{
valObj
.
fColor
=
fColor
.
value
;
updateBtn
(
)
;
updateText
(
)
;
}
)
;
brColor
.
addEventListener
(
"change"
,
function
(
)
{
valObj
.
brColor
=
brColor
.
value
;
updateBtn
(
)
;
updateText
(
)
;
}
)
;
brSize
.
addEventListener
(
"change"
,
function
(
)
{
valObj
.
brSize
=
brSize
.
value
;
updateBtn
(
)
;
updateText
(
)
;
}
)
;
fSize
.
addEventListener
(
"change"
,
function
(
)
{
valObj
.
fSize
=
fSize
.
value
;
updateBtn
(
)
;
updateText
(
)
;
}
)
;
setInterval
(
(
)
=>
{
for
(
i
=
0
;
i
<
BorderStyle
.
length
;
i
++
)
{
if
(
BorderStyle
[
i
]
.
checked
)
{
// console.log("hii");
valObj
.
BorderStyle
=
BorderStyle
[
i
]
.
value
;
updateBtn
(
)
;
updateText
(
)
;
}
}
}
,
500
)
;
tMargin
.
addEventListener
(
"change"
,
function
(
)
{
valObj
.
tMargin
=
tMargin
.
value
;
updateBtn
(
)
;
updateText
(
)
;
}
)
;
rMargin
.
addEventListener
(
"change"
,
function
(
)
{
valObj
.
rMargin
=
rMargin
.
value
;
updateBtn
(
)
;
updateText
(
)
;
}
)
;
bMargin
.
addEventListener
(
"change"
,
function
(
)
{
valObj
.
bMargin
=
bMargin
.
value
;
updateBtn
(
)
;
updateText
(
)
;
}
)
;
lMargin
.
addEventListener
(
"change"
,
function
(
)
{
valObj
.
lMargin
=
lMargin
.
value
;
updateBtn
(
)
;
updateText
(
)
;
}
)
;
tPadding
.
addEventListener
(
"change"
,
function
(
)
{
valObj
.
tPadding
=
tPadding
.
value
;
updateBtn
(
)
;
updateText
(
)
;
}
)
;
rPadding
.
addEventListener
(
"change"
,
function
(
)
{
valObj
.
rPadding
=
rPadding
.
value
;
updateBtn
(
)
;
updateText
(
)
;
}
)
;
bPadding
.
addEventListener
(
"change"
,
function
(
)
{
valObj
.
bPadding
=
bPadding
.
value
;
updateBtn
(
)
;
updateText
(
)
;
}
)
;
lPadding
.
addEventListener
(
"change"
,
function
(
)
{
valObj
.
lPadding
=
lPadding
.
value
;
updateBtn
(
)
;
updateText
(
)
;
}
)
;
tlRadius
.
addEventListener
(
"change"
,
function
(
)
{
valObj
.
tlRadius
=
tlRadius
.
value
;
updateBtn
(
)
;
updateText
(
)
;
}
)
;
trRadius
.
addEventListener
(
"change"
,
function
(
)
{
valObj
.
trRadius
=
trRadius
.
value
;
updateBtn
(
)
;
updateText
(
)
;
}
)
;
brRadius
.
addEventListener
(
"change"
,
function
(
)
{
valObj
.
brRadius
=
brRadius
.
value
;
updateBtn
(
)
;
updateText
(
)
;
}
)
;
blRadius
.
addEventListener
(
"change"
,
function
(
)
{
valObj
.
blRadius
=
blRadius
.
value
;
updateBtn
(
)
;
updateText
(
)
;
}
)
;
// OutputBtn.addEventListener("click", function () {
// console.log(valObj);
// showChange();
// });
function
showChange
(
)
{
OutputBtn
.
style
.
background
=
"red"
;
OutputBtn
.
style
.
color
=
"white"
;
}
window
.
onload
=
function
(
)
{
//inputs default set
bgColor
.
value
=
valObj
.
bgColor
;
fColor
.
value
=
valObj
.
fColor
;
brColor
.
value
=
valObj
.
brColor
;
brSize
.
value
=
valObj
.
brSize
;
fSize
.
value
=
valObj
.
fSize
;
BorderStyle
.
value
=
valObj
.
BorderStyle
;
tMargin
.
value
=
valObj
.
tMargin
;
rMargin
.
value
=
valObj
.
rMargin
;
bMargin
.
value
=
valObj
.
bMargin
;
lMargin
.
value
=
valObj
.
lMargin
;
tPadding
.
value
=
valObj
.
tPadding
;
rPadding
.
value
=
valObj
.
rPadding
;
bPadding
.
value
=
valObj
.
bPadding
;
lPadding
.
value
=
valObj
.
lPadding
;
tlRadius
.
value
=
valObj
.
tlRadius
;
trRadius
.
value
=
valObj
.
trRadius
;
brRadius
.
value
=
valObj
.
brRadius
;
blRadius
.
value
=
valObj
.
blRadius
;
//button default set
updateBtn
(
)
;
updateText
(
)
;
}
;
var
text
=
""
;
function
updateText
(
)
{
text
=
`
background-color:
${
valObj
.
bgColor
}
;
color:
${
valObj
.
fColor
}
;
border-color:
${
valObj
.
brColor
}
;
border-width:
${
valObj
.
brSize
+
"px"
}
;
font-size:
${
valObj
.
fSize
+
"px"
}
;
border-style:
${
valObj
.
BorderStyle
}
;
margin-top:
${
valObj
.
tMargin
+
"px"
}
;
margin-right:
${
valObj
.
rMargin
+
"px"
}
;
margin-bottom:
${
valObj
.
bMargin
+
"px"
}
;
margin-left:
${
valObj
.
lMargin
+
"px"
}
;
padding-top:
${
valObj
.
tPadding
+
"px"
}
;
padding-right:
${
valObj
.
rPadding
+
"px"
}
;
padding-bottom:
${
valObj
.
bPadding
+
"px"
}
;
padding-left:
${
valObj
.
lPadding
+
"px"
}
;
border-top-left-radius:
${
valObj
.
tlRadius
+
"px"
}
;
border-top-right-radius:
${
valObj
.
trRadius
+
"px"
}
;
border-bottom-right-radius:
${
valObj
.
brRadius
+
"px"
}
;
border-bottom-left-radius:
${
valObj
.
blRadius
+
"px"
}
;
`
;
}
//clipboard function
copyBtn
.
addEventListener
(
"click"
,
function
(
)
{
navigator
.
clipboard
.
writeText
(
text
)
.
then
(
function
(
)
{
console
.
log
(
"Async: Copying to clipboard was successful!"
)
;
}
,
function
(
err
)
{
console
.
error
(
"Async: Could not copy text: "
,
err
)
;
}
)
;
}
)
;
// setting values to btn
function
updateBtn
(
)
{
OutputBtn
.
style
.
background
=
valObj
.
bgColor
;
OutputBtn
.
style
.
color
=
valObj
.
fColor
;
OutputBtn
.
style
.
borderColor
=
valObj
.
brColor
;
OutputBtn
.
style
.
borderWidth
=
valObj
.
brSize
+
"px"
;
OutputBtn
.
style
.
fontSize
=
valObj
.
fSize
+
"px"
;
OutputBtn
.
style
.
borderStyle
=
valObj
.
BorderStyle
;
OutputBtn
.
style
.
marginTop
=
valObj
.
tMargin
+
"px"
;
OutputBtn
.
style
.
marginRight
=
valObj
.
rMargin
+
"px"
;
OutputBtn
.
style
.
marginBottom
=
valObj
.
bMargin
+
"px"
;
OutputBtn
.
style
.
marginLeft
=
valObj
.
lMargin
+
"px"
;
OutputBtn
.
style
.
paddingTop
=
valObj
.
tPadding
+
"px"
;
OutputBtn
.
style
.
paddingRight
=
valObj
.
rPadding
+
"px"
;
OutputBtn
.
style
.
paddingBottom
=
valObj
.
bPadding
+
"px"
;
OutputBtn
.
style
.
paddingLeft
=
valObj
.
lPadding
+
"px"
;
OutputBtn
.
style
.
borderTopLeftRadius
=
valObj
.
tlRadius
+
"px"
;
OutputBtn
.
style
.
borderTopRightRadius
=
valObj
.
trRadius
+
"px"
;
OutputBtn
.
style
.
borderBottomRightRadius
=
valObj
.
brRadius
+
"px"
;
OutputBtn
.
style
.
borderBottomLeftRadius
=
valObj
.
blRadius
+
"px"
;
}
Back
|
FazBrowse Home
|
New Git URL