-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathindex.html
105 lines (96 loc) · 2.66 KB
/
index.html
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
<!doctype html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<title>pybadge pylint badges for Readme files</title>
</head>
<body>
<div style="text-align: center;
color: #888;
background-color: #eee;
border-radius: 10px;
margin: 5% 10% 5% 10%;
padding: 1%;
font-family: 'Lucida Sans Typewriter', 'Lucida Console', monaco, 'Bitstream Vera Sans Mono', monospace;
font-size: 3vw;
font-style: normal;
font-variant: normal;
font-weight: 500;
line-height: 26.4px;"
>
<h3 style="margin: 2%;">
pylint score badges
<img id="preview" src="" />
</h3>
<p>
Your Score
</p>
<input style="font-size: 300%;
color: #888;
text-align: center;
background-color: #eee;
border: 1px solid;
font-family: 'Lucida Sans Typewriter', 'Lucida Console', monaco, 'Bitstream Vera Sans Mono', monospace;
font-style: normal;
font-variant: normal;
font-weight: 500;
line-height: 26.4px;"
id="score"
type="number"
min="0"
max="10"
onClick="this.select();"
onchange="createLink()"
onkeyup="createLink()" />
<p>
<span style="font-size: 1.5vw;">Markdown</span>
<p>
<input style="text-align: center;
font-size: 130%;
background-color: #eee;
border: 0px;
color: #888;
width: 100%;
font-family: 'Lucida Sans Typewriter', 'Lucida Console', monaco, 'Bitstream Vera Sans Mono', monospace;
font-size: 2vw;
font-style: normal;
font-variant: normal;
font-weight: 500;
line-height: 26.4px;"
id="link"
type="text"
onClick="this.select();"
</p>
</p>
</div>
<script>
scoreElement = document.getElementById('score');
linkElement = document.getElementById('link');
previewElement = document.getElementById('preview');
function createLink() {
score = parseFloat(scoreElement.value);
if(Number.isNaN(score)) {
score = 0.0;
}
score = Math.round(score * 100) / 100;
if(score > 10.0) {
score = 10.0;
} else if (score < 0) {
score = 0.0;
}
thisUri = window.location.href;
link = "badges/" + score + ".svg"
if(thisUri.lastIndexOf('/') !== thisUri.length - 1) {
link = "/" + link;
}
link = thisUri + link;
previewElement.src = link;
linkElement.value = "" ;
}
// default
defaultScore = "7.5";
scoreElement.value = defaultScore;
createLink();
</script>
</body>
</html>