-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
3,764 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
package-lock=false | ||
optional=false | ||
ignore-prepublish=true | ||
lockfile-version=3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,18 @@ | ||
.gap-2 { | ||
gap: 0.5rem; | ||
} | ||
|
||
@property --stargazers { | ||
syntax: "<integer>"; | ||
initial-value: 0; | ||
inherits: false; | ||
} | ||
|
||
.stargazers-count { | ||
transition: --stargazers 1s; | ||
counter-reset: stargazers var(--stargazers); | ||
} | ||
|
||
.stargazers-count::after { | ||
content: counter(stargazers); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
'use strict'; | ||
|
||
var exec = function() { | ||
fetch('https://api.github.com/repos/vsn4ik/input-spinner') | ||
.then(function(response) { | ||
return response.json(); | ||
}) | ||
.then(function(response) { | ||
// NOTE: XSS check | ||
if (typeof response.stargazers_count !== 'number') { | ||
return; | ||
} | ||
|
||
document.querySelector('.js-stargazers-count').style.setProperty('--stargazers', response.stargazers_count); | ||
}); | ||
|
||
$('#customize-spinner').spinner('changed', function(event, newVal, oldVal) { | ||
$('#old-val').text(oldVal); | ||
$('#new-val').text(newVal); | ||
}); | ||
|
||
$('[data-trigger="spinner"]').spinner('changing', function(event, newVal, oldVal) { | ||
$(event.currentTarget).closest('.well').find('small').text('Old = ' + oldVal + ', New = ' + newVal); | ||
}); | ||
|
||
$('#step-spinner').spinner({ | ||
step: function(dir) { | ||
if ((this.oldValue === 1 && dir === 'down') || (this.oldValue === -1 && dir === 'up')) { | ||
return 2; | ||
} | ||
return 1; | ||
} | ||
}); | ||
}; | ||
|
||
if (document.readyState === 'loading') { | ||
document.addEventListener('DOMContentLoaded', exec); | ||
} else { | ||
exec(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,46 +5,43 @@ | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<title>Input Spinner</title> | ||
|
||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/css/bootstrap.css"> | ||
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.15.1/css/all.css"> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.css"> | ||
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.15.4/css/all.css"> | ||
<link rel="stylesheet" href="dist/input-spinner.css"> | ||
<link rel="stylesheet" href="assets/css/old.css"> | ||
<link rel="stylesheet" href="assets/css/docs.css"> | ||
|
||
<script src="https://code.jquery.com/jquery-3.5.1.slim.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.js"></script> | ||
<script src="dist/input-spinner.js"></script> | ||
<script> | ||
document.addEventListener('DOMContentLoaded', function() { | ||
$('#customize-spinner').spinner('changed', function(event, newVal, oldVal) { | ||
$('#old-val').text(oldVal); | ||
$('#new-val').text(newVal); | ||
}); | ||
|
||
$('[data-trigger="spinner"]').spinner('changing', function(event, newVal, oldVal) { | ||
$(event.currentTarget).closest('.well').find('small').text('Old = ' + oldVal + ', New = ' + newVal); | ||
}); | ||
|
||
$('#step-spinner').spinner({ | ||
step: function(dir) { | ||
if ((this.oldValue === 1 && dir === 'down') || (this.oldValue === -1 && dir === 'up')) { | ||
return 2; | ||
} | ||
return 1; | ||
} | ||
}); | ||
}); | ||
</script> | ||
<script src="https://code.jquery.com/jquery-3.7.1.slim.js" defer></script> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.js" defer></script> | ||
<script src="dist/input-spinner.js" defer></script> | ||
<script src="assets/js/docs.js" defer></script> | ||
</head> | ||
<body> | ||
<div class="wrapper"> | ||
<header> | ||
<h1 class="header">Input Spinner</h1> | ||
<p class="header">A Number-Spinner, Support keyboard operations and continuous changing.</p> | ||
|
||
<div class="d-flex flex-wrap gap-2"> | ||
<a class="btn btn-primary" href="https://github.com/vsn4ik/input-spinner/archive/master.zip"><i class="fas fa-download fa-lg"></i> Download</a> | ||
<a class="btn btn-secondary" href="https://github.com/vsn4ik/input-spinner/"><i class="fab fa-github fa-lg"></i> View On GitHub</a> | ||
<div class="btn-toolbar gap-2"> | ||
<a class="btn btn-primary d-flex align-items-center" href="https://github.com/vsn4ik/input-spinner/archive/master.zip" download> | ||
<span class="fas fa-download mr-1"></span> | ||
<span>Download</span> | ||
</a> | ||
|
||
<div class="input-group"> | ||
<div class="input-group-prepend"> | ||
<a class="btn btn-secondary d-flex align-items-center" href="https://github.com/vsn4ik/input-spinner/"> | ||
<span class="fab fa-github mr-1"></span> | ||
View on GitHub | ||
</a> | ||
</div> | ||
|
||
<div class="input-group-append"> | ||
<div class="js-stargazers-count stargazers-count input-group-text bg-white d-flex align-items-center"> | ||
<span class="fas fa-star mr-1"></span> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</header> | ||
|
||
|
Oops, something went wrong.