prvi
This commit is contained in:
7
EveryThing/wwwroot/vendor/libs/globalize/examples/amd-bower/.bowerrc
vendored
Normal file
7
EveryThing/wwwroot/vendor/libs/globalize/examples/amd-bower/.bowerrc
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"directory": "bower_components",
|
||||
"scripts": {
|
||||
"preinstall": "npm install cldr-data-downloader",
|
||||
"postinstall": "node ./node_modules/cldr-data-downloader/bin/download.js -i bower_components/cldr-data/index.json -o bower_components/cldr-data/"
|
||||
}
|
||||
}
|
||||
1
EveryThing/wwwroot/vendor/libs/globalize/examples/amd-bower/.npmignore
vendored
Normal file
1
EveryThing/wwwroot/vendor/libs/globalize/examples/amd-bower/.npmignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
bower_components/
|
||||
65
EveryThing/wwwroot/vendor/libs/globalize/examples/amd-bower/README.md
vendored
Normal file
65
EveryThing/wwwroot/vendor/libs/globalize/examples/amd-bower/README.md
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
# Hello World (AMD + bower)
|
||||
|
||||
We assume you know what [AMD](https://github.com/amdjs/amdjs-api/wiki/AMD) and
|
||||
[bower](http://bower.io/) is.
|
||||
|
||||
The demo is composed of the following files:
|
||||
|
||||
```
|
||||
.
|
||||
├── index.html
|
||||
└── main.js
|
||||
```
|
||||
|
||||
Before running it, execute the requirements below.
|
||||
|
||||
|
||||
## Requirements
|
||||
|
||||
**1. Install Globalize**
|
||||
|
||||
Let's use bower to download Globalize. For more information on regard of
|
||||
installation, please read [Getting Started](../../README.md#installation).
|
||||
|
||||
```
|
||||
bower install
|
||||
```
|
||||
|
||||
Note bower will also fetch some other dependencies of this demo, eg. require.js
|
||||
and its json plugin.
|
||||
|
||||
You'll get this:
|
||||
|
||||
```
|
||||
.
|
||||
├── bower_components/
|
||||
│ ├── globalize/
|
||||
│ │ └── dist/
|
||||
│ │ ├── globalize
|
||||
│ │ │ ├── date.js
|
||||
│ │ │ └── ...
|
||||
│ │ └── globalize.js
|
||||
│ └── ...
|
||||
├── index.html
|
||||
└── main.js
|
||||
```
|
||||
|
||||
**2. Install Dependencies**
|
||||
|
||||
No action needed, because bower has already handled that for us.
|
||||
|
||||
**3. CLDR content**
|
||||
|
||||
No action needed, because bower has already handled that for us. Note `.bowerrc`
|
||||
has postinstall hook that populates bower's cldr-data skeleton. For more
|
||||
information, see [bower's cldr-data](https://github.com/rxaviers/cldr-data-bower).
|
||||
|
||||
|
||||
## Running the demo
|
||||
|
||||
Once you've completed the requirements above:
|
||||
|
||||
1. Start a server by running `python -m SimpleHTTPServer` or other alternative servers such as [http-server](https://github.com/nodeapps/http-server), [nginx](http://nginx.org/en/docs/), [apache](http://httpd.apache.org/docs/trunk/).
|
||||
1. Point your browser at `http://localhost:8000/`.
|
||||
1. Understand the demo by reading the source code (both index.html and main.js).
|
||||
We have comments there for you.
|
||||
13
EveryThing/wwwroot/vendor/libs/globalize/examples/amd-bower/bower.json
vendored
Normal file
13
EveryThing/wwwroot/vendor/libs/globalize/examples/amd-bower/bower.json
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"name": "globalize-hello-world-amd-bower",
|
||||
"dependencies": {
|
||||
"cldr-data": "*",
|
||||
"globalize": "^1.3.0",
|
||||
"iana-tz-data": "*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"requirejs": "2.1.14",
|
||||
"requirejs-plugins": "1.0.2" ,
|
||||
"requirejs-text": "2.0.12"
|
||||
}
|
||||
}
|
||||
46
EveryThing/wwwroot/vendor/libs/globalize/examples/amd-bower/index.html
vendored
Normal file
46
EveryThing/wwwroot/vendor/libs/globalize/examples/amd-bower/index.html
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
<!doctype html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>Globalize Hello World (AMD + bower)</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Globalize Hello World (AMD + bower)</h1>
|
||||
|
||||
<div id="requirements">
|
||||
<h2>Requirements</h2>
|
||||
<ul>
|
||||
<li>Run `bower install` (you must have bower installed first).</li>
|
||||
<li>Start a server, e.g., by running `python -m SimpleHTTPServer`.</li>
|
||||
<li>Point your browser at `http://localhost:8000/`.</li>
|
||||
<li>Please, read README.md for more information on any of the above.</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div id="demo" style="display: none">
|
||||
<h2>Demo output</h2>
|
||||
<p>Now: <span id="date"></span></p>
|
||||
<p>Now: <span id="dateToParts"></span> (note the highlighted month, the markup was added using formatDateToParts)</p>
|
||||
<p>Now (in America/Sao_Paulo): <span id="zonedDate"></span></p>
|
||||
<p>A number: <span id="number"></span></p>
|
||||
<p>A number (compact form): <span id="number-compact"></span></p>
|
||||
<p>A currency: <span id="currency"></span></p>
|
||||
<p>Plural form of <span id="plural-number"></span> is <span id="plural-form"></span></p>
|
||||
<p>Messages:</p>
|
||||
<ul>
|
||||
<li><span id="message-0"></span></li>
|
||||
<li><span id="message-1"></span></li>
|
||||
<li><span id="message-2"></span></li>
|
||||
<li><span id="message-3"></span></li>
|
||||
</ul>
|
||||
<p>Something happened: <span id="relative-time"></span></p>
|
||||
<p>Speed limit: <span id="unit"></span></p>
|
||||
</div>
|
||||
|
||||
<!--
|
||||
Load require.js and let it execute main.js
|
||||
-->
|
||||
<script data-main="main.js" src="bower_components/requirejs/require.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
141
EveryThing/wwwroot/vendor/libs/globalize/examples/amd-bower/main.js
vendored
Normal file
141
EveryThing/wwwroot/vendor/libs/globalize/examples/amd-bower/main.js
vendored
Normal file
@@ -0,0 +1,141 @@
|
||||
/**
|
||||
* 1. Configure require.js paths.
|
||||
*/
|
||||
require.config({
|
||||
paths: {
|
||||
// Globalize dependencies paths.
|
||||
cldr: "./bower_components/cldrjs/dist/cldr",
|
||||
|
||||
// Unicode CLDR JSON data.
|
||||
"cldr-data": "./bower_components/cldr-data",
|
||||
|
||||
// IANA time zone data.
|
||||
"iana-tz-data": "../bower_components/iana-tz-data/iana-tz-data",
|
||||
|
||||
// require.js plugin we'll use to fetch CLDR JSON content.
|
||||
json: "./bower_components/requirejs-plugins/src/json",
|
||||
|
||||
// text is json's dependency.
|
||||
text: "./bower_components/requirejs-text/text",
|
||||
|
||||
// Globalize.
|
||||
globalize: "./bower_components/globalize/dist/globalize"
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* 2. Require dependencies and run your code.
|
||||
*/
|
||||
require([
|
||||
"globalize",
|
||||
|
||||
// CLDR content.
|
||||
"json!cldr-data/main/en/ca-gregorian.json",
|
||||
"json!cldr-data/main/en/currencies.json",
|
||||
"json!cldr-data/main/en/dateFields.json",
|
||||
"json!cldr-data/main/en/numbers.json",
|
||||
"json!cldr-data/main/en/timeZoneNames.json",
|
||||
"json!cldr-data/main/en/units.json",
|
||||
"json!cldr-data/supplemental/currencyData.json",
|
||||
"json!cldr-data/supplemental/likelySubtags.json",
|
||||
"json!cldr-data/supplemental/metaZones.json",
|
||||
"json!cldr-data/supplemental/plurals.json",
|
||||
"json!cldr-data/supplemental/timeData.json",
|
||||
"json!cldr-data/supplemental/weekData.json",
|
||||
"json!messages/en.json",
|
||||
"json!iana-tz-data.json",
|
||||
|
||||
// Extend Globalize with Date and Number modules.
|
||||
"globalize/currency",
|
||||
"globalize/date",
|
||||
"globalize/message",
|
||||
"globalize/number",
|
||||
"globalize/plural",
|
||||
"globalize/relative-time",
|
||||
"globalize/unit"
|
||||
], function( Globalize, enGregorian, enCurrencies, enDateFields, enNumbers,
|
||||
enTimeZoneNames, enUnits, currencyData, likelySubtags, metaZones,
|
||||
pluralsData, timeData, weekData, messages, ianaTzData ) {
|
||||
|
||||
var en, like, number;
|
||||
|
||||
// At this point, we have Globalize loaded. But, before we can use it, we need to feed it on the appropriate I18n content (Unicode CLDR). Read Requirements on Getting Started on the root's README.md for more information.
|
||||
Globalize.load(
|
||||
currencyData,
|
||||
enCurrencies,
|
||||
enDateFields,
|
||||
enGregorian,
|
||||
enNumbers,
|
||||
enTimeZoneNames,
|
||||
enUnits,
|
||||
likelySubtags,
|
||||
metaZones,
|
||||
pluralsData,
|
||||
timeData,
|
||||
weekData
|
||||
);
|
||||
Globalize.loadMessages( messages );
|
||||
Globalize.loadTimeZone( ianaTzData );
|
||||
|
||||
// Instantiate "en".
|
||||
en = Globalize( "en" );
|
||||
|
||||
// Use Globalize to format dates.
|
||||
document.getElementById( "date" ).textContent = en.formatDate( new Date(), {
|
||||
datetime: "medium"
|
||||
});
|
||||
|
||||
// Use Globalize to format dates on specific time zone.
|
||||
document.getElementById( "zonedDate" ).textContent = en.formatDate( new Date(), {
|
||||
datetime: "full",
|
||||
timeZone: "America/Sao_Paulo"
|
||||
});
|
||||
|
||||
// Use Globalize to format dates to parts.
|
||||
document.getElementById( "dateToParts" ).innerHTML = en.formatDateToParts( new Date(), {
|
||||
datetime: "medium"
|
||||
}).map( function( part ) {
|
||||
switch ( part.type ) {
|
||||
case "month": return "<strong>" + part.value + "</strong>";
|
||||
default: return part.value;
|
||||
}
|
||||
}).reduce( function( memo, value ) {
|
||||
return memo + value;
|
||||
});
|
||||
|
||||
// Use Globalize to format numbers.
|
||||
number = en.numberFormatter();
|
||||
document.getElementById( "number" ).textContent = number( 12345.6789 );
|
||||
document.getElementById( "number-compact" ).textContent = en.formatNumber( 12345.6789, {
|
||||
compact: "short",
|
||||
minimumSignificantDigits: 1,
|
||||
maximumSignificantDigits: 3
|
||||
});
|
||||
|
||||
// Use Globalize to format currencies.
|
||||
document.getElementById( "currency" ).textContent = en.formatCurrency( 69900, "USD" );
|
||||
|
||||
// Use Globalize to get the plural form of a numeric value.
|
||||
document.getElementById( "plural-number" ).textContent = number( 12345.6789 );
|
||||
document.getElementById( "plural-form" ).textContent = en.plural( 12345.6789 );
|
||||
|
||||
// Use Globalize to format a message with plural inflection.
|
||||
like = en.messageFormatter( "like" );
|
||||
document.getElementById( "message-0" ).textContent = like( 0 );
|
||||
document.getElementById( "message-1" ).textContent = like( 1 );
|
||||
document.getElementById( "message-2" ).textContent = like( 2 );
|
||||
document.getElementById( "message-3" ).textContent = like( 3 );
|
||||
|
||||
// Use Globalize to format a relative time.
|
||||
document.getElementById( "relative-time" ).textContent = en.formatRelativeTime( -35, "second" );
|
||||
|
||||
// Use Globalize to format a unit.
|
||||
document.getElementById( "unit" ).textContent = en.formatUnit( 60, "mile/hour", {
|
||||
form: "short"
|
||||
});
|
||||
|
||||
document.getElementById( "requirements" ).style.display = "none";
|
||||
document.getElementById( "demo" ).style.display = "block";
|
||||
|
||||
});
|
||||
12
EveryThing/wwwroot/vendor/libs/globalize/examples/amd-bower/messages/en.json
vendored
Normal file
12
EveryThing/wwwroot/vendor/libs/globalize/examples/amd-bower/messages/en.json
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"en": {
|
||||
"like": [
|
||||
"{0, plural, offset:1",
|
||||
" =0 {Be the first to like this}",
|
||||
" =1 {You liked this}",
|
||||
" one {You and someone else liked this}",
|
||||
" other {You and # others liked this}",
|
||||
"}"
|
||||
]
|
||||
}
|
||||
}
|
||||
14
EveryThing/wwwroot/vendor/libs/globalize/examples/amd-bower/package.json
vendored
Normal file
14
EveryThing/wwwroot/vendor/libs/globalize/examples/amd-bower/package.json
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"name": "globalize-hello-world-amd-bower",
|
||||
"private": true,
|
||||
"comment": [
|
||||
"You don't need this file. The only reasone this example does have a",
|
||||
"package.json is to fool npm, so cldr-data-downloader doesn't get",
|
||||
"installed on Globalize's root.",
|
||||
"",
|
||||
"It's analogous to `chroot .` for npm. [:P]"
|
||||
],
|
||||
"dependencies": {
|
||||
"cldr-data-downloader": "^0.3.4"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user