Skip to content

Commit f91d033

Browse files
committed
Update
1 parent 71c23e2 commit f91d033

File tree

10 files changed

+3764
-90
lines changed

10 files changed

+3764
-90
lines changed

.github/workflows/test.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,15 @@ jobs:
99

1010
steps:
1111
- name: Clone repository
12-
uses: actions/checkout@v2
12+
uses: actions/checkout@v4
1313

1414
- name: Setup Node.js
15-
uses: actions/setup-node@v1
15+
uses: actions/setup-node@v3
1616
with:
17-
node-version: 12
18-
19-
- run: node --version
20-
- run: npm --version
17+
node-version: 'lts/hydrogen'
2118

2219
- name: Install npm dependencies
23-
run: npm install
20+
run: npm ci
2421

2522
- name: Run tests
2623
run: npm run test

.npmrc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
package-lock=false
2-
optional=false
31
ignore-prepublish=true
2+
lockfile-version=3

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
# [Input Spinner](https://vsn4ik.github.io/input-spinner/)
22

33
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
4-
[![Build Status](https://github.com/vsn4ik/input-spinner/workflows/Test/badge.svg)](https://github.com/vsn4ik/input-spinner/actions?workflow=Test)
5-
[![devDependency Status](https://david-dm.org/vsn4ik/input-spinner/dev-status.svg)](https://david-dm.org/vsn4ik/input-spinner?type=dev)
4+
[![Build Status](https://github.com/vsn4ik/input-spinner/actions/workflows/test.yml/badge.svg)](https://github.com/vsn4ik/input-spinner/actions/workflows/test.yml)
65

76

87
A Number-Spinner, Support keyboard operations and continuous changing.

docs/assets/css/docs.css

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
11
.gap-2 {
22
gap: 0.5rem;
33
}
4+
5+
@property --stargazers {
6+
syntax: "<integer>";
7+
initial-value: 0;
8+
inherits: false;
9+
}
10+
11+
.stargazers-count {
12+
transition: --stargazers 1s;
13+
counter-reset: stargazers var(--stargazers);
14+
}
15+
16+
.stargazers-count::after {
17+
content: counter(stargazers);
18+
}

docs/assets/css/old.css

Lines changed: 8 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,10 @@ time, mark, audio, video {
2626
/* Base text styles */
2727

2828
body {
29-
padding: 10px 50px 0 0;
3029
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
3130
font-size: 14px;
3231
color: #232323;
3332
background-color: #FBFAF7;
34-
margin: 0;
3533
line-height: 1.8em;
3634
-webkit-font-smoothing: antialiased;
3735
}
@@ -166,7 +164,9 @@ td {
166164

167165
/* Wrapper */
168166
.wrapper {
169-
width: 960px;
167+
display: flex;
168+
align-items: baseline;
169+
/* width: 960px; */
170170
}
171171

172172

@@ -175,9 +175,9 @@ td {
175175
header {
176176
background-color: #171717;
177177
color: #FDFDFB;
178-
width: 270px;
179-
float: left;
180-
position: fixed;
178+
width: 320px;
179+
position: sticky;
180+
top: 30px;
181181
border: 1px solid #000;
182182
border-top-right-radius: 4px;
183183
border-bottom-right-radius: 4px;
@@ -236,39 +236,19 @@ header li:hover {
236236

237237
section {
238238
width: 650px;
239-
float: right;
240239
padding-bottom: 50px;
241240
}
242241

243-
244-
/* Footer */
245-
246-
footer {
247-
width: 170px;
248-
float: left;
249-
position: fixed;
250-
bottom: 10px;
251-
padding-left: 50px;
252-
}
253-
254242
@media print, screen and (max-width: 960px) {
255243
div.wrapper {
256-
width: auto;
257-
margin: 0;
244+
flex-direction: column;
258245
}
259246

260-
header, section, footer {
261-
float: none;
247+
header, section {
262248
position: static;
263249
width: auto;
264250
}
265251

266-
footer {
267-
border-top: 1px solid #ccc;
268-
margin: 0 84px 0 50px;
269-
padding: 0;
270-
}
271-
272252
section {
273253
padding: 20px 84px 20px 50px;
274254
margin: 0 0 20px;
@@ -300,10 +280,6 @@ footer {
300280
margin: 0 0 30px;
301281
}
302282

303-
footer {
304-
margin: 0 0 0 30px;
305-
}
306-
307283
header ul, header p.view {
308284
position: static;
309285
}
@@ -313,14 +289,6 @@ footer {
313289
header ul li.download {
314290
display: none;
315291
}
316-
317-
footer {
318-
margin: 0 0 0 20px;
319-
}
320-
321-
footer a {
322-
display: block;
323-
}
324292
}
325293

326294
@media print {

docs/assets/js/docs.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
'use strict';
2+
3+
var exec = function() {
4+
fetch('https://api.github.com/repos/vsn4ik/input-spinner')
5+
.then(function(response) {
6+
return response.json();
7+
})
8+
.then(function(response) {
9+
// NOTE: XSS check
10+
if (typeof response.stargazers_count !== 'number') {
11+
return;
12+
}
13+
14+
document.querySelector('.js-stargazers-count').style.setProperty('--stargazers', response.stargazers_count);
15+
});
16+
17+
$('#customize-spinner').spinner('changed', function(event, newVal, oldVal) {
18+
$('#old-val').text(oldVal);
19+
$('#new-val').text(newVal);
20+
});
21+
22+
$('[data-trigger="spinner"]').spinner('changing', function(event, newVal, oldVal) {
23+
$(event.currentTarget).closest('.well').find('small').text('Old = ' + oldVal + ', New = ' + newVal);
24+
});
25+
26+
$('#step-spinner').spinner({
27+
step: function(dir) {
28+
if ((this.oldValue === 1 && dir === 'down') || (this.oldValue === -1 && dir === 'up')) {
29+
return 2;
30+
}
31+
return 1;
32+
}
33+
});
34+
};
35+
36+
if (document.readyState === 'loading') {
37+
document.addEventListener('DOMContentLoaded', exec);
38+
} else {
39+
exec();
40+
}

docs/example.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
<meta name="viewport" content="width=device-width, initial-scale=1">
66
<title>Input Spinner - Example</title>
77

8-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/css/bootstrap.css">
9-
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.15.1/css/all.css">
8+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.css">
9+
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.15.4/css/all.css">
1010
<link rel="stylesheet" href="dist/input-spinner.css">
1111

12-
<script src="https://code.jquery.com/jquery-3.5.1.slim.js"></script>
13-
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/js/bootstrap.js"></script>
12+
<script src="https://code.jquery.com/jquery-3.7.1.slim.js"></script>
13+
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/js/bootstrap.js"></script>
1414
<script src="dist/input-spinner.js"></script>
1515
<script>
1616
document.addEventListener('DOMContentLoaded', function() {

docs/index.html

Lines changed: 26 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,46 +5,43 @@
55
<meta name="viewport" content="width=device-width, initial-scale=1">
66
<title>Input Spinner</title>
77

8-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/css/bootstrap.css">
9-
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.15.1/css/all.css">
8+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.css">
9+
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.15.4/css/all.css">
1010
<link rel="stylesheet" href="dist/input-spinner.css">
1111
<link rel="stylesheet" href="assets/css/old.css">
1212
<link rel="stylesheet" href="assets/css/docs.css">
1313

14-
<script src="https://code.jquery.com/jquery-3.5.1.slim.js"></script>
15-
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.js"></script>
16-
<script src="dist/input-spinner.js"></script>
17-
<script>
18-
document.addEventListener('DOMContentLoaded', function() {
19-
$('#customize-spinner').spinner('changed', function(event, newVal, oldVal) {
20-
$('#old-val').text(oldVal);
21-
$('#new-val').text(newVal);
22-
});
23-
24-
$('[data-trigger="spinner"]').spinner('changing', function(event, newVal, oldVal) {
25-
$(event.currentTarget).closest('.well').find('small').text('Old = ' + oldVal + ', New = ' + newVal);
26-
});
27-
28-
$('#step-spinner').spinner({
29-
step: function(dir) {
30-
if ((this.oldValue === 1 && dir === 'down') || (this.oldValue === -1 && dir === 'up')) {
31-
return 2;
32-
}
33-
return 1;
34-
}
35-
});
36-
});
37-
</script>
14+
<script src="https://code.jquery.com/jquery-3.7.1.slim.js" defer></script>
15+
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.js" defer></script>
16+
<script src="dist/input-spinner.js" defer></script>
17+
<script src="assets/js/docs.js" defer></script>
3818
</head>
3919
<body>
4020
<div class="wrapper">
4121
<header>
4222
<h1 class="header">Input Spinner</h1>
4323
<p class="header">A Number-Spinner, Support keyboard operations and continuous changing.</p>
4424

45-
<div class="d-flex flex-wrap gap-2">
46-
<a class="btn btn-primary" href="https://github.com/vsn4ik/input-spinner/archive/master.zip"><i class="fas fa-download fa-lg"></i>&nbsp;Download</a>
47-
<a class="btn btn-secondary" href="https://github.com/vsn4ik/input-spinner/"><i class="fab fa-github fa-lg"></i>&nbsp;View On GitHub</a>
25+
<div class="btn-toolbar gap-2">
26+
<a class="btn btn-primary d-flex align-items-center" href="https://github.com/vsn4ik/input-spinner/archive/master.zip" download>
27+
<span class="fas fa-download mr-1"></span>
28+
<span>Download</span>
29+
</a>
30+
31+
<div class="input-group">
32+
<div class="input-group-prepend">
33+
<a class="btn btn-secondary d-flex align-items-center" href="https://github.com/vsn4ik/input-spinner/">
34+
<span class="fab fa-github mr-1"></span>
35+
View on GitHub
36+
</a>
37+
</div>
38+
39+
<div class="input-group-append">
40+
<div class="js-stargazers-count stargazers-count input-group-text bg-white d-flex align-items-center">
41+
<span class="fas fa-star mr-1"></span>
42+
</div>
43+
</div>
44+
</div>
4845
</div>
4946
</header>
5047

0 commit comments

Comments
 (0)