mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Spinner: Update demos FIXME
This commit is contained in:
parent
e1b0a2777a
commit
d877e1d088
@ -8,7 +8,11 @@
|
|||||||
"tests"
|
"tests"
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"jquery": ">=1.6 <1.11"
|
"jquery": ">1.6",
|
||||||
|
"requirejs": "~2.1.14",
|
||||||
|
"globalize": "1.x",
|
||||||
|
"requirejs-plugins": "~1.0.2",
|
||||||
|
"requirejs-text": "~2.0.12"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"jquery-mousewheel": "3.1.11",
|
"jquery-mousewheel": "3.1.11",
|
||||||
|
@ -4,15 +4,6 @@
|
|||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>jQuery UI Spinner - Currency</title>
|
<title>jQuery UI Spinner - Currency</title>
|
||||||
<link rel="stylesheet" href="../../themes/base/all.css">
|
<link rel="stylesheet" href="../../themes/base/all.css">
|
||||||
<script src="../../jquery.js"></script>
|
|
||||||
<script src="../../external/jquery.mousewheel.js"></script>
|
|
||||||
<script src="../../external/globalize.js"></script>
|
|
||||||
<script src="../../external/globalize.culture.de-DE.js"></script>
|
|
||||||
<script src="../../external/globalize.culture.ja-JP.js"></script>
|
|
||||||
<script src="../../ui/core.js"></script>
|
|
||||||
<script src="../../ui/widget.js"></script>
|
|
||||||
<script src="../../ui/button.js"></script>
|
|
||||||
<script src="../../ui/spinner.js"></script>
|
|
||||||
<link rel="stylesheet" href="../demos.css">
|
<link rel="stylesheet" href="../demos.css">
|
||||||
<script>
|
<script>
|
||||||
$(function() {
|
$(function() {
|
||||||
@ -49,5 +40,6 @@
|
|||||||
<div class="demo-description">
|
<div class="demo-description">
|
||||||
<p>Example of a donation form, with currency selection and amount spinner.</p>
|
<p>Example of a donation form, with currency selection and amount spinner.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -4,30 +4,7 @@
|
|||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>jQuery UI Spinner - Decimal</title>
|
<title>jQuery UI Spinner - Decimal</title>
|
||||||
<link rel="stylesheet" href="../../themes/base/all.css">
|
<link rel="stylesheet" href="../../themes/base/all.css">
|
||||||
<script src="../../jquery.js"></script>
|
|
||||||
<script src="../../external/jquery.mousewheel.js"></script>
|
|
||||||
<script src="../../external/globalize.js"></script>
|
|
||||||
<script src="../../external/globalize.culture.de-DE.js"></script>
|
|
||||||
<script src="../../external/globalize.culture.ja-JP.js"></script>
|
|
||||||
<script src="../../ui/core.js"></script>
|
|
||||||
<script src="../../ui/widget.js"></script>
|
|
||||||
<script src="../../ui/button.js"></script>
|
|
||||||
<script src="../../ui/spinner.js"></script>
|
|
||||||
<link rel="stylesheet" href="../demos.css">
|
<link rel="stylesheet" href="../demos.css">
|
||||||
<script>
|
|
||||||
$(function() {
|
|
||||||
$( "#spinner" ).spinner({
|
|
||||||
step: 0.01,
|
|
||||||
numberFormat: "n"
|
|
||||||
});
|
|
||||||
|
|
||||||
$( "#culture" ).change(function() {
|
|
||||||
var current = $( "#spinner" ).spinner( "value" );
|
|
||||||
Globalize.culture( $(this).val() );
|
|
||||||
$( "#spinner" ).spinner( "value", current );
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
@ -38,9 +15,9 @@
|
|||||||
<p>
|
<p>
|
||||||
<label for="culture">Select a culture to use for formatting:</label>
|
<label for="culture">Select a culture to use for formatting:</label>
|
||||||
<select id="culture">
|
<select id="culture">
|
||||||
<option value="en-EN" selected="selected">English</option>
|
<option value="en" selected="selected">English</option>
|
||||||
<option value="de-DE">German</option>
|
<option value="es">Spanish</option>
|
||||||
<option value="ja-JP">Japanese</option>
|
<option value="ar">Arabic</option>
|
||||||
</select>
|
</select>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
@ -52,5 +29,56 @@
|
|||||||
formatting, based on the new culture.
|
formatting, based on the new culture.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<script src="../../deleteme/requirejs/require.js"></script>
|
||||||
|
<script>
|
||||||
|
|
||||||
|
require.config({
|
||||||
|
paths: {
|
||||||
|
cldr: "../../deleteme/cldrjs/dist/cldr",
|
||||||
|
"cldr-data": "../../deleteme/cldr",
|
||||||
|
globalize: "../../deleteme/globalize/dist/globalize",
|
||||||
|
jquery: "../../deleteme/jquery/dist/jquery",
|
||||||
|
json: "../../deleteme/requirejs-plugins/src/json",
|
||||||
|
text: "../../deleteme/requirejs-text/text",
|
||||||
|
ui: "../../ui"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
require([
|
||||||
|
"jquery",
|
||||||
|
"globalize",
|
||||||
|
"json!cldr-data/main/ar/numbers.json",
|
||||||
|
"json!cldr-data/main/en/numbers.json",
|
||||||
|
"json!cldr-data/main/es/numbers.json",
|
||||||
|
"json!cldr-data/supplemental/likelySubtags.json",
|
||||||
|
"globalize/number",
|
||||||
|
"ui/spinner"
|
||||||
|
], function( $, Globalize, arNumbers, enNumbers, esNumbers, likelySubtags ) {
|
||||||
|
|
||||||
|
Globalize.load( arNumbers );
|
||||||
|
Globalize.load( enNumbers );
|
||||||
|
Globalize.load( esNumbers );
|
||||||
|
Globalize.load( likelySubtags );
|
||||||
|
Globalize.locale( "en" );
|
||||||
|
|
||||||
|
$( "#spinner" ).spinner({
|
||||||
|
step: 0.01,
|
||||||
|
numberFormat: {
|
||||||
|
maximumFractionDigits: 2,
|
||||||
|
minimumFractionDigits: 2
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$( "#culture" ).change(function() {
|
||||||
|
var current = $( "#spinner" ).spinner( "value" );
|
||||||
|
Globalize.locale( $(this).val() );
|
||||||
|
$( "#spinner" ).spinner( "value", current );
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -4,15 +4,62 @@
|
|||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>jQuery UI Spinner - Default functionality</title>
|
<title>jQuery UI Spinner - Default functionality</title>
|
||||||
<link rel="stylesheet" href="../../themes/base/all.css">
|
<link rel="stylesheet" href="../../themes/base/all.css">
|
||||||
<script src="../../jquery.js"></script>
|
|
||||||
<script src="../../external/jquery.mousewheel.js"></script>
|
|
||||||
<script src="../../ui/core.js"></script>
|
|
||||||
<script src="../../ui/widget.js"></script>
|
|
||||||
<script src="../../ui/button.js"></script>
|
|
||||||
<script src="../../ui/spinner.js"></script>
|
|
||||||
<link rel="stylesheet" href="../demos.css">
|
<link rel="stylesheet" href="../demos.css">
|
||||||
<script>
|
</head>
|
||||||
$(function() {
|
<body>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<label for="spinner">Select a value:</label>
|
||||||
|
<input id="spinner" name="value">
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<button id="disable">Toggle disable/enable</button>
|
||||||
|
<button id="destroy">Toggle widget</button>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<button id="getvalue">Get value</button>
|
||||||
|
<button id="setvalue">Set value to 5</button>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="demo-description">
|
||||||
|
<p>Default spinner.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="../../deleteme/requirejs/require.js"></script>
|
||||||
|
<script>
|
||||||
|
|
||||||
|
require.config({
|
||||||
|
paths: {
|
||||||
|
cldr: "../../deleteme/cldrjs/dist/cldr",
|
||||||
|
"cldr-data": "../../deleteme/cldr",
|
||||||
|
globalize: "../../deleteme/globalize/dist/globalize",
|
||||||
|
jquery: "../../deleteme/jquery/dist/jquery",
|
||||||
|
"jquery-mousewheel": "../../deleteme/jquery-mousewheel/jquery.mousewheel",
|
||||||
|
json: "../../deleteme/requirejs-plugins/src/json",
|
||||||
|
text: "../../deleteme/requirejs-text/text",
|
||||||
|
ui: "../../ui"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
require([
|
||||||
|
"jquery",
|
||||||
|
"globalize",
|
||||||
|
"json!cldr-data/main/ar/numbers.json",
|
||||||
|
"json!cldr-data/main/en/numbers.json",
|
||||||
|
"json!cldr-data/main/es/numbers.json",
|
||||||
|
"json!cldr-data/supplemental/likelySubtags.json",
|
||||||
|
"globalize/number",
|
||||||
|
"ui/spinner"
|
||||||
|
], function( $, Globalize, arNumbers, enNumbers, esNumbers, likelySubtags ) {
|
||||||
|
|
||||||
|
Globalize.load( arNumbers );
|
||||||
|
Globalize.load( enNumbers );
|
||||||
|
Globalize.load( esNumbers );
|
||||||
|
Globalize.load( likelySubtags );
|
||||||
|
Globalize.locale( "en" );
|
||||||
|
|
||||||
var spinner = $( "#spinner" ).spinner();
|
var spinner = $( "#spinner" ).spinner();
|
||||||
|
|
||||||
$( "#disable" ).click(function() {
|
$( "#disable" ).click(function() {
|
||||||
@ -37,28 +84,10 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
$( "button" ).button();
|
$( "button" ).button();
|
||||||
});
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<p>
|
});
|
||||||
<label for="spinner">Select a value:</label>
|
|
||||||
<input id="spinner" name="value">
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
</script>
|
||||||
<button id="disable">Toggle disable/enable</button>
|
|
||||||
<button id="destroy">Toggle widget</button>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<button id="getvalue">Get value</button>
|
|
||||||
<button id="setvalue">Set value to 5</button>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<div class="demo-description">
|
|
||||||
<p>Default spinner.</p>
|
|
||||||
</div>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -5,34 +5,7 @@
|
|||||||
<title>jQuery UI Spinner - Map</title>
|
<title>jQuery UI Spinner - Map</title>
|
||||||
<link rel="stylesheet" href="../../themes/base/all.css">
|
<link rel="stylesheet" href="../../themes/base/all.css">
|
||||||
<script src="http://maps.google.com/maps/api/js?sensor=false"></script>
|
<script src="http://maps.google.com/maps/api/js?sensor=false"></script>
|
||||||
<script src="../../jquery.js"></script>
|
|
||||||
<script src="../../external/jquery.mousewheel.js"></script>
|
|
||||||
<script src="../../ui/core.js"></script>
|
|
||||||
<script src="../../ui/widget.js"></script>
|
|
||||||
<script src="../../ui/button.js"></script>
|
|
||||||
<script src="../../ui/spinner.js"></script>
|
|
||||||
<link rel="stylesheet" href="../demos.css">
|
<link rel="stylesheet" href="../demos.css">
|
||||||
<script>
|
|
||||||
$(function() {
|
|
||||||
function latlong() {
|
|
||||||
return new google.maps.LatLng( $("#lat").val(), $("#lng").val() );
|
|
||||||
}
|
|
||||||
function position() {
|
|
||||||
map.setCenter( latlong() );
|
|
||||||
}
|
|
||||||
$( "#lat, #lng" ).spinner({
|
|
||||||
step: .001,
|
|
||||||
change: position,
|
|
||||||
stop: position
|
|
||||||
});
|
|
||||||
|
|
||||||
var map = new google.maps.Map( $("#map")[0], {
|
|
||||||
zoom: 8,
|
|
||||||
center: latlong(),
|
|
||||||
mapTypeId: google.maps.MapTypeId.ROADMAP
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
<style>
|
<style>
|
||||||
#map {
|
#map {
|
||||||
width:500px;
|
width:500px;
|
||||||
@ -53,5 +26,64 @@
|
|||||||
<div class="demo-description">
|
<div class="demo-description">
|
||||||
<p>Google Maps integration, using spinners to change latitude and longitude.</p>
|
<p>Google Maps integration, using spinners to change latitude and longitude.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<script src="../../deleteme/requirejs/require.js"></script>
|
||||||
|
<script>
|
||||||
|
|
||||||
|
require.config({
|
||||||
|
paths: {
|
||||||
|
cldr: "../../deleteme/cldrjs/dist/cldr",
|
||||||
|
"cldr-data": "../../deleteme/cldr",
|
||||||
|
globalize: "../../deleteme/globalize/dist/globalize",
|
||||||
|
jquery: "../../deleteme/jquery/dist/jquery",
|
||||||
|
"jquery-mousewheel": "../../deleteme/jquery-mousewheel/jquery.mousewheel",
|
||||||
|
json: "../../deleteme/requirejs-plugins/src/json",
|
||||||
|
text: "../../deleteme/requirejs-text/text",
|
||||||
|
ui: "../../ui"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
require([
|
||||||
|
"jquery",
|
||||||
|
"globalize",
|
||||||
|
"json!cldr-data/main/ar/numbers.json",
|
||||||
|
"json!cldr-data/main/en/numbers.json",
|
||||||
|
"json!cldr-data/main/es/numbers.json",
|
||||||
|
"json!cldr-data/supplemental/likelySubtags.json",
|
||||||
|
"globalize/number",
|
||||||
|
"ui/spinner"
|
||||||
|
], function( $, Globalize, arNumbers, enNumbers, esNumbers, likelySubtags ) {
|
||||||
|
|
||||||
|
Globalize.load( arNumbers );
|
||||||
|
Globalize.load( enNumbers );
|
||||||
|
Globalize.load( esNumbers );
|
||||||
|
Globalize.load( likelySubtags );
|
||||||
|
Globalize.locale( "en" );
|
||||||
|
|
||||||
|
function latlong() {
|
||||||
|
return new google.maps.LatLng( $("#lat").val(), $("#lng").val() );
|
||||||
|
}
|
||||||
|
function position() {
|
||||||
|
map.setCenter( latlong() );
|
||||||
|
}
|
||||||
|
$( "#lat, #lng" ).spinner({
|
||||||
|
step: .001,
|
||||||
|
change: position,
|
||||||
|
stop: position,
|
||||||
|
numberFormat: {
|
||||||
|
minimumFractionDigits: 3
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var map = new google.maps.Map( $("#map")[0], {
|
||||||
|
zoom: 8,
|
||||||
|
center: latlong(),
|
||||||
|
mapTypeId: google.maps.MapTypeId.ROADMAP
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -4,28 +4,7 @@
|
|||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>jQuery UI Spinner - Overflow</title>
|
<title>jQuery UI Spinner - Overflow</title>
|
||||||
<link rel="stylesheet" href="../../themes/base/all.css">
|
<link rel="stylesheet" href="../../themes/base/all.css">
|
||||||
<script src="../../jquery.js"></script>
|
|
||||||
<script src="../../external/jquery.mousewheel.js"></script>
|
|
||||||
<script src="../../ui/core.js"></script>
|
|
||||||
<script src="../../ui/widget.js"></script>
|
|
||||||
<script src="../../ui/button.js"></script>
|
|
||||||
<script src="../../ui/spinner.js"></script>
|
|
||||||
<link rel="stylesheet" href="../demos.css">
|
<link rel="stylesheet" href="../demos.css">
|
||||||
<script>
|
|
||||||
$(function() {
|
|
||||||
$( "#spinner" ).spinner({
|
|
||||||
spin: function( event, ui ) {
|
|
||||||
if ( ui.value > 10 ) {
|
|
||||||
$( this ).spinner( "value", -10 );
|
|
||||||
return false;
|
|
||||||
} else if ( ui.value < -10 ) {
|
|
||||||
$( this ).spinner( "value", 10 );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
@ -40,5 +19,55 @@ Overflowing spinner restricted to a range of -10 to 10.
|
|||||||
For anything above 10, it'll overflow to -10, and the other way round.
|
For anything above 10, it'll overflow to -10, and the other way round.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<script src="../../deleteme/requirejs/require.js"></script>
|
||||||
|
<script>
|
||||||
|
|
||||||
|
require.config({
|
||||||
|
paths: {
|
||||||
|
cldr: "../../deleteme/cldrjs/dist/cldr",
|
||||||
|
"cldr-data": "../../deleteme/cldr",
|
||||||
|
globalize: "../../deleteme/globalize/dist/globalize",
|
||||||
|
jquery: "../../deleteme/jquery/dist/jquery",
|
||||||
|
"jquery-mousewheel": "../../deleteme/jquery-mousewheel/jquery.mousewheel",
|
||||||
|
json: "../../deleteme/requirejs-plugins/src/json",
|
||||||
|
text: "../../deleteme/requirejs-text/text",
|
||||||
|
ui: "../../ui"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
require([
|
||||||
|
"jquery",
|
||||||
|
"globalize",
|
||||||
|
"json!cldr-data/main/ar/numbers.json",
|
||||||
|
"json!cldr-data/main/en/numbers.json",
|
||||||
|
"json!cldr-data/main/es/numbers.json",
|
||||||
|
"json!cldr-data/supplemental/likelySubtags.json",
|
||||||
|
"globalize/number",
|
||||||
|
"ui/spinner"
|
||||||
|
], function( $, Globalize, arNumbers, enNumbers, esNumbers, likelySubtags ) {
|
||||||
|
|
||||||
|
Globalize.load( arNumbers );
|
||||||
|
Globalize.load( enNumbers );
|
||||||
|
Globalize.load( esNumbers );
|
||||||
|
Globalize.load( likelySubtags );
|
||||||
|
Globalize.locale( "en" );
|
||||||
|
|
||||||
|
$( "#spinner" ).spinner({
|
||||||
|
spin: function( event, ui ) {
|
||||||
|
if ( ui.value > 10 ) {
|
||||||
|
$( this ).spinner( "value", -10 );
|
||||||
|
return false;
|
||||||
|
} else if ( ui.value < -10 ) {
|
||||||
|
$( this ).spinner( "value", 10 );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -4,16 +4,68 @@
|
|||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>jQuery UI Spinner - Time</title>
|
<title>jQuery UI Spinner - Time</title>
|
||||||
<link rel="stylesheet" href="../../themes/base/all.css">
|
<link rel="stylesheet" href="../../themes/base/all.css">
|
||||||
<script src="../../jquery.js"></script>
|
|
||||||
<script src="../../external/jquery.mousewheel.js"></script>
|
|
||||||
<script src="../../external/globalize.js"></script>
|
|
||||||
<script src="../../external/globalize.culture.de-DE.js"></script>
|
|
||||||
<script src="../../ui/core.js"></script>
|
|
||||||
<script src="../../ui/widget.js"></script>
|
|
||||||
<script src="../../ui/button.js"></script>
|
|
||||||
<script src="../../ui/spinner.js"></script>
|
|
||||||
<link rel="stylesheet" href="../demos.css">
|
<link rel="stylesheet" href="../demos.css">
|
||||||
<script>
|
<script>
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<label for="spinner">Time spinner:</label>
|
||||||
|
<input id="spinner" name="spinner" value="08:30 PM">
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<label for="locale">Select a locale to use for formatting:</label>
|
||||||
|
<select id="locale">
|
||||||
|
<option value="en" selected="selected">English</option>
|
||||||
|
<option value="de">German</option>
|
||||||
|
</select>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="demo-description">
|
||||||
|
<p>
|
||||||
|
A custom widget extending spinner. Use the Globalization plugin to parse and output
|
||||||
|
a timestamp, with custom step and page options. Cursor up/down spins minutes, page up/down
|
||||||
|
spins hours.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="../../deleteme/requirejs/require.js"></script>
|
||||||
|
<script>
|
||||||
|
|
||||||
|
require.config({
|
||||||
|
paths: {
|
||||||
|
cldr: "../../deleteme/cldrjs/dist/cldr",
|
||||||
|
"cldr-data": "../../deleteme/cldr",
|
||||||
|
globalize: "../../deleteme/globalize/dist/globalize",
|
||||||
|
jquery: "../../deleteme/jquery/dist/jquery",
|
||||||
|
"jquery-mousewheel": "../../deleteme/jquery-mousewheel/jquery.mousewheel",
|
||||||
|
json: "../../deleteme/requirejs-plugins/src/json",
|
||||||
|
text: "../../deleteme/requirejs-text/text",
|
||||||
|
ui: "../../ui"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
require([
|
||||||
|
"jquery",
|
||||||
|
"globalize",
|
||||||
|
"json!cldr-data/main/de/ca-gregorian.json",
|
||||||
|
"json!cldr-data/main/de/numbers.json",
|
||||||
|
"json!cldr-data/main/en/ca-gregorian.json",
|
||||||
|
"json!cldr-data/main/en/numbers.json",
|
||||||
|
"json!cldr-data/supplemental/likelySubtags.json",
|
||||||
|
"globalize/date",
|
||||||
|
"globalize/number",
|
||||||
|
"ui/spinner"
|
||||||
|
], function( $, Globalize, deCaGregorian, deNumbers, enCaGregorian, enNumbers, likelySubtags ) {
|
||||||
|
|
||||||
|
Globalize.load( deCaGregorian );
|
||||||
|
Globalize.load( deNumbers );
|
||||||
|
Globalize.load( enCaGregorian );
|
||||||
|
Globalize.load( enNumbers );
|
||||||
|
Globalize.load( likelySubtags );
|
||||||
|
Globalize.locale( "en" );
|
||||||
|
|
||||||
$.widget( "ui.timespinner", $.ui.spinner, {
|
$.widget( "ui.timespinner", $.ui.spinner, {
|
||||||
options: {
|
options: {
|
||||||
// seconds
|
// seconds
|
||||||
@ -28,47 +80,26 @@
|
|||||||
if ( Number( value ) == value ) {
|
if ( Number( value ) == value ) {
|
||||||
return Number( value );
|
return Number( value );
|
||||||
}
|
}
|
||||||
return +Globalize.parseDate( value );
|
return Globalize.parseDate( value, { time: "short" } ).getTime();
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
},
|
},
|
||||||
|
|
||||||
_format: function( value ) {
|
_format: function( value ) {
|
||||||
return Globalize.format( new Date(value), "t" );
|
return Globalize.formatDate( new Date( value ), { time: "short" } );
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$(function() {
|
|
||||||
$( "#spinner" ).timespinner();
|
$( "#spinner" ).timespinner();
|
||||||
|
|
||||||
$( "#culture" ).change(function() {
|
$( "#locale" ).change(function() {
|
||||||
var current = $( "#spinner" ).timespinner( "value" );
|
var current = $( "#spinner" ).timespinner( "value" );
|
||||||
Globalize.culture( $(this).val() );
|
Globalize.locale( $(this).val() );
|
||||||
$( "#spinner" ).timespinner( "value", current );
|
$( "#spinner" ).timespinner( "value", current );
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<p>
|
</script>
|
||||||
<label for="spinner">Time spinner:</label>
|
|
||||||
<input id="spinner" name="spinner" value="08:30 PM">
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
<label for="culture">Select a culture to use for formatting:</label>
|
|
||||||
<select id="culture">
|
|
||||||
<option value="en-EN" selected="selected">English</option>
|
|
||||||
<option value="de-DE">German</option>
|
|
||||||
</select>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<div class="demo-description">
|
|
||||||
<p>
|
|
||||||
A custom widget extending spinner. Use the Globalization plugin to parse and output
|
|
||||||
a timestamp, with custom step and page options. Cursor up/down spins minutes, page up/down
|
|
||||||
spins hours.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
Loading…
Reference in New Issue
Block a user