init
14
.editorconfig
Normal file
@ -0,0 +1,14 @@
|
||||
# http://editorconfig.org
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.md]
|
||||
insert_final_newline = false
|
||||
trim_trailing_whitespace = false
|
||||
6
.gitignore
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
# Specifies intentionally untracked files to ignore when using Git
|
||||
# http://git-scm.com/docs/gitignore
|
||||
|
||||
node_modules/
|
||||
platforms/
|
||||
plugins/
|
||||
10
bower.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"name": "HelloIonic",
|
||||
"private": "true",
|
||||
"devDependencies": {
|
||||
"ionic": "driftyco/ionic-bower#1.3.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"angular-animate": "^1.5.8"
|
||||
}
|
||||
}
|
||||
50
config.xml
Normal file
@ -0,0 +1,50 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<widget id="com.raataar.terence" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
|
||||
<name>Ein Kinderspiel</name>
|
||||
<description>
|
||||
Fuer Terence
|
||||
</description>
|
||||
<author email="you@example.com" href="http://example.com.com/">
|
||||
Carsten Hilmer
|
||||
</author>
|
||||
<content src="index.html"/>
|
||||
<access origin="*"/>
|
||||
<preference name="webviewbounce" value="false"/>
|
||||
<preference name="UIWebViewBounce" value="false"/>
|
||||
<preference name="DisallowOverscroll" value="true"/>
|
||||
<preference name="SplashScreenDelay" value="2000"/>
|
||||
<preference name="FadeSplashScreenDuration" value="2000"/>
|
||||
<preference name="android-minSdkVersion" value="16"/>
|
||||
<preference name="BackupWebStorage" value="none"/>
|
||||
<preference name="SplashScreen" value="screen"/>
|
||||
<feature name="StatusBar">
|
||||
<param name="ios-package" onload="true" value="CDVStatusBar"/>
|
||||
</feature>
|
||||
<plugin name="cordova-plugin-device" spec="~1.1.3"/>
|
||||
<plugin name="cordova-plugin-console" spec="~1.0.4"/>
|
||||
<plugin name="cordova-plugin-whitelist" spec="~1.3.0"/>
|
||||
<plugin name="cordova-plugin-splashscreen" spec="~4.0.0"/>
|
||||
<plugin name="cordova-plugin-statusbar" spec="~2.2.0"/>
|
||||
<plugin name="ionic-plugin-keyboard" spec="~2.2.1"/>
|
||||
<platform name="android">
|
||||
<icon src="resources\android\icon\drawable-ldpi-icon.png" density="ldpi"/>
|
||||
<icon src="resources\android\icon\drawable-mdpi-icon.png" density="mdpi"/>
|
||||
<icon src="resources\android\icon\drawable-hdpi-icon.png" density="hdpi"/>
|
||||
<icon src="resources\android\icon\drawable-xhdpi-icon.png" density="xhdpi"/>
|
||||
<icon src="resources\android\icon\drawable-xxhdpi-icon.png" density="xxhdpi"/>
|
||||
<icon src="resources\android\icon\drawable-xxxhdpi-icon.png" density="xxxhdpi"/>
|
||||
<splash src="resources\android\splash\drawable-land-ldpi-screen.png" density="land-ldpi"/>
|
||||
<splash src="resources\android\splash\drawable-land-mdpi-screen.png" density="land-mdpi"/>
|
||||
<splash src="resources\android\splash\drawable-land-hdpi-screen.png" density="land-hdpi"/>
|
||||
<splash src="resources\android\splash\drawable-land-xhdpi-screen.png" density="land-xhdpi"/>
|
||||
<splash src="resources\android\splash\drawable-land-xxhdpi-screen.png" density="land-xxhdpi"/>
|
||||
<splash src="resources\android\splash\drawable-land-xxxhdpi-screen.png" density="land-xxxhdpi"/>
|
||||
<splash src="resources\android\splash\drawable-port-ldpi-screen.png" density="port-ldpi"/>
|
||||
<splash src="resources\android\splash\drawable-port-mdpi-screen.png" density="port-mdpi"/>
|
||||
<splash src="resources\android\splash\drawable-port-hdpi-screen.png" density="port-hdpi"/>
|
||||
<splash src="resources\android\splash\drawable-port-xhdpi-screen.png" density="port-xhdpi"/>
|
||||
<splash src="resources\android\splash\drawable-port-xxhdpi-screen.png" density="port-xxhdpi"/>
|
||||
<splash src="resources\android\splash\drawable-port-xxxhdpi-screen.png" density="port-xxxhdpi"/>
|
||||
</platform>
|
||||
<icon src="resources\android\icon\drawable-xhdpi-icon.png"/>
|
||||
</widget>
|
||||
51
gulpfile.js
Normal file
@ -0,0 +1,51 @@
|
||||
var gulp = require('gulp');
|
||||
var gutil = require('gulp-util');
|
||||
var bower = require('bower');
|
||||
var concat = require('gulp-concat');
|
||||
var sass = require('gulp-sass');
|
||||
var minifyCss = require('gulp-minify-css');
|
||||
var rename = require('gulp-rename');
|
||||
var sh = require('shelljs');
|
||||
|
||||
var paths = {
|
||||
sass: ['./scss/**/*.scss']
|
||||
};
|
||||
|
||||
gulp.task('default', ['sass']);
|
||||
|
||||
gulp.task('sass', function(done) {
|
||||
gulp.src('./scss/ionic.app.scss')
|
||||
.pipe(sass())
|
||||
.on('error', sass.logError)
|
||||
.pipe(gulp.dest('./www/css/'))
|
||||
.pipe(minifyCss({
|
||||
keepSpecialComments: 0
|
||||
}))
|
||||
.pipe(rename({ extname: '.min.css' }))
|
||||
.pipe(gulp.dest('./www/css/'))
|
||||
.on('end', done);
|
||||
});
|
||||
|
||||
gulp.task('watch', function() {
|
||||
gulp.watch(paths.sass, ['sass']);
|
||||
});
|
||||
|
||||
gulp.task('install', ['git-check'], function() {
|
||||
return bower.commands.install()
|
||||
.on('log', function(data) {
|
||||
gutil.log('bower', gutil.colors.cyan(data.id), data.message);
|
||||
});
|
||||
});
|
||||
|
||||
gulp.task('git-check', function(done) {
|
||||
if (!sh.which('git')) {
|
||||
console.log(
|
||||
' ' + gutil.colors.red('Git is not installed.'),
|
||||
'\n Git, the version control system, is required to download Ionic.',
|
||||
'\n Download git here:', gutil.colors.cyan('http://git-scm.com/downloads') + '.',
|
||||
'\n Once git is installed, run \'' + gutil.colors.cyan('gulp install') + '\' again.'
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
done();
|
||||
});
|
||||
83
hooks/README.md
Normal file
@ -0,0 +1,83 @@
|
||||
<!--
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
-->
|
||||
# Cordova Hooks
|
||||
|
||||
This directory may contain scripts used to customize cordova commands. This
|
||||
directory used to exist at `.cordova/hooks`, but has now been moved to the
|
||||
project root. Any scripts you add to these directories will be executed before
|
||||
and after the commands corresponding to the directory name. Useful for
|
||||
integrating your own build systems or integrating with version control systems.
|
||||
|
||||
__Remember__: Make your scripts executable.
|
||||
|
||||
## Hook Directories
|
||||
The following subdirectories will be used for hooks:
|
||||
|
||||
after_build/
|
||||
after_compile/
|
||||
after_docs/
|
||||
after_emulate/
|
||||
after_platform_add/
|
||||
after_platform_rm/
|
||||
after_platform_ls/
|
||||
after_plugin_add/
|
||||
after_plugin_ls/
|
||||
after_plugin_rm/
|
||||
after_plugin_search/
|
||||
after_prepare/
|
||||
after_run/
|
||||
after_serve/
|
||||
before_build/
|
||||
before_compile/
|
||||
before_docs/
|
||||
before_emulate/
|
||||
before_platform_add/
|
||||
before_platform_rm/
|
||||
before_platform_ls/
|
||||
before_plugin_add/
|
||||
before_plugin_ls/
|
||||
before_plugin_rm/
|
||||
before_plugin_search/
|
||||
before_prepare/
|
||||
before_run/
|
||||
before_serve/
|
||||
pre_package/ <-- Windows 8 and Windows Phone only.
|
||||
|
||||
## Script Interface
|
||||
|
||||
All scripts are run from the project's root directory and have the root directory passes as the first argument. All other options are passed to the script using environment variables:
|
||||
|
||||
* CORDOVA_VERSION - The version of the Cordova-CLI.
|
||||
* CORDOVA_PLATFORMS - Comma separated list of platforms that the command applies to (e.g.: android, ios).
|
||||
* CORDOVA_PLUGINS - Comma separated list of plugin IDs that the command applies to (e.g.: org.apache.cordova.file, org.apache.cordova.file-transfer)
|
||||
* CORDOVA_HOOK - Path to the hook that is being executed.
|
||||
* CORDOVA_CMDLINE - The exact command-line arguments passed to cordova (e.g.: cordova run ios --emulate)
|
||||
|
||||
If a script returns a non-zero exit code, then the parent cordova command will be aborted.
|
||||
|
||||
|
||||
## Writing hooks
|
||||
|
||||
We highly recommend writting your hooks using Node.js so that they are
|
||||
cross-platform. Some good examples are shown here:
|
||||
|
||||
[http://devgirl.org/2013/11/12/three-hooks-your-cordovaphonegap-project-needs/](http://devgirl.org/2013/11/12/three-hooks-your-cordovaphonegap-project-needs/)
|
||||
|
||||
94
hooks/after_prepare/010_add_platform_class.js
Normal file
@ -0,0 +1,94 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
// Add Platform Class
|
||||
// v1.0
|
||||
// Automatically adds the platform class to the body tag
|
||||
// after the `prepare` command. By placing the platform CSS classes
|
||||
// directly in the HTML built for the platform, it speeds up
|
||||
// rendering the correct layout/style for the specific platform
|
||||
// instead of waiting for the JS to figure out the correct classes.
|
||||
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
|
||||
var rootdir = process.argv[2];
|
||||
|
||||
function addPlatformBodyTag(indexPath, platform) {
|
||||
// add the platform class to the body tag
|
||||
try {
|
||||
var platformClass = 'platform-' + platform;
|
||||
var cordovaClass = 'platform-cordova platform-webview';
|
||||
|
||||
var html = fs.readFileSync(indexPath, 'utf8');
|
||||
|
||||
var bodyTag = findBodyTag(html);
|
||||
if(!bodyTag) return; // no opening body tag, something's wrong
|
||||
|
||||
if(bodyTag.indexOf(platformClass) > -1) return; // already added
|
||||
|
||||
var newBodyTag = bodyTag;
|
||||
|
||||
var classAttr = findClassAttr(bodyTag);
|
||||
if(classAttr) {
|
||||
// body tag has existing class attribute, add the classname
|
||||
var endingQuote = classAttr.substring(classAttr.length-1);
|
||||
var newClassAttr = classAttr.substring(0, classAttr.length-1);
|
||||
newClassAttr += ' ' + platformClass + ' ' + cordovaClass + endingQuote;
|
||||
newBodyTag = bodyTag.replace(classAttr, newClassAttr);
|
||||
|
||||
} else {
|
||||
// add class attribute to the body tag
|
||||
newBodyTag = bodyTag.replace('>', ' class="' + platformClass + ' ' + cordovaClass + '">');
|
||||
}
|
||||
|
||||
html = html.replace(bodyTag, newBodyTag);
|
||||
|
||||
fs.writeFileSync(indexPath, html, 'utf8');
|
||||
|
||||
process.stdout.write('add to body class: ' + platformClass + '\n');
|
||||
} catch(e) {
|
||||
process.stdout.write(e);
|
||||
}
|
||||
}
|
||||
|
||||
function findBodyTag(html) {
|
||||
// get the body tag
|
||||
try{
|
||||
return html.match(/<body(?=[\s>])(.*?)>/gi)[0];
|
||||
}catch(e){}
|
||||
}
|
||||
|
||||
function findClassAttr(bodyTag) {
|
||||
// get the body tag's class attribute
|
||||
try{
|
||||
return bodyTag.match(/ class=["|'](.*?)["|']/gi)[0];
|
||||
}catch(e){}
|
||||
}
|
||||
|
||||
if (rootdir) {
|
||||
|
||||
// go through each of the platform directories that have been prepared
|
||||
var platforms = (process.env.CORDOVA_PLATFORMS ? process.env.CORDOVA_PLATFORMS.split(',') : []);
|
||||
|
||||
for(var x=0; x<platforms.length; x++) {
|
||||
// open up the index.html file at the www root
|
||||
try {
|
||||
var platform = platforms[x].trim().toLowerCase();
|
||||
var indexPath;
|
||||
|
||||
if(platform == 'android') {
|
||||
indexPath = path.join('platforms', platform, 'assets', 'www', 'index.html');
|
||||
} else {
|
||||
indexPath = path.join('platforms', platform, 'www', 'index.html');
|
||||
}
|
||||
|
||||
if(fs.existsSync(indexPath)) {
|
||||
addPlatformBodyTag(indexPath, platform);
|
||||
}
|
||||
|
||||
} catch(e) {
|
||||
process.stdout.write(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
4
ionic.config.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"name": "Ein Kinderspiel",
|
||||
"app_id": ""
|
||||
}
|
||||
4
ionic.project
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"name": "terence",
|
||||
"app_id": ""
|
||||
}
|
||||
26
package.json
Normal file
@ -0,0 +1,26 @@
|
||||
{
|
||||
"name": "blank",
|
||||
"version": "1.1.1",
|
||||
"description": "blank: An Ionic project",
|
||||
"dependencies": {
|
||||
"gulp": "^3.5.6",
|
||||
"gulp-sass": "^2.0.4",
|
||||
"gulp-concat": "^2.2.0",
|
||||
"gulp-minify-css": "^0.3.0",
|
||||
"gulp-rename": "^1.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"bower": "^1.3.3",
|
||||
"gulp-util": "^2.2.14",
|
||||
"shelljs": "^0.3.0"
|
||||
},
|
||||
"cordovaPlugins": [
|
||||
"cordova-plugin-device",
|
||||
"cordova-plugin-console",
|
||||
"cordova-plugin-whitelist",
|
||||
"cordova-plugin-splashscreen",
|
||||
"cordova-plugin-statusbar",
|
||||
"ionic-plugin-keyboard"
|
||||
],
|
||||
"cordovaPlatforms": []
|
||||
}
|
||||
BIN
resources/android/icon/drawable-hdpi-icon.png
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
resources/android/icon/drawable-ldpi-icon.png
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
BIN
resources/android/icon/drawable-mdpi-icon.png
Normal file
|
After Width: | Height: | Size: 5.4 KiB |
BIN
resources/android/icon/drawable-xhdpi-icon.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
resources/android/icon/drawable-xxhdpi-icon.png
Normal file
|
After Width: | Height: | Size: 29 KiB |
BIN
resources/android/icon/drawable-xxxhdpi-icon.png
Normal file
|
After Width: | Height: | Size: 44 KiB |
BIN
resources/android/splash/drawable-land-hdpi-screen.png
Normal file
|
After Width: | Height: | Size: 116 KiB |
BIN
resources/android/splash/drawable-land-ldpi-screen.png
Normal file
|
After Width: | Height: | Size: 27 KiB |
BIN
resources/android/splash/drawable-land-mdpi-screen.png
Normal file
|
After Width: | Height: | Size: 51 KiB |
BIN
resources/android/splash/drawable-land-xhdpi-screen.png
Normal file
|
After Width: | Height: | Size: 249 KiB |
BIN
resources/android/splash/drawable-land-xxhdpi-screen.png
Normal file
|
After Width: | Height: | Size: 356 KiB |
BIN
resources/android/splash/drawable-land-xxxhdpi-screen.png
Normal file
|
After Width: | Height: | Size: 476 KiB |
BIN
resources/android/splash/drawable-port-hdpi-screen.png
Normal file
|
After Width: | Height: | Size: 115 KiB |
BIN
resources/android/splash/drawable-port-ldpi-screen.png
Normal file
|
After Width: | Height: | Size: 27 KiB |
BIN
resources/android/splash/drawable-port-mdpi-screen.png
Normal file
|
After Width: | Height: | Size: 51 KiB |
BIN
resources/android/splash/drawable-port-xhdpi-screen.png
Normal file
|
After Width: | Height: | Size: 245 KiB |
BIN
resources/android/splash/drawable-port-xxhdpi-screen.png
Normal file
|
After Width: | Height: | Size: 348 KiB |
BIN
resources/android/splash/drawable-port-xxxhdpi-screen.png
Normal file
|
After Width: | Height: | Size: 468 KiB |
BIN
resources/icon.psd
Normal file
BIN
resources/ios/icon/icon-40.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
resources/ios/icon/icon-40@2x.png
Normal file
|
After Width: | Height: | Size: 3.5 KiB |
BIN
resources/ios/icon/icon-50.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
resources/ios/icon/icon-50@2x.png
Normal file
|
After Width: | Height: | Size: 4.6 KiB |
BIN
resources/ios/icon/icon-60.png
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
BIN
resources/ios/icon/icon-60@2x.png
Normal file
|
After Width: | Height: | Size: 5.9 KiB |
BIN
resources/ios/icon/icon-60@3x.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
resources/ios/icon/icon-72.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
resources/ios/icon/icon-72@2x.png
Normal file
|
After Width: | Height: | Size: 7.6 KiB |
BIN
resources/ios/icon/icon-76.png
Normal file
|
After Width: | Height: | Size: 3.2 KiB |
BIN
resources/ios/icon/icon-76@2x.png
Normal file
|
After Width: | Height: | Size: 8.1 KiB |
BIN
resources/ios/icon/icon-small.png
Normal file
|
After Width: | Height: | Size: 818 B |
BIN
resources/ios/icon/icon-small@2x.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
resources/ios/icon/icon-small@3x.png
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
resources/ios/icon/icon.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
resources/ios/icon/icon@2x.png
Normal file
|
After Width: | Height: | Size: 5.6 KiB |
BIN
resources/ios/splash/Default-568h@2x~iphone.png
Normal file
|
After Width: | Height: | Size: 31 KiB |
BIN
resources/ios/splash/Default-667h.png
Normal file
|
After Width: | Height: | Size: 40 KiB |
BIN
resources/ios/splash/Default-736h.png
Normal file
|
After Width: | Height: | Size: 44 KiB |
BIN
resources/ios/splash/Default-Landscape-736h.png
Normal file
|
After Width: | Height: | Size: 44 KiB |
BIN
resources/ios/splash/Default-Landscape@2x~ipad.png
Normal file
|
After Width: | Height: | Size: 100 KiB |
BIN
resources/ios/splash/Default-Landscape~ipad.png
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
resources/ios/splash/Default-Portrait@2x~ipad.png
Normal file
|
After Width: | Height: | Size: 97 KiB |
BIN
resources/ios/splash/Default-Portrait~ipad.png
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
resources/ios/splash/Default@2x~iphone.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
resources/ios/splash/Default~iphone.png
Normal file
|
After Width: | Height: | Size: 7.0 KiB |
BIN
resources/splash.psd
Normal file
23
scss/ionic.app.scss
Normal file
@ -0,0 +1,23 @@
|
||||
/*
|
||||
To customize the look and feel of Ionic, you can override the variables
|
||||
in ionic's _variables.scss file.
|
||||
|
||||
For example, you might change some of the default colors:
|
||||
|
||||
$light: #fff !default;
|
||||
$stable: #f8f8f8 !default;
|
||||
$positive: #387ef5 !default;
|
||||
$calm: #11c1f3 !default;
|
||||
$balanced: #33cd5f !default;
|
||||
$energized: #ffc900 !default;
|
||||
$assertive: #ef473a !default;
|
||||
$royal: #886aea !default;
|
||||
$dark: #444 !default;
|
||||
*/
|
||||
|
||||
// The path for our ionicons font files, relative to the built CSS in www/css
|
||||
$ionicons-font-path: "../lib/ionic/fonts" !default;
|
||||
|
||||
// Include all of Ionic
|
||||
@import "www/lib/ionic/scss/ionic";
|
||||
|
||||
3340
www/css/animate.css
vendored
Normal file
16
www/css/style.css
Normal file
@ -0,0 +1,16 @@
|
||||
/* Empty. Add your own CSS if you like */
|
||||
|
||||
.myborder{
|
||||
display: inline-block;
|
||||
border-radius: 6px;
|
||||
color: black;
|
||||
border-style: solid;
|
||||
border-color:black;
|
||||
border-width: 2px;
|
||||
}
|
||||
|
||||
.myborder:active {
|
||||
background-color: #3e8e41;
|
||||
box-shadow: 0 5px #666;
|
||||
transform: translateY(4px);
|
||||
}
|
||||
BIN
www/img/elefant.jpg
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
www/img/esel.jpg
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
www/img/hahn.jpg
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
www/img/hund.jpg
Normal file
|
After Width: | Height: | Size: 24 KiB |
BIN
www/img/katze.jpg
Normal file
|
After Width: | Height: | Size: 96 KiB |
BIN
www/img/kuh.jpg
Normal file
|
After Width: | Height: | Size: 31 KiB |
BIN
www/img/maus.jpg
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
www/img/schaf.jpg
Normal file
|
After Width: | Height: | Size: 117 KiB |
56
www/index.html
Normal file
@ -0,0 +1,56 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
|
||||
<title></title>
|
||||
|
||||
<link rel="manifest" href="manifest.json">
|
||||
|
||||
<!-- un-comment this code to enable service worker
|
||||
<script>
|
||||
if ('serviceWorker' in navigator) {
|
||||
navigator.serviceWorker.register('service-worker.js')
|
||||
.then(() => console.log('service worker installed'))
|
||||
.catch(err => console.log('Error', err));
|
||||
}
|
||||
</script>-->
|
||||
|
||||
<link href="lib/ionic/css/ionic.css" rel="stylesheet">
|
||||
<link href="css/style.css" rel="stylesheet">
|
||||
<link href="css/animate.css" rel="stylesheet">
|
||||
|
||||
<!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above
|
||||
<link href="css/ionic.app.css" rel="stylesheet">
|
||||
-->
|
||||
|
||||
<!-- ionic/angularjs js -->
|
||||
<script src="lib/ionic/js/ionic.bundle.js"></script>
|
||||
<script src="js/lib/angular-animate/angular-animate.js"></script>
|
||||
<!-- cordova script (this will be a 404 during development) -->
|
||||
<script src="lib/ng-cordova/ng-cordova.min.js"></script>
|
||||
|
||||
<!-- cordova script (this will be a 404 during development) -->
|
||||
<script src="cordova.js"></script>
|
||||
|
||||
<!-- your app's js -->
|
||||
<script src="js/app.js"></script>
|
||||
<script src="js/controllers.js"></script>
|
||||
<script src="js/services.js"></script>
|
||||
</head>
|
||||
<body ng-app="starter">
|
||||
<!--
|
||||
The nav bar that will be updated as we navigate between views.
|
||||
-->
|
||||
<ion-nav-bar class="bar-stable">
|
||||
<ion-nav-back-button>
|
||||
</ion-nav-back-button>
|
||||
</ion-nav-bar>
|
||||
<!--
|
||||
The views will be rendered in the <ion-nav-view> directive below
|
||||
Templates are in the /templates folder (but you could also
|
||||
have templates inline in this html file if you'd like).
|
||||
-->
|
||||
<ion-nav-view></ion-nav-view>
|
||||
</body>
|
||||
</html>
|
||||
77
www/js/app.js
Normal file
@ -0,0 +1,77 @@
|
||||
// Ionic Starter App
|
||||
|
||||
// angular.module is a global place for creating, registering and retrieving Angular modules
|
||||
// 'starter' is the name of this angular module example (also set in a <body> attribute in index.html)
|
||||
// the 2nd parameter is an array of 'requires'
|
||||
// 'starter.services' is found in services.js
|
||||
// 'starter.controllers' is found in controllers.js
|
||||
angular.module('starter', ['ionic', 'ngCordova', 'starter.controllers', 'starter.services'])
|
||||
|
||||
.run(function($ionicPlatform) {
|
||||
$ionicPlatform.ready(function() {
|
||||
// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
|
||||
// for form inputs)
|
||||
if (window.cordova && window.cordova.plugins && window.cordova.plugins.Keyboard) {
|
||||
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
|
||||
cordova.plugins.Keyboard.disableScroll(true);
|
||||
|
||||
}
|
||||
if (window.StatusBar) {
|
||||
// org.apache.cordova.statusbar required
|
||||
StatusBar.styleDefault();
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
.config(function($stateProvider, $urlRouterProvider) {
|
||||
|
||||
// Ionic uses AngularUI Router which uses the concept of states
|
||||
// Learn more here: https://github.com/angular-ui/ui-router
|
||||
// Set up the various states which the app can be in.
|
||||
// Each state's controller can be found in controllers.js
|
||||
$stateProvider
|
||||
|
||||
// setup an abstract state for the tabs directive
|
||||
.state('tab', {
|
||||
url: '/tab',
|
||||
abstract: true,
|
||||
templateUrl: 'templates/tabs.html'
|
||||
})
|
||||
|
||||
// Each tab has its own nav history stack:
|
||||
|
||||
.state('tab.dash', {
|
||||
url: '/dash',
|
||||
views: {
|
||||
'tab-dash': {
|
||||
templateUrl: 'templates/tab-dash.html',
|
||||
controller: 'DashCtrl'
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
.state('tab.spiel1', {
|
||||
url: '/spiel1',
|
||||
views: {
|
||||
'tab-spiel1': {
|
||||
templateUrl: 'templates/spiel1.html',
|
||||
controller: 'Spiel1Ctrl'
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
.state('tab.spiel2', {
|
||||
url: '/spiel2',
|
||||
views: {
|
||||
'tab-spiel2': {
|
||||
templateUrl: 'templates/spiel2.html',
|
||||
controller: 'Spiel2Ctrl'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// if none of the above states are matched, use this as the fallback
|
||||
$urlRouterProvider.otherwise('/tab/dash');
|
||||
|
||||
});
|
||||
262
www/js/controllers.js
Normal file
@ -0,0 +1,262 @@
|
||||
angular.module('starter.controllers', [])
|
||||
|
||||
.controller('DashCtrl', function($scope, $cordovaMedia, $state) {
|
||||
|
||||
$scope.play = function(src) {
|
||||
var media = new Media(src, null, null);
|
||||
$cordovaMedia.play(media);
|
||||
}
|
||||
|
||||
|
||||
$scope.starte_spiel1 = function() {
|
||||
var media = new Media('/android_asset/www/sounds/spiel1.mp3', goto_spiel1, null);
|
||||
$cordovaMedia.play(media);
|
||||
}
|
||||
|
||||
$scope.starte_spiel2 = function() {
|
||||
var media = new Media('/android_asset/www/sounds/spiel2.mp3', goto_spiel2, null);
|
||||
$cordovaMedia.play(media);
|
||||
}
|
||||
|
||||
function goto_spiel1() {
|
||||
$state.go('tab.spiel1');
|
||||
}
|
||||
|
||||
function goto_spiel2() {
|
||||
$state.go('tab.spiel2');
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
.controller('Spiel2Ctrl', function($scope, $cordovaMedia, $state) {
|
||||
|
||||
$scope.spiele=[];
|
||||
|
||||
var tier = {
|
||||
bild: 'elefant.jpg',
|
||||
sound1: 'sound_elefant.mp3',
|
||||
sound2: ''
|
||||
};
|
||||
$scope.spiele.push(tier);
|
||||
|
||||
var tier1 = {
|
||||
bild: 'esel.jpg',
|
||||
sound1: 'sound_esel.mp3',
|
||||
sound2: ''
|
||||
};
|
||||
$scope.spiele.push(tier1);
|
||||
|
||||
var tier2 = {
|
||||
bild: 'hahn.jpg',
|
||||
sound1: 'sound_hahn.mp3',
|
||||
sound2: ''
|
||||
};
|
||||
$scope.spiele.push(tier2);
|
||||
|
||||
var tier3 = {
|
||||
bild: 'hund.jpg',
|
||||
sound1: 'sound_hund.mp3',
|
||||
sound2: ''
|
||||
};
|
||||
$scope.spiele.push(tier3);
|
||||
|
||||
var tier4 = {
|
||||
bild: 'katze.jpg',
|
||||
sound1: 'sound_katze.mp3',
|
||||
sound2: ''
|
||||
};
|
||||
$scope.spiele.push(tier4);
|
||||
|
||||
var tier5 = {
|
||||
bild: 'kuh.jpg',
|
||||
sound1: 'sound_kuh.mp3',
|
||||
sound2: ''
|
||||
};
|
||||
$scope.spiele.push(tier5);
|
||||
|
||||
var tier6 = {
|
||||
bild: 'maus.jpg',
|
||||
sound1: 'sound_maus.mp3',
|
||||
sound2: ''
|
||||
};
|
||||
$scope.spiele.push(tier6);
|
||||
|
||||
var tier7 = {
|
||||
bild: 'schaf.jpg',
|
||||
sound1: 'sound_schaf.mp3',
|
||||
sound2: ''
|
||||
};
|
||||
$scope.spiele.push(tier7);
|
||||
|
||||
$scope.play = function(src) {
|
||||
var media = new Media(src, null, null);
|
||||
$cordovaMedia.play(media);
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
.controller('Spiel1Ctrl', function($scope, $cordovaMedia, $state, $timeout) {
|
||||
|
||||
$scope.spiele=[];
|
||||
$scope.sounds=[];
|
||||
$scope.tierfinden='';
|
||||
$scope.randomid=0;
|
||||
$scope.error = false;
|
||||
|
||||
$scope.sounds.push('');
|
||||
|
||||
var tier = {
|
||||
id: 1,
|
||||
bild: 'elefant.jpg',
|
||||
sound1: 'sound_elefant.mp3',
|
||||
antwort: ''
|
||||
};
|
||||
$scope.spiele.push(tier);
|
||||
$scope.sounds.push('finde_elefant.mp3');
|
||||
|
||||
var tier1 = {
|
||||
id: 2,
|
||||
bild: 'esel.jpg',
|
||||
sound1: 'sound_esel.mp3',
|
||||
antwort: ''
|
||||
};
|
||||
$scope.spiele.push(tier1);
|
||||
$scope.sounds.push('finde_esel.mp3');
|
||||
|
||||
var tier2 = {
|
||||
id: 3,
|
||||
bild: 'hahn.jpg',
|
||||
sound1: 'sound_hahn.mp3',
|
||||
antwort: ''
|
||||
};
|
||||
$scope.spiele.push(tier2);
|
||||
$scope.sounds.push('finde_hahn.mp3');
|
||||
|
||||
var tier3 = {
|
||||
id: 4,
|
||||
bild: 'hund.jpg',
|
||||
sound1: 'sound_hund.mp3',
|
||||
sound2: ''
|
||||
};
|
||||
$scope.spiele.push(tier3);
|
||||
$scope.sounds.push('finde_hund.mp3');
|
||||
|
||||
var tier4 = {
|
||||
id: 5,
|
||||
bild: 'katze.jpg',
|
||||
sound1: 'sound_katze.mp3',
|
||||
sound2: ''
|
||||
};
|
||||
$scope.spiele.push(tier4);
|
||||
$scope.sounds.push('finde_katze.mp3');
|
||||
|
||||
var tier5 = {
|
||||
id: 6,
|
||||
bild: 'kuh.jpg',
|
||||
sound1: 'sound_kuh.mp3',
|
||||
sound2: ''
|
||||
};
|
||||
$scope.spiele.push(tier5);
|
||||
$scope.sounds.push('finde_kuh.mp3');
|
||||
|
||||
var tier6 = {
|
||||
id: 7,
|
||||
bild: 'maus.jpg',
|
||||
sound1: 'sound_maus.mp3',
|
||||
sound2: ''
|
||||
};
|
||||
$scope.spiele.push(tier6);
|
||||
$scope.sounds.push('finde_maus.mp3');
|
||||
|
||||
var tier7 = {
|
||||
id: 8,
|
||||
bild: 'schaf.jpg',
|
||||
sound1: 'sound_schaf.mp3',
|
||||
sound2: ''
|
||||
};
|
||||
$scope.spiele.push(tier7);
|
||||
$scope.sounds.push('finde_schaf.mp3');
|
||||
|
||||
|
||||
$scope.answer = function(src) {
|
||||
|
||||
if (src==$scope.randomid){
|
||||
|
||||
$timeout(function () {
|
||||
$scope.spiele=shuffleArray($scope.spiele);
|
||||
$timeout(function () {
|
||||
$scope.spiele=shuffleArray($scope.spiele);
|
||||
$timeout(function () {
|
||||
$scope.spiele=shuffleArray($scope.spiele);
|
||||
}, 500);
|
||||
}, 500);
|
||||
}, 500);
|
||||
|
||||
$scope.playwait('/android_asset/www/sounds/bravo.mp3')
|
||||
}
|
||||
else{
|
||||
$scope.play('/android_asset/www/sounds/falsch.mp3');
|
||||
$scope.error = true;
|
||||
$timeout(function () {
|
||||
$scope.error = false;
|
||||
}, 1000);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
var shuffleArray = function(array) {
|
||||
var m = array.length, t, i;
|
||||
|
||||
// While there remain elements to shuffle
|
||||
while (m) {
|
||||
// Pick a remaining element…
|
||||
i = Math.floor(Math.random() * m--);
|
||||
|
||||
// And swap it with the current element.
|
||||
t = array[m];
|
||||
array[m] = array[i];
|
||||
array[i] = t;
|
||||
}
|
||||
|
||||
return array;
|
||||
}
|
||||
|
||||
function goto_newspiel() {
|
||||
$scope.randomid = getRandomInt(1, 8);
|
||||
$scope.play('/android_asset/www/sounds/' + $scope.sounds[$scope.randomid]);
|
||||
}
|
||||
|
||||
function getRandomInt(min, max) {
|
||||
var tmpInt=0;
|
||||
min = Math.ceil(min);
|
||||
max = Math.floor(max);
|
||||
tmpInt = Math.floor(Math.random() * (max - min + 1)) + min;
|
||||
|
||||
if (tmpInt > max){
|
||||
tmpInt=max;
|
||||
}
|
||||
|
||||
if (tmpInt < min){
|
||||
tmpInt=min;
|
||||
}
|
||||
|
||||
return tmpInt;
|
||||
}
|
||||
|
||||
|
||||
$scope.play = function(src) {
|
||||
var media = new Media(src, null, null);
|
||||
$cordovaMedia.play(media);
|
||||
}
|
||||
|
||||
$scope.playwait = function(src) {
|
||||
var media = new Media(src, goto_newspiel, null);
|
||||
$cordovaMedia.play(media);
|
||||
}
|
||||
|
||||
goto_newspiel();
|
||||
|
||||
});
|
||||
50
www/js/services.js
Normal file
@ -0,0 +1,50 @@
|
||||
angular.module('starter.services', [])
|
||||
|
||||
.factory('Chats', function() {
|
||||
// Might use a resource here that returns a JSON array
|
||||
|
||||
// Some fake testing data
|
||||
var chats = [{
|
||||
id: 0,
|
||||
name: 'Ben Sparrow',
|
||||
lastText: 'You on your way?',
|
||||
face: 'img/ben.png'
|
||||
}, {
|
||||
id: 1,
|
||||
name: 'Max Lynx',
|
||||
lastText: 'Hey, it\'s me',
|
||||
face: 'img/max.png'
|
||||
}, {
|
||||
id: 2,
|
||||
name: 'Adam Bradleyson',
|
||||
lastText: 'I should buy a boat',
|
||||
face: 'img/adam.jpg'
|
||||
}, {
|
||||
id: 3,
|
||||
name: 'Perry Governor',
|
||||
lastText: 'Look at my mukluks!',
|
||||
face: 'img/perry.png'
|
||||
}, {
|
||||
id: 4,
|
||||
name: 'Mike Harrington',
|
||||
lastText: 'This is wicked good ice cream.',
|
||||
face: 'img/mike.png'
|
||||
}];
|
||||
|
||||
return {
|
||||
all: function() {
|
||||
return chats;
|
||||
},
|
||||
remove: function(chat) {
|
||||
chats.splice(chats.indexOf(chat), 1);
|
||||
},
|
||||
get: function(chatId) {
|
||||
for (var i = 0; i < chats.length; i++) {
|
||||
if (chats[i].id === parseInt(chatId)) {
|
||||
return chats[i];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
});
|
||||
21
www/lib/angular-animate/.bower.json
Normal file
@ -0,0 +1,21 @@
|
||||
{
|
||||
"name": "angular-animate",
|
||||
"version": "1.5.8",
|
||||
"license": "MIT",
|
||||
"main": "./angular-animate.js",
|
||||
"ignore": [],
|
||||
"dependencies": {
|
||||
"angular": "1.5.8"
|
||||
},
|
||||
"homepage": "https://github.com/angular/bower-angular-animate",
|
||||
"_release": "1.5.8",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "v1.5.8",
|
||||
"commit": "688b68844cf95420e1793327f69d0c25589c23d1"
|
||||
},
|
||||
"_source": "https://github.com/angular/bower-angular-animate.git",
|
||||
"_target": "^1.5.8",
|
||||
"_originalSource": "angular-animate",
|
||||
"_direct": true
|
||||
}
|
||||
21
www/lib/angular-animate/LICENSE.md
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 Angular
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
68
www/lib/angular-animate/README.md
Normal file
@ -0,0 +1,68 @@
|
||||
# packaged angular-animate
|
||||
|
||||
This repo is for distribution on `npm` and `bower`. The source for this module is in the
|
||||
[main AngularJS repo](https://github.com/angular/angular.js/tree/master/src/ngAnimate).
|
||||
Please file issues and pull requests against that repo.
|
||||
|
||||
## Install
|
||||
|
||||
You can install this package either with `npm` or with `bower`.
|
||||
|
||||
### npm
|
||||
|
||||
```shell
|
||||
npm install angular-animate
|
||||
```
|
||||
|
||||
Then add `ngAnimate` as a dependency for your app:
|
||||
|
||||
```javascript
|
||||
angular.module('myApp', [require('angular-animate')]);
|
||||
```
|
||||
|
||||
### bower
|
||||
|
||||
```shell
|
||||
bower install angular-animate
|
||||
```
|
||||
|
||||
Then add a `<script>` to your `index.html`:
|
||||
|
||||
```html
|
||||
<script src="/bower_components/angular-animate/angular-animate.js"></script>
|
||||
```
|
||||
|
||||
Then add `ngAnimate` as a dependency for your app:
|
||||
|
||||
```javascript
|
||||
angular.module('myApp', ['ngAnimate']);
|
||||
```
|
||||
|
||||
## Documentation
|
||||
|
||||
Documentation is available on the
|
||||
[AngularJS docs site](http://docs.angularjs.org/api/ngAnimate).
|
||||
|
||||
## License
|
||||
|
||||
The MIT License
|
||||
|
||||
Copyright (c) 2010-2015 Google, Inc. http://angularjs.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
4139
www/lib/angular-animate/angular-animate.js
vendored
Normal file
57
www/lib/angular-animate/angular-animate.min.js
vendored
Normal file
@ -0,0 +1,57 @@
|
||||
/*
|
||||
AngularJS v1.5.8
|
||||
(c) 2010-2016 Google, Inc. http://angularjs.org
|
||||
License: MIT
|
||||
*/
|
||||
(function(R,B){'use strict';function Da(a,b,c){if(!a)throw Ma("areq",b||"?",c||"required");return a}function Ea(a,b){if(!a&&!b)return"";if(!a)return b;if(!b)return a;Y(a)&&(a=a.join(" "));Y(b)&&(b=b.join(" "));return a+" "+b}function Na(a){var b={};a&&(a.to||a.from)&&(b.to=a.to,b.from=a.from);return b}function Z(a,b,c){var d="";a=Y(a)?a:a&&G(a)&&a.length?a.split(/\s+/):[];s(a,function(a,l){a&&0<a.length&&(d+=0<l?" ":"",d+=c?b+a:a+b)});return d}function Oa(a){if(a instanceof F)switch(a.length){case 0:return a;
|
||||
case 1:if(1===a[0].nodeType)return a;break;default:return F(ta(a))}if(1===a.nodeType)return F(a)}function ta(a){if(!a[0])return a;for(var b=0;b<a.length;b++){var c=a[b];if(1==c.nodeType)return c}}function Pa(a,b,c){s(b,function(b){a.addClass(b,c)})}function Qa(a,b,c){s(b,function(b){a.removeClass(b,c)})}function V(a){return function(b,c){c.addClass&&(Pa(a,b,c.addClass),c.addClass=null);c.removeClass&&(Qa(a,b,c.removeClass),c.removeClass=null)}}function oa(a){a=a||{};if(!a.$$prepared){var b=a.domOperation||
|
||||
P;a.domOperation=function(){a.$$domOperationFired=!0;b();b=P};a.$$prepared=!0}return a}function ha(a,b){Fa(a,b);Ga(a,b)}function Fa(a,b){b.from&&(a.css(b.from),b.from=null)}function Ga(a,b){b.to&&(a.css(b.to),b.to=null)}function W(a,b,c){var d=b.options||{};c=c.options||{};var e=(d.addClass||"")+" "+(c.addClass||""),l=(d.removeClass||"")+" "+(c.removeClass||"");a=Ra(a.attr("class"),e,l);c.preparationClasses&&(d.preparationClasses=$(c.preparationClasses,d.preparationClasses),delete c.preparationClasses);
|
||||
e=d.domOperation!==P?d.domOperation:null;ua(d,c);e&&(d.domOperation=e);d.addClass=a.addClass?a.addClass:null;d.removeClass=a.removeClass?a.removeClass:null;b.addClass=d.addClass;b.removeClass=d.removeClass;return d}function Ra(a,b,c){function d(a){G(a)&&(a=a.split(" "));var b={};s(a,function(a){a.length&&(b[a]=!0)});return b}var e={};a=d(a);b=d(b);s(b,function(a,b){e[b]=1});c=d(c);s(c,function(a,b){e[b]=1===e[b]?null:-1});var l={addClass:"",removeClass:""};s(e,function(b,c){var d,e;1===b?(d="addClass",
|
||||
e=!a[c]||a[c+"-remove"]):-1===b&&(d="removeClass",e=a[c]||a[c+"-add"]);e&&(l[d].length&&(l[d]+=" "),l[d]+=c)});return l}function y(a){return a instanceof F?a[0]:a}function Sa(a,b,c){var d="";b&&(d=Z(b,"ng-",!0));c.addClass&&(d=$(d,Z(c.addClass,"-add")));c.removeClass&&(d=$(d,Z(c.removeClass,"-remove")));d.length&&(c.preparationClasses=d,a.addClass(d))}function pa(a,b){var c=b?"-"+b+"s":"";la(a,[ma,c]);return[ma,c]}function va(a,b){var c=b?"paused":"",d=aa+"PlayState";la(a,[d,c]);return[d,c]}function la(a,
|
||||
b){a.style[b[0]]=b[1]}function $(a,b){return a?b?a+" "+b:a:b}function Ha(a,b,c){var d=Object.create(null),e=a.getComputedStyle(b)||{};s(c,function(a,b){var c=e[a];if(c){var g=c.charAt(0);if("-"===g||"+"===g||0<=g)c=Ta(c);0===c&&(c=null);d[b]=c}});return d}function Ta(a){var b=0;a=a.split(/\s*,\s*/);s(a,function(a){"s"==a.charAt(a.length-1)&&(a=a.substring(0,a.length-1));a=parseFloat(a)||0;b=b?Math.max(a,b):a});return b}function wa(a){return 0===a||null!=a}function Ia(a,b){var c=S,d=a+"s";b?c+="Duration":
|
||||
d+=" linear all";return[c,d]}function Ja(){var a=Object.create(null);return{flush:function(){a=Object.create(null)},count:function(b){return(b=a[b])?b.total:0},get:function(b){return(b=a[b])&&b.value},put:function(b,c){a[b]?a[b].total++:a[b]={total:1,value:c}}}}function Ka(a,b,c){s(c,function(c){a[c]=xa(a[c])?a[c]:b.style.getPropertyValue(c)})}var S,ya,aa,za;void 0===R.ontransitionend&&void 0!==R.onwebkittransitionend?(S="WebkitTransition",ya="webkitTransitionEnd transitionend"):(S="transition",ya=
|
||||
"transitionend");void 0===R.onanimationend&&void 0!==R.onwebkitanimationend?(aa="WebkitAnimation",za="webkitAnimationEnd animationend"):(aa="animation",za="animationend");var qa=aa+"Delay",Aa=aa+"Duration",ma=S+"Delay",La=S+"Duration",Ma=B.$$minErr("ng"),Ua={transitionDuration:La,transitionDelay:ma,transitionProperty:S+"Property",animationDuration:Aa,animationDelay:qa,animationIterationCount:aa+"IterationCount"},Va={transitionDuration:La,transitionDelay:ma,animationDuration:Aa,animationDelay:qa},
|
||||
Ba,ua,s,Y,xa,ea,Ca,ba,G,J,F,P;B.module("ngAnimate",[],function(){P=B.noop;Ba=B.copy;ua=B.extend;F=B.element;s=B.forEach;Y=B.isArray;G=B.isString;ba=B.isObject;J=B.isUndefined;xa=B.isDefined;Ca=B.isFunction;ea=B.isElement}).directive("ngAnimateSwap",["$animate","$rootScope",function(a,b){return{restrict:"A",transclude:"element",terminal:!0,priority:600,link:function(b,d,e,l,n){var I,g;b.$watchCollection(e.ngAnimateSwap||e["for"],function(e){I&&a.leave(I);g&&(g.$destroy(),g=null);if(e||0===e)g=b.$new(),
|
||||
n(g,function(b){I=b;a.enter(b,null,d)})})}}}]).directive("ngAnimateChildren",["$interpolate",function(a){return{link:function(b,c,d){function e(a){c.data("$$ngAnimateChildren","on"===a||"true"===a)}var l=d.ngAnimateChildren;G(l)&&0===l.length?c.data("$$ngAnimateChildren",!0):(e(a(l)(b)),d.$observe("ngAnimateChildren",e))}}}]).factory("$$rAFScheduler",["$$rAF",function(a){function b(a){d=d.concat(a);c()}function c(){if(d.length){for(var b=d.shift(),n=0;n<b.length;n++)b[n]();e||a(function(){e||c()})}}
|
||||
var d,e;d=b.queue=[];b.waitUntilQuiet=function(b){e&&e();e=a(function(){e=null;b();c()})};return b}]).provider("$$animateQueue",["$animateProvider",function(a){function b(a){if(!a)return null;a=a.split(" ");var b=Object.create(null);s(a,function(a){b[a]=!0});return b}function c(a,c){if(a&&c){var d=b(c);return a.split(" ").some(function(a){return d[a]})}}function d(a,b,c,d){return l[a].some(function(a){return a(b,c,d)})}function e(a,b){var c=0<(a.addClass||"").length,d=0<(a.removeClass||"").length;
|
||||
return b?c&&d:c||d}var l=this.rules={skip:[],cancel:[],join:[]};l.join.push(function(a,b,c){return!b.structural&&e(b)});l.skip.push(function(a,b,c){return!b.structural&&!e(b)});l.skip.push(function(a,b,c){return"leave"==c.event&&b.structural});l.skip.push(function(a,b,c){return c.structural&&2===c.state&&!b.structural});l.cancel.push(function(a,b,c){return c.structural&&b.structural});l.cancel.push(function(a,b,c){return 2===c.state&&b.structural});l.cancel.push(function(a,b,d){if(d.structural)return!1;
|
||||
a=b.addClass;b=b.removeClass;var e=d.addClass;d=d.removeClass;return J(a)&&J(b)||J(e)&&J(d)?!1:c(a,d)||c(b,e)});this.$get=["$$rAF","$rootScope","$rootElement","$document","$$HashMap","$$animation","$$AnimateRunner","$templateRequest","$$jqLite","$$forceReflow",function(b,c,g,l,C,Wa,Q,t,H,T){function O(){var a=!1;return function(b){a?b():c.$$postDigest(function(){a=!0;b()})}}function x(a,b,c){var f=y(b),d=y(a),N=[];(a=h[c])&&s(a,function(a){w.call(a.node,f)?N.push(a.callback):"leave"===c&&w.call(a.node,
|
||||
d)&&N.push(a.callback)});return N}function r(a,b,c){var f=ta(b);return a.filter(function(a){return!(a.node===f&&(!c||a.callback===c))})}function p(a,h,v){function r(c,f,d,h){sa(function(){var c=x(T,a,f);c.length?b(function(){s(c,function(b){b(a,d,h)});"close"!==d||a[0].parentNode||ra.off(a)}):"close"!==d||a[0].parentNode||ra.off(a)});c.progress(f,d,h)}function k(b){var c=a,f=m;f.preparationClasses&&(c.removeClass(f.preparationClasses),f.preparationClasses=null);f.activeClasses&&(c.removeClass(f.activeClasses),
|
||||
f.activeClasses=null);E(a,m);ha(a,m);m.domOperation();A.complete(!b)}var m=Ba(v),p,T;if(a=Oa(a))p=y(a),T=a.parent();var m=oa(m),A=new Q,sa=O();Y(m.addClass)&&(m.addClass=m.addClass.join(" "));m.addClass&&!G(m.addClass)&&(m.addClass=null);Y(m.removeClass)&&(m.removeClass=m.removeClass.join(" "));m.removeClass&&!G(m.removeClass)&&(m.removeClass=null);m.from&&!ba(m.from)&&(m.from=null);m.to&&!ba(m.to)&&(m.to=null);if(!p)return k(),A;v=[p.className,m.addClass,m.removeClass].join(" ");if(!Xa(v))return k(),
|
||||
A;var g=0<=["enter","move","leave"].indexOf(h),w=l[0].hidden,t=!f||w||N.get(p);v=!t&&z.get(p)||{};var H=!!v.state;t||H&&1==v.state||(t=!M(a,T,h));if(t)return w&&r(A,h,"start"),k(),w&&r(A,h,"close"),A;g&&K(a);w={structural:g,element:a,event:h,addClass:m.addClass,removeClass:m.removeClass,close:k,options:m,runner:A};if(H){if(d("skip",a,w,v)){if(2===v.state)return k(),A;W(a,v,w);return v.runner}if(d("cancel",a,w,v))if(2===v.state)v.runner.end();else if(v.structural)v.close();else return W(a,v,w),v.runner;
|
||||
else if(d("join",a,w,v))if(2===v.state)W(a,w,{});else return Sa(a,g?h:null,m),h=w.event=v.event,m=W(a,v,w),v.runner}else W(a,w,{});(H=w.structural)||(H="animate"===w.event&&0<Object.keys(w.options.to||{}).length||e(w));if(!H)return k(),ka(a),A;var C=(v.counter||0)+1;w.counter=C;L(a,1,w);c.$$postDigest(function(){var b=z.get(p),c=!b,b=b||{},f=0<(a.parent()||[]).length&&("animate"===b.event||b.structural||e(b));if(c||b.counter!==C||!f){c&&(E(a,m),ha(a,m));if(c||g&&b.event!==h)m.domOperation(),A.end();
|
||||
f||ka(a)}else h=!b.structural&&e(b,!0)?"setClass":b.event,L(a,2),b=Wa(a,h,b.options),A.setHost(b),r(A,h,"start",{}),b.done(function(b){k(!b);(b=z.get(p))&&b.counter===C&&ka(y(a));r(A,h,"close",{})})});return A}function K(a){a=y(a).querySelectorAll("[data-ng-animate]");s(a,function(a){var b=parseInt(a.getAttribute("data-ng-animate")),c=z.get(a);if(c)switch(b){case 2:c.runner.end();case 1:z.remove(a)}})}function ka(a){a=y(a);a.removeAttribute("data-ng-animate");z.remove(a)}function k(a,b){return y(a)===
|
||||
y(b)}function M(a,b,c){c=F(l[0].body);var f=k(a,c)||"HTML"===a[0].nodeName,d=k(a,g),h=!1,r,e=N.get(y(a));(a=F.data(a[0],"$ngAnimatePin"))&&(b=a);for(b=y(b);b;){d||(d=k(b,g));if(1!==b.nodeType)break;a=z.get(b)||{};if(!h){var p=N.get(b);if(!0===p&&!1!==e){e=!0;break}else!1===p&&(e=!1);h=a.structural}if(J(r)||!0===r)a=F.data(b,"$$ngAnimateChildren"),xa(a)&&(r=a);if(h&&!1===r)break;f||(f=k(b,c));if(f&&d)break;if(!d&&(a=F.data(b,"$ngAnimatePin"))){b=y(a);continue}b=b.parentNode}return(!h||r)&&!0!==e&&
|
||||
d&&f}function L(a,b,c){c=c||{};c.state=b;a=y(a);a.setAttribute("data-ng-animate",b);c=(b=z.get(a))?ua(b,c):c;z.put(a,c)}var z=new C,N=new C,f=null,A=c.$watch(function(){return 0===t.totalPendingRequests},function(a){a&&(A(),c.$$postDigest(function(){c.$$postDigest(function(){null===f&&(f=!0)})}))}),h=Object.create(null),sa=a.classNameFilter(),Xa=sa?function(a){return sa.test(a)}:function(){return!0},E=V(H),w=R.Node.prototype.contains||function(a){return this===a||!!(this.compareDocumentPosition(a)&
|
||||
16)},ra={on:function(a,b,c){var f=ta(b);h[a]=h[a]||[];h[a].push({node:f,callback:c});F(b).on("$destroy",function(){z.get(f)||ra.off(a,b,c)})},off:function(a,b,c){if(1!==arguments.length||G(arguments[0])){var f=h[a];f&&(h[a]=1===arguments.length?null:r(f,b,c))}else for(f in b=arguments[0],h)h[f]=r(h[f],b)},pin:function(a,b){Da(ea(a),"element","not an element");Da(ea(b),"parentElement","not an element");a.data("$ngAnimatePin",b)},push:function(a,b,c,f){c=c||{};c.domOperation=f;return p(a,b,c)},enabled:function(a,
|
||||
b){var c=arguments.length;if(0===c)b=!!f;else if(ea(a)){var d=y(a);1===c?b=!N.get(d):N.put(d,!b)}else b=f=!!a;return b}};return ra}]}]).provider("$$animation",["$animateProvider",function(a){var b=this.drivers=[];this.$get=["$$jqLite","$rootScope","$injector","$$AnimateRunner","$$HashMap","$$rAFScheduler",function(a,d,e,l,n,I){function g(a){function b(a){if(a.processed)return a;a.processed=!0;var d=a.domNode,p=d.parentNode;e.put(d,a);for(var K;p;){if(K=e.get(p)){K.processed||(K=b(K));break}p=p.parentNode}(K||
|
||||
c).children.push(a);return a}var c={children:[]},d,e=new n;for(d=0;d<a.length;d++){var g=a[d];e.put(g.domNode,a[d]={domNode:g.domNode,fn:g.fn,children:[]})}for(d=0;d<a.length;d++)b(a[d]);return function(a){var b=[],c=[],d;for(d=0;d<a.children.length;d++)c.push(a.children[d]);a=c.length;var e=0,k=[];for(d=0;d<c.length;d++){var g=c[d];0>=a&&(a=e,e=0,b.push(k),k=[]);k.push(g.fn);g.children.forEach(function(a){e++;c.push(a)});a--}k.length&&b.push(k);return b}(c)}var u=[],C=V(a);return function(n,Q,t){function H(a){a=
|
||||
a.hasAttribute("ng-animate-ref")?[a]:a.querySelectorAll("[ng-animate-ref]");var b=[];s(a,function(a){var c=a.getAttribute("ng-animate-ref");c&&c.length&&b.push(a)});return b}function T(a){var b=[],c={};s(a,function(a,d){var h=y(a.element),e=0<=["enter","move"].indexOf(a.event),h=a.structural?H(h):[];if(h.length){var k=e?"to":"from";s(h,function(a){var b=a.getAttribute("ng-animate-ref");c[b]=c[b]||{};c[b][k]={animationID:d,element:F(a)}})}else b.push(a)});var d={},e={};s(c,function(c,k){var r=c.from,
|
||||
p=c.to;if(r&&p){var z=a[r.animationID],g=a[p.animationID],A=r.animationID.toString();if(!e[A]){var n=e[A]={structural:!0,beforeStart:function(){z.beforeStart();g.beforeStart()},close:function(){z.close();g.close()},classes:O(z.classes,g.classes),from:z,to:g,anchors:[]};n.classes.length?b.push(n):(b.push(z),b.push(g))}e[A].anchors.push({out:r.element,"in":p.element})}else r=r?r.animationID:p.animationID,p=r.toString(),d[p]||(d[p]=!0,b.push(a[r]))});return b}function O(a,b){a=a.split(" ");b=b.split(" ");
|
||||
for(var c=[],d=0;d<a.length;d++){var e=a[d];if("ng-"!==e.substring(0,3))for(var r=0;r<b.length;r++)if(e===b[r]){c.push(e);break}}return c.join(" ")}function x(a){for(var c=b.length-1;0<=c;c--){var d=e.get(b[c])(a);if(d)return d}}function r(a,b){function c(a){(a=a.data("$$animationRunner"))&&a.setHost(b)}a.from&&a.to?(c(a.from.element),c(a.to.element)):c(a.element)}function p(){var a=n.data("$$animationRunner");!a||"leave"===Q&&t.$$domOperationFired||a.end()}function K(b){n.off("$destroy",p);n.removeData("$$animationRunner");
|
||||
C(n,t);ha(n,t);t.domOperation();L&&a.removeClass(n,L);n.removeClass("ng-animate");k.complete(!b)}t=oa(t);var ka=0<=["enter","move","leave"].indexOf(Q),k=new l({end:function(){K()},cancel:function(){K(!0)}});if(!b.length)return K(),k;n.data("$$animationRunner",k);var M=Ea(n.attr("class"),Ea(t.addClass,t.removeClass)),L=t.tempClasses;L&&(M+=" "+L,t.tempClasses=null);var z;ka&&(z="ng-"+Q+"-prepare",a.addClass(n,z));u.push({element:n,classes:M,event:Q,structural:ka,options:t,beforeStart:function(){n.addClass("ng-animate");
|
||||
L&&a.addClass(n,L);z&&(a.removeClass(n,z),z=null)},close:K});n.on("$destroy",p);if(1<u.length)return k;d.$$postDigest(function(){var a=[];s(u,function(b){b.element.data("$$animationRunner")?a.push(b):b.close()});u.length=0;var b=T(a),c=[];s(b,function(a){c.push({domNode:y(a.from?a.from.element:a.element),fn:function(){a.beforeStart();var b,c=a.close;if((a.anchors?a.from.element||a.to.element:a.element).data("$$animationRunner")){var d=x(a);d&&(b=d.start)}b?(b=b(),b.done(function(a){c(!a)}),r(a,b)):
|
||||
c()}})});I(g(c))});return k}}]}]).provider("$animateCss",["$animateProvider",function(a){var b=Ja(),c=Ja();this.$get=["$window","$$jqLite","$$AnimateRunner","$timeout","$$forceReflow","$sniffer","$$rAFScheduler","$$animateQueue",function(a,e,l,n,I,g,u,C){function B(a,b){var c=a.parentNode;return(c.$$ngAnimateParentKey||(c.$$ngAnimateParentKey=++O))+"-"+a.getAttribute("class")+"-"+b}function Q(r,p,g,n){var k;0<b.count(g)&&(k=c.get(g),k||(p=Z(p,"-stagger"),e.addClass(r,p),k=Ha(a,r,n),k.animationDuration=
|
||||
Math.max(k.animationDuration,0),k.transitionDuration=Math.max(k.transitionDuration,0),e.removeClass(r,p),c.put(g,k)));return k||{}}function t(a){x.push(a);u.waitUntilQuiet(function(){b.flush();c.flush();for(var a=I(),d=0;d<x.length;d++)x[d](a);x.length=0})}function H(c,e,g){e=b.get(g);e||(e=Ha(a,c,Ua),"infinite"===e.animationIterationCount&&(e.animationIterationCount=1));b.put(g,e);c=e;g=c.animationDelay;e=c.transitionDelay;c.maxDelay=g&&e?Math.max(g,e):g||e;c.maxDuration=Math.max(c.animationDuration*
|
||||
c.animationIterationCount,c.transitionDuration);return c}var T=V(e),O=0,x=[];return function(a,c){function d(){k()}function u(){k(!0)}function k(b){if(!(w||F&&O)){w=!0;O=!1;f.$$skipPreparationClasses||e.removeClass(a,ga);e.removeClass(a,ea);va(h,!1);pa(h,!1);s(x,function(a){h.style[a[0]]=""});T(a,f);ha(a,f);Object.keys(A).length&&s(A,function(a,b){a?h.style.setProperty(b,a):h.style.removeProperty(b)});if(f.onDone)f.onDone();fa&&fa.length&&a.off(fa.join(" "),z);var c=a.data("$$animateCss");c&&(n.cancel(c[0].timer),
|
||||
a.removeData("$$animateCss"));G&&G.complete(!b)}}function M(a){q.blockTransition&&pa(h,a);q.blockKeyframeAnimation&&va(h,!!a)}function L(){G=new l({end:d,cancel:u});t(P);k();return{$$willAnimate:!1,start:function(){return G},end:d}}function z(a){a.stopPropagation();var b=a.originalEvent||a;a=b.$manualTimeStamp||Date.now();b=parseFloat(b.elapsedTime.toFixed(3));Math.max(a-W,0)>=R&&b>=m&&(F=!0,k())}function N(){function b(){if(!w){M(!1);s(x,function(a){h.style[a[0]]=a[1]});T(a,f);e.addClass(a,ea);if(q.recalculateTimingStyles){na=
|
||||
h.className+" "+ga;ia=B(h,na);D=H(h,na,ia);ca=D.maxDelay;J=Math.max(ca,0);m=D.maxDuration;if(0===m){k();return}q.hasTransitions=0<D.transitionDuration;q.hasAnimations=0<D.animationDuration}q.applyAnimationDelay&&(ca="boolean"!==typeof f.delay&&wa(f.delay)?parseFloat(f.delay):ca,J=Math.max(ca,0),D.animationDelay=ca,da=[qa,ca+"s"],x.push(da),h.style[da[0]]=da[1]);R=1E3*J;V=1E3*m;if(f.easing){var d,g=f.easing;q.hasTransitions&&(d=S+"TimingFunction",x.push([d,g]),h.style[d]=g);q.hasAnimations&&(d=aa+
|
||||
"TimingFunction",x.push([d,g]),h.style[d]=g)}D.transitionDuration&&fa.push(ya);D.animationDuration&&fa.push(za);W=Date.now();var p=R+1.5*V;d=W+p;var g=a.data("$$animateCss")||[],N=!0;if(g.length){var l=g[0];(N=d>l.expectedEndTime)?n.cancel(l.timer):g.push(k)}N&&(p=n(c,p,!1),g[0]={timer:p,expectedEndTime:d},g.push(k),a.data("$$animateCss",g));if(fa.length)a.on(fa.join(" "),z);f.to&&(f.cleanupStyles&&Ka(A,h,Object.keys(f.to)),Ga(a,f))}}function c(){var b=a.data("$$animateCss");if(b){for(var d=1;d<b.length;d++)b[d]();
|
||||
a.removeData("$$animateCss")}}if(!w)if(h.parentNode){var d=function(a){if(F)O&&a&&(O=!1,k());else if(O=!a,D.animationDuration)if(a=va(h,O),O)x.push(a);else{var b=x,c=b.indexOf(a);0<=a&&b.splice(c,1)}},g=0<ba&&(D.transitionDuration&&0===X.transitionDuration||D.animationDuration&&0===X.animationDuration)&&Math.max(X.animationDelay,X.transitionDelay);g?n(b,Math.floor(g*ba*1E3),!1):b();v.resume=function(){d(!0)};v.pause=function(){d(!1)}}else k()}var f=c||{};f.$$prepared||(f=oa(Ba(f)));var A={},h=y(a);
|
||||
if(!h||!h.parentNode||!C.enabled())return L();var x=[],I=a.attr("class"),E=Na(f),w,O,F,G,v,J,R,m,V,W,fa=[];if(0===f.duration||!g.animations&&!g.transitions)return L();var ja=f.event&&Y(f.event)?f.event.join(" "):f.event,$="",U="";ja&&f.structural?$=Z(ja,"ng-",!0):ja&&($=ja);f.addClass&&(U+=Z(f.addClass,"-add"));f.removeClass&&(U.length&&(U+=" "),U+=Z(f.removeClass,"-remove"));f.applyClassesEarly&&U.length&&T(a,f);var ga=[$,U].join(" ").trim(),na=I+" "+ga,ea=Z(ga,"-active"),I=E.to&&0<Object.keys(E.to).length;
|
||||
if(!(0<(f.keyframeStyle||"").length||I||ga))return L();var ia,X;0<f.stagger?(E=parseFloat(f.stagger),X={transitionDelay:E,animationDelay:E,transitionDuration:0,animationDuration:0}):(ia=B(h,na),X=Q(h,ga,ia,Va));f.$$skipPreparationClasses||e.addClass(a,ga);f.transitionStyle&&(E=[S,f.transitionStyle],la(h,E),x.push(E));0<=f.duration&&(E=0<h.style[S].length,E=Ia(f.duration,E),la(h,E),x.push(E));f.keyframeStyle&&(E=[aa,f.keyframeStyle],la(h,E),x.push(E));var ba=X?0<=f.staggerIndex?f.staggerIndex:b.count(ia):
|
||||
0;(ja=0===ba)&&!f.skipBlocking&&pa(h,9999);var D=H(h,na,ia),ca=D.maxDelay;J=Math.max(ca,0);m=D.maxDuration;var q={};q.hasTransitions=0<D.transitionDuration;q.hasAnimations=0<D.animationDuration;q.hasTransitionAll=q.hasTransitions&&"all"==D.transitionProperty;q.applyTransitionDuration=I&&(q.hasTransitions&&!q.hasTransitionAll||q.hasAnimations&&!q.hasTransitions);q.applyAnimationDuration=f.duration&&q.hasAnimations;q.applyTransitionDelay=wa(f.delay)&&(q.applyTransitionDuration||q.hasTransitions);q.applyAnimationDelay=
|
||||
wa(f.delay)&&q.hasAnimations;q.recalculateTimingStyles=0<U.length;if(q.applyTransitionDuration||q.applyAnimationDuration)m=f.duration?parseFloat(f.duration):m,q.applyTransitionDuration&&(q.hasTransitions=!0,D.transitionDuration=m,E=0<h.style[S+"Property"].length,x.push(Ia(m,E))),q.applyAnimationDuration&&(q.hasAnimations=!0,D.animationDuration=m,x.push([Aa,m+"s"]));if(0===m&&!q.recalculateTimingStyles)return L();if(null!=f.delay){var da;"boolean"!==typeof f.delay&&(da=parseFloat(f.delay),J=Math.max(da,
|
||||
0));q.applyTransitionDelay&&x.push([ma,da+"s"]);q.applyAnimationDelay&&x.push([qa,da+"s"])}null==f.duration&&0<D.transitionDuration&&(q.recalculateTimingStyles=q.recalculateTimingStyles||ja);R=1E3*J;V=1E3*m;f.skipBlocking||(q.blockTransition=0<D.transitionDuration,q.blockKeyframeAnimation=0<D.animationDuration&&0<X.animationDelay&&0===X.animationDuration);f.from&&(f.cleanupStyles&&Ka(A,h,Object.keys(f.from)),Fa(a,f));q.blockTransition||q.blockKeyframeAnimation?M(m):f.skipBlocking||pa(h,!1);return{$$willAnimate:!0,
|
||||
end:d,start:function(){if(!w)return v={end:d,cancel:u,resume:null,pause:null},G=new l(v),t(N),G}}}}]}]).provider("$$animateCssDriver",["$$animationProvider",function(a){a.drivers.push("$$animateCssDriver");this.$get=["$animateCss","$rootScope","$$AnimateRunner","$rootElement","$sniffer","$$jqLite","$document",function(a,c,d,e,l,n,I){function g(a){return a.replace(/\bng-\S+\b/g,"")}function u(a,b){G(a)&&(a=a.split(" "));G(b)&&(b=b.split(" "));return a.filter(function(a){return-1===b.indexOf(a)}).join(" ")}
|
||||
function C(c,e,n){function l(a){var b={},c=y(a).getBoundingClientRect();s(["width","height","top","left"],function(a){var d=c[a];switch(a){case "top":d+=t.scrollTop;break;case "left":d+=t.scrollLeft}b[a]=Math.floor(d)+"px"});return b}function p(){var c=g(n.attr("class")||""),d=u(c,k),c=u(k,c),d=a(C,{to:l(n),addClass:"ng-anchor-in "+d,removeClass:"ng-anchor-out "+c,delay:!0});return d.$$willAnimate?d:null}function I(){C.remove();e.removeClass("ng-animate-shim");n.removeClass("ng-animate-shim")}var C=
|
||||
F(y(e).cloneNode(!0)),k=g(C.attr("class")||"");e.addClass("ng-animate-shim");n.addClass("ng-animate-shim");C.addClass("ng-anchor");H.append(C);var M;c=function(){var c=a(C,{addClass:"ng-anchor-out",delay:!0,from:l(e)});return c.$$willAnimate?c:null}();if(!c&&(M=p(),!M))return I();var L=c||M;return{start:function(){function a(){c&&c.end()}var b,c=L.start();c.done(function(){c=null;if(!M&&(M=p()))return c=M.start(),c.done(function(){c=null;I();b.complete()}),c;I();b.complete()});return b=new d({end:a,
|
||||
cancel:a})}}}function B(a,b,c,e){var g=Q(a,P),n=Q(b,P),l=[];s(e,function(a){(a=C(c,a.out,a["in"]))&&l.push(a)});if(g||n||0!==l.length)return{start:function(){function a(){s(b,function(a){a.end()})}var b=[];g&&b.push(g.start());n&&b.push(n.start());s(l,function(a){b.push(a.start())});var c=new d({end:a,cancel:a});d.all(b,function(a){c.complete(a)});return c}}}function Q(c){var d=c.element,e=c.options||{};c.structural&&(e.event=c.event,e.structural=!0,e.applyClassesEarly=!0,"leave"===c.event&&(e.onDone=
|
||||
e.domOperation));e.preparationClasses&&(e.event=$(e.event,e.preparationClasses));c=a(d,e);return c.$$willAnimate?c:null}if(!l.animations&&!l.transitions)return P;var t=I[0].body;c=y(e);var H=F(c.parentNode&&11===c.parentNode.nodeType||t.contains(c)?c:t);V(n);return function(a){return a.from&&a.to?B(a.from,a.to,a.classes,a.anchors):Q(a)}}]}]).provider("$$animateJs",["$animateProvider",function(a){this.$get=["$injector","$$AnimateRunner","$$jqLite",function(b,c,d){function e(c){c=Y(c)?c:c.split(" ");
|
||||
for(var d=[],e={},l=0;l<c.length;l++){var s=c[l],B=a.$$registeredAnimations[s];B&&!e[s]&&(d.push(b.get(B)),e[s]=!0)}return d}var l=V(d);return function(a,b,d,u){function C(){u.domOperation();l(a,u)}function B(a,b,d,e,f){switch(d){case "animate":b=[b,e.from,e.to,f];break;case "setClass":b=[b,F,G,f];break;case "addClass":b=[b,F,f];break;case "removeClass":b=[b,G,f];break;default:b=[b,f]}b.push(e);if(a=a.apply(a,b))if(Ca(a.start)&&(a=a.start()),a instanceof c)a.done(f);else if(Ca(a))return a;return P}
|
||||
function y(a,b,d,e,f){var g=[];s(e,function(e){var k=e[f];k&&g.push(function(){var e,f,g=!1,h=function(a){g||(g=!0,(f||P)(a),e.complete(!a))};e=new c({end:function(){h()},cancel:function(){h(!0)}});f=B(k,a,b,d,function(a){h(!1===a)});return e})});return g}function t(a,b,d,e,f){var g=y(a,b,d,e,f);if(0===g.length){var h,k;"beforeSetClass"===f?(h=y(a,"removeClass",d,e,"beforeRemoveClass"),k=y(a,"addClass",d,e,"beforeAddClass")):"setClass"===f&&(h=y(a,"removeClass",d,e,"removeClass"),k=y(a,"addClass",
|
||||
d,e,"addClass"));h&&(g=g.concat(h));k&&(g=g.concat(k))}if(0!==g.length)return function(a){var b=[];g.length&&s(g,function(a){b.push(a())});b.length?c.all(b,a):a();return function(a){s(b,function(b){a?b.cancel():b.end()})}}}var H=!1;3===arguments.length&&ba(d)&&(u=d,d=null);u=oa(u);d||(d=a.attr("class")||"",u.addClass&&(d+=" "+u.addClass),u.removeClass&&(d+=" "+u.removeClass));var F=u.addClass,G=u.removeClass,x=e(d),r,p;if(x.length){var K,J;"leave"==b?(J="leave",K="afterLeave"):(J="before"+b.charAt(0).toUpperCase()+
|
||||
b.substr(1),K=b);"enter"!==b&&"move"!==b&&(r=t(a,b,u,x,J));p=t(a,b,u,x,K)}if(r||p){var k;return{$$willAnimate:!0,end:function(){k?k.end():(H=!0,C(),ha(a,u),k=new c,k.complete(!0));return k},start:function(){function b(c){H=!0;C();ha(a,u);k.complete(c)}if(k)return k;k=new c;var d,e=[];r&&e.push(function(a){d=r(a)});e.length?e.push(function(a){C();a(!0)}):C();p&&e.push(function(a){d=p(a)});k.setHost({end:function(){H||((d||P)(void 0),b(void 0))},cancel:function(){H||((d||P)(!0),b(!0))}});c.chain(e,
|
||||
b);return k}}}}}]}]).provider("$$animateJsDriver",["$$animationProvider",function(a){a.drivers.push("$$animateJsDriver");this.$get=["$$animateJs","$$AnimateRunner",function(a,c){function d(c){return a(c.element,c.event,c.classes,c.options)}return function(a){if(a.from&&a.to){var b=d(a.from),n=d(a.to);if(b||n)return{start:function(){function a(){return function(){s(d,function(a){a.end()})}}var d=[];b&&d.push(b.start());n&&d.push(n.start());c.all(d,function(a){e.complete(a)});var e=new c({end:a(),cancel:a()});
|
||||
return e}}}else return d(a)}}]}])})(window,window.angular);
|
||||
//# sourceMappingURL=angular-animate.min.js.map
|
||||
8
www/lib/angular-animate/angular-animate.min.js.map
Normal file
10
www/lib/angular-animate/bower.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"name": "angular-animate",
|
||||
"version": "1.5.8",
|
||||
"license": "MIT",
|
||||
"main": "./angular-animate.js",
|
||||
"ignore": [],
|
||||
"dependencies": {
|
||||
"angular": "1.5.8"
|
||||
}
|
||||
}
|
||||
2
www/lib/angular-animate/index.js
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
require('./angular-animate');
|
||||
module.exports = 'ngAnimate';
|
||||
33
www/lib/angular-animate/package.json
Normal file
@ -0,0 +1,33 @@
|
||||
{
|
||||
"name": "angular-animate",
|
||||
"version": "1.5.8",
|
||||
"description": "AngularJS module for animations",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/angular/angular.js.git"
|
||||
},
|
||||
"keywords": [
|
||||
"angular",
|
||||
"framework",
|
||||
"browser",
|
||||
"animation",
|
||||
"client-side"
|
||||
],
|
||||
"author": "Angular Core Team <angular-core+npm@google.com>",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/angular/angular.js/issues"
|
||||
},
|
||||
"homepage": "http://angularjs.org",
|
||||
"jspm": {
|
||||
"shim": {
|
||||
"angular-animate": {
|
||||
"deps": ["angular"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
20
www/lib/angular-sanitize/.bower.json
Normal file
@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "angular-sanitize",
|
||||
"version": "1.5.3",
|
||||
"license": "MIT",
|
||||
"main": "./angular-sanitize.js",
|
||||
"ignore": [],
|
||||
"dependencies": {
|
||||
"angular": "1.5.3"
|
||||
},
|
||||
"homepage": "https://github.com/angular/bower-angular-sanitize",
|
||||
"_release": "1.5.3",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "v1.5.3",
|
||||
"commit": "d62a5eecedc71828f6f935fbde6c07217a95988a"
|
||||
},
|
||||
"_source": "https://github.com/angular/bower-angular-sanitize.git",
|
||||
"_target": "1.5.3",
|
||||
"_originalSource": "angular-sanitize"
|
||||
}
|
||||
68
www/lib/angular-sanitize/README.md
Normal file
@ -0,0 +1,68 @@
|
||||
# packaged angular-sanitize
|
||||
|
||||
This repo is for distribution on `npm` and `bower`. The source for this module is in the
|
||||
[main AngularJS repo](https://github.com/angular/angular.js/tree/master/src/ngSanitize).
|
||||
Please file issues and pull requests against that repo.
|
||||
|
||||
## Install
|
||||
|
||||
You can install this package either with `npm` or with `bower`.
|
||||
|
||||
### npm
|
||||
|
||||
```shell
|
||||
npm install angular-sanitize
|
||||
```
|
||||
|
||||
Then add `ngSanitize` as a dependency for your app:
|
||||
|
||||
```javascript
|
||||
angular.module('myApp', [require('angular-sanitize')]);
|
||||
```
|
||||
|
||||
### bower
|
||||
|
||||
```shell
|
||||
bower install angular-sanitize
|
||||
```
|
||||
|
||||
Add a `<script>` to your `index.html`:
|
||||
|
||||
```html
|
||||
<script src="/bower_components/angular-sanitize/angular-sanitize.js"></script>
|
||||
```
|
||||
|
||||
Then add `ngSanitize` as a dependency for your app:
|
||||
|
||||
```javascript
|
||||
angular.module('myApp', ['ngSanitize']);
|
||||
```
|
||||
|
||||
## Documentation
|
||||
|
||||
Documentation is available on the
|
||||
[AngularJS docs site](http://docs.angularjs.org/api/ngSanitize).
|
||||
|
||||
## License
|
||||
|
||||
The MIT License
|
||||
|
||||
Copyright (c) 2010-2015 Google, Inc. http://angularjs.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
717
www/lib/angular-sanitize/angular-sanitize.js
vendored
Normal file
@ -0,0 +1,717 @@
|
||||
/**
|
||||
* @license AngularJS v1.5.3
|
||||
* (c) 2010-2016 Google, Inc. http://angularjs.org
|
||||
* License: MIT
|
||||
*/
|
||||
(function(window, angular, undefined) {'use strict';
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Any commits to this file should be reviewed with security in mind. *
|
||||
* Changes to this file can potentially create security vulnerabilities. *
|
||||
* An approval from 2 Core members with history of modifying *
|
||||
* this file is required. *
|
||||
* *
|
||||
* Does the change somehow allow for arbitrary javascript to be executed? *
|
||||
* Or allows for someone to change the prototype of built-in objects? *
|
||||
* Or gives undesired access to variables likes document or window? *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
var $sanitizeMinErr = angular.$$minErr('$sanitize');
|
||||
|
||||
/**
|
||||
* @ngdoc module
|
||||
* @name ngSanitize
|
||||
* @description
|
||||
*
|
||||
* # ngSanitize
|
||||
*
|
||||
* The `ngSanitize` module provides functionality to sanitize HTML.
|
||||
*
|
||||
*
|
||||
* <div doc-module-components="ngSanitize"></div>
|
||||
*
|
||||
* See {@link ngSanitize.$sanitize `$sanitize`} for usage.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ngdoc service
|
||||
* @name $sanitize
|
||||
* @kind function
|
||||
*
|
||||
* @description
|
||||
* Sanitizes an html string by stripping all potentially dangerous tokens.
|
||||
*
|
||||
* The input is sanitized by parsing the HTML into tokens. All safe tokens (from a whitelist) are
|
||||
* then serialized back to properly escaped html string. This means that no unsafe input can make
|
||||
* it into the returned string.
|
||||
*
|
||||
* The whitelist for URL sanitization of attribute values is configured using the functions
|
||||
* `aHrefSanitizationWhitelist` and `imgSrcSanitizationWhitelist` of {@link ng.$compileProvider
|
||||
* `$compileProvider`}.
|
||||
*
|
||||
* The input may also contain SVG markup if this is enabled via {@link $sanitizeProvider}.
|
||||
*
|
||||
* @param {string} html HTML input.
|
||||
* @returns {string} Sanitized HTML.
|
||||
*
|
||||
* @example
|
||||
<example module="sanitizeExample" deps="angular-sanitize.js">
|
||||
<file name="index.html">
|
||||
<script>
|
||||
angular.module('sanitizeExample', ['ngSanitize'])
|
||||
.controller('ExampleController', ['$scope', '$sce', function($scope, $sce) {
|
||||
$scope.snippet =
|
||||
'<p style="color:blue">an html\n' +
|
||||
'<em onmouseover="this.textContent=\'PWN3D!\'">click here</em>\n' +
|
||||
'snippet</p>';
|
||||
$scope.deliberatelyTrustDangerousSnippet = function() {
|
||||
return $sce.trustAsHtml($scope.snippet);
|
||||
};
|
||||
}]);
|
||||
</script>
|
||||
<div ng-controller="ExampleController">
|
||||
Snippet: <textarea ng-model="snippet" cols="60" rows="3"></textarea>
|
||||
<table>
|
||||
<tr>
|
||||
<td>Directive</td>
|
||||
<td>How</td>
|
||||
<td>Source</td>
|
||||
<td>Rendered</td>
|
||||
</tr>
|
||||
<tr id="bind-html-with-sanitize">
|
||||
<td>ng-bind-html</td>
|
||||
<td>Automatically uses $sanitize</td>
|
||||
<td><pre><div ng-bind-html="snippet"><br/></div></pre></td>
|
||||
<td><div ng-bind-html="snippet"></div></td>
|
||||
</tr>
|
||||
<tr id="bind-html-with-trust">
|
||||
<td>ng-bind-html</td>
|
||||
<td>Bypass $sanitize by explicitly trusting the dangerous value</td>
|
||||
<td>
|
||||
<pre><div ng-bind-html="deliberatelyTrustDangerousSnippet()">
|
||||
</div></pre>
|
||||
</td>
|
||||
<td><div ng-bind-html="deliberatelyTrustDangerousSnippet()"></div></td>
|
||||
</tr>
|
||||
<tr id="bind-default">
|
||||
<td>ng-bind</td>
|
||||
<td>Automatically escapes</td>
|
||||
<td><pre><div ng-bind="snippet"><br/></div></pre></td>
|
||||
<td><div ng-bind="snippet"></div></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</file>
|
||||
<file name="protractor.js" type="protractor">
|
||||
it('should sanitize the html snippet by default', function() {
|
||||
expect(element(by.css('#bind-html-with-sanitize div')).getInnerHtml()).
|
||||
toBe('<p>an html\n<em>click here</em>\nsnippet</p>');
|
||||
});
|
||||
|
||||
it('should inline raw snippet if bound to a trusted value', function() {
|
||||
expect(element(by.css('#bind-html-with-trust div')).getInnerHtml()).
|
||||
toBe("<p style=\"color:blue\">an html\n" +
|
||||
"<em onmouseover=\"this.textContent='PWN3D!'\">click here</em>\n" +
|
||||
"snippet</p>");
|
||||
});
|
||||
|
||||
it('should escape snippet without any filter', function() {
|
||||
expect(element(by.css('#bind-default div')).getInnerHtml()).
|
||||
toBe("<p style=\"color:blue\">an html\n" +
|
||||
"<em onmouseover=\"this.textContent='PWN3D!'\">click here</em>\n" +
|
||||
"snippet</p>");
|
||||
});
|
||||
|
||||
it('should update', function() {
|
||||
element(by.model('snippet')).clear();
|
||||
element(by.model('snippet')).sendKeys('new <b onclick="alert(1)">text</b>');
|
||||
expect(element(by.css('#bind-html-with-sanitize div')).getInnerHtml()).
|
||||
toBe('new <b>text</b>');
|
||||
expect(element(by.css('#bind-html-with-trust div')).getInnerHtml()).toBe(
|
||||
'new <b onclick="alert(1)">text</b>');
|
||||
expect(element(by.css('#bind-default div')).getInnerHtml()).toBe(
|
||||
"new <b onclick=\"alert(1)\">text</b>");
|
||||
});
|
||||
</file>
|
||||
</example>
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @ngdoc provider
|
||||
* @name $sanitizeProvider
|
||||
*
|
||||
* @description
|
||||
* Creates and configures {@link $sanitize} instance.
|
||||
*/
|
||||
function $SanitizeProvider() {
|
||||
var svgEnabled = false;
|
||||
|
||||
this.$get = ['$$sanitizeUri', function($$sanitizeUri) {
|
||||
if (svgEnabled) {
|
||||
angular.extend(validElements, svgElements);
|
||||
}
|
||||
return function(html) {
|
||||
var buf = [];
|
||||
htmlParser(html, htmlSanitizeWriter(buf, function(uri, isImage) {
|
||||
return !/^unsafe:/.test($$sanitizeUri(uri, isImage));
|
||||
}));
|
||||
return buf.join('');
|
||||
};
|
||||
}];
|
||||
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name $sanitizeProvider#enableSvg
|
||||
* @kind function
|
||||
*
|
||||
* @description
|
||||
* Enables a subset of svg to be supported by the sanitizer.
|
||||
*
|
||||
* <div class="alert alert-warning">
|
||||
* <p>By enabling this setting without taking other precautions, you might expose your
|
||||
* application to click-hijacking attacks. In these attacks, sanitized svg elements could be positioned
|
||||
* outside of the containing element and be rendered over other elements on the page (e.g. a login
|
||||
* link). Such behavior can then result in phishing incidents.</p>
|
||||
*
|
||||
* <p>To protect against these, explicitly setup `overflow: hidden` css rule for all potential svg
|
||||
* tags within the sanitized content:</p>
|
||||
*
|
||||
* <br>
|
||||
*
|
||||
* <pre><code>
|
||||
* .rootOfTheIncludedContent svg {
|
||||
* overflow: hidden !important;
|
||||
* }
|
||||
* </code></pre>
|
||||
* </div>
|
||||
*
|
||||
* @param {boolean=} regexp New regexp to whitelist urls with.
|
||||
* @returns {boolean|ng.$sanitizeProvider} Returns the currently configured value if called
|
||||
* without an argument or self for chaining otherwise.
|
||||
*/
|
||||
this.enableSvg = function(enableSvg) {
|
||||
if (angular.isDefined(enableSvg)) {
|
||||
svgEnabled = enableSvg;
|
||||
return this;
|
||||
} else {
|
||||
return svgEnabled;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function sanitizeText(chars) {
|
||||
var buf = [];
|
||||
var writer = htmlSanitizeWriter(buf, angular.noop);
|
||||
writer.chars(chars);
|
||||
return buf.join('');
|
||||
}
|
||||
|
||||
|
||||
// Regular Expressions for parsing tags and attributes
|
||||
var SURROGATE_PAIR_REGEXP = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g,
|
||||
// Match everything outside of normal chars and " (quote character)
|
||||
NON_ALPHANUMERIC_REGEXP = /([^\#-~ |!])/g;
|
||||
|
||||
|
||||
// Good source of info about elements and attributes
|
||||
// http://dev.w3.org/html5/spec/Overview.html#semantics
|
||||
// http://simon.html5.org/html-elements
|
||||
|
||||
// Safe Void Elements - HTML5
|
||||
// http://dev.w3.org/html5/spec/Overview.html#void-elements
|
||||
var voidElements = toMap("area,br,col,hr,img,wbr");
|
||||
|
||||
// Elements that you can, intentionally, leave open (and which close themselves)
|
||||
// http://dev.w3.org/html5/spec/Overview.html#optional-tags
|
||||
var optionalEndTagBlockElements = toMap("colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr"),
|
||||
optionalEndTagInlineElements = toMap("rp,rt"),
|
||||
optionalEndTagElements = angular.extend({},
|
||||
optionalEndTagInlineElements,
|
||||
optionalEndTagBlockElements);
|
||||
|
||||
// Safe Block Elements - HTML5
|
||||
var blockElements = angular.extend({}, optionalEndTagBlockElements, toMap("address,article," +
|
||||
"aside,blockquote,caption,center,del,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5," +
|
||||
"h6,header,hgroup,hr,ins,map,menu,nav,ol,pre,section,table,ul"));
|
||||
|
||||
// Inline Elements - HTML5
|
||||
var inlineElements = angular.extend({}, optionalEndTagInlineElements, toMap("a,abbr,acronym,b," +
|
||||
"bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,q,ruby,rp,rt,s," +
|
||||
"samp,small,span,strike,strong,sub,sup,time,tt,u,var"));
|
||||
|
||||
// SVG Elements
|
||||
// https://wiki.whatwg.org/wiki/Sanitization_rules#svg_Elements
|
||||
// Note: the elements animate,animateColor,animateMotion,animateTransform,set are intentionally omitted.
|
||||
// They can potentially allow for arbitrary javascript to be executed. See #11290
|
||||
var svgElements = toMap("circle,defs,desc,ellipse,font-face,font-face-name,font-face-src,g,glyph," +
|
||||
"hkern,image,linearGradient,line,marker,metadata,missing-glyph,mpath,path,polygon,polyline," +
|
||||
"radialGradient,rect,stop,svg,switch,text,title,tspan");
|
||||
|
||||
// Blocked Elements (will be stripped)
|
||||
var blockedElements = toMap("script,style");
|
||||
|
||||
var validElements = angular.extend({},
|
||||
voidElements,
|
||||
blockElements,
|
||||
inlineElements,
|
||||
optionalEndTagElements);
|
||||
|
||||
//Attributes that have href and hence need to be sanitized
|
||||
var uriAttrs = toMap("background,cite,href,longdesc,src,xlink:href");
|
||||
|
||||
var htmlAttrs = toMap('abbr,align,alt,axis,bgcolor,border,cellpadding,cellspacing,class,clear,' +
|
||||
'color,cols,colspan,compact,coords,dir,face,headers,height,hreflang,hspace,' +
|
||||
'ismap,lang,language,nohref,nowrap,rel,rev,rows,rowspan,rules,' +
|
||||
'scope,scrolling,shape,size,span,start,summary,tabindex,target,title,type,' +
|
||||
'valign,value,vspace,width');
|
||||
|
||||
// SVG attributes (without "id" and "name" attributes)
|
||||
// https://wiki.whatwg.org/wiki/Sanitization_rules#svg_Attributes
|
||||
var svgAttrs = toMap('accent-height,accumulate,additive,alphabetic,arabic-form,ascent,' +
|
||||
'baseProfile,bbox,begin,by,calcMode,cap-height,class,color,color-rendering,content,' +
|
||||
'cx,cy,d,dx,dy,descent,display,dur,end,fill,fill-rule,font-family,font-size,font-stretch,' +
|
||||
'font-style,font-variant,font-weight,from,fx,fy,g1,g2,glyph-name,gradientUnits,hanging,' +
|
||||
'height,horiz-adv-x,horiz-origin-x,ideographic,k,keyPoints,keySplines,keyTimes,lang,' +
|
||||
'marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mathematical,' +
|
||||
'max,min,offset,opacity,orient,origin,overline-position,overline-thickness,panose-1,' +
|
||||
'path,pathLength,points,preserveAspectRatio,r,refX,refY,repeatCount,repeatDur,' +
|
||||
'requiredExtensions,requiredFeatures,restart,rotate,rx,ry,slope,stemh,stemv,stop-color,' +
|
||||
'stop-opacity,strikethrough-position,strikethrough-thickness,stroke,stroke-dasharray,' +
|
||||
'stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,' +
|
||||
'stroke-width,systemLanguage,target,text-anchor,to,transform,type,u1,u2,underline-position,' +
|
||||
'underline-thickness,unicode,unicode-range,units-per-em,values,version,viewBox,visibility,' +
|
||||
'width,widths,x,x-height,x1,x2,xlink:actuate,xlink:arcrole,xlink:role,xlink:show,xlink:title,' +
|
||||
'xlink:type,xml:base,xml:lang,xml:space,xmlns,xmlns:xlink,y,y1,y2,zoomAndPan', true);
|
||||
|
||||
var validAttrs = angular.extend({},
|
||||
uriAttrs,
|
||||
svgAttrs,
|
||||
htmlAttrs);
|
||||
|
||||
function toMap(str, lowercaseKeys) {
|
||||
var obj = {}, items = str.split(','), i;
|
||||
for (i = 0; i < items.length; i++) {
|
||||
obj[lowercaseKeys ? angular.lowercase(items[i]) : items[i]] = true;
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
var inertBodyElement;
|
||||
(function(window) {
|
||||
var doc;
|
||||
if (window.document && window.document.implementation) {
|
||||
doc = window.document.implementation.createHTMLDocument("inert");
|
||||
} else {
|
||||
throw $sanitizeMinErr('noinert', "Can't create an inert html document");
|
||||
}
|
||||
var docElement = doc.documentElement || doc.getDocumentElement();
|
||||
var bodyElements = docElement.getElementsByTagName('body');
|
||||
|
||||
// usually there should be only one body element in the document, but IE doesn't have any, so we need to create one
|
||||
if (bodyElements.length === 1) {
|
||||
inertBodyElement = bodyElements[0];
|
||||
} else {
|
||||
var html = doc.createElement('html');
|
||||
inertBodyElement = doc.createElement('body');
|
||||
html.appendChild(inertBodyElement);
|
||||
doc.appendChild(html);
|
||||
}
|
||||
})(window);
|
||||
|
||||
/**
|
||||
* @example
|
||||
* htmlParser(htmlString, {
|
||||
* start: function(tag, attrs) {},
|
||||
* end: function(tag) {},
|
||||
* chars: function(text) {},
|
||||
* comment: function(text) {}
|
||||
* });
|
||||
*
|
||||
* @param {string} html string
|
||||
* @param {object} handler
|
||||
*/
|
||||
function htmlParser(html, handler) {
|
||||
if (html === null || html === undefined) {
|
||||
html = '';
|
||||
} else if (typeof html !== 'string') {
|
||||
html = '' + html;
|
||||
}
|
||||
inertBodyElement.innerHTML = html;
|
||||
|
||||
//mXSS protection
|
||||
var mXSSAttempts = 5;
|
||||
do {
|
||||
if (mXSSAttempts === 0) {
|
||||
throw $sanitizeMinErr('uinput', "Failed to sanitize html because the input is unstable");
|
||||
}
|
||||
mXSSAttempts--;
|
||||
|
||||
// strip custom-namespaced attributes on IE<=11
|
||||
if (document.documentMode <= 11) {
|
||||
stripCustomNsAttrs(inertBodyElement);
|
||||
}
|
||||
html = inertBodyElement.innerHTML; //trigger mXSS
|
||||
inertBodyElement.innerHTML = html;
|
||||
} while (html !== inertBodyElement.innerHTML);
|
||||
|
||||
var node = inertBodyElement.firstChild;
|
||||
while (node) {
|
||||
switch (node.nodeType) {
|
||||
case 1: // ELEMENT_NODE
|
||||
handler.start(node.nodeName.toLowerCase(), attrToMap(node.attributes));
|
||||
break;
|
||||
case 3: // TEXT NODE
|
||||
handler.chars(node.textContent);
|
||||
break;
|
||||
}
|
||||
|
||||
var nextNode;
|
||||
if (!(nextNode = node.firstChild)) {
|
||||
if (node.nodeType == 1) {
|
||||
handler.end(node.nodeName.toLowerCase());
|
||||
}
|
||||
nextNode = node.nextSibling;
|
||||
if (!nextNode) {
|
||||
while (nextNode == null) {
|
||||
node = node.parentNode;
|
||||
if (node === inertBodyElement) break;
|
||||
nextNode = node.nextSibling;
|
||||
if (node.nodeType == 1) {
|
||||
handler.end(node.nodeName.toLowerCase());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
node = nextNode;
|
||||
}
|
||||
|
||||
while (node = inertBodyElement.firstChild) {
|
||||
inertBodyElement.removeChild(node);
|
||||
}
|
||||
}
|
||||
|
||||
function attrToMap(attrs) {
|
||||
var map = {};
|
||||
for (var i = 0, ii = attrs.length; i < ii; i++) {
|
||||
var attr = attrs[i];
|
||||
map[attr.name] = attr.value;
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Escapes all potentially dangerous characters, so that the
|
||||
* resulting string can be safely inserted into attribute or
|
||||
* element text.
|
||||
* @param value
|
||||
* @returns {string} escaped text
|
||||
*/
|
||||
function encodeEntities(value) {
|
||||
return value.
|
||||
replace(/&/g, '&').
|
||||
replace(SURROGATE_PAIR_REGEXP, function(value) {
|
||||
var hi = value.charCodeAt(0);
|
||||
var low = value.charCodeAt(1);
|
||||
return '&#' + (((hi - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000) + ';';
|
||||
}).
|
||||
replace(NON_ALPHANUMERIC_REGEXP, function(value) {
|
||||
return '&#' + value.charCodeAt(0) + ';';
|
||||
}).
|
||||
replace(/</g, '<').
|
||||
replace(/>/g, '>');
|
||||
}
|
||||
|
||||
/**
|
||||
* create an HTML/XML writer which writes to buffer
|
||||
* @param {Array} buf use buf.join('') to get out sanitized html string
|
||||
* @returns {object} in the form of {
|
||||
* start: function(tag, attrs) {},
|
||||
* end: function(tag) {},
|
||||
* chars: function(text) {},
|
||||
* comment: function(text) {}
|
||||
* }
|
||||
*/
|
||||
function htmlSanitizeWriter(buf, uriValidator) {
|
||||
var ignoreCurrentElement = false;
|
||||
var out = angular.bind(buf, buf.push);
|
||||
return {
|
||||
start: function(tag, attrs) {
|
||||
tag = angular.lowercase(tag);
|
||||
if (!ignoreCurrentElement && blockedElements[tag]) {
|
||||
ignoreCurrentElement = tag;
|
||||
}
|
||||
if (!ignoreCurrentElement && validElements[tag] === true) {
|
||||
out('<');
|
||||
out(tag);
|
||||
angular.forEach(attrs, function(value, key) {
|
||||
var lkey=angular.lowercase(key);
|
||||
var isImage = (tag === 'img' && lkey === 'src') || (lkey === 'background');
|
||||
if (validAttrs[lkey] === true &&
|
||||
(uriAttrs[lkey] !== true || uriValidator(value, isImage))) {
|
||||
out(' ');
|
||||
out(key);
|
||||
out('="');
|
||||
out(encodeEntities(value));
|
||||
out('"');
|
||||
}
|
||||
});
|
||||
out('>');
|
||||
}
|
||||
},
|
||||
end: function(tag) {
|
||||
tag = angular.lowercase(tag);
|
||||
if (!ignoreCurrentElement && validElements[tag] === true && voidElements[tag] !== true) {
|
||||
out('</');
|
||||
out(tag);
|
||||
out('>');
|
||||
}
|
||||
if (tag == ignoreCurrentElement) {
|
||||
ignoreCurrentElement = false;
|
||||
}
|
||||
},
|
||||
chars: function(chars) {
|
||||
if (!ignoreCurrentElement) {
|
||||
out(encodeEntities(chars));
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* When IE9-11 comes across an unknown namespaced attribute e.g. 'xlink:foo' it adds 'xmlns:ns1' attribute to declare
|
||||
* ns1 namespace and prefixes the attribute with 'ns1' (e.g. 'ns1:xlink:foo'). This is undesirable since we don't want
|
||||
* to allow any of these custom attributes. This method strips them all.
|
||||
*
|
||||
* @param node Root element to process
|
||||
*/
|
||||
function stripCustomNsAttrs(node) {
|
||||
if (node.nodeType === Node.ELEMENT_NODE) {
|
||||
var attrs = node.attributes;
|
||||
for (var i = 0, l = attrs.length; i < l; i++) {
|
||||
var attrNode = attrs[i];
|
||||
var attrName = attrNode.name.toLowerCase();
|
||||
if (attrName === 'xmlns:ns1' || attrName.indexOf('ns1:') === 0) {
|
||||
node.removeAttributeNode(attrNode);
|
||||
i--;
|
||||
l--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var nextNode = node.firstChild;
|
||||
if (nextNode) {
|
||||
stripCustomNsAttrs(nextNode);
|
||||
}
|
||||
|
||||
nextNode = node.nextSibling;
|
||||
if (nextNode) {
|
||||
stripCustomNsAttrs(nextNode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// define ngSanitize module and register $sanitize service
|
||||
angular.module('ngSanitize', []).provider('$sanitize', $SanitizeProvider);
|
||||
|
||||
/* global sanitizeText: false */
|
||||
|
||||
/**
|
||||
* @ngdoc filter
|
||||
* @name linky
|
||||
* @kind function
|
||||
*
|
||||
* @description
|
||||
* Finds links in text input and turns them into html links. Supports `http/https/ftp/mailto` and
|
||||
* plain email address links.
|
||||
*
|
||||
* Requires the {@link ngSanitize `ngSanitize`} module to be installed.
|
||||
*
|
||||
* @param {string} text Input text.
|
||||
* @param {string} target Window (`_blank|_self|_parent|_top`) or named frame to open links in.
|
||||
* @param {object|function(url)} [attributes] Add custom attributes to the link element.
|
||||
*
|
||||
* Can be one of:
|
||||
*
|
||||
* - `object`: A map of attributes
|
||||
* - `function`: Takes the url as a parameter and returns a map of attributes
|
||||
*
|
||||
* If the map of attributes contains a value for `target`, it overrides the value of
|
||||
* the target parameter.
|
||||
*
|
||||
*
|
||||
* @returns {string} Html-linkified and {@link $sanitize sanitized} text.
|
||||
*
|
||||
* @usage
|
||||
<span ng-bind-html="linky_expression | linky"></span>
|
||||
*
|
||||
* @example
|
||||
<example module="linkyExample" deps="angular-sanitize.js">
|
||||
<file name="index.html">
|
||||
<div ng-controller="ExampleController">
|
||||
Snippet: <textarea ng-model="snippet" cols="60" rows="3"></textarea>
|
||||
<table>
|
||||
<tr>
|
||||
<th>Filter</th>
|
||||
<th>Source</th>
|
||||
<th>Rendered</th>
|
||||
</tr>
|
||||
<tr id="linky-filter">
|
||||
<td>linky filter</td>
|
||||
<td>
|
||||
<pre><div ng-bind-html="snippet | linky"><br></div></pre>
|
||||
</td>
|
||||
<td>
|
||||
<div ng-bind-html="snippet | linky"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="linky-target">
|
||||
<td>linky target</td>
|
||||
<td>
|
||||
<pre><div ng-bind-html="snippetWithSingleURL | linky:'_blank'"><br></div></pre>
|
||||
</td>
|
||||
<td>
|
||||
<div ng-bind-html="snippetWithSingleURL | linky:'_blank'"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="linky-custom-attributes">
|
||||
<td>linky custom attributes</td>
|
||||
<td>
|
||||
<pre><div ng-bind-html="snippetWithSingleURL | linky:'_self':{rel: 'nofollow'}"><br></div></pre>
|
||||
</td>
|
||||
<td>
|
||||
<div ng-bind-html="snippetWithSingleURL | linky:'_self':{rel: 'nofollow'}"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="escaped-html">
|
||||
<td>no filter</td>
|
||||
<td><pre><div ng-bind="snippet"><br></div></pre></td>
|
||||
<td><div ng-bind="snippet"></div></td>
|
||||
</tr>
|
||||
</table>
|
||||
</file>
|
||||
<file name="script.js">
|
||||
angular.module('linkyExample', ['ngSanitize'])
|
||||
.controller('ExampleController', ['$scope', function($scope) {
|
||||
$scope.snippet =
|
||||
'Pretty text with some links:\n'+
|
||||
'http://angularjs.org/,\n'+
|
||||
'mailto:us@somewhere.org,\n'+
|
||||
'another@somewhere.org,\n'+
|
||||
'and one more: ftp://127.0.0.1/.';
|
||||
$scope.snippetWithSingleURL = 'http://angularjs.org/';
|
||||
}]);
|
||||
</file>
|
||||
<file name="protractor.js" type="protractor">
|
||||
it('should linkify the snippet with urls', function() {
|
||||
expect(element(by.id('linky-filter')).element(by.binding('snippet | linky')).getText()).
|
||||
toBe('Pretty text with some links: http://angularjs.org/, us@somewhere.org, ' +
|
||||
'another@somewhere.org, and one more: ftp://127.0.0.1/.');
|
||||
expect(element.all(by.css('#linky-filter a')).count()).toEqual(4);
|
||||
});
|
||||
|
||||
it('should not linkify snippet without the linky filter', function() {
|
||||
expect(element(by.id('escaped-html')).element(by.binding('snippet')).getText()).
|
||||
toBe('Pretty text with some links: http://angularjs.org/, mailto:us@somewhere.org, ' +
|
||||
'another@somewhere.org, and one more: ftp://127.0.0.1/.');
|
||||
expect(element.all(by.css('#escaped-html a')).count()).toEqual(0);
|
||||
});
|
||||
|
||||
it('should update', function() {
|
||||
element(by.model('snippet')).clear();
|
||||
element(by.model('snippet')).sendKeys('new http://link.');
|
||||
expect(element(by.id('linky-filter')).element(by.binding('snippet | linky')).getText()).
|
||||
toBe('new http://link.');
|
||||
expect(element.all(by.css('#linky-filter a')).count()).toEqual(1);
|
||||
expect(element(by.id('escaped-html')).element(by.binding('snippet')).getText())
|
||||
.toBe('new http://link.');
|
||||
});
|
||||
|
||||
it('should work with the target property', function() {
|
||||
expect(element(by.id('linky-target')).
|
||||
element(by.binding("snippetWithSingleURL | linky:'_blank'")).getText()).
|
||||
toBe('http://angularjs.org/');
|
||||
expect(element(by.css('#linky-target a')).getAttribute('target')).toEqual('_blank');
|
||||
});
|
||||
|
||||
it('should optionally add custom attributes', function() {
|
||||
expect(element(by.id('linky-custom-attributes')).
|
||||
element(by.binding("snippetWithSingleURL | linky:'_self':{rel: 'nofollow'}")).getText()).
|
||||
toBe('http://angularjs.org/');
|
||||
expect(element(by.css('#linky-custom-attributes a')).getAttribute('rel')).toEqual('nofollow');
|
||||
});
|
||||
</file>
|
||||
</example>
|
||||
*/
|
||||
angular.module('ngSanitize').filter('linky', ['$sanitize', function($sanitize) {
|
||||
var LINKY_URL_REGEXP =
|
||||
/((ftp|https?):\/\/|(www\.)|(mailto:)?[A-Za-z0-9._%+-]+@)\S*[^\s.;,(){}<>"\u201d\u2019]/i,
|
||||
MAILTO_REGEXP = /^mailto:/i;
|
||||
|
||||
var linkyMinErr = angular.$$minErr('linky');
|
||||
var isString = angular.isString;
|
||||
|
||||
return function(text, target, attributes) {
|
||||
if (text == null || text === '') return text;
|
||||
if (!isString(text)) throw linkyMinErr('notstring', 'Expected string but received: {0}', text);
|
||||
|
||||
var match;
|
||||
var raw = text;
|
||||
var html = [];
|
||||
var url;
|
||||
var i;
|
||||
while ((match = raw.match(LINKY_URL_REGEXP))) {
|
||||
// We can not end in these as they are sometimes found at the end of the sentence
|
||||
url = match[0];
|
||||
// if we did not match ftp/http/www/mailto then assume mailto
|
||||
if (!match[2] && !match[4]) {
|
||||
url = (match[3] ? 'http://' : 'mailto:') + url;
|
||||
}
|
||||
i = match.index;
|
||||
addText(raw.substr(0, i));
|
||||
addLink(url, match[0].replace(MAILTO_REGEXP, ''));
|
||||
raw = raw.substring(i + match[0].length);
|
||||
}
|
||||
addText(raw);
|
||||
return $sanitize(html.join(''));
|
||||
|
||||
function addText(text) {
|
||||
if (!text) {
|
||||
return;
|
||||
}
|
||||
html.push(sanitizeText(text));
|
||||
}
|
||||
|
||||
function addLink(url, text) {
|
||||
var key;
|
||||
html.push('<a ');
|
||||
if (angular.isFunction(attributes)) {
|
||||
attributes = attributes(url);
|
||||
}
|
||||
if (angular.isObject(attributes)) {
|
||||
for (key in attributes) {
|
||||
html.push(key + '="' + attributes[key] + '" ');
|
||||
}
|
||||
} else {
|
||||
attributes = {};
|
||||
}
|
||||
if (angular.isDefined(target) && !('target' in attributes)) {
|
||||
html.push('target="',
|
||||
target,
|
||||
'" ');
|
||||
}
|
||||
html.push('href="',
|
||||
url.replace(/"/g, '"'),
|
||||
'">');
|
||||
addText(text);
|
||||
html.push('</a>');
|
||||
}
|
||||
};
|
||||
}]);
|
||||
|
||||
|
||||
})(window, window.angular);
|
||||
15
www/lib/angular-sanitize/angular-sanitize.min.js
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
/*
|
||||
AngularJS v1.5.3
|
||||
(c) 2010-2016 Google, Inc. http://angularjs.org
|
||||
License: MIT
|
||||
*/
|
||||
(function(A,e,B){'use strict';function C(a){var c=[];v(c,e.noop).chars(a);return c.join("")}function h(a,c){var b={},d=a.split(","),l;for(l=0;l<d.length;l++)b[c?e.lowercase(d[l]):d[l]]=!0;return b}function D(a,c){null===a||a===B?a="":"string"!==typeof a&&(a=""+a);g.innerHTML=a;var b=5;do{if(0===b)throw w("uinput");b--;11>=document.documentMode&&n(g);a=g.innerHTML;g.innerHTML=a}while(a!==g.innerHTML);for(b=g.firstChild;b;){switch(b.nodeType){case 1:c.start(b.nodeName.toLowerCase(),E(b.attributes));
|
||||
break;case 3:c.chars(b.textContent)}var d;if(!(d=b.firstChild)&&(1==b.nodeType&&c.end(b.nodeName.toLowerCase()),d=b.nextSibling,!d))for(;null==d;){b=b.parentNode;if(b===g)break;d=b.nextSibling;1==b.nodeType&&c.end(b.nodeName.toLowerCase())}b=d}for(;b=g.firstChild;)g.removeChild(b)}function E(a){for(var c={},b=0,d=a.length;b<d;b++){var l=a[b];c[l.name]=l.value}return c}function x(a){return a.replace(/&/g,"&").replace(F,function(a){var b=a.charCodeAt(0);a=a.charCodeAt(1);return"&#"+(1024*(b-55296)+
|
||||
(a-56320)+65536)+";"}).replace(G,function(a){return"&#"+a.charCodeAt(0)+";"}).replace(/</g,"<").replace(/>/g,">")}function v(a,c){var b=!1,d=e.bind(a,a.push);return{start:function(a,f){a=e.lowercase(a);!b&&H[a]&&(b=a);b||!0!==t[a]||(d("<"),d(a),e.forEach(f,function(b,f){var g=e.lowercase(f),h="img"===a&&"src"===g||"background"===g;!0!==I[g]||!0===y[g]&&!c(b,h)||(d(" "),d(f),d('="'),d(x(b)),d('"'))}),d(">"))},end:function(a){a=e.lowercase(a);b||!0!==t[a]||!0===z[a]||(d("</"),d(a),d(">"));a==
|
||||
b&&(b=!1)},chars:function(a){b||d(x(a))}}}function n(a){if(a.nodeType===Node.ELEMENT_NODE)for(var c=a.attributes,b=0,d=c.length;b<d;b++){var e=c[b],f=e.name.toLowerCase();if("xmlns:ns1"===f||0===f.indexOf("ns1:"))a.removeAttributeNode(e),b--,d--}(c=a.firstChild)&&n(c);(c=a.nextSibling)&&n(c)}var w=e.$$minErr("$sanitize"),F=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,G=/([^\#-~ |!])/g,z=h("area,br,col,hr,img,wbr"),q=h("colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr"),k=h("rp,rt"),u=e.extend({},k,q),q=e.extend({},
|
||||
q,h("address,article,aside,blockquote,caption,center,del,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5,h6,header,hgroup,hr,ins,map,menu,nav,ol,pre,section,table,ul")),k=e.extend({},k,h("a,abbr,acronym,b,bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,q,ruby,rp,rt,s,samp,small,span,strike,strong,sub,sup,time,tt,u,var")),J=h("circle,defs,desc,ellipse,font-face,font-face-name,font-face-src,g,glyph,hkern,image,linearGradient,line,marker,metadata,missing-glyph,mpath,path,polygon,polyline,radialGradient,rect,stop,svg,switch,text,title,tspan"),
|
||||
H=h("script,style"),t=e.extend({},z,q,k,u),y=h("background,cite,href,longdesc,src,xlink:href"),u=h("abbr,align,alt,axis,bgcolor,border,cellpadding,cellspacing,class,clear,color,cols,colspan,compact,coords,dir,face,headers,height,hreflang,hspace,ismap,lang,language,nohref,nowrap,rel,rev,rows,rowspan,rules,scope,scrolling,shape,size,span,start,summary,tabindex,target,title,type,valign,value,vspace,width"),k=h("accent-height,accumulate,additive,alphabetic,arabic-form,ascent,baseProfile,bbox,begin,by,calcMode,cap-height,class,color,color-rendering,content,cx,cy,d,dx,dy,descent,display,dur,end,fill,fill-rule,font-family,font-size,font-stretch,font-style,font-variant,font-weight,from,fx,fy,g1,g2,glyph-name,gradientUnits,hanging,height,horiz-adv-x,horiz-origin-x,ideographic,k,keyPoints,keySplines,keyTimes,lang,marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mathematical,max,min,offset,opacity,orient,origin,overline-position,overline-thickness,panose-1,path,pathLength,points,preserveAspectRatio,r,refX,refY,repeatCount,repeatDur,requiredExtensions,requiredFeatures,restart,rotate,rx,ry,slope,stemh,stemv,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,stroke,stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,stroke-width,systemLanguage,target,text-anchor,to,transform,type,u1,u2,underline-position,underline-thickness,unicode,unicode-range,units-per-em,values,version,viewBox,visibility,width,widths,x,x-height,x1,x2,xlink:actuate,xlink:arcrole,xlink:role,xlink:show,xlink:title,xlink:type,xml:base,xml:lang,xml:space,xmlns,xmlns:xlink,y,y1,y2,zoomAndPan",
|
||||
!0),I=e.extend({},y,k,u),g;(function(a){if(a.document&&a.document.implementation)a=a.document.implementation.createHTMLDocument("inert");else throw w("noinert");var c=(a.documentElement||a.getDocumentElement()).getElementsByTagName("body");1===c.length?g=c[0]:(c=a.createElement("html"),g=a.createElement("body"),c.appendChild(g),a.appendChild(c))})(A);e.module("ngSanitize",[]).provider("$sanitize",function(){var a=!1;this.$get=["$$sanitizeUri",function(c){a&&e.extend(t,J);return function(a){var d=
|
||||
[];D(a,v(d,function(a,b){return!/^unsafe:/.test(c(a,b))}));return d.join("")}}];this.enableSvg=function(c){return e.isDefined(c)?(a=c,this):a}});e.module("ngSanitize").filter("linky",["$sanitize",function(a){var c=/((ftp|https?):\/\/|(www\.)|(mailto:)?[A-Za-z0-9._%+-]+@)\S*[^\s.;,(){}<>"\u201d\u2019]/i,b=/^mailto:/i,d=e.$$minErr("linky"),g=e.isString;return function(f,h,m){function k(a){a&&p.push(C(a))}function q(a,b){var c;p.push("<a ");e.isFunction(m)&&(m=m(a));if(e.isObject(m))for(c in m)p.push(c+
|
||||
'="'+m[c]+'" ');else m={};!e.isDefined(h)||"target"in m||p.push('target="',h,'" ');p.push('href="',a.replace(/"/g,"""),'">');k(b);p.push("</a>")}if(null==f||""===f)return f;if(!g(f))throw d("notstring",f);for(var r=f,p=[],s,n;f=r.match(c);)s=f[0],f[2]||f[4]||(s=(f[3]?"http://":"mailto:")+s),n=f.index,k(r.substr(0,n)),q(s,f[0].replace(b,"")),r=r.substring(n+f[0].length);k(r);return a(p.join(""))}}])})(window,window.angular);
|
||||
//# sourceMappingURL=angular-sanitize.min.js.map
|
||||
8
www/lib/angular-sanitize/angular-sanitize.min.js.map
Normal file
10
www/lib/angular-sanitize/bower.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"name": "angular-sanitize",
|
||||
"version": "1.5.3",
|
||||
"license": "MIT",
|
||||
"main": "./angular-sanitize.js",
|
||||
"ignore": [],
|
||||
"dependencies": {
|
||||
"angular": "1.5.3"
|
||||
}
|
||||
}
|
||||
2
www/lib/angular-sanitize/index.js
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
require('./angular-sanitize');
|
||||
module.exports = 'ngSanitize';
|
||||
26
www/lib/angular-sanitize/package.json
Normal file
@ -0,0 +1,26 @@
|
||||
{
|
||||
"name": "angular-sanitize",
|
||||
"version": "1.5.3",
|
||||
"description": "AngularJS module for sanitizing HTML",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/angular/angular.js.git"
|
||||
},
|
||||
"keywords": [
|
||||
"angular",
|
||||
"framework",
|
||||
"browser",
|
||||
"html",
|
||||
"client-side"
|
||||
],
|
||||
"author": "Angular Core Team <angular-core+npm@google.com>",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/angular/angular.js/issues"
|
||||
},
|
||||
"homepage": "http://angularjs.org"
|
||||
}
|
||||
33
www/lib/angular-ui-router/.bower.json
Normal file
@ -0,0 +1,33 @@
|
||||
{
|
||||
"name": "angular-ui-router",
|
||||
"version": "0.2.13",
|
||||
"main": "./release/angular-ui-router.js",
|
||||
"dependencies": {
|
||||
"angular": ">= 1.0.8"
|
||||
},
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"node_modules",
|
||||
"bower_components",
|
||||
"component.json",
|
||||
"package.json",
|
||||
"lib",
|
||||
"config",
|
||||
"sample",
|
||||
"test",
|
||||
"tests",
|
||||
"ngdoc_assets",
|
||||
"Gruntfile.js",
|
||||
"files.js"
|
||||
],
|
||||
"homepage": "https://github.com/angular-ui/angular-ui-router-bower",
|
||||
"_release": "0.2.13",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "0.2.13",
|
||||
"commit": "2e580f271defdec34f464aab0cca519e41d1ee33"
|
||||
},
|
||||
"_source": "https://github.com/angular-ui/angular-ui-router-bower.git",
|
||||
"_target": "0.2.13",
|
||||
"_originalSource": "angular-ui-router"
|
||||
}
|
||||
197
www/lib/angular-ui-router/CHANGELOG.md
Normal file
@ -0,0 +1,197 @@
|
||||
<a name="0.2.13"></a>
|
||||
### 0.2.13 (2014-11-20)
|
||||
|
||||
This release primarily fixes issues reported against 0.2.12
|
||||
|
||||
#### Bug Fixes
|
||||
|
||||
* **$state:** fix $state.includes/.is to apply param types before comparisions fix(uiSref): ma ([19715d15](https://github.com/angular-ui/ui-router/commit/19715d15e3cbfff724519e9febedd05b49c75baa), closes [#1513](https://github.com/angular-ui/ui-router/issues/1513))
|
||||
* Avoid re-synchronizing from url after .transitionTo ([b267ecd3](https://github.com/angular-ui/ui-router/commit/b267ecd348e5c415233573ef95ebdbd051875f52), closes [#1573](https://github.com/angular-ui/ui-router/issues/1573))
|
||||
* **$urlMatcherFactory:**
|
||||
* Built-in date type uses local time zone ([d726bedc](https://github.com/angular-ui/ui-router/commit/d726bedcbb5f70a5660addf43fd52ec730790293))
|
||||
* make date type fn check .is before running ([aa94ce3b](https://github.com/angular-ui/ui-router/commit/aa94ce3b86632ad05301530a2213099da73a3dc0), closes [#1564](https://github.com/angular-ui/ui-router/issues/1564))
|
||||
* early binding of array handler bypasses type resolution ([ada4bc27](https://github.com/angular-ui/ui-router/commit/ada4bc27df5eff3ba3ab0de94a09bd91b0f7a28c))
|
||||
* add 'any' Type for non-encoding non-url params ([3bfd75ab](https://github.com/angular-ui/ui-router/commit/3bfd75ab445ee2f1dd55275465059ed116b10b27), closes [#1562](https://github.com/angular-ui/ui-router/issues/1562))
|
||||
* fix encoding slashes in params ([0c983a08](https://github.com/angular-ui/ui-router/commit/0c983a08e2947f999683571477debd73038e95cf), closes [#1119](https://github.com/angular-ui/ui-router/issues/1119))
|
||||
* fix mixed path/query params ordering problem ([a479fbd0](https://github.com/angular-ui/ui-router/commit/a479fbd0b8eb393a94320973e5b9a62d83912ee2), closes [#1543](https://github.com/angular-ui/ui-router/issues/1543))
|
||||
* **ArrayType:**
|
||||
* specify empty array mapping corner case ([74aa6091](https://github.com/angular-ui/ui-router/commit/74aa60917e996b0b4e27bbb4eb88c3c03832021d), closes [#1511](https://github.com/angular-ui/ui-router/issues/1511))
|
||||
* fix .equals for array types ([5e6783b7](https://github.com/angular-ui/ui-router/commit/5e6783b77af9a90ddff154f990b43dbb17eeda6e), closes [#1538](https://github.com/angular-ui/ui-router/issues/1538))
|
||||
* **Param:** fix default value shorthand declaration ([831d812a](https://github.com/angular-ui/ui-router/commit/831d812a524524c71f0ee1c9afaf0487a5a66230), closes [#1554](https://github.com/angular-ui/ui-router/issues/1554))
|
||||
* **common:** fixed the _.filter clone to not create sparse arrays ([750f5cf5](https://github.com/angular-ui/ui-router/commit/750f5cf5fd91f9ada96f39e50d39aceb2caf22b6), closes [#1563](https://github.com/angular-ui/ui-router/issues/1563))
|
||||
* **ie8:** fix calls to indexOf and filter ([dcb31b84](https://github.com/angular-ui/ui-router/commit/dcb31b843391b3e61dee4de13f368c109541813e), closes [#1556](https://github.com/angular-ui/ui-router/issues/1556))
|
||||
|
||||
|
||||
#### Features
|
||||
|
||||
* add json parameter Type ([027f1fcf](https://github.com/angular-ui/ui-router/commit/027f1fcf9c0916cea651e88981345da6f9ff214a))
|
||||
|
||||
|
||||
<a name="0.2.12"></a>
|
||||
### 0.2.12 (2014-11-13)
|
||||
|
||||
#### Bug Fixes
|
||||
|
||||
* **$resolve:** use resolve fn result, not parent resolved value of same name ([67f5e00c](https://github.com/angular-ui/ui-router/commit/67f5e00cc9aa006ce3fe6cde9dff261c28eab70a), closes [#1317], [#1353])
|
||||
* **$state:**
|
||||
* populate default params in .transitionTo. ([3f60fbe6](https://github.com/angular-ui/ui-router/commit/3f60fbe6d65ebeca8d97952c05aa1d269f1b7ba1), closes [#1396])
|
||||
* reload() now reinvokes controllers ([73443420](https://github.com/angular-ui/ui-router/commit/7344342018847902594dc1fc62d30a5c30f01763), closes [#582])
|
||||
* do not emit $viewContentLoading if notify: false ([74255feb](https://github.com/angular-ui/ui-router/commit/74255febdf48ae082a02ca1e735165f2c369a463), closes [#1387](https://github.com/angular-ui/ui-router/issues/1387))
|
||||
* register states at config-time ([4533fe36](https://github.com/angular-ui/ui-router/commit/4533fe36e0ab2f0143edd854a4145deaa013915a))
|
||||
* handle parent.name when parent is obj ([4533fe36](https://github.com/angular-ui/ui-router/commit/4533fe36e0ab2f0143edd854a4145deaa013915a))
|
||||
* **$urlMatcherFactory:**
|
||||
* register types at config ([4533fe36](https://github.com/angular-ui/ui-router/commit/4533fe36e0ab2f0143edd854a4145deaa013915a), closes [#1476])
|
||||
* made path params default value "" for backwards compat ([8f998e71](https://github.com/angular-ui/ui-router/commit/8f998e71e43a0b31293331c981f5db0f0097b8ba))
|
||||
* Pre-replace certain param values for better mapping ([6374a3e2](https://github.com/angular-ui/ui-router/commit/6374a3e29ab932014a7c77d2e1ab884cc841a2e3))
|
||||
* fixed ParamSet.$$keys() ordering ([9136fecb](https://github.com/angular-ui/ui-router/commit/9136fecbc2bfd4fda748a9914f0225a46c933860))
|
||||
* empty string policy now respected in Param.value() ([db12c85c](https://github.com/angular-ui/ui-router/commit/db12c85c16f2d105415f9bbbdeb11863f64728e0))
|
||||
* "string" type now encodes/decodes slashes ([3045e415](https://github.com/angular-ui/ui-router/commit/3045e41577a8b8b8afc6039f42adddf5f3c061ec), closes [#1119])
|
||||
* allow arrays in both path and query params ([fdd2f2c1](https://github.com/angular-ui/ui-router/commit/fdd2f2c191c4a67c874fdb9ec9a34f8dde9ad180), closes [#1073], [#1045], [#1486], [#1394])
|
||||
* typed params in search ([8d4cab69](https://github.com/angular-ui/ui-router/commit/8d4cab69dd67058e1a716892cc37b7d80a57037f), closes [#1488](https://github.com/angular-ui/ui-router/issues/1488))
|
||||
* no longer generate unroutable urls ([cb9fd9d8](https://github.com/angular-ui/ui-router/commit/cb9fd9d8943cb26c7223f6990db29c82ae8740f8), closes [#1487](https://github.com/angular-ui/ui-router/issues/1487))
|
||||
* handle optional parameter followed by required parameter in url format. ([efc72106](https://github.com/angular-ui/ui-router/commit/efc72106ddcc4774b48ea176a505ef9e95193b41))
|
||||
* default to parameter string coersion. ([13a468a7](https://github.com/angular-ui/ui-router/commit/13a468a7d54c2fb0751b94c0c1841d580b71e6dc), closes [#1414](https://github.com/angular-ui/ui-router/issues/1414))
|
||||
* concat respects strictMode/caseInsensitive ([dd72e103](https://github.com/angular-ui/ui-router/commit/dd72e103edb342d9cf802816fe127e1bbd68fd5f), closes [#1395])
|
||||
* **ui-sref:**
|
||||
* Allow sref state options to take a scope object ([b5f7b596](https://github.com/angular-ui/ui-router/commit/b5f7b59692ce4933e2d63eb5df3f50a4ba68ccc0))
|
||||
* replace raw href modification with attrs. ([08c96782](https://github.com/angular-ui/ui-router/commit/08c96782faf881b0c7ab00afc233ee6729548fa0))
|
||||
* nagivate to state when url is "" fix($state.href): generate href for state with ([656b5aab](https://github.com/angular-ui/ui-router/commit/656b5aab906e5749db9b5a080c6a83b95f50fd91), closes [#1363](https://github.com/angular-ui/ui-router/issues/1363))
|
||||
* Check that state is defined in isMatch() ([92aebc75](https://github.com/angular-ui/ui-router/commit/92aebc7520f88babdc6e266536086e07263514c3), closes [#1314](https://github.com/angular-ui/ui-router/issues/1314), [#1332](https://github.com/angular-ui/ui-router/issues/1332))
|
||||
* **uiView:**
|
||||
* allow inteprolated ui-view names ([81f6a19a](https://github.com/angular-ui/ui-router/commit/81f6a19a432dac9198fd33243855bfd3b4fea8c0), closes [#1324](https://github.com/angular-ui/ui-router/issues/1324))
|
||||
* Made anim work with angular 1.3 ([c3bb7ad9](https://github.com/angular-ui/ui-router/commit/c3bb7ad903da1e1f3c91019cfd255be8489ff4ef), closes [#1367](https://github.com/angular-ui/ui-router/issues/1367), [#1345](https://github.com/angular-ui/ui-router/issues/1345))
|
||||
* **urlRouter:** html5Mode accepts an object from angular v1.3.0-rc.3 ([7fea1e9d](https://github.com/angular-ui/ui-router/commit/7fea1e9d0d8c6e09cc6c895ecb93d4221e9adf48))
|
||||
* **stateFilters:** mark state filters as stateful. ([a00b353e](https://github.com/angular-ui/ui-router/commit/a00b353e3036f64a81245c4e7898646ba218f833), closes [#1479])
|
||||
* **ui-router:** re-add IE8 compatibility for map/filter/keys ([8ce69d9f](https://github.com/angular-ui/ui-router/commit/8ce69d9f7c886888ab53eca7e53536f36b428aae), closes [#1518], [#1383])
|
||||
* **package:** point 'main' to a valid filename ([ac903350](https://github.com/angular-ui/ui-router/commit/ac9033501debb63364539d91fbf3a0cba4579f8e))
|
||||
* **travis:** make CI build faster ([0531de05](https://github.com/angular-ui/ui-router/commit/0531de052e414a8d839fbb4e7635e923e94865b3))
|
||||
|
||||
|
||||
#### Features
|
||||
|
||||
##### Default and Typed params
|
||||
|
||||
This release includes a lot of bug fixes around default/optional and typed parameters. As such, 0.2.12 is the first release where we recommend those features be used.
|
||||
|
||||
* **$state:**
|
||||
* add state params validation ([b1379e6a](https://github.com/angular-ui/ui-router/commit/b1379e6a4d38f7ed7436e05873932d7c279af578), closes [#1433](https://github.com/angular-ui/ui-router/issues/1433))
|
||||
* is/includes/get work on relative stateOrName ([232e94b3](https://github.com/angular-ui/ui-router/commit/232e94b3c2ca2c764bb9510046e4b61690c87852))
|
||||
* .reload() returns state transition promise ([639e0565](https://github.com/angular-ui/ui-router/commit/639e0565dece9d5544cc93b3eee6e11c99bd7373))
|
||||
* **$templateFactory:** request templateURL as text/html ([ccd60769](https://github.com/angular-ui/ui-router/commit/ccd6076904a4b801d77b47f6e2de4c06ce9962f8), closes [#1287])
|
||||
* **$urlMatcherFactory:** Made a Params and ParamSet class ([0cc1e6cc](https://github.com/angular-ui/ui-router/commit/0cc1e6cc461a4640618e2bb594566551c54834e2))
|
||||
|
||||
|
||||
|
||||
<a name="0.2.11"></a>
|
||||
### 0.2.11 (2014-08-26)
|
||||
|
||||
|
||||
#### Bug Fixes
|
||||
|
||||
* **$resolve:** Resolves only inherit from immediate parent fixes #702 ([df34e20c](https://github.com/angular-ui/ui-router/commit/df34e20c576299e7a3c8bd4ebc68d42341c0ace9))
|
||||
* **$state:**
|
||||
* change $state.href default options.inherit to true ([deea695f](https://github.com/angular-ui/ui-router/commit/deea695f5cacc55de351ab985144fd233c02a769))
|
||||
* sanity-check state lookups ([456fd5ae](https://github.com/angular-ui/ui-router/commit/456fd5aec9ea507518927bfabd62b4afad4cf714), closes [#980](https://github.com/angular-ui/ui-router/issues/980))
|
||||
* didn't comply to inherit parameter ([09836781](https://github.com/angular-ui/ui-router/commit/09836781f126c1c485b06551eb9cfd4fa0f45c35))
|
||||
* allow view content loading broadcast ([7b78edee](https://github.com/angular-ui/ui-router/commit/7b78edeeb52a74abf4d3f00f79534033d5a08d1a))
|
||||
* **$urlMatcherFactory:**
|
||||
* detect injected functions ([91f75ae6](https://github.com/angular-ui/ui-router/commit/91f75ae66c4d129f6f69e53bd547594e9661f5d5))
|
||||
* syntax ([1ebed370](https://github.com/angular-ui/ui-router/commit/1ebed37069bae8614d41541d56521f5c45f703f3))
|
||||
* **UrlMatcher:**
|
||||
* query param function defaults ([f9c20530](https://github.com/angular-ui/ui-router/commit/f9c205304f10d8a4ebe7efe9025e642016479a51))
|
||||
* don't decode default values ([63607bdb](https://github.com/angular-ui/ui-router/commit/63607bdbbcb432d3fb37856a1cb3da0cd496804e))
|
||||
* **travis:** update Node version to fix build ([d6b95ef2](https://github.com/angular-ui/ui-router/commit/d6b95ef23d9dacb4eba08897f5190a0bcddb3a48))
|
||||
* **uiSref:**
|
||||
* Generate an href for states with a blank url. closes #1293 ([691745b1](https://github.com/angular-ui/ui-router/commit/691745b12fa05d3700dd28f0c8d25f8a105074ad))
|
||||
* should inherit params by default ([b973dad1](https://github.com/angular-ui/ui-router/commit/b973dad155ad09a7975e1476bd096f7b2c758eeb))
|
||||
* cancel transition if preventDefault() has been called ([2e6d9167](https://github.com/angular-ui/ui-router/commit/2e6d9167d3afbfbca6427e53e012f94fb5fb8022))
|
||||
* **uiView:** Fixed infinite loop when is called .go() from a controller. ([e13988b8](https://github.com/angular-ui/ui-router/commit/e13988b8cd6231d75c78876ee9d012cc87f4a8d9), closes [#1194](https://github.com/angular-ui/ui-router/issues/1194))
|
||||
* **docs:**
|
||||
* Fixed link to milestones ([6c0ae500](https://github.com/angular-ui/ui-router/commit/6c0ae500cc238ea9fc95adcc15415c55fc9e1f33))
|
||||
* fix bug in decorator example ([4bd00af5](https://github.com/angular-ui/ui-router/commit/4bd00af50b8b88a49d1545a76290731cb8e0feb1))
|
||||
* Removed an incorrect semi-colon ([af97cef8](https://github.com/angular-ui/ui-router/commit/af97cef8b967f2e32177e539ef41450dca131a7d))
|
||||
* Explain return value of rule as function ([5e887890](https://github.com/angular-ui/ui-router/commit/5e8878900a6ffe59a81aed531a3925e34a297377))
|
||||
|
||||
|
||||
#### Features
|
||||
|
||||
* **$state:**
|
||||
* allow parameters to pass unharmed ([8939d057](https://github.com/angular-ui/ui-router/commit/8939d0572ab1316e458ef016317ecff53131a822))
|
||||
* **BREAKING CHANGE**: state parameters are no longer automatically coerced to strings, and unspecified parameter values are now set to undefined rather than null.
|
||||
* allow prevent syncUrl on failure ([753060b9](https://github.com/angular-ui/ui-router/commit/753060b910d5d2da600a6fa0757976e401c33172))
|
||||
* **typescript:** Add typescript definitions for component builds ([521ceb3f](https://github.com/angular-ui/ui-router/commit/521ceb3fd7850646422f411921e21ce5e7d82e0f))
|
||||
* **uiSref:** extend syntax for ui-sref ([71cad3d6](https://github.com/angular-ui/ui-router/commit/71cad3d636508b5a9fe004775ad1f1adc0c80c3e))
|
||||
* **uiSrefActive:**
|
||||
* Also activate for child states. ([bf163ad6](https://github.com/angular-ui/ui-router/commit/bf163ad6ce176ce28792696c8302d7cdf5c05a01), closes [#818](https://github.com/angular-ui/ui-router/issues/818))
|
||||
* **BREAKING CHANGE** Since ui-sref-active now activates even when child states are active you may need to swap out your ui-sref-active with ui-sref-active-eq, thought typically we think devs want the auto inheritance.
|
||||
|
||||
* uiSrefActiveEq: new directive with old ui-sref-active behavior
|
||||
* **$urlRouter:**
|
||||
* defer URL change interception ([c72d8ce1](https://github.com/angular-ui/ui-router/commit/c72d8ce11916d0ac22c81b409c9e61d7048554d7))
|
||||
* force URLs to have valid params ([d48505cd](https://github.com/angular-ui/ui-router/commit/d48505cd328d83e39d5706e085ba319715f999a6))
|
||||
* abstract $location handling ([08b4636b](https://github.com/angular-ui/ui-router/commit/08b4636b294611f08db35f00641eb5211686fb50))
|
||||
* **$urlMatcherFactory:**
|
||||
* fail on bad parameters ([d8f124c1](https://github.com/angular-ui/ui-router/commit/d8f124c10d00c7e5dde88c602d966db261aea221))
|
||||
* date type support ([b7f074ff](https://github.com/angular-ui/ui-router/commit/b7f074ff65ca150a3cdbda4d5ad6cb17107300eb))
|
||||
* implement type support ([450b1f0e](https://github.com/angular-ui/ui-router/commit/450b1f0e8e03c738174ff967f688b9a6373290f4))
|
||||
* **UrlMatcher:**
|
||||
* handle query string arrays ([9cf764ef](https://github.com/angular-ui/ui-router/commit/9cf764efab45fa9309368688d535ddf6e96d6449), closes [#373](https://github.com/angular-ui/ui-router/issues/373))
|
||||
* injectable functions as defaults ([00966ecd](https://github.com/angular-ui/ui-router/commit/00966ecd91fb745846039160cab707bfca8b3bec))
|
||||
* default values & type decoding for query params ([a472b301](https://github.com/angular-ui/ui-router/commit/a472b301389fbe84d1c1fa9f24852b492a569d11))
|
||||
* allow shorthand definitions ([5b724304](https://github.com/angular-ui/ui-router/commit/5b7243049793505e44b6608ea09878c37c95b1f5))
|
||||
* validates whole interface ([32b27db1](https://github.com/angular-ui/ui-router/commit/32b27db173722e9194ef1d5c0ea7d93f25a98d11))
|
||||
* implement non-strict matching ([a3e21366](https://github.com/angular-ui/ui-router/commit/a3e21366bee0475c9795a1ec76f70eec41c5b4e3))
|
||||
* add per-param config support ([07b3029f](https://github.com/angular-ui/ui-router/commit/07b3029f4d409cf955780113df92e36401b47580))
|
||||
* **BREAKING CHANGE**: the `params` option in state configurations must now be an object keyed by parameter name.
|
||||
|
||||
### 0.2.10 (2014-03-12)
|
||||
|
||||
|
||||
#### Bug Fixes
|
||||
|
||||
* **$state:** use $browser.baseHref() when generating urls with .href() ([cbcc8488](https://github.com/angular-ui/ui-router/commit/cbcc84887d6b6d35258adabb97c714cd9c1e272d))
|
||||
* **bower.json:** JS files should not be ignored ([ccdab193](https://github.com/angular-ui/ui-router/commit/ccdab193315f304eb3be5f5b97c47a926c79263e))
|
||||
* **dev:** karma:background task is missing, can't run grunt:dev. ([d9f7b898](https://github.com/angular-ui/ui-router/commit/d9f7b898e8e3abb8c846b0faa16a382913d7b22b))
|
||||
* **sample:** Contacts menu button not staying active when navigating to detail states. Need t ([2fcb8443](https://github.com/angular-ui/ui-router/commit/2fcb84437cb43ade12682a92b764f13cac77dfe7))
|
||||
* **uiSref:** support mock-clicks/events with no data ([717d3ff7](https://github.com/angular-ui/ui-router/commit/717d3ff7d0ba72d239892dee562b401cdf90e418))
|
||||
* **uiView:**
|
||||
* Do NOT autoscroll when autoscroll attr is missing ([affe5bd7](https://github.com/angular-ui/ui-router/commit/affe5bd785cdc3f02b7a9f64a52e3900386ec3a0), closes [#807](https://github.com/angular-ui/ui-router/issues/807))
|
||||
* Refactoring uiView directive to copy ngView logic ([548fab6a](https://github.com/angular-ui/ui-router/commit/548fab6ab9debc9904c5865c8bc68b4fc3271dd0), closes [#857](https://github.com/angular-ui/ui-router/issues/857), [#552](https://github.com/angular-ui/ui-router/issues/552))
|
||||
|
||||
|
||||
#### Features
|
||||
|
||||
* **$state:** includes() allows glob patterns for state matching. ([2d5f6b37](https://github.com/angular-ui/ui-router/commit/2d5f6b37191a3135f4a6d9e8f344c54edcdc065b))
|
||||
* **UrlMatcher:** Add support for case insensitive url matching ([642d5247](https://github.com/angular-ui/ui-router/commit/642d524799f604811e680331002feec7199a1fb5))
|
||||
* **uiSref:** add support for transition options ([2ed7a728](https://github.com/angular-ui/ui-router/commit/2ed7a728cee6854b38501fbc1df6139d3de5b28a))
|
||||
* **uiView:** add controllerAs config with function ([1ee7334a](https://github.com/angular-ui/ui-router/commit/1ee7334a73efeccc9b95340e315cdfd59944762d))
|
||||
|
||||
|
||||
### 0.2.9 (2014-01-17)
|
||||
|
||||
|
||||
This release is identical to 0.2.8. 0.2.8 was re-tagged in git to fix a problem with bower.
|
||||
|
||||
|
||||
### 0.2.8 (2014-01-16)
|
||||
|
||||
|
||||
#### Bug Fixes
|
||||
|
||||
* **$state:** allow null to be passed as 'params' param ([094dc30e](https://github.com/angular-ui/ui-router/commit/094dc30e883e1bd14e50a475553bafeaade3b178))
|
||||
* **$state.go:** param inheritance shouldn't inherit from siblings ([aea872e0](https://github.com/angular-ui/ui-router/commit/aea872e0b983cb433436ce5875df10c838fccedb))
|
||||
* **bower.json:** fixes bower.json ([eed3cc4d](https://github.com/angular-ui/ui-router/commit/eed3cc4d4dfef1d3ef84b9fd063127538ebf59d3))
|
||||
* **uiSrefActive:** annotate controller injection ([85921422](https://github.com/angular-ui/ui-router/commit/85921422ff7fb0effed358136426d616cce3d583), closes [#671](https://github.com/angular-ui/ui-router/issues/671))
|
||||
* **uiView:**
|
||||
* autoscroll tests pass on 1.2.4 & 1.1.5 ([86eacac0](https://github.com/angular-ui/ui-router/commit/86eacac09ca5e9000bd3b9c7ba6e2cc95d883a3a))
|
||||
* don't animate initial load ([83b6634d](https://github.com/angular-ui/ui-router/commit/83b6634d27942ca74766b2b1244a7fc52c5643d9))
|
||||
* test pass against 1.0.8 and 1.2.4 ([a402415a](https://github.com/angular-ui/ui-router/commit/a402415a2a28b360c43b9fe8f4f54c540f6c33de))
|
||||
* it should autoscroll when expr is missing. ([8bb9e27a](https://github.com/angular-ui/ui-router/commit/8bb9e27a2986725f45daf44c4c9f846385095aff))
|
||||
|
||||
|
||||
#### Features
|
||||
|
||||
* **uiSref:** add target attribute behaviour ([c12bf9a5](https://github.com/angular-ui/ui-router/commit/c12bf9a520d30d70294e3d82de7661900f8e394e))
|
||||
* **uiView:**
|
||||
* merge autoscroll expression test. ([b89e0f87](https://github.com/angular-ui/ui-router/commit/b89e0f871d5cc35c10925ede986c10684d5c9252))
|
||||
* cache and test autoscroll expression ([ee262282](https://github.com/angular-ui/ui-router/commit/ee2622828c2ce83807f006a459ac4e11406d9258))
|
||||
65
www/lib/angular-ui-router/CONTRIBUTING.md
Normal file
@ -0,0 +1,65 @@
|
||||
|
||||
# Report an Issue
|
||||
|
||||
Help us make UI-Router better! If you think you might have found a bug, or some other weirdness, start by making sure
|
||||
it hasn't already been reported. You can [search through existing issues](https://github.com/angular-ui/ui-router/search?q=wat%3F&type=Issues)
|
||||
to see if someone's reported one similar to yours.
|
||||
|
||||
If not, then [create a plunkr](http://bit.ly/UIR-Plunk) that demonstrates the problem (try to use as little code
|
||||
as possible: the more minimalist, the faster we can debug it).
|
||||
|
||||
Next, [create a new issue](https://github.com/angular-ui/ui-router/issues/new) that briefly explains the problem,
|
||||
and provides a bit of background as to the circumstances that triggered it. Don't forget to include the link to
|
||||
that plunkr you created!
|
||||
|
||||
**Note**: If you're unsure how a feature is used, or are encountering some unexpected behavior that you aren't sure
|
||||
is a bug, it's best to talk it out on
|
||||
[StackOverflow](http://stackoverflow.com/questions/ask?tags=angularjs,angular-ui-router) before reporting it. This
|
||||
keeps development streamlined, and helps us focus on building great software.
|
||||
|
||||
|
||||
Issues only! |
|
||||
-------------|
|
||||
Please keep in mind that the issue tracker is for *issues*. Please do *not* post an issue if you need help or support. Instead, see one of the above-mentioned forums or [IRC](irc://irc.freenode.net/#angularjs). |
|
||||
|
||||
####Purple Labels
|
||||
A purple label means that **you** need to take some further action.
|
||||
- : Your issue is not specific enough, or there is no clear action that we can take. Please clarify and refine your issue.
|
||||
- : Please [create a plunkr](http://bit.ly/UIR-Plunk)
|
||||
- : We suspect your issue is really a help request, or could be answered by the community. Please ask your question on [StackOverflow](http://stackoverflow.com/questions/ask?tags=angularjs,angular-ui-router). If you determine that is an actual issue, please explain why.
|
||||
|
||||
If your issue gets labeled with purple label, no further action will be taken until you respond to the label appropriately.
|
||||
|
||||
# Contribute
|
||||
|
||||
**(1)** See the **[Developing](#developing)** section below, to get the development version of UI-Router up and running on your local machine.
|
||||
|
||||
**(2)** Check out the [roadmap](https://github.com/angular-ui/ui-router/milestones) to see where the project is headed, and if your feature idea fits with where we're headed.
|
||||
|
||||
**(3)** If you're not sure, [open an RFC](https://github.com/angular-ui/ui-router/issues/new?title=RFC:%20My%20idea) to get some feedback on your idea.
|
||||
|
||||
**(4)** Finally, commit some code and open a pull request. Code & commits should abide by the following rules:
|
||||
|
||||
- *Always* have test coverage for new features (or regression tests for bug fixes), and *never* break existing tests
|
||||
- Commits should represent one logical change each; if a feature goes through multiple iterations, squash your commits down to one
|
||||
- Make sure to follow the [Angular commit message format](https://github.com/angular/angular.js/blob/master/CONTRIBUTING.md#commit-message-format) so your change will appear in the changelog of the next release.
|
||||
- Changes should always respect the coding style of the project
|
||||
|
||||
|
||||
|
||||
# Developing
|
||||
|
||||
UI-Router uses <code>grunt >= 0.4.x</code>. Make sure to upgrade your environment and read the
|
||||
[Migration Guide](http://gruntjs.com/upgrading-from-0.3-to-0.4).
|
||||
|
||||
Dependencies for building from source and running tests:
|
||||
|
||||
* [grunt-cli](https://github.com/gruntjs/grunt-cli) - run: `$ npm install -g grunt-cli`
|
||||
* Then, install the development dependencies by running `$ npm install` from the project directory
|
||||
|
||||
There are a number of targets in the gruntfile that are used to generating different builds:
|
||||
|
||||
* `grunt`: Perform a normal build, runs jshint and karma tests
|
||||
* `grunt build`: Perform a normal build
|
||||
* `grunt dist`: Perform a clean build and generate documentation
|
||||
* `grunt dev`: Run dev server (sample app) and watch for changes, builds and runs karma tests on changes.
|
||||
21
www/lib/angular-ui-router/LICENSE
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License
|
||||
|
||||
Copyright (c) 2014 The AngularUI Team, Karsten Sperling
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
243
www/lib/angular-ui-router/README.md
Normal file
@ -0,0 +1,243 @@
|
||||
# AngularUI Router [](https://travis-ci.org/angular-ui/ui-router)
|
||||
|
||||
#### The de-facto solution to flexible routing with nested views
|
||||
---
|
||||
**[Download 0.2.11](http://angular-ui.github.io/ui-router/release/angular-ui-router.js)** (or **[Minified](http://angular-ui.github.io/ui-router/release/angular-ui-router.min.js)**) **|**
|
||||
**[Guide](https://github.com/angular-ui/ui-router/wiki) |**
|
||||
**[API](http://angular-ui.github.io/ui-router/site) |**
|
||||
**[Sample](http://angular-ui.github.com/ui-router/sample/) ([Src](https://github.com/angular-ui/ui-router/tree/gh-pages/sample)) |**
|
||||
**[FAQ](https://github.com/angular-ui/ui-router/wiki/Frequently-Asked-Questions) |**
|
||||
**[Resources](#resources) |**
|
||||
**[Report an Issue](https://github.com/angular-ui/ui-router/blob/master/CONTRIBUTING.md#report-an-issue) |**
|
||||
**[Contribute](https://github.com/angular-ui/ui-router/blob/master/CONTRIBUTING.md#contribute) |**
|
||||
**[Help!](http://stackoverflow.com/questions/ask?tags=angularjs,angular-ui-router) |**
|
||||
**[Discuss](https://groups.google.com/forum/#!categories/angular-ui/router)**
|
||||
|
||||
---
|
||||
|
||||
AngularUI Router is a routing framework for [AngularJS](http://angularjs.org), which allows you to organize the
|
||||
parts of your interface into a [*state machine*](https://en.wikipedia.org/wiki/Finite-state_machine). Unlike the
|
||||
[`$route` service](http://docs.angularjs.org/api/ngRoute.$route) in the Angular ngRoute module, which is organized around URL
|
||||
routes, UI-Router is organized around [*states*](https://github.com/angular-ui/ui-router/wiki),
|
||||
which may optionally have routes, as well as other behavior, attached.
|
||||
|
||||
States are bound to *named*, *nested* and *parallel views*, allowing you to powerfully manage your application's interface.
|
||||
|
||||
Check out the sample app: http://angular-ui.github.io/ui-router/sample/
|
||||
|
||||
-
|
||||
**Note:** *UI-Router is under active development. As such, while this library is well-tested, the API may change. Consider using it in production applications only if you're comfortable following a changelog and updating your usage accordingly.*
|
||||
|
||||
|
||||
## Get Started
|
||||
|
||||
**(1)** Get UI-Router in one of the following ways:
|
||||
- clone & [build](CONTRIBUTING.md#developing) this repository
|
||||
- [download the release](http://angular-ui.github.io/ui-router/release/angular-ui-router.js) (or [minified](http://angular-ui.github.io/ui-router/release/angular-ui-router.min.js))
|
||||
- via **[Bower](http://bower.io/)**: by running `$ bower install angular-ui-router` from your console
|
||||
- or via **[npm](https://www.npmjs.org/)**: by running `$ npm install angular-ui-router` from your console
|
||||
- or via **[Component](https://github.com/component/component)**: by running `$ component install angular-ui/ui-router` from your console
|
||||
|
||||
**(2)** Include `angular-ui-router.js` (or `angular-ui-router.min.js`) in your `index.html`, after including Angular itself (For Component users: ignore this step)
|
||||
|
||||
**(3)** Add `'ui.router'` to your main module's list of dependencies (For Component users: replace `'ui.router'` with `require('angular-ui-router')`)
|
||||
|
||||
When you're done, your setup should look similar to the following:
|
||||
|
||||
>
|
||||
```html
|
||||
<!doctype html>
|
||||
<html ng-app="myApp">
|
||||
<head>
|
||||
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.min.js"></script>
|
||||
<script src="js/angular-ui-router.min.js"></script>
|
||||
<script>
|
||||
var myApp = angular.module('myApp', ['ui.router']);
|
||||
// For Component users, it should look like this:
|
||||
// var myApp = angular.module('myApp', [require('angular-ui-router')]);
|
||||
</script>
|
||||
...
|
||||
</head>
|
||||
<body>
|
||||
...
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
### [Nested States & Views](http://plnkr.co/edit/u18KQc?p=preview)
|
||||
|
||||
The majority of UI-Router's power is in its ability to nest states & views.
|
||||
|
||||
**(1)** First, follow the [setup](#get-started) instructions detailed above.
|
||||
|
||||
**(2)** Then, add a [`ui-view` directive](https://github.com/angular-ui/ui-router/wiki/Quick-Reference#ui-view) to the `<body />` of your app.
|
||||
|
||||
>
|
||||
```html
|
||||
<!-- index.html -->
|
||||
<body>
|
||||
<div ui-view></div>
|
||||
<!-- We'll also add some navigation: -->
|
||||
<a ui-sref="state1">State 1</a>
|
||||
<a ui-sref="state2">State 2</a>
|
||||
</body>
|
||||
```
|
||||
|
||||
**(3)** You'll notice we also added some links with [`ui-sref` directives](https://github.com/angular-ui/ui-router/wiki/Quick-Reference#ui-sref). In addition to managing state transitions, this directive auto-generates the `href` attribute of the `<a />` element it's attached to, if the corresponding state has a URL. Next we'll add some templates. These will plug into the `ui-view` within `index.html`. Notice that they have their own `ui-view` as well! That is the key to nesting states and views.
|
||||
|
||||
>
|
||||
```html
|
||||
<!-- partials/state1.html -->
|
||||
<h1>State 1</h1>
|
||||
<hr/>
|
||||
<a ui-sref="state1.list">Show List</a>
|
||||
<div ui-view></div>
|
||||
```
|
||||
```html
|
||||
<!-- partials/state2.html -->
|
||||
<h1>State 2</h1>
|
||||
<hr/>
|
||||
<a ui-sref="state2.list">Show List</a>
|
||||
<div ui-view></div>
|
||||
```
|
||||
|
||||
**(4)** Next, we'll add some child templates. *These* will get plugged into the `ui-view` of their parent state templates.
|
||||
|
||||
>
|
||||
```html
|
||||
<!-- partials/state1.list.html -->
|
||||
<h3>List of State 1 Items</h3>
|
||||
<ul>
|
||||
<li ng-repeat="item in items">{{ item }}</li>
|
||||
</ul>
|
||||
```
|
||||
|
||||
>
|
||||
```html
|
||||
<!-- partials/state2.list.html -->
|
||||
<h3>List of State 2 Things</h3>
|
||||
<ul>
|
||||
<li ng-repeat="thing in things">{{ thing }}</li>
|
||||
</ul>
|
||||
```
|
||||
|
||||
**(5)** Finally, we'll wire it all up with `$stateProvider`. Set up your states in the module config, as in the following:
|
||||
|
||||
|
||||
>
|
||||
```javascript
|
||||
myApp.config(function($stateProvider, $urlRouterProvider) {
|
||||
//
|
||||
// For any unmatched url, redirect to /state1
|
||||
$urlRouterProvider.otherwise("/state1");
|
||||
//
|
||||
// Now set up the states
|
||||
$stateProvider
|
||||
.state('state1', {
|
||||
url: "/state1",
|
||||
templateUrl: "partials/state1.html"
|
||||
})
|
||||
.state('state1.list', {
|
||||
url: "/list",
|
||||
templateUrl: "partials/state1.list.html",
|
||||
controller: function($scope) {
|
||||
$scope.items = ["A", "List", "Of", "Items"];
|
||||
}
|
||||
})
|
||||
.state('state2', {
|
||||
url: "/state2",
|
||||
templateUrl: "partials/state2.html"
|
||||
})
|
||||
.state('state2.list', {
|
||||
url: "/list",
|
||||
templateUrl: "partials/state2.list.html",
|
||||
controller: function($scope) {
|
||||
$scope.things = ["A", "Set", "Of", "Things"];
|
||||
}
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
**(6)** See this quick start example in action.
|
||||
>**[Go to Quick Start Plunker for Nested States & Views](http://plnkr.co/edit/u18KQc?p=preview)**
|
||||
|
||||
**(7)** This only scratches the surface
|
||||
>**[Dive Deeper!](https://github.com/angular-ui/ui-router/wiki)**
|
||||
|
||||
|
||||
### [Multiple & Named Views](http://plnkr.co/edit/SDOcGS?p=preview)
|
||||
|
||||
Another great feature is the ability to have multiple `ui-view`s view per template.
|
||||
|
||||
**Pro Tip:** *While multiple parallel views are a powerful feature, you'll often be able to manage your
|
||||
interfaces more effectively by nesting your views, and pairing those views with nested states.*
|
||||
|
||||
**(1)** Follow the [setup](#get-started) instructions detailed above.
|
||||
|
||||
**(2)** Add one or more `ui-view` to your app, give them names.
|
||||
>
|
||||
```html
|
||||
<!-- index.html -->
|
||||
<body>
|
||||
<div ui-view="viewA"></div>
|
||||
<div ui-view="viewB"></div>
|
||||
<!-- Also a way to navigate -->
|
||||
<a ui-sref="route1">Route 1</a>
|
||||
<a ui-sref="route2">Route 2</a>
|
||||
</body>
|
||||
```
|
||||
|
||||
**(3)** Set up your states in the module config:
|
||||
>
|
||||
```javascript
|
||||
myApp.config(function($stateProvider) {
|
||||
$stateProvider
|
||||
.state('index', {
|
||||
url: "",
|
||||
views: {
|
||||
"viewA": { template: "index.viewA" },
|
||||
"viewB": { template: "index.viewB" }
|
||||
}
|
||||
})
|
||||
.state('route1', {
|
||||
url: "/route1",
|
||||
views: {
|
||||
"viewA": { template: "route1.viewA" },
|
||||
"viewB": { template: "route1.viewB" }
|
||||
}
|
||||
})
|
||||
.state('route2', {
|
||||
url: "/route2",
|
||||
views: {
|
||||
"viewA": { template: "route2.viewA" },
|
||||
"viewB": { template: "route2.viewB" }
|
||||
}
|
||||
})
|
||||
});
|
||||
```
|
||||
|
||||
**(4)** See this quick start example in action.
|
||||
>**[Go to Quick Start Plunker for Multiple & Named Views](http://plnkr.co/edit/SDOcGS?p=preview)**
|
||||
|
||||
|
||||
## Resources
|
||||
|
||||
* [In-Depth Guide](https://github.com/angular-ui/ui-router/wiki)
|
||||
* [API Reference](http://angular-ui.github.io/ui-router/site)
|
||||
* [Sample App](http://angular-ui.github.com/ui-router/sample/) ([Source](https://github.com/angular-ui/ui-router/tree/gh-pages/sample))
|
||||
* [FAQ](https://github.com/angular-ui/ui-router/wiki/Frequently-Asked-Questions)
|
||||
* [Slides comparing ngRoute to ui-router](http://slid.es/timkindberg/ui-router#/)
|
||||
* [UI-Router Extras / Addons](http://christopherthielen.github.io/ui-router-extras/#/home) (@christopherthielen)
|
||||
|
||||
### Videos
|
||||
|
||||
* [Introduction Video](https://egghead.io/lessons/angularjs-introduction-ui-router) (egghead.io)
|
||||
* [Tim Kindberg on Angular UI-Router](https://www.youtube.com/watch?v=lBqiZSemrqg)
|
||||
* [Activating States](https://egghead.io/lessons/angularjs-ui-router-activating-states) (egghead.io)
|
||||
* [Learn Angular.js using UI-Router](http://youtu.be/QETUuZ27N0w) (LearnCode.academy)
|
||||
|
||||
|
||||
|
||||
## Reporting issues and Contributing
|
||||
|
||||
Please read our [Contributor guidelines](CONTRIBUTING.md) before reporting an issue or creating a pull request.
|
||||
126
www/lib/angular-ui-router/api/angular-ui-router.d.ts
vendored
Normal file
@ -0,0 +1,126 @@
|
||||
// Type definitions for Angular JS 1.1.5+ (ui.router module)
|
||||
// Project: https://github.com/angular-ui/ui-router
|
||||
// Definitions by: Michel Salib <https://github.com/michelsalib>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module ng.ui {
|
||||
|
||||
interface IState {
|
||||
name?: string;
|
||||
template?: string;
|
||||
templateUrl?: any; // string || () => string
|
||||
templateProvider?: any; // () => string || IPromise<string>
|
||||
controller?: any;
|
||||
controllerAs?: string;
|
||||
controllerProvider?: any;
|
||||
resolve?: {};
|
||||
url?: string;
|
||||
params?: any;
|
||||
views?: {};
|
||||
abstract?: boolean;
|
||||
onEnter?: (...args: any[]) => void;
|
||||
onExit?: (...args: any[]) => void;
|
||||
data?: any;
|
||||
reloadOnSearch?: boolean;
|
||||
}
|
||||
|
||||
interface ITypedState<T> extends IState {
|
||||
data?: T;
|
||||
}
|
||||
|
||||
interface IStateProvider extends IServiceProvider {
|
||||
state(name: string, config: IState): IStateProvider;
|
||||
state(config: IState): IStateProvider;
|
||||
decorator(name?: string, decorator?: (state: IState, parent: Function) => any): any;
|
||||
}
|
||||
|
||||
interface IUrlMatcher {
|
||||
concat(pattern: string): IUrlMatcher;
|
||||
exec(path: string, searchParams: {}): {};
|
||||
parameters(): string[];
|
||||
format(values: {}): string;
|
||||
}
|
||||
|
||||
interface IUrlMatcherFactory {
|
||||
compile(pattern: string): IUrlMatcher;
|
||||
isMatcher(o: any): boolean;
|
||||
}
|
||||
|
||||
interface IUrlRouterProvider extends IServiceProvider {
|
||||
when(whenPath: RegExp, handler: Function): IUrlRouterProvider;
|
||||
when(whenPath: RegExp, handler: any[]): IUrlRouterProvider;
|
||||
when(whenPath: RegExp, toPath: string): IUrlRouterProvider;
|
||||
when(whenPath: IUrlMatcher, hanlder: Function): IUrlRouterProvider;
|
||||
when(whenPath: IUrlMatcher, handler: any[]): IUrlRouterProvider;
|
||||
when(whenPath: IUrlMatcher, toPath: string): IUrlRouterProvider;
|
||||
when(whenPath: string, handler: Function): IUrlRouterProvider;
|
||||
when(whenPath: string, handler: any[]): IUrlRouterProvider;
|
||||
when(whenPath: string, toPath: string): IUrlRouterProvider;
|
||||
otherwise(handler: Function): IUrlRouterProvider;
|
||||
otherwise(handler: any[]): IUrlRouterProvider;
|
||||
otherwise(path: string): IUrlRouterProvider;
|
||||
rule(handler: Function): IUrlRouterProvider;
|
||||
rule(handler: any[]): IUrlRouterProvider;
|
||||
}
|
||||
|
||||
interface IStateOptions {
|
||||
location?: any;
|
||||
inherit?: boolean;
|
||||
relative?: IState;
|
||||
notify?: boolean;
|
||||
reload?: boolean;
|
||||
}
|
||||
|
||||
interface IHrefOptions {
|
||||
lossy?: boolean;
|
||||
inherit?: boolean;
|
||||
relative?: IState;
|
||||
absolute?: boolean;
|
||||
}
|
||||
|
||||
interface IStateService {
|
||||
go(to: string, params?: {}, options?: IStateOptions): IPromise<any>;
|
||||
transitionTo(state: string, params?: {}, updateLocation?: boolean): void;
|
||||
transitionTo(state: string, params?: {}, options?: IStateOptions): void;
|
||||
includes(state: string, params?: {}): boolean;
|
||||
is(state:string, params?: {}): boolean;
|
||||
is(state: IState, params?: {}): boolean;
|
||||
href(state: IState, params?: {}, options?: IHrefOptions): string;
|
||||
href(state: string, params?: {}, options?: IHrefOptions): string;
|
||||
get(state: string): IState;
|
||||
get(): IState[];
|
||||
current: IState;
|
||||
params: any;
|
||||
reload(): void;
|
||||
}
|
||||
|
||||
interface IStateParamsService {
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
interface IStateParams {
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
interface IUrlRouterService {
|
||||
/*
|
||||
* Triggers an update; the same update that happens when the address bar
|
||||
* url changes, aka $locationChangeSuccess.
|
||||
*
|
||||
* This method is useful when you need to use preventDefault() on the
|
||||
* $locationChangeSuccess event, perform some custom logic (route protection,
|
||||
* auth, config, redirection, etc) and then finally proceed with the transition
|
||||
* by calling $urlRouter.sync().
|
||||
*
|
||||
*/
|
||||
sync(): void;
|
||||
}
|
||||
|
||||
interface IUiViewScrollProvider {
|
||||
/*
|
||||
* Reverts back to using the core $anchorScroll service for scrolling
|
||||
* based on the url anchor.
|
||||
*/
|
||||
useAnchorScroll(): void;
|
||||
}
|
||||
}
|
||||
23
www/lib/angular-ui-router/bower.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"name": "angular-ui-router",
|
||||
"version": "0.2.13",
|
||||
"main": "./release/angular-ui-router.js",
|
||||
"dependencies": {
|
||||
"angular": ">= 1.0.8"
|
||||
},
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"node_modules",
|
||||
"bower_components",
|
||||
"component.json",
|
||||
"package.json",
|
||||
"lib",
|
||||
"config",
|
||||
"sample",
|
||||
"test",
|
||||
"tests",
|
||||
"ngdoc_assets",
|
||||
"Gruntfile.js",
|
||||
"files.js"
|
||||
]
|
||||
}
|
||||
4232
www/lib/angular-ui-router/release/angular-ui-router.js
vendored
Normal file
7
www/lib/angular-ui-router/release/angular-ui-router.min.js
vendored
Normal file
292
www/lib/angular-ui-router/src/common.js
vendored
Normal file
@ -0,0 +1,292 @@
|
||||
/*jshint globalstrict:true*/
|
||||
/*global angular:false*/
|
||||
'use strict';
|
||||
|
||||
var isDefined = angular.isDefined,
|
||||
isFunction = angular.isFunction,
|
||||
isString = angular.isString,
|
||||
isObject = angular.isObject,
|
||||
isArray = angular.isArray,
|
||||
forEach = angular.forEach,
|
||||
extend = angular.extend,
|
||||
copy = angular.copy;
|
||||
|
||||
function inherit(parent, extra) {
|
||||
return extend(new (extend(function() {}, { prototype: parent }))(), extra);
|
||||
}
|
||||
|
||||
function merge(dst) {
|
||||
forEach(arguments, function(obj) {
|
||||
if (obj !== dst) {
|
||||
forEach(obj, function(value, key) {
|
||||
if (!dst.hasOwnProperty(key)) dst[key] = value;
|
||||
});
|
||||
}
|
||||
});
|
||||
return dst;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the common ancestor path between two states.
|
||||
*
|
||||
* @param {Object} first The first state.
|
||||
* @param {Object} second The second state.
|
||||
* @return {Array} Returns an array of state names in descending order, not including the root.
|
||||
*/
|
||||
function ancestors(first, second) {
|
||||
var path = [];
|
||||
|
||||
for (var n in first.path) {
|
||||
if (first.path[n] !== second.path[n]) break;
|
||||
path.push(first.path[n]);
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
/**
|
||||
* IE8-safe wrapper for `Object.keys()`.
|
||||
*
|
||||
* @param {Object} object A JavaScript object.
|
||||
* @return {Array} Returns the keys of the object as an array.
|
||||
*/
|
||||
function objectKeys(object) {
|
||||
if (Object.keys) {
|
||||
return Object.keys(object);
|
||||
}
|
||||
var result = [];
|
||||
|
||||
angular.forEach(object, function(val, key) {
|
||||
result.push(key);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* IE8-safe wrapper for `Array.prototype.indexOf()`.
|
||||
*
|
||||
* @param {Array} array A JavaScript array.
|
||||
* @param {*} value A value to search the array for.
|
||||
* @return {Number} Returns the array index value of `value`, or `-1` if not present.
|
||||
*/
|
||||
function indexOf(array, value) {
|
||||
if (Array.prototype.indexOf) {
|
||||
return array.indexOf(value, Number(arguments[2]) || 0);
|
||||
}
|
||||
var len = array.length >>> 0, from = Number(arguments[2]) || 0;
|
||||
from = (from < 0) ? Math.ceil(from) : Math.floor(from);
|
||||
|
||||
if (from < 0) from += len;
|
||||
|
||||
for (; from < len; from++) {
|
||||
if (from in array && array[from] === value) return from;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Merges a set of parameters with all parameters inherited between the common parents of the
|
||||
* current state and a given destination state.
|
||||
*
|
||||
* @param {Object} currentParams The value of the current state parameters ($stateParams).
|
||||
* @param {Object} newParams The set of parameters which will be composited with inherited params.
|
||||
* @param {Object} $current Internal definition of object representing the current state.
|
||||
* @param {Object} $to Internal definition of object representing state to transition to.
|
||||
*/
|
||||
function inheritParams(currentParams, newParams, $current, $to) {
|
||||
var parents = ancestors($current, $to), parentParams, inherited = {}, inheritList = [];
|
||||
|
||||
for (var i in parents) {
|
||||
if (!parents[i].params) continue;
|
||||
parentParams = objectKeys(parents[i].params);
|
||||
if (!parentParams.length) continue;
|
||||
|
||||
for (var j in parentParams) {
|
||||
if (indexOf(inheritList, parentParams[j]) >= 0) continue;
|
||||
inheritList.push(parentParams[j]);
|
||||
inherited[parentParams[j]] = currentParams[parentParams[j]];
|
||||
}
|
||||
}
|
||||
return extend({}, inherited, newParams);
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a non-strict comparison of the subset of two objects, defined by a list of keys.
|
||||
*
|
||||
* @param {Object} a The first object.
|
||||
* @param {Object} b The second object.
|
||||
* @param {Array} keys The list of keys within each object to compare. If the list is empty or not specified,
|
||||
* it defaults to the list of keys in `a`.
|
||||
* @return {Boolean} Returns `true` if the keys match, otherwise `false`.
|
||||
*/
|
||||
function equalForKeys(a, b, keys) {
|
||||
if (!keys) {
|
||||
keys = [];
|
||||
for (var n in a) keys.push(n); // Used instead of Object.keys() for IE8 compatibility
|
||||
}
|
||||
|
||||
for (var i=0; i<keys.length; i++) {
|
||||
var k = keys[i];
|
||||
if (a[k] != b[k]) return false; // Not '===', values aren't necessarily normalized
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the subset of an object, based on a list of keys.
|
||||
*
|
||||
* @param {Array} keys
|
||||
* @param {Object} values
|
||||
* @return {Boolean} Returns a subset of `values`.
|
||||
*/
|
||||
function filterByKeys(keys, values) {
|
||||
var filtered = {};
|
||||
|
||||
forEach(keys, function (name) {
|
||||
filtered[name] = values[name];
|
||||
});
|
||||
return filtered;
|
||||
}
|
||||
|
||||
// like _.indexBy
|
||||
// when you know that your index values will be unique, or you want last-one-in to win
|
||||
function indexBy(array, propName) {
|
||||
var result = {};
|
||||
forEach(array, function(item) {
|
||||
result[item[propName]] = item;
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
// extracted from underscore.js
|
||||
// Return a copy of the object only containing the whitelisted properties.
|
||||
function pick(obj) {
|
||||
var copy = {};
|
||||
var keys = Array.prototype.concat.apply(Array.prototype, Array.prototype.slice.call(arguments, 1));
|
||||
forEach(keys, function(key) {
|
||||
if (key in obj) copy[key] = obj[key];
|
||||
});
|
||||
return copy;
|
||||
}
|
||||
|
||||
// extracted from underscore.js
|
||||
// Return a copy of the object omitting the blacklisted properties.
|
||||
function omit(obj) {
|
||||
var copy = {};
|
||||
var keys = Array.prototype.concat.apply(Array.prototype, Array.prototype.slice.call(arguments, 1));
|
||||
for (var key in obj) {
|
||||
if (indexOf(keys, key) == -1) copy[key] = obj[key];
|
||||
}
|
||||
return copy;
|
||||
}
|
||||
|
||||
function pluck(collection, key) {
|
||||
var result = isArray(collection) ? [] : {};
|
||||
|
||||
forEach(collection, function(val, i) {
|
||||
result[i] = isFunction(key) ? key(val) : val[key];
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
function filter(collection, callback) {
|
||||
var array = isArray(collection);
|
||||
var result = array ? [] : {};
|
||||
forEach(collection, function(val, i) {
|
||||
if (callback(val, i)) {
|
||||
result[array ? result.length : i] = val;
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
function map(collection, callback) {
|
||||
var result = isArray(collection) ? [] : {};
|
||||
|
||||
forEach(collection, function(val, i) {
|
||||
result[i] = callback(val, i);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @ngdoc overview
|
||||
* @name ui.router.util
|
||||
*
|
||||
* @description
|
||||
* # ui.router.util sub-module
|
||||
*
|
||||
* This module is a dependency of other sub-modules. Do not include this module as a dependency
|
||||
* in your angular app (use {@link ui.router} module instead).
|
||||
*
|
||||
*/
|
||||
angular.module('ui.router.util', ['ng']);
|
||||
|
||||
/**
|
||||
* @ngdoc overview
|
||||
* @name ui.router.router
|
||||
*
|
||||
* @requires ui.router.util
|
||||
*
|
||||
* @description
|
||||
* # ui.router.router sub-module
|
||||
*
|
||||
* This module is a dependency of other sub-modules. Do not include this module as a dependency
|
||||
* in your angular app (use {@link ui.router} module instead).
|
||||
*/
|
||||
angular.module('ui.router.router', ['ui.router.util']);
|
||||
|
||||
/**
|
||||
* @ngdoc overview
|
||||
* @name ui.router.state
|
||||
*
|
||||
* @requires ui.router.router
|
||||
* @requires ui.router.util
|
||||
*
|
||||
* @description
|
||||
* # ui.router.state sub-module
|
||||
*
|
||||
* This module is a dependency of the main ui.router module. Do not include this module as a dependency
|
||||
* in your angular app (use {@link ui.router} module instead).
|
||||
*
|
||||
*/
|
||||
angular.module('ui.router.state', ['ui.router.router', 'ui.router.util']);
|
||||
|
||||
/**
|
||||
* @ngdoc overview
|
||||
* @name ui.router
|
||||
*
|
||||
* @requires ui.router.state
|
||||
*
|
||||
* @description
|
||||
* # ui.router
|
||||
*
|
||||
* ## The main module for ui.router
|
||||
* There are several sub-modules included with the ui.router module, however only this module is needed
|
||||
* as a dependency within your angular app. The other modules are for organization purposes.
|
||||
*
|
||||
* The modules are:
|
||||
* * ui.router - the main "umbrella" module
|
||||
* * ui.router.router -
|
||||
*
|
||||
* *You'll need to include **only** this module as the dependency within your angular app.*
|
||||
*
|
||||
* <pre>
|
||||
* <!doctype html>
|
||||
* <html ng-app="myApp">
|
||||
* <head>
|
||||
* <script src="js/angular.js"></script>
|
||||
* <!-- Include the ui-router script -->
|
||||
* <script src="js/angular-ui-router.min.js"></script>
|
||||
* <script>
|
||||
* // ...and add 'ui.router' as a dependency
|
||||
* var myApp = angular.module('myApp', ['ui.router']);
|
||||
* </script>
|
||||
* </head>
|
||||
* <body>
|
||||
* </body>
|
||||
* </html>
|
||||
* </pre>
|
||||
*/
|
||||
angular.module('ui.router', ['ui.router.state']);
|
||||
|
||||
angular.module('ui.router.compat', ['ui.router']);
|
||||
252
www/lib/angular-ui-router/src/resolve.js
vendored
Normal file
@ -0,0 +1,252 @@
|
||||
/**
|
||||
* @ngdoc object
|
||||
* @name ui.router.util.$resolve
|
||||
*
|
||||
* @requires $q
|
||||
* @requires $injector
|
||||
*
|
||||
* @description
|
||||
* Manages resolution of (acyclic) graphs of promises.
|
||||
*/
|
||||
$Resolve.$inject = ['$q', '$injector'];
|
||||
function $Resolve( $q, $injector) {
|
||||
|
||||
var VISIT_IN_PROGRESS = 1,
|
||||
VISIT_DONE = 2,
|
||||
NOTHING = {},
|
||||
NO_DEPENDENCIES = [],
|
||||
NO_LOCALS = NOTHING,
|
||||
NO_PARENT = extend($q.when(NOTHING), { $$promises: NOTHING, $$values: NOTHING });
|
||||
|
||||
|
||||
/**
|
||||
* @ngdoc function
|
||||
* @name ui.router.util.$resolve#study
|
||||
* @methodOf ui.router.util.$resolve
|
||||
*
|
||||
* @description
|
||||
* Studies a set of invocables that are likely to be used multiple times.
|
||||
* <pre>
|
||||
* $resolve.study(invocables)(locals, parent, self)
|
||||
* </pre>
|
||||
* is equivalent to
|
||||
* <pre>
|
||||
* $resolve.resolve(invocables, locals, parent, self)
|
||||
* </pre>
|
||||
* but the former is more efficient (in fact `resolve` just calls `study`
|
||||
* internally).
|
||||
*
|
||||
* @param {object} invocables Invocable objects
|
||||
* @return {function} a function to pass in locals, parent and self
|
||||
*/
|
||||
this.study = function (invocables) {
|
||||
if (!isObject(invocables)) throw new Error("'invocables' must be an object");
|
||||
var invocableKeys = objectKeys(invocables || {});
|
||||
|
||||
// Perform a topological sort of invocables to build an ordered plan
|
||||
var plan = [], cycle = [], visited = {};
|
||||
function visit(value, key) {
|
||||
if (visited[key] === VISIT_DONE) return;
|
||||
|
||||
cycle.push(key);
|
||||
if (visited[key] === VISIT_IN_PROGRESS) {
|
||||
cycle.splice(0, indexOf(cycle, key));
|
||||
throw new Error("Cyclic dependency: " + cycle.join(" -> "));
|
||||
}
|
||||
visited[key] = VISIT_IN_PROGRESS;
|
||||
|
||||
if (isString(value)) {
|
||||
plan.push(key, [ function() { return $injector.get(value); }], NO_DEPENDENCIES);
|
||||
} else {
|
||||
var params = $injector.annotate(value);
|
||||
forEach(params, function (param) {
|
||||
if (param !== key && invocables.hasOwnProperty(param)) visit(invocables[param], param);
|
||||
});
|
||||
plan.push(key, value, params);
|
||||
}
|
||||
|
||||
cycle.pop();
|
||||
visited[key] = VISIT_DONE;
|
||||
}
|
||||
forEach(invocables, visit);
|
||||
invocables = cycle = visited = null; // plan is all that's required
|
||||
|
||||
function isResolve(value) {
|
||||
return isObject(value) && value.then && value.$$promises;
|
||||
}
|
||||
|
||||
return function (locals, parent, self) {
|
||||
if (isResolve(locals) && self === undefined) {
|
||||
self = parent; parent = locals; locals = null;
|
||||
}
|
||||
if (!locals) locals = NO_LOCALS;
|
||||
else if (!isObject(locals)) {
|
||||
throw new Error("'locals' must be an object");
|
||||
}
|
||||
if (!parent) parent = NO_PARENT;
|
||||
else if (!isResolve(parent)) {
|
||||
throw new Error("'parent' must be a promise returned by $resolve.resolve()");
|
||||
}
|
||||
|
||||
// To complete the overall resolution, we have to wait for the parent
|
||||
// promise and for the promise for each invokable in our plan.
|
||||
var resolution = $q.defer(),
|
||||
result = resolution.promise,
|
||||
promises = result.$$promises = {},
|
||||
values = extend({}, locals),
|
||||
wait = 1 + plan.length/3,
|
||||
merged = false;
|
||||
|
||||
function done() {
|
||||
// Merge parent values we haven't got yet and publish our own $$values
|
||||
if (!--wait) {
|
||||
if (!merged) merge(values, parent.$$values);
|
||||
result.$$values = values;
|
||||
result.$$promises = result.$$promises || true; // keep for isResolve()
|
||||
delete result.$$inheritedValues;
|
||||
resolution.resolve(values);
|
||||
}
|
||||
}
|
||||
|
||||
function fail(reason) {
|
||||
result.$$failure = reason;
|
||||
resolution.reject(reason);
|
||||
}
|
||||
|
||||
// Short-circuit if parent has already failed
|
||||
if (isDefined(parent.$$failure)) {
|
||||
fail(parent.$$failure);
|
||||
return result;
|
||||
}
|
||||
|
||||
if (parent.$$inheritedValues) {
|
||||
merge(values, omit(parent.$$inheritedValues, invocableKeys));
|
||||
}
|
||||
|
||||
// Merge parent values if the parent has already resolved, or merge
|
||||
// parent promises and wait if the parent resolve is still in progress.
|
||||
extend(promises, parent.$$promises);
|
||||
if (parent.$$values) {
|
||||
merged = merge(values, omit(parent.$$values, invocableKeys));
|
||||
result.$$inheritedValues = omit(parent.$$values, invocableKeys);
|
||||
done();
|
||||
} else {
|
||||
if (parent.$$inheritedValues) {
|
||||
result.$$inheritedValues = omit(parent.$$inheritedValues, invocableKeys);
|
||||
}
|
||||
parent.then(done, fail);
|
||||
}
|
||||
|
||||
// Process each invocable in the plan, but ignore any where a local of the same name exists.
|
||||
for (var i=0, ii=plan.length; i<ii; i+=3) {
|
||||
if (locals.hasOwnProperty(plan[i])) done();
|
||||
else invoke(plan[i], plan[i+1], plan[i+2]);
|
||||
}
|
||||
|
||||
function invoke(key, invocable, params) {
|
||||
// Create a deferred for this invocation. Failures will propagate to the resolution as well.
|
||||
var invocation = $q.defer(), waitParams = 0;
|
||||
function onfailure(reason) {
|
||||
invocation.reject(reason);
|
||||
fail(reason);
|
||||
}
|
||||
// Wait for any parameter that we have a promise for (either from parent or from this
|
||||
// resolve; in that case study() will have made sure it's ordered before us in the plan).
|
||||
forEach(params, function (dep) {
|
||||
if (promises.hasOwnProperty(dep) && !locals.hasOwnProperty(dep)) {
|
||||
waitParams++;
|
||||
promises[dep].then(function (result) {
|
||||
values[dep] = result;
|
||||
if (!(--waitParams)) proceed();
|
||||
}, onfailure);
|
||||
}
|
||||
});
|
||||
if (!waitParams) proceed();
|
||||
function proceed() {
|
||||
if (isDefined(result.$$failure)) return;
|
||||
try {
|
||||
invocation.resolve($injector.invoke(invocable, self, values));
|
||||
invocation.promise.then(function (result) {
|
||||
values[key] = result;
|
||||
done();
|
||||
}, onfailure);
|
||||
} catch (e) {
|
||||
onfailure(e);
|
||||
}
|
||||
}
|
||||
// Publish promise synchronously; invocations further down in the plan may depend on it.
|
||||
promises[key] = invocation.promise;
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @ngdoc function
|
||||
* @name ui.router.util.$resolve#resolve
|
||||
* @methodOf ui.router.util.$resolve
|
||||
*
|
||||
* @description
|
||||
* Resolves a set of invocables. An invocable is a function to be invoked via
|
||||
* `$injector.invoke()`, and can have an arbitrary number of dependencies.
|
||||
* An invocable can either return a value directly,
|
||||
* or a `$q` promise. If a promise is returned it will be resolved and the
|
||||
* resulting value will be used instead. Dependencies of invocables are resolved
|
||||
* (in this order of precedence)
|
||||
*
|
||||
* - from the specified `locals`
|
||||
* - from another invocable that is part of this `$resolve` call
|
||||
* - from an invocable that is inherited from a `parent` call to `$resolve`
|
||||
* (or recursively
|
||||
* - from any ancestor `$resolve` of that parent).
|
||||
*
|
||||
* The return value of `$resolve` is a promise for an object that contains
|
||||
* (in this order of precedence)
|
||||
*
|
||||
* - any `locals` (if specified)
|
||||
* - the resolved return values of all injectables
|
||||
* - any values inherited from a `parent` call to `$resolve` (if specified)
|
||||
*
|
||||
* The promise will resolve after the `parent` promise (if any) and all promises
|
||||
* returned by injectables have been resolved. If any invocable
|
||||
* (or `$injector.invoke`) throws an exception, or if a promise returned by an
|
||||
* invocable is rejected, the `$resolve` promise is immediately rejected with the
|
||||
* same error. A rejection of a `parent` promise (if specified) will likewise be
|
||||
* propagated immediately. Once the `$resolve` promise has been rejected, no
|
||||
* further invocables will be called.
|
||||
*
|
||||
* Cyclic dependencies between invocables are not permitted and will caues `$resolve`
|
||||
* to throw an error. As a special case, an injectable can depend on a parameter
|
||||
* with the same name as the injectable, which will be fulfilled from the `parent`
|
||||
* injectable of the same name. This allows inherited values to be decorated.
|
||||
* Note that in this case any other injectable in the same `$resolve` with the same
|
||||
* dependency would see the decorated value, not the inherited value.
|
||||
*
|
||||
* Note that missing dependencies -- unlike cyclic dependencies -- will cause an
|
||||
* (asynchronous) rejection of the `$resolve` promise rather than a (synchronous)
|
||||
* exception.
|
||||
*
|
||||
* Invocables are invoked eagerly as soon as all dependencies are available.
|
||||
* This is true even for dependencies inherited from a `parent` call to `$resolve`.
|
||||
*
|
||||
* As a special case, an invocable can be a string, in which case it is taken to
|
||||
* be a service name to be passed to `$injector.get()`. This is supported primarily
|
||||
* for backwards-compatibility with the `resolve` property of `$routeProvider`
|
||||
* routes.
|
||||
*
|
||||
* @param {object} invocables functions to invoke or
|
||||
* `$injector` services to fetch.
|
||||
* @param {object} locals values to make available to the injectables
|
||||
* @param {object} parent a promise returned by another call to `$resolve`.
|
||||
* @param {object} self the `this` for the invoked methods
|
||||
* @return {object} Promise for an object that contains the resolved return value
|
||||
* of all invocables, as well as any inherited and local values.
|
||||
*/
|
||||
this.resolve = function (invocables, locals, parent, self) {
|
||||
return this.study(invocables)(locals, parent, self);
|
||||
};
|
||||
}
|
||||
|
||||
angular.module('ui.router.util').service('$resolve', $Resolve);
|
||||
|
||||