commit 991d6da530692f725ce33d46d3459856504f7610 Author: martind2000 Date: Thu Mar 17 08:20:54 2016 +0000 init diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c6cbe56 --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +*.iml +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build +/captures diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 0000000..d9a4a1e --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +TrainTimes \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..96cc43e --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..97626ba --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml new file mode 100644 index 0000000..8d2df47 --- /dev/null +++ b/.idea/gradle.xml @@ -0,0 +1,18 @@ + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..5d19981 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..808e001 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml new file mode 100644 index 0000000..7f68460 --- /dev/null +++ b/.idea/runConfigurations.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..6564d52 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/app/build.gradle b/app/build.gradle new file mode 100644 index 0000000..fc42b4a --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,26 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 23 + buildToolsVersion "23.0.1" + + defaultConfig { + applicationId "com.silvrtree.traintimes" + minSdkVersion 21 + targetSdkVersion 23 + versionCode 1 + versionName "1.0" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + compile fileTree(dir: 'libs', include: ['*.jar']) + testCompile 'junit:junit:4.12' + compile 'com.android.support:appcompat-v7:23.1.1' +} diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 0000000..c23cf02 --- /dev/null +++ b/app/proguard-rules.pro @@ -0,0 +1,17 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in C:\Users\marti\AppData\Local\Android\sdk/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the proguardFiles +# directive in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} diff --git a/app/src/androidTest/java/com/silvrtree/traintimes/ApplicationTest.java b/app/src/androidTest/java/com/silvrtree/traintimes/ApplicationTest.java new file mode 100644 index 0000000..5c9a9c1 --- /dev/null +++ b/app/src/androidTest/java/com/silvrtree/traintimes/ApplicationTest.java @@ -0,0 +1,13 @@ +package com.silvrtree.traintimes; + +import android.app.Application; +import android.test.ApplicationTestCase; + +/** + * Testing Fundamentals + */ +public class ApplicationTest extends ApplicationTestCase { + public ApplicationTest() { + super(Application.class); + } +} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..bd32127 --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + diff --git a/app/src/main/assets/assets/active_departure.png b/app/src/main/assets/assets/active_departure.png new file mode 100644 index 0000000..90ef02d Binary files /dev/null and b/app/src/main/assets/assets/active_departure.png differ diff --git a/app/src/main/assets/assets/active_stop.png b/app/src/main/assets/assets/active_stop.png new file mode 100644 index 0000000..942bd60 Binary files /dev/null and b/app/src/main/assets/assets/active_stop.png differ diff --git a/app/src/main/assets/assets/active_terminate.png b/app/src/main/assets/assets/active_terminate.png new file mode 100644 index 0000000..1cce342 Binary files /dev/null and b/app/src/main/assets/assets/active_terminate.png differ diff --git a/app/src/main/assets/assets/fm-old.png b/app/src/main/assets/assets/fm-old.png new file mode 100644 index 0000000..f77b34d Binary files /dev/null and b/app/src/main/assets/assets/fm-old.png differ diff --git a/app/src/main/assets/assets/fm.png b/app/src/main/assets/assets/fm.png new file mode 100644 index 0000000..bab0ee2 Binary files /dev/null and b/app/src/main/assets/assets/fm.png differ diff --git a/app/src/main/assets/assets/previous_departure.png b/app/src/main/assets/assets/previous_departure.png new file mode 100644 index 0000000..7e5452b Binary files /dev/null and b/app/src/main/assets/assets/previous_departure.png differ diff --git a/app/src/main/assets/assets/previous_stop.png b/app/src/main/assets/assets/previous_stop.png new file mode 100644 index 0000000..8d7cbcd Binary files /dev/null and b/app/src/main/assets/assets/previous_stop.png differ diff --git a/app/src/main/assets/assets/previous_terminate.png b/app/src/main/assets/assets/previous_terminate.png new file mode 100644 index 0000000..25f9cbe Binary files /dev/null and b/app/src/main/assets/assets/previous_terminate.png differ diff --git a/app/src/main/assets/assets/tf_small_pale.png b/app/src/main/assets/assets/tf_small_pale.png new file mode 100644 index 0000000..3233080 Binary files /dev/null and b/app/src/main/assets/assets/tf_small_pale.png differ diff --git a/app/src/main/assets/css/normalize-min.css b/app/src/main/assets/css/normalize-min.css new file mode 100644 index 0000000..2b0030b --- /dev/null +++ b/app/src/main/assets/css/normalize-min.css @@ -0,0 +1,76 @@ +html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;} +body{margin:0;} +article, +aside, +details, +figcaption, +figure, +footer, +header, +hgroup, +main, +menu, +nav, +section, +summary{display:block;} +audio, +canvas, +progress, +video{display:inline-block;vertical-align:baseline;} +audio:not([controls]){display:none;height:0;} +[hidden], +template{display:none;} +a{background-color:transparent;} +a:active, +a:hover{outline:0;} +abbr[title]{border-bottom:1px dotted;} +b, +strong{font-weight:bold;} +dfn{font-style:italic;} +h1{font-size:2em;margin:0.67em 0;} +mark{background:#ff0;color:#000;} +small{font-size:80%;} +sub, +sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline;} +sup{top:-0.5em;} +sub{bottom:-0.25em;} +img{border:0;} +svg:not(:root){overflow:hidden;} +figure{margin:1em 40px;} +hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0;} +pre{overflow:auto;} +code, +kbd, +pre, +samp{font-family:monospace, monospace;font-size:1em;} +button, +input, +optgroup, +select, +textarea{color:inherit;font:inherit;margin:0;} +button{overflow:visible;} +button, +select{text-transform:none;} +button, +html input[type="button"], +input[type="reset"], +input[type="submit"]{-webkit-appearance:button;cursor:pointer;} +button[disabled], +html input[disabled]{cursor:default;} +button::-moz-focus-inner, +input::-moz-focus-inner{border:0;padding:0;} +input{line-height:normal;} +input[type="checkbox"], +input[type="radio"]{box-sizing:border-box;padding:0;} +input[type="number"]::-webkit-inner-spin-button, +input[type="number"]::-webkit-outer-spin-button{height:auto;} +input[type="search"]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box;} +input[type="search"]::-webkit-search-cancel-button, +input[type="search"]::-webkit-search-decoration{-webkit-appearance:none;} +fieldset{border:1px solid #c0c0c0;margin:0 2px;padding:0.35em 0.625em 0.75em;} +legend{border:0;padding:0;} +textarea{overflow:auto;} +optgroup{font-weight:bold;} +table{border-collapse:collapse;border-spacing:0;} +td, +th{padding:0;} diff --git a/app/src/main/assets/css/normalize.css b/app/src/main/assets/css/normalize.css new file mode 100644 index 0000000..458eea1 --- /dev/null +++ b/app/src/main/assets/css/normalize.css @@ -0,0 +1,427 @@ +/*! normalize.css v3.0.2 | MIT License | git.io/normalize */ + +/** + * 1. Set default font family to sans-serif. + * 2. Prevent iOS text size adjust after orientation change, without disabling + * user zoom. + */ + +html { + font-family: sans-serif; /* 1 */ + -ms-text-size-adjust: 100%; /* 2 */ + -webkit-text-size-adjust: 100%; /* 2 */ +} + +/** + * Remove default margin. + */ + +body { + margin: 0; +} + +/* HTML5 display definitions + ========================================================================== */ + +/** + * Correct `block` display not defined for any HTML5 element in IE 8/9. + * Correct `block` display not defined for `details` or `summary` in IE 10/11 + * and Firefox. + * Correct `block` display not defined for `main` in IE 11. + */ + +article, +aside, +details, +figcaption, +figure, +footer, +header, +hgroup, +main, +menu, +nav, +section, +summary { + display: block; +} + +/** + * 1. Correct `inline-block` display not defined in IE 8/9. + * 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera. + */ + +audio, +canvas, +progress, +video { + display: inline-block; /* 1 */ + vertical-align: baseline; /* 2 */ +} + +/** + * Prevent modern browsers from displaying `audio` without controls. + * Remove excess height in iOS 5 devices. + */ + +audio:not([controls]) { + display: none; + height: 0; +} + +/** + * Address `[hidden]` styling not present in IE 8/9/10. + * Hide the `template` element in IE 8/9/11, Safari, and Firefox < 22. + */ + +[hidden], +template { + display: none; +} + +/* Links + ========================================================================== */ + +/** + * Remove the gray background color from active links in IE 10. + */ + +a { + background-color: transparent; +} + +/** + * Improve readability when focused and also mouse hovered in all browsers. + */ + +a:active, +a:hover { + outline: 0; +} + +/* Text-level semantics + ========================================================================== */ + +/** + * Address styling not present in IE 8/9/10/11, Safari, and Chrome. + */ + +abbr[title] { + border-bottom: 1px dotted; +} + +/** + * Address style set to `bolder` in Firefox 4+, Safari, and Chrome. + */ + +b, +strong { + font-weight: bold; +} + +/** + * Address styling not present in Safari and Chrome. + */ + +dfn { + font-style: italic; +} + +/** + * Address variable `h1` font-size and margin within `section` and `article` + * contexts in Firefox 4+, Safari, and Chrome. + */ + +h1 { + font-size: 2em; + margin: 0.67em 0; +} + +/** + * Address styling not present in IE 8/9. + */ + +mark { + background: #ff0; + color: #000; +} + +/** + * Address inconsistent and variable font size in all browsers. + */ + +small { + font-size: 80%; +} + +/** + * Prevent `sub` and `sup` affecting `line-height` in all browsers. + */ + +sub, +sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; +} + +sup { + top: -0.5em; +} + +sub { + bottom: -0.25em; +} + +/* Embedded content + ========================================================================== */ + +/** + * Remove border when inside `a` element in IE 8/9/10. + */ + +img { + border: 0; +} + +/** + * Correct overflow not hidden in IE 9/10/11. + */ + +svg:not(:root) { + overflow: hidden; +} + +/* Grouping content + ========================================================================== */ + +/** + * Address margin not present in IE 8/9 and Safari. + */ + +figure { + margin: 1em 40px; +} + +/** + * Address differences between Firefox and other browsers. + */ + +hr { + -moz-box-sizing: content-box; + box-sizing: content-box; + height: 0; +} + +/** + * Contain overflow in all browsers. + */ + +pre { + overflow: auto; +} + +/** + * Address odd `em`-unit font size rendering in all browsers. + */ + +code, +kbd, +pre, +samp { + font-family: monospace, monospace; + font-size: 1em; +} + +/* Forms + ========================================================================== */ + +/** + * Known limitation: by default, Chrome and Safari on OS X allow very limited + * styling of `select`, unless a `border` property is set. + */ + +/** + * 1. Correct color not being inherited. + * Known issue: affects color of disabled elements. + * 2. Correct font properties not being inherited. + * 3. Address margins set differently in Firefox 4+, Safari, and Chrome. + */ + +button, +input, +optgroup, +select, +textarea { + color: inherit; /* 1 */ + font: inherit; /* 2 */ + margin: 0; /* 3 */ +} + +/** + * Address `overflow` set to `hidden` in IE 8/9/10/11. + */ + +button { + overflow: visible; +} + +/** + * Address inconsistent `text-transform` inheritance for `button` and `select`. + * All other form control elements do not inherit `text-transform` values. + * Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera. + * Correct `select` style inheritance in Firefox. + */ + +button, +select { + text-transform: none; +} + +/** + * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio` + * and `video` controls. + * 2. Correct inability to style clickable `input` types in iOS. + * 3. Improve usability and consistency of cursor style between image-type + * `input` and others. + */ + +button, +html input[type="button"], /* 1 */ +input[type="reset"], +input[type="submit"] { + -webkit-appearance: button; /* 2 */ + cursor: pointer; /* 3 */ +} + +/** + * Re-set default cursor for disabled elements. + */ + +button[disabled], +html input[disabled] { + cursor: default; +} + +/** + * Remove inner padding and border in Firefox 4+. + */ + +button::-moz-focus-inner, +input::-moz-focus-inner { + border: 0; + padding: 0; +} + +/** + * Address Firefox 4+ setting `line-height` on `input` using `!important` in + * the UA stylesheet. + */ + +input { + line-height: normal; +} + +/** + * It's recommended that you don't attempt to style these elements. + * Firefox's implementation doesn't respect box-sizing, padding, or width. + * + * 1. Address box sizing set to `content-box` in IE 8/9/10. + * 2. Remove excess padding in IE 8/9/10. + */ + +input[type="checkbox"], +input[type="radio"] { + box-sizing: border-box; /* 1 */ + padding: 0; /* 2 */ +} + +/** + * Fix the cursor style for Chrome's increment/decrement buttons. For certain + * `font-size` values of the `input`, it causes the cursor style of the + * decrement button to change from `default` to `text`. + */ + +input[type="number"]::-webkit-inner-spin-button, +input[type="number"]::-webkit-outer-spin-button { + height: auto; +} + +/** + * 1. Address `appearance` set to `searchfield` in Safari and Chrome. + * 2. Address `box-sizing` set to `border-box` in Safari and Chrome + * (include `-moz` to future-proof). + */ + +input[type="search"] { + -webkit-appearance: textfield; /* 1 */ + -moz-box-sizing: content-box; + -webkit-box-sizing: content-box; /* 2 */ + box-sizing: content-box; +} + +/** + * Remove inner padding and search cancel button in Safari and Chrome on OS X. + * Safari (but not Chrome) clips the cancel button when the search input has + * padding (and `textfield` appearance). + */ + +input[type="search"]::-webkit-search-cancel-button, +input[type="search"]::-webkit-search-decoration { + -webkit-appearance: none; +} + +/** + * Define consistent border, margin, and padding. + */ + +fieldset { + border: 1px solid #c0c0c0; + margin: 0 2px; + padding: 0.35em 0.625em 0.75em; +} + +/** + * 1. Correct `color` not being inherited in IE 8/9/10/11. + * 2. Remove padding so people aren't caught out if they zero out fieldsets. + */ + +legend { + border: 0; /* 1 */ + padding: 0; /* 2 */ +} + +/** + * Remove default vertical scrollbar in IE 8/9/10/11. + */ + +textarea { + overflow: auto; +} + +/** + * Don't inherit the `font-weight` (applied by a rule above). + * NOTE: the default cannot safely be changed in Chrome and Safari on OS X. + */ + +optgroup { + font-weight: bold; +} + +/* Tables + ========================================================================== */ + +/** + * Remove most spacing between table cells. + */ + +table { + border-collapse: collapse; + border-spacing: 0; +} + +td, +th { + padding: 0; +} diff --git a/app/src/main/assets/css/skeleton-min.css b/app/src/main/assets/css/skeleton-min.css new file mode 100644 index 0000000..149307f --- /dev/null +++ b/app/src/main/assets/css/skeleton-min.css @@ -0,0 +1,181 @@ +.container{position:relative;width:100%;max-width:960px;margin:0 auto;padding:0 20px;box-sizing:border-box;} +.column, +.columns{width:100%;float:left;box-sizing:border-box;} +@media (min-width:400px){.container{width:85%;padding:0;} +} +@media (min-width:550px){.container{width:80%;} +.column, +.columns{margin-left:4%;} +.column:first-child, +.columns:first-child{margin-left:0;} +.one.column, +.one.columns{width:4.66666666667%;} +.two.columns{width:13.3333333333%;} +.three.columns{width:22%;} +.four.columns{width:30.6666666667%;} +.five.columns{width:39.3333333333%;} +.six.columns{width:48%;} +.seven.columns{width:56.6666666667%;} +.eight.columns{width:65.3333333333%;} +.nine.columns{width:74.0%;} +.ten.columns{width:82.6666666667%;} +.eleven.columns{width:91.3333333333%;} +.twelve.columns{width:100%;margin-left:0;} +.one-third.column{width:30.6666666667%;} +.two-thirds.column{width:65.3333333333%;} +.one-half.column{width:48%;} +.offset-by-one.column, +.offset-by-one.columns{margin-left:8.66666666667%;} +.offset-by-two.column, +.offset-by-two.columns{margin-left:17.3333333333%;} +.offset-by-three.column, +.offset-by-three.columns{margin-left:26%;} +.offset-by-four.column, +.offset-by-four.columns{margin-left:34.6666666667%;} +.offset-by-five.column, +.offset-by-five.columns{margin-left:43.3333333333%;} +.offset-by-six.column, +.offset-by-six.columns{margin-left:52%;} +.offset-by-seven.column, +.offset-by-seven.columns{margin-left:60.6666666667%;} +.offset-by-eight.column, +.offset-by-eight.columns{margin-left:69.3333333333%;} +.offset-by-nine.column, +.offset-by-nine.columns{margin-left:78.0%;} +.offset-by-ten.column, +.offset-by-ten.columns{margin-left:86.6666666667%;} +.offset-by-eleven.column, +.offset-by-eleven.columns{margin-left:95.3333333333%;} +.offset-by-one-third.column, +.offset-by-one-third.columns{margin-left:34.6666666667%;} +.offset-by-two-thirds.column, +.offset-by-two-thirds.columns{margin-left:69.3333333333%;} +.offset-by-one-half.column, +.offset-by-one-half.columns{margin-left:52%;} +} +html{font-size:62.5%;} +body{font-size:1.5em;line-height:1.6;font-weight:400;font-family:"Raleway", "HelveticaNeue", "Helvetica Neue", Helvetica, Arial, sans-serif;color:#222;} +h1, h2, h3, h4, h5, h6{margin-top:0;margin-bottom:2rem;font-weight:300;} +h1{font-size:4.0rem;line-height:1.2;letter-spacing:-.1rem;} +h2{font-size:3.6rem;line-height:1.25;letter-spacing:-.1rem;} +h3{font-size:3.0rem;line-height:1.3;letter-spacing:-.1rem;} +h4{font-size:2.4rem;line-height:1.35;letter-spacing:-.08rem;} +h5{font-size:1.8rem;line-height:1.5;letter-spacing:-.05rem;} +h6{font-size:1.5rem;line-height:1.6;letter-spacing:0;} +@media (min-width:550px){h1{font-size:5.0rem;} +h2{font-size:4.2rem;} +h3{font-size:3.6rem;} +h4{font-size:3.0rem;} +h5{font-size:2.4rem;} +h6{font-size:1.5rem;} +} +p{margin-top:0;} +a{color:#1EAEDB;} +a:hover{color:#0FA0CE;} +.button, +button, +input[type="submit"], +input[type="reset"], +input[type="button"]{display:inline-block;height:38px;padding:0 30px;color:#555;text-align:center;font-size:11px;font-weight:600;line-height:38px;letter-spacing:.1rem;text-transform:uppercase;text-decoration:none;white-space:nowrap;background-color:transparent;border-radius:4px;border:1px solid #bbb;cursor:pointer;box-sizing:border-box;} +.button:hover, +button:hover, +input[type="submit"]:hover, +input[type="reset"]:hover, +input[type="button"]:hover, +.button:focus, +button:focus, +input[type="submit"]:focus, +input[type="reset"]:focus, +input[type="button"]:focus{color:#333;border-color:#888;outline:0;} +.button.button-primary, +button.button-primary, +input[type="submit"].button-primary, +input[type="reset"].button-primary, +input[type="button"].button-primary{color:#FFF;background-color:#33C3F0;border-color:#33C3F0;} +.button.button-primary:hover, +button.button-primary:hover, +input[type="submit"].button-primary:hover, +input[type="reset"].button-primary:hover, +input[type="button"].button-primary:hover, +.button.button-primary:focus, +button.button-primary:focus, +input[type="submit"].button-primary:focus, +input[type="reset"].button-primary:focus, +input[type="button"].button-primary:focus{color:#FFF;background-color:#1EAEDB;border-color:#1EAEDB;} +input[type="email"], +input[type="number"], +input[type="search"], +input[type="text"], +input[type="tel"], +input[type="url"], +input[type="password"], +textarea, +select{height:38px;padding:6px 10px;background-color:#fff;border:1px solid #D1D1D1;border-radius:4px;box-shadow:none;box-sizing:border-box;} +input[type="email"], +input[type="number"], +input[type="search"], +input[type="text"], +input[type="tel"], +input[type="url"], +input[type="password"], +textarea{-webkit-appearance:none;-moz-appearance:none;appearance:none;} +textarea{min-height:65px;padding-top:6px;padding-bottom:6px;} +input[type="email"]:focus, +input[type="number"]:focus, +input[type="search"]:focus, +input[type="text"]:focus, +input[type="tel"]:focus, +input[type="url"]:focus, +input[type="password"]:focus, +textarea:focus, +select:focus{border:1px solid #33C3F0;outline:0;} +label, +legend{display:block;margin-bottom:.5rem;font-weight:600;} +fieldset{padding:0;border-width:0;} +input[type="checkbox"], +input[type="radio"]{display:inline;} +label > .label-body{display:inline-block;margin-left:.5rem;font-weight:normal;} +ul{list-style:circle inside;} +ol{list-style:decimal inside;} +ol, ul{padding-left:0;margin-top:0;} +ul ul, +ul ol, +ol ol, +ol ul{margin:1.5rem 0 1.7rem 3rem;font-size:90%;} +li{margin-bottom:1rem;} +code{padding:.2rem .5rem;margin:0 .2rem;font-size:90%;white-space:nowrap;background:#F1F1F1;border:1px solid #E1E1E1;border-radius:4px;} +pre > code{display:block;padding:1rem 1.5rem;white-space:pre;} +th, +td{padding:12px 15px;text-align:left;border-bottom:1px solid #E1E1E1;} +th:first-child, +td:first-child{padding-left:0;} +th:last-child, +td:last-child{padding-right:0;} +button, +.button{margin-bottom:1rem;} +input, +textarea, +select, +fieldset{margin-bottom:1.5rem;} +pre, +blockquote, +dl, +figure, +table, +p, +ul, +ol, +form{margin-bottom:2.5rem;} +.u-full-width{width:100%;box-sizing:border-box;} +.u-max-full-width{max-width:100%;box-sizing:border-box;} +.u-pull-right{float:right;} +.u-pull-left{float:left;} +hr{margin-top:3rem;margin-bottom:3.5rem;border-width:0;border-top:1px solid #E1E1E1;} +.container:after, +.row:after, +.u-cf{content:"";display:table;clear:both;} +@media (min-width:400px){} +@media (min-width:550px){} +@media (min-width:750px){} +@media (min-width:1000px){} +@media (min-width:1200px){} diff --git a/app/src/main/assets/css/skeleton.css b/app/src/main/assets/css/skeleton.css new file mode 100644 index 0000000..6e0819d --- /dev/null +++ b/app/src/main/assets/css/skeleton.css @@ -0,0 +1,418 @@ +/* +* Skeleton V2.0.4 +* Copyright 2014, Dave Gamache +* www.getskeleton.com +* Free to use under the MIT license. +* http://www.opensource.org/licenses/mit-license.php +* 12/29/2014 +*/ + + +/* Table of contents +–––––––––––––––––––––––––––––––––––––––––––––––––– +- Grid +- Base Styles +- Typography +- Links +- Buttons +- Forms +- Lists +- Code +- Tables +- Spacing +- Utilities +- Clearing +- Media Queries +*/ + + +/* Grid +–––––––––––––––––––––––––––––––––––––––––––––––––– */ +.container { + position: relative; + width: 100%; + max-width: 960px; + margin: 0 auto; + padding: 0 20px; + box-sizing: border-box; } +.column, +.columns { + width: 100%; + float: left; + box-sizing: border-box; } + +/* For devices larger than 400px */ +@media (min-width: 400px) { + .container { + width: 85%; + padding: 0; } +} + +/* For devices larger than 550px */ +@media (min-width: 550px) { + .container { + width: 80%; } + .column, + .columns { + margin-left: 4%; } + .column:first-child, + .columns:first-child { + margin-left: 0; } + + .one.column, + .one.columns { width: 4.66666666667%; } + .two.columns { width: 13.3333333333%; } + .three.columns { width: 22%; } + .four.columns { width: 30.6666666667%; } + .five.columns { width: 39.3333333333%; } + .six.columns { width: 48%; } + .seven.columns { width: 56.6666666667%; } + .eight.columns { width: 65.3333333333%; } + .nine.columns { width: 74.0%; } + .ten.columns { width: 82.6666666667%; } + .eleven.columns { width: 91.3333333333%; } + .twelve.columns { width: 100%; margin-left: 0; } + + .one-third.column { width: 30.6666666667%; } + .two-thirds.column { width: 65.3333333333%; } + + .one-half.column { width: 48%; } + + /* Offsets */ + .offset-by-one.column, + .offset-by-one.columns { margin-left: 8.66666666667%; } + .offset-by-two.column, + .offset-by-two.columns { margin-left: 17.3333333333%; } + .offset-by-three.column, + .offset-by-three.columns { margin-left: 26%; } + .offset-by-four.column, + .offset-by-four.columns { margin-left: 34.6666666667%; } + .offset-by-five.column, + .offset-by-five.columns { margin-left: 43.3333333333%; } + .offset-by-six.column, + .offset-by-six.columns { margin-left: 52%; } + .offset-by-seven.column, + .offset-by-seven.columns { margin-left: 60.6666666667%; } + .offset-by-eight.column, + .offset-by-eight.columns { margin-left: 69.3333333333%; } + .offset-by-nine.column, + .offset-by-nine.columns { margin-left: 78.0%; } + .offset-by-ten.column, + .offset-by-ten.columns { margin-left: 86.6666666667%; } + .offset-by-eleven.column, + .offset-by-eleven.columns { margin-left: 95.3333333333%; } + + .offset-by-one-third.column, + .offset-by-one-third.columns { margin-left: 34.6666666667%; } + .offset-by-two-thirds.column, + .offset-by-two-thirds.columns { margin-left: 69.3333333333%; } + + .offset-by-one-half.column, + .offset-by-one-half.columns { margin-left: 52%; } + +} + + +/* Base Styles +–––––––––––––––––––––––––––––––––––––––––––––––––– */ +/* NOTE +html is set to 62.5% so that all the REM measurements throughout Skeleton +are based on 10px sizing. So basically 1.5rem = 15px :) */ +html { + font-size: 62.5%; } +body { + font-size: 1.5em; /* currently ems cause chrome bug misinterpreting rems on body element */ + line-height: 1.6; + font-weight: 400; + font-family: 'Roboto Slab', "HelveticaNeue", "Helvetica Neue", Helvetica, Arial, sans-serif; + color: #222; } + + +/* Typography +–––––––––––––––––––––––––––––––––––––––––––––––––– */ +h1, h2, h3, h4, h5, h6 { + margin-top: 0; + margin-bottom: 2rem; + font-weight: 300; } +h1 { font-size: 4.0rem; line-height: 1.2; letter-spacing: -.1rem;} +h2 { font-size: 3.6rem; line-height: 1.25; letter-spacing: -.1rem; } +h3 { font-size: 3.0rem; line-height: 1.3; letter-spacing: -.1rem; } +h4 { font-size: 2.4rem; line-height: 1.35; letter-spacing: -.08rem; } +h5 { font-size: 1.8rem; line-height: 1.5; letter-spacing: -.05rem; } +h6 { font-size: 1.5rem; line-height: 1.6; letter-spacing: 0; } + +/* Larger than phablet */ +@media (min-width: 550px) { + h1 { font-size: 5.0rem; } + h2 { font-size: 4.2rem; } + h3 { font-size: 3.6rem; } + h4 { font-size: 3.0rem; } + h5 { font-size: 2.4rem; } + h6 { font-size: 1.5rem; } +} + +p { + margin-top: 0; } + + +/* Links +–––––––––––––––––––––––––––––––––––––––––––––––––– */ +a { + color: #1EAEDB; } +a:hover { + color: #0FA0CE; } + + +/* Buttons +–––––––––––––––––––––––––––––––––––––––––––––––––– */ +.button, +button, +input[type="submit"], +input[type="reset"], +input[type="button"] { + display: inline-block; + height: 38px; + padding: 0 30px; + color: #555; + text-align: center; + font-size: 11px; + font-weight: 600; + line-height: 38px; + letter-spacing: .1rem; + text-transform: uppercase; + text-decoration: none; + white-space: nowrap; + background-color: transparent; + border-radius: 4px; + border: 1px solid #bbb; + cursor: pointer; + box-sizing: border-box; } +.button:hover, +button:hover, +input[type="submit"]:hover, +input[type="reset"]:hover, +input[type="button"]:hover, +.button:focus, +button:focus, +input[type="submit"]:focus, +input[type="reset"]:focus, +input[type="button"]:focus { + color: #333; + border-color: #888; + outline: 0; } +.button.button-primary, +button.button-primary, +input[type="submit"].button-primary, +input[type="reset"].button-primary, +input[type="button"].button-primary { + color: #FFF; + background-color: #33C3F0; + border-color: #33C3F0; } +.button.button-primary:hover, +button.button-primary:hover, +input[type="submit"].button-primary:hover, +input[type="reset"].button-primary:hover, +input[type="button"].button-primary:hover, +.button.button-primary:focus, +button.button-primary:focus, +input[type="submit"].button-primary:focus, +input[type="reset"].button-primary:focus, +input[type="button"].button-primary:focus { + color: #FFF; + background-color: #1EAEDB; + border-color: #1EAEDB; } + + +/* Forms +–––––––––––––––––––––––––––––––––––––––––––––––––– */ +input[type="email"], +input[type="number"], +input[type="search"], +input[type="text"], +input[type="tel"], +input[type="url"], +input[type="password"], +textarea, +select { + height: 38px; + padding: 6px 10px; /* The 6px vertically centers text on FF, ignored by Webkit */ + background-color: #fff; + border: 1px solid #D1D1D1; + border-radius: 4px; + box-shadow: none; + box-sizing: border-box; } +/* Removes awkward default styles on some inputs for iOS */ +input[type="email"], +input[type="number"], +input[type="search"], +input[type="text"], +input[type="tel"], +input[type="url"], +input[type="password"], +textarea { + -webkit-appearance: none; + -moz-appearance: none; + appearance: none; } +textarea { + min-height: 65px; + padding-top: 6px; + padding-bottom: 6px; } +input[type="email"]:focus, +input[type="number"]:focus, +input[type="search"]:focus, +input[type="text"]:focus, +input[type="tel"]:focus, +input[type="url"]:focus, +input[type="password"]:focus, +textarea:focus, +select:focus { + border: 1px solid #33C3F0; + outline: 0; } +label, +legend { + display: block; + margin-bottom: .5rem; + font-weight: 600; } +fieldset { + padding: 0; + border-width: 0; } +input[type="checkbox"], +input[type="radio"] { + display: inline; } +label > .label-body { + display: inline-block; + margin-left: .5rem; + font-weight: normal; } + + +/* Lists +–––––––––––––––––––––––––––––––––––––––––––––––––– */ +ul { + list-style: circle inside; } +ol { + list-style: decimal inside; } +ol, ul { + padding-left: 0; + margin-top: 0; } +ul ul, +ul ol, +ol ol, +ol ul { + margin: 1.5rem 0 1.5rem 3rem; + font-size: 90%; } +li { + margin-bottom: 1rem; } + + +/* Code +–––––––––––––––––––––––––––––––––––––––––––––––––– */ +code { + padding: .2rem .5rem; + margin: 0 .2rem; + font-size: 90%; + white-space: nowrap; + background: #F1F1F1; + border: 1px solid #E1E1E1; + border-radius: 4px; } +pre > code { + display: block; + padding: 1rem 1.5rem; + white-space: pre; } + + +/* Tables +–––––––––––––––––––––––––––––––––––––––––––––––––– */ +th, +td { + padding: 12px 15px; + text-align: left; + border-bottom: 1px solid #E1E1E1; } +th:first-child, +td:first-child { + padding-left: 0; } +th:last-child, +td:last-child { + padding-right: 0; } + + +/* Spacing +–––––––––––––––––––––––––––––––––––––––––––––––––– */ +button, +.button { + margin-bottom: 1rem; } +input, +textarea, +select, +fieldset { + margin-bottom: 1.5rem; } +pre, +blockquote, +dl, +figure, +table, +p, +ul, +ol, +form { + margin-bottom: 2.5rem; } + + +/* Utilities +–––––––––––––––––––––––––––––––––––––––––––––––––– */ +.u-full-width { + width: 100%; + box-sizing: border-box; } +.u-max-full-width { + max-width: 100%; + box-sizing: border-box; } +.u-pull-right { + float: right; } +.u-pull-left { + float: left; } + + +/* Misc +–––––––––––––––––––––––––––––––––––––––––––––––––– */ +hr { + margin-top: 3rem; + margin-bottom: 3.5rem; + border-width: 0; + border-top: 1px solid #E1E1E1; } + + +/* Clearing +–––––––––––––––––––––––––––––––––––––––––––––––––– */ + +/* Self Clearing Goodness */ +.container:after, +.row:after, +.u-cf { + content: ""; + display: table; + clear: both; } + + +/* Media Queries +–––––––––––––––––––––––––––––––––––––––––––––––––– */ +/* +Note: The best way to structure the use of media queries is to create the queries +near the relevant code. For example, if you wanted to change the styles for buttons +on small devices, paste the mobile query code up in the buttons section and style it +there. +*/ + + +/* Larger than mobile */ +@media (min-width: 400px) {} + +/* Larger than phablet (also point when grid becomes active) */ +@media (min-width: 550px) {} + +/* Larger than tablet */ +@media (min-width: 750px) {} + +/* Larger than desktop */ +@media (min-width: 1000px) {} + +/* Larger than Desktop HD */ +@media (min-width: 1200px) {} diff --git a/app/src/main/assets/ejs/propertrains.ejs b/app/src/main/assets/ejs/propertrains.ejs new file mode 100644 index 0000000..1c6b2c2 --- /dev/null +++ b/app/src/main/assets/ejs/propertrains.ejs @@ -0,0 +1,17 @@ +
<%=locationName%> TO <%=filterLocationName%>
+ + + + + + +<% trainServices.forEach(function (item) { %> + + + + + + + <% }) %> + +
DestinationTimeStatusPlatform
<%=item.destination[0].locationName%><%=item.sta%><%=item.eta%><%=item.platform%>
diff --git a/app/src/main/assets/ejs/routes.ejs b/app/src/main/assets/ejs/routes.ejs new file mode 100644 index 0000000..3313aad --- /dev/null +++ b/app/src/main/assets/ejs/routes.ejs @@ -0,0 +1,22 @@ +<%=locationName%> + + +<% if (previousCallingPoints !== null) { +previousCallingPoints[0].callingPoint.forEach(function (item) { %> + + + + + <% })}; %> + + + + +<% if (subsequentCallingPoints !== null) { +subsequentCallingPoints[0].callingPoint.forEach(function (item) { %> + + + + + <% })}; %> +
<%=item.locationName%>
<%=locationName%>
<%=item.locationName%>
\ No newline at end of file diff --git a/app/src/main/assets/ejs/trains.ejs b/app/src/main/assets/ejs/trains.ejs new file mode 100644 index 0000000..20dc790 --- /dev/null +++ b/app/src/main/assets/ejs/trains.ejs @@ -0,0 +1,18 @@ +
<%=locationName%> TO <%=filterLocationName%>
+ + + + + + +<% if (trainServices !== null) { +trainServices.forEach(function (item) { %> + + + + + + + <% })}; %> + +
DestinationTimeStatusPlatform
<%=item.destination[0].locationName%><%=item.sta%><%=item.eta%><%=item.platform%>
diff --git a/app/src/main/assets/feeds.html b/app/src/main/assets/feeds.html new file mode 100644 index 0000000..7eda06b --- /dev/null +++ b/app/src/main/assets/feeds.html @@ -0,0 +1,93 @@ + + + + + + Feedmaster + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
StationTime
Paisley GS to Glasgow Central-- : --
Glasgow Central to Partick-- : --
Partick to Dumbarton Central-- : --
Glasgow Queen St to Dumbarton Central-- : --
+
+
+ +
+
+ + + + + + + + + diff --git a/app/src/main/assets/js/app.prod.js b/app/src/main/assets/js/app.prod.js new file mode 100644 index 0000000..dcec31a --- /dev/null +++ b/app/src/main/assets/js/app.prod.js @@ -0,0 +1,116 @@ +var APP; +APP = { + refreshStep: 0, + preUrl: '/', + + _storage: { + lastupdated: null, + feeds: {} + }, + + lastUpdated: null, + preCache: function () { + this._trains = new EJS({ + url: 'ejs/trains.ejs' + }); + }, + elmCache: {}, + + init: function () { + // console.log('app starting...'); + this.preCache(); + this.getUpdatedTimes(); + }, + getUpdatedTimes: function () { + this.getNextTrainTime('pyg', 'glc'); + this.getNextTrainTime('glc', 'ptk'); + this.getNextTrainTime('ptk', 'dbc'); + this.getNextTrainTime('glq', 'dbc'); + }, + getNextTrainTime: function (from, to) { + var self, feedUrl, dest, jsonData; + self = this; + feedUrl = this.preUrl + 'getnexttraintimes?from=' + from + '&to=' + to; + dest = from + to; + + jsonData = Android.getJson(feedUrl); + + if (jsonData != '') { + self.updateTrain(dest, JSON.parse(jsonData)); + } + }, + updateTrain: function (n, obj) { + var output, status; + + if (this.elmCache[n] == null) { + this.elmCache[n] = $('#' + n); + } + + output = (obj.eta.toLowerCase() === "on time") ? obj.sta : obj.eta; + status = (obj.eta.toLowerCase() !== "on time") ? 'delayed' : 'ontime'; + + this.elmCache[n].html(output); + this.elmCache[n].prop('class', status); + }, + getTrains: function (from, to) { + var jsonData, self, url; + self = this; + url = '/gettrains?from=' + from + "&to=" + to; + jsonData = Android.getJson(url); + + if (jsonData != '') { + self.getTrainsCB(self.fixProblems(jsonData)); + } + }, + fixProblems: function(data) { + var work = JSON.parse(data); + console.log(); + for (var i = 0; i< work.trainServices.length;i++) + { + console.log(work.trainServices[i].sta); + if (work.trainServices[i].sta === null) + { + console.log('FIX'); + // this train starts from this station.. so swap in other values + work.trainServices[i].sta = work.trainServices[i].std; + work.trainServices[i].eta = work.trainServices[i].etd; + } + + if (work.trainServices[i].platform === null) { + work.trainServices[i].platform = 'NA'; + } + } + + return work; + }, + + getTrainsCB: function (results) { + if (this.elmCache.dest$ == null) { + this.elmCache.dest$ = $('#trainResults'); + } + + var html = this._trains.render(results); + + this.elmCache.dest$.empty(); + this.elmCache.dest$.append(html); + + }, + setRoute: function(route) { + Android.setRoute(route); + } +}; + +function setRoute(route) +{ + APP.setRoute(route); +} + +Zepto(function ($) { + // console.log('Start app'); + if (typeof(Storage) !== "undefined") { + APP.init(); + } else { + // Sorry! No Web Storage support.. + alert('No local storage'); + } +}); \ No newline at end of file diff --git a/app/src/main/assets/js/fx.js b/app/src/main/assets/js/fx.js new file mode 100644 index 0000000..2b21155 --- /dev/null +++ b/app/src/main/assets/js/fx.js @@ -0,0 +1,123 @@ +// Zepto.js +// (c) 2010-2015 Thomas Fuchs +// Zepto.js may be freely distributed under the MIT license. + +;(function($, undefined){ + var prefix = '', eventPrefix, + vendors = { Webkit: 'webkit', Moz: '', O: 'o' }, + testEl = document.createElement('div'), + supportedTransforms = /^((translate|rotate|scale)(X|Y|Z|3d)?|matrix(3d)?|perspective|skew(X|Y)?)$/i, + transform, + transitionProperty, transitionDuration, transitionTiming, transitionDelay, + animationName, animationDuration, animationTiming, animationDelay, + cssReset = {} + + function dasherize(str) { return str.replace(/([a-z])([A-Z])/, '$1-$2').toLowerCase() } + function normalizeEvent(name) { return eventPrefix ? eventPrefix + name : name.toLowerCase() } + + $.each(vendors, function(vendor, event){ + if (testEl.style[vendor + 'TransitionProperty'] !== undefined) { + prefix = '-' + vendor.toLowerCase() + '-' + eventPrefix = event + return false + } + }) + + transform = prefix + 'transform' + cssReset[transitionProperty = prefix + 'transition-property'] = + cssReset[transitionDuration = prefix + 'transition-duration'] = + cssReset[transitionDelay = prefix + 'transition-delay'] = + cssReset[transitionTiming = prefix + 'transition-timing-function'] = + cssReset[animationName = prefix + 'animation-name'] = + cssReset[animationDuration = prefix + 'animation-duration'] = + cssReset[animationDelay = prefix + 'animation-delay'] = + cssReset[animationTiming = prefix + 'animation-timing-function'] = '' + + $.fx = { + off: (eventPrefix === undefined && testEl.style.transitionProperty === undefined), + speeds: { _default: 400, fast: 200, slow: 600 }, + cssPrefix: prefix, + transitionEnd: normalizeEvent('TransitionEnd'), + animationEnd: normalizeEvent('AnimationEnd') + } + + $.fn.animate = function(properties, duration, ease, callback, delay){ + if ($.isFunction(duration)) + callback = duration, ease = undefined, duration = undefined + if ($.isFunction(ease)) + callback = ease, ease = undefined + if ($.isPlainObject(duration)) + ease = duration.easing, callback = duration.complete, delay = duration.delay, duration = duration.duration + if (duration) duration = (typeof duration == 'number' ? duration : + ($.fx.speeds[duration] || $.fx.speeds._default)) / 1000 + if (delay) delay = parseFloat(delay) / 1000 + return this.anim(properties, duration, ease, callback, delay) + } + + $.fn.anim = function(properties, duration, ease, callback, delay){ + var key, cssValues = {}, cssProperties, transforms = '', + that = this, wrappedCallback, endEvent = $.fx.transitionEnd, + fired = false + + if (duration === undefined) duration = $.fx.speeds._default / 1000 + if (delay === undefined) delay = 0 + if ($.fx.off) duration = 0 + + if (typeof properties == 'string') { + // keyframe animation + cssValues[animationName] = properties + cssValues[animationDuration] = duration + 's' + cssValues[animationDelay] = delay + 's' + cssValues[animationTiming] = (ease || 'linear') + endEvent = $.fx.animationEnd + } else { + cssProperties = [] + // CSS transitions + for (key in properties) + if (supportedTransforms.test(key)) transforms += key + '(' + properties[key] + ') ' + else cssValues[key] = properties[key], cssProperties.push(dasherize(key)) + + if (transforms) cssValues[transform] = transforms, cssProperties.push(transform) + if (duration > 0 && typeof properties === 'object') { + cssValues[transitionProperty] = cssProperties.join(', ') + cssValues[transitionDuration] = duration + 's' + cssValues[transitionDelay] = delay + 's' + cssValues[transitionTiming] = (ease || 'linear') + } + } + + wrappedCallback = function(event){ + if (typeof event !== 'undefined') { + if (event.target !== event.currentTarget) return // makes sure the event didn't bubble from "below" + $(event.target).unbind(endEvent, wrappedCallback) + } else + $(this).unbind(endEvent, wrappedCallback) // triggered by setTimeout + + fired = true + $(this).css(cssReset) + callback && callback.call(this) + } + if (duration > 0){ + this.bind(endEvent, wrappedCallback) + // transitionEnd is not always firing on older Android phones + // so make sure it gets fired + setTimeout(function(){ + if (fired) return + wrappedCallback.call(that) + }, ((duration + delay) * 1000) + 25) + } + + // trigger page reflow so new elements can animate + this.size() && this.get(0).clientLeft + + this.css(cssValues) + + if (duration <= 0) setTimeout(function() { + that.each(function(){ wrappedCallback.call(this) }) + }, 0) + + return this + } + + testEl = null +})(Zepto) diff --git a/app/src/main/assets/js/fx_methods.js b/app/src/main/assets/js/fx_methods.js new file mode 100644 index 0000000..7503f3d --- /dev/null +++ b/app/src/main/assets/js/fx_methods.js @@ -0,0 +1,71 @@ +// Zepto.js +// (c) 2010-2015 Thomas Fuchs +// Zepto.js may be freely distributed under the MIT license. + +;(function($, undefined){ + var document = window.document, docElem = document.documentElement, + origShow = $.fn.show, origHide = $.fn.hide, origToggle = $.fn.toggle + + function anim(el, speed, opacity, scale, callback) { + if (typeof speed == 'function' && !callback) callback = speed, speed = undefined + var props = { opacity: opacity } + if (scale) { + props.scale = scale + el.css($.fx.cssPrefix + 'transform-origin', '0 0') + } + return el.animate(props, speed, null, callback) + } + + function hide(el, speed, scale, callback) { + return anim(el, speed, 0, scale, function(){ + origHide.call($(this)) + callback && callback.call(this) + }) + } + + $.fn.show = function(speed, callback) { + origShow.call(this) + if (speed === undefined) speed = 0 + else this.css('opacity', 0) + return anim(this, speed, 1, '1,1', callback) + } + + $.fn.hide = function(speed, callback) { + if (speed === undefined) return origHide.call(this) + else return hide(this, speed, '0,0', callback) + } + + $.fn.toggle = function(speed, callback) { + if (speed === undefined || typeof speed == 'boolean') + return origToggle.call(this, speed) + else return this.each(function(){ + var el = $(this) + el[el.css('display') == 'none' ? 'show' : 'hide'](speed, callback) + }) + } + + $.fn.fadeTo = function(speed, opacity, callback) { + return anim(this, speed, opacity, null, callback) + } + + $.fn.fadeIn = function(speed, callback) { + var target = this.css('opacity') + if (target > 0) this.css('opacity', 0) + else target = 1 + return origShow.call(this).fadeTo(speed, target, callback) + } + + $.fn.fadeOut = function(speed, callback) { + return hide(this, speed, null, callback) + } + + $.fn.fadeToggle = function(speed, callback) { + return this.each(function(){ + var el = $(this) + el[ + (el.css('opacity') == 0 || el.css('display') == 'none') ? 'fadeIn' : 'fadeOut' + ](speed, callback) + }) + } + +})(Zepto) diff --git a/app/src/main/assets/js/jquery.unveil.js b/app/src/main/assets/js/jquery.unveil.js new file mode 100644 index 0000000..38feb61 --- /dev/null +++ b/app/src/main/assets/js/jquery.unveil.js @@ -0,0 +1,70 @@ +/** + * jQuery Unveil + * A very lightweight jQuery plugin to lazy load images + * http://luis-almeida.github.com/unveil + * + * Licensed under the MIT license. + * Copyright 2013 Luís Almeida + * https://github.com/luis-almeida + */ + +; +(function($) { + + var blackList = ['feeds.feedburner.com', '.feedsportal.co']; + $.fn.unveil = function(threshold, callback) { + + var $w = $(window), + th = threshold || 0, + retina = window.devicePixelRatio > 1, + attrib = retina ? "data-src-retina" : "data-src", + images = this, + loaded; + + this.one("unveil", function() { + var source = this.getAttribute(attrib); + source = source || this.getAttribute("data-src"); + + var flag = false; + for (var item in blackList) { + var u = blackList[item]; + if (source.indexOf(u) !== -1) { + flag = true; + } + } + if (source && !flag) { + this.setAttribute("src", source); + if (typeof callback === "function") callback.call(this); + } + + if (flag) { + this.setAttribute("style", 'display:none !important;'); + } + }); + + function unveil() { + var inview = images.filter(function() { + var $e = $(this); + // if ($e.is(":hidden")) return; + + var wt = $w.scrollTop(), + wb = wt + $w.height(), + et = $e.offset().top, + eb = et + $e.height(); + + return eb >= wt - th && et <= wb + th; + }); + + loaded = inview.trigger("unveil"); + images = images.not(loaded); + } + + $w.on("scroll.unveil resize.unveil lookup.unveil", unveil); + + unveil(); + + return this; + + }; + + })(window.jQuery || window.Zepto); diff --git a/app/src/main/assets/js/output.min.js b/app/src/main/assets/js/output.min.js new file mode 100644 index 0000000..c315a3d --- /dev/null +++ b/app/src/main/assets/js/output.min.js @@ -0,0 +1,3 @@ +var Zepto=function(){function t(t){return null==t?String(t):q[R.call(t)]||"object"}function e(e){return"function"==t(e)}function n(t){return null!=t&&t==t.window}function r(t){return null!=t&&t.nodeType==t.DOCUMENT_NODE}function i(e){return"object"==t(e)}function o(t){return i(t)&&!n(t)&&Object.getPrototypeOf(t)==Object.prototype}function s(t){return"number"==typeof t.length}function a(t){return k.call(t,function(t){return null!=t})}function u(t){return t.length>0?D.fn.concat.apply([],t):t}function c(t){return t.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/_/g,"-").toLowerCase()}function l(t){return t in J?J[t]:J[t]=new RegExp("(^|\\s)"+t+"(\\s|$)")}function f(t,e){return"number"!=typeof e||P[c(t)]?e:e+"px"}function h(t){var e,n;return C[t]||(e=O.createElement(t),O.body.appendChild(e),n=getComputedStyle(e,"").getPropertyValue("display"),e.parentNode.removeChild(e),"none"==n&&(n="block"),C[t]=n),C[t]}function d(t){return"children"in t?Y.call(t.children):D.map(t.childNodes,function(t){return 1==t.nodeType?t:void 0})}function p(t,e,n){for(b in e)n&&(o(e[b])||X(e[b]))?(o(e[b])&&!o(t[b])&&(t[b]={}),X(e[b])&&!X(t[b])&&(t[b]=[]),p(t[b],e[b],n)):e[b]!==S&&(t[b]=e[b])}function m(t,e){return null==e?D(t):D(t).filter(e)}function _(t,n,r,i){return e(n)?n.call(t,r,i):n}function g(t,e,n){null==n?t.removeAttribute(e):t.setAttribute(e,n)}function y(t,e){var n=t.className||"",r=n&&n.baseVal!==S;return e===S?r?n.baseVal:n:void(r?n.baseVal=e:t.className=e)}function v(t){try{return t?"true"==t||("false"==t?!1:"null"==t?null:+t+""==t?+t:/^[\[\{]/.test(t)?D.parseJSON(t):t):t}catch(e){return t}}function w(t,e){e(t);for(var n=0,r=t.childNodes.length;r>n;n++)w(t.childNodes[n],e)}var S,b,D,M,x,E,T=[],Y=T.slice,k=T.filter,O=window.document,C={},J={},P={"column-count":1,columns:1,"font-weight":1,"line-height":1,opacity:1,"z-index":1,zoom:1},H=/^\s*<(\w+|!)[^>]*>/,j=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,L=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,F=/^(?:body|html)$/i,N=/([A-Z])/g,A=["val","css","html","text","data","width","height","offset"],U=["after","prepend","before","append"],W=O.createElement("table"),G=O.createElement("tr"),I={tr:O.createElement("tbody"),tbody:W,thead:W,tfoot:W,td:G,th:G,"*":O.createElement("div")},z=/complete|loaded|interactive/,Z=/^[\w-]*$/,q={},R=q.toString,V={},$=O.createElement("div"),B={tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},X=Array.isArray||function(t){return t instanceof Array};return V.matches=function(t,e){if(!e||!t||1!==t.nodeType)return!1;var n=t.webkitMatchesSelector||t.mozMatchesSelector||t.oMatchesSelector||t.matchesSelector;if(n)return n.call(t,e);var r,i=t.parentNode,o=!i;return o&&(i=$).appendChild(t),r=~V.qsa(i,e).indexOf(t),o&&$.removeChild(t),r},x=function(t){return t.replace(/-+(.)?/g,function(t,e){return e?e.toUpperCase():""})},E=function(t){return k.call(t,function(e,n){return t.indexOf(e)==n})},V.fragment=function(t,e,n){var r,i,s;return j.test(t)&&(r=D(O.createElement(RegExp.$1))),r||(t.replace&&(t=t.replace(L,"<$1>")),e===S&&(e=H.test(t)&&RegExp.$1),e in I||(e="*"),s=I[e],s.innerHTML=""+t,r=D.each(Y.call(s.childNodes),function(){s.removeChild(this)})),o(n)&&(i=D(r),D.each(n,function(t,e){A.indexOf(t)>-1?i[t](e):i.attr(t,e)})),r},V.Z=function(t,e){return t=t||[],t.__proto__=D.fn,t.selector=e||"",t},V.isZ=function(t){return t instanceof V.Z},V.init=function(t,n){var r;if(!t)return V.Z();if("string"==typeof t)if(t=t.trim(),"<"==t[0]&&H.test(t))r=V.fragment(t,RegExp.$1,n),t=null;else{if(n!==S)return D(n).find(t);r=V.qsa(O,t)}else{if(e(t))return D(O).ready(t);if(V.isZ(t))return t;if(X(t))r=a(t);else if(i(t))r=[t],t=null;else if(H.test(t))r=V.fragment(t.trim(),RegExp.$1,n),t=null;else{if(n!==S)return D(n).find(t);r=V.qsa(O,t)}}return V.Z(r,t)},D=function(t,e){return V.init(t,e)},D.extend=function(t){var e,n=Y.call(arguments,1);return"boolean"==typeof t&&(e=t,t=n.shift()),n.forEach(function(n){p(t,n,e)}),t},V.qsa=function(t,e){var n,i="#"==e[0],o=!i&&"."==e[0],s=i||o?e.slice(1):e,a=Z.test(s);return r(t)&&a&&i?(n=t.getElementById(s))?[n]:[]:1!==t.nodeType&&9!==t.nodeType?[]:Y.call(a&&!i?o?t.getElementsByClassName(s):t.getElementsByTagName(e):t.querySelectorAll(e))},D.contains=O.documentElement.contains?function(t,e){return t!==e&&t.contains(e)}:function(t,e){for(;e&&(e=e.parentNode);)if(e===t)return!0;return!1},D.type=t,D.isFunction=e,D.isWindow=n,D.isArray=X,D.isPlainObject=o,D.isEmptyObject=function(t){var e;for(e in t)return!1;return!0},D.inArray=function(t,e,n){return T.indexOf.call(e,t,n)},D.camelCase=x,D.trim=function(t){return null==t?"":String.prototype.trim.call(t)},D.uuid=0,D.support={},D.expr={},D.map=function(t,e){var n,r,i,o=[];if(s(t))for(r=0;r=0?t:t+this.length]},toArray:function(){return this.get()},size:function(){return this.length},remove:function(){return this.each(function(){null!=this.parentNode&&this.parentNode.removeChild(this)})},each:function(t){return T.every.call(this,function(e,n){return t.call(e,n,e)!==!1}),this},filter:function(t){return e(t)?this.not(this.not(t)):D(k.call(this,function(e){return V.matches(e,t)}))},add:function(t,e){return D(E(this.concat(D(t,e))))},is:function(t){return this.length>0&&V.matches(this[0],t)},not:function(t){var n=[];if(e(t)&&t.call!==S)this.each(function(e){t.call(this,e)||n.push(this)});else{var r="string"==typeof t?this.filter(t):s(t)&&e(t.item)?Y.call(t):D(t);this.forEach(function(t){r.indexOf(t)<0&&n.push(t)})}return D(n)},has:function(t){return this.filter(function(){return i(t)?D.contains(this,t):D(this).find(t).size()})},eq:function(t){return-1===t?this.slice(t):this.slice(t,+t+1)},first:function(){var t=this[0];return t&&!i(t)?t:D(t)},last:function(){var t=this[this.length-1];return t&&!i(t)?t:D(t)},find:function(t){var e,n=this;return e=t?"object"==typeof t?D(t).filter(function(){var t=this;return T.some.call(n,function(e){return D.contains(e,t)})}):1==this.length?D(V.qsa(this[0],t)):this.map(function(){return V.qsa(this,t)}):D()},closest:function(t,e){var n=this[0],i=!1;for("object"==typeof t&&(i=D(t));n&&!(i?i.indexOf(n)>=0:V.matches(n,t));)n=n!==e&&!r(n)&&n.parentNode;return D(n)},parents:function(t){for(var e=[],n=this;n.length>0;)n=D.map(n,function(t){return(t=t.parentNode)&&!r(t)&&e.indexOf(t)<0?(e.push(t),t):void 0});return m(e,t)},parent:function(t){return m(E(this.pluck("parentNode")),t)},children:function(t){return m(this.map(function(){return d(this)}),t)},contents:function(){return this.map(function(){return Y.call(this.childNodes)})},siblings:function(t){return m(this.map(function(t,e){return k.call(d(e.parentNode),function(t){return t!==e})}),t)},empty:function(){return this.each(function(){this.innerHTML=""})},pluck:function(t){return D.map(this,function(e){return e[t]})},show:function(){return this.each(function(){"none"==this.style.display&&(this.style.display=""),"none"==getComputedStyle(this,"").getPropertyValue("display")&&(this.style.display=h(this.nodeName))})},replaceWith:function(t){return this.before(t).remove()},wrap:function(t){var n=e(t);if(this[0]&&!n)var r=D(t).get(0),i=r.parentNode||this.length>1;return this.each(function(e){D(this).wrapAll(n?t.call(this,e):i?r.cloneNode(!0):r)})},wrapAll:function(t){if(this[0]){D(this[0]).before(t=D(t));for(var e;(e=t.children()).length;)t=e.first();D(t).append(this)}return this},wrapInner:function(t){var n=e(t);return this.each(function(e){var r=D(this),i=r.contents(),o=n?t.call(this,e):t;i.length?i.wrapAll(o):r.append(o)})},unwrap:function(){return this.parent().each(function(){D(this).replaceWith(D(this).children())}),this},clone:function(){return this.map(function(){return this.cloneNode(!0)})},hide:function(){return this.css("display","none")},toggle:function(t){return this.each(function(){var e=D(this);(t===S?"none"==e.css("display"):t)?e.show():e.hide()})},prev:function(t){return D(this.pluck("previousElementSibling")).filter(t||"*")},next:function(t){return D(this.pluck("nextElementSibling")).filter(t||"*")},html:function(t){return 0 in arguments?this.each(function(e){var n=this.innerHTML;D(this).empty().append(_(this,t,e,n))}):0 in this?this[0].innerHTML:null},text:function(t){return 0 in arguments?this.each(function(e){var n=_(this,t,e,this.textContent);this.textContent=null==n?"":""+n}):0 in this?this[0].textContent:null},attr:function(t,e){var n;return"string"!=typeof t||1 in arguments?this.each(function(n){if(1===this.nodeType)if(i(t))for(b in t)g(this,b,t[b]);else g(this,t,_(this,e,n,this.getAttribute(t)))}):this.length&&1===this[0].nodeType?!(n=this[0].getAttribute(t))&&t in this[0]?this[0][t]:n:S},removeAttr:function(t){return this.each(function(){1===this.nodeType&&t.split(" ").forEach(function(t){g(this,t)},this)})},prop:function(t,e){return t=B[t]||t,1 in arguments?this.each(function(n){this[t]=_(this,e,n,this[t])}):this[0]&&this[0][t]},data:function(t,e){var n="data-"+t.replace(N,"-$1").toLowerCase(),r=1 in arguments?this.attr(n,e):this.attr(n);return null!==r?v(r):S},val:function(t){return 0 in arguments?this.each(function(e){this.value=_(this,t,e,this.value)}):this[0]&&(this[0].multiple?D(this[0]).find("option").filter(function(){return this.selected}).pluck("value"):this[0].value)},offset:function(t){if(t)return this.each(function(e){var n=D(this),r=_(this,t,e,n.offset()),i=n.offsetParent().offset(),o={top:r.top-i.top,left:r.left-i.left};"static"==n.css("position")&&(o.position="relative"),n.css(o)});if(!this.length)return null;var e=this[0].getBoundingClientRect();return{left:e.left+window.pageXOffset,top:e.top+window.pageYOffset,width:Math.round(e.width),height:Math.round(e.height)}},css:function(e,n){if(arguments.length<2){var r,i=this[0];if(!i)return;if(r=getComputedStyle(i,""),"string"==typeof e)return i.style[x(e)]||r.getPropertyValue(e);if(X(e)){var o={};return D.each(e,function(t,e){o[e]=i.style[x(e)]||r.getPropertyValue(e)}),o}}var s="";if("string"==t(e))n||0===n?s=c(e)+":"+f(e,n):this.each(function(){this.style.removeProperty(c(e))});else for(b in e)e[b]||0===e[b]?s+=c(b)+":"+f(b,e[b])+";":this.each(function(){this.style.removeProperty(c(b))});return this.each(function(){this.style.cssText+=";"+s})},index:function(t){return t?this.indexOf(D(t)[0]):this.parent().children().indexOf(this[0])},hasClass:function(t){return t?T.some.call(this,function(t){return this.test(y(t))},l(t)):!1},addClass:function(t){return t?this.each(function(e){if("className"in this){M=[];var n=y(this),r=_(this,t,e,n);r.split(/\s+/g).forEach(function(t){D(this).hasClass(t)||M.push(t)},this),M.length&&y(this,n+(n?" ":"")+M.join(" "))}}):this},removeClass:function(t){return this.each(function(e){if("className"in this){if(t===S)return y(this,"");M=y(this),_(this,t,e,M).split(/\s+/g).forEach(function(t){M=M.replace(l(t)," ")}),y(this,M.trim())}})},toggleClass:function(t,e){return t?this.each(function(n){var r=D(this),i=_(this,t,n,y(this));i.split(/\s+/g).forEach(function(t){(e===S?!r.hasClass(t):e)?r.addClass(t):r.removeClass(t)})}):this},scrollTop:function(t){if(this.length){var e="scrollTop"in this[0];return t===S?e?this[0].scrollTop:this[0].pageYOffset:this.each(e?function(){this.scrollTop=t}:function(){this.scrollTo(this.scrollX,t)})}},scrollLeft:function(t){if(this.length){var e="scrollLeft"in this[0];return t===S?e?this[0].scrollLeft:this[0].pageXOffset:this.each(e?function(){this.scrollLeft=t}:function(){this.scrollTo(t,this.scrollY)})}},position:function(){if(this.length){var t=this[0],e=this.offsetParent(),n=this.offset(),r=F.test(e[0].nodeName)?{top:0,left:0}:e.offset();return n.top-=parseFloat(D(t).css("margin-top"))||0,n.left-=parseFloat(D(t).css("margin-left"))||0,r.top+=parseFloat(D(e[0]).css("border-top-width"))||0,r.left+=parseFloat(D(e[0]).css("border-left-width"))||0,{top:n.top-r.top,left:n.left-r.left}}},offsetParent:function(){return this.map(function(){for(var t=this.offsetParent||O.body;t&&!F.test(t.nodeName)&&"static"==D(t).css("position");)t=t.offsetParent;return t})}},D.fn.detach=D.fn.remove,["width","height"].forEach(function(t){var e=t.replace(/./,function(t){return t[0].toUpperCase()});D.fn[t]=function(i){var o,s=this[0];return i===S?n(s)?s["inner"+e]:r(s)?s.documentElement["scroll"+e]:(o=this.offset())&&o[t]:this.each(function(e){s=D(this),s.css(t,_(this,i,e,s[t]()))})}}),U.forEach(function(e,n){var r=n%2;D.fn[e]=function(){var e,i,o=D.map(arguments,function(n){return e=t(n),"object"==e||"array"==e||null==n?n:V.fragment(n)}),s=this.length>1;return o.length<1?this:this.each(function(t,e){i=r?e:e.parentNode,e=0==n?e.nextSibling:1==n?e.firstChild:2==n?e:null;var a=D.contains(O.documentElement,i);o.forEach(function(t){if(s)t=t.cloneNode(!0);else if(!i)return D(t).remove();i.insertBefore(t,e),a&&w(t,function(t){null==t.nodeName||"SCRIPT"!==t.nodeName.toUpperCase()||t.type&&"text/javascript"!==t.type||t.src||window.eval.call(window,t.innerHTML)})})})},D.fn[r?e+"To":"insert"+(n?"Before":"After")]=function(t){return D(t)[e](this),this}}),V.Z.prototype=D.fn,V.uniq=E,V.deserializeValue=v,D.zepto=V,D}();window.Zepto=Zepto,void 0===window.$&&(window.$=Zepto),function(t){function e(t){return t._zid||(t._zid=h++)}function n(t,n,o,s){if(n=r(n),n.ns)var a=i(n.ns);return(_[e(t)]||[]).filter(function(t){return!(!t||n.e&&t.e!=n.e||n.ns&&!a.test(t.ns)||o&&e(t.fn)!==e(o)||s&&t.sel!=s)})}function r(t){var e=(""+t).split(".");return{e:e[0],ns:e.slice(1).sort().join(" ")}}function i(t){return new RegExp("(?:^| )"+t.replace(" "," .* ?")+"(?: |$)")}function o(t,e){return t.del&&!y&&t.e in v||!!e}function s(t){return w[t]||y&&v[t]||t}function a(n,i,a,u,l,h,d){var p=e(n),m=_[p]||(_[p]=[]);i.split(/\s/).forEach(function(e){if("ready"==e)return t(document).ready(a);var i=r(e);i.fn=a,i.sel=l,i.e in w&&(a=function(e){var n=e.relatedTarget;return!n||n!==this&&!t.contains(this,n)?i.fn.apply(this,arguments):void 0}),i.del=h;var p=h||a;i.proxy=function(t){if(t=c(t),!t.isImmediatePropagationStopped()){t.data=u;var e=p.apply(n,t._args==f?[t]:[t].concat(t._args));return e===!1&&(t.preventDefault(),t.stopPropagation()),e}},i.i=m.length,m.push(i),"addEventListener"in n&&n.addEventListener(s(i.e),i.proxy,o(i,d))})}function u(t,r,i,a,u){var c=e(t);(r||"").split(/\s/).forEach(function(e){n(t,e,i,a).forEach(function(e){delete _[c][e.i],"removeEventListener"in t&&t.removeEventListener(s(e.e),e.proxy,o(e,u))})})}function c(e,n){return(n||!e.isDefaultPrevented)&&(n||(n=e),t.each(M,function(t,r){var i=n[t];e[t]=function(){return this[r]=S,i&&i.apply(n,arguments)},e[r]=b}),(n.defaultPrevented!==f?n.defaultPrevented:"returnValue"in n?n.returnValue===!1:n.getPreventDefault&&n.getPreventDefault())&&(e.isDefaultPrevented=S)),e}function l(t){var e,n={originalEvent:t};for(e in t)D.test(e)||t[e]===f||(n[e]=t[e]);return c(n,t)}var f,h=1,d=Array.prototype.slice,p=t.isFunction,m=function(t){return"string"==typeof t},_={},g={},y="onfocusin"in window,v={focus:"focusin",blur:"focusout"},w={mouseenter:"mouseover",mouseleave:"mouseout"};g.click=g.mousedown=g.mouseup=g.mousemove="MouseEvents",t.event={add:a,remove:u},t.proxy=function(n,r){var i=2 in arguments&&d.call(arguments,2);if(p(n)){var o=function(){return n.apply(r,i?i.concat(d.call(arguments)):arguments)};return o._zid=e(n),o}if(m(r))return i?(i.unshift(n[r],n),t.proxy.apply(null,i)):t.proxy(n[r],n);throw new TypeError("expected function")},t.fn.bind=function(t,e,n){return this.on(t,e,n)},t.fn.unbind=function(t,e){return this.off(t,e)},t.fn.one=function(t,e,n,r){return this.on(t,e,n,r,1)};var S=function(){return!0},b=function(){return!1},D=/^([A-Z]|returnValue$|layer[XY]$)/,M={preventDefault:"isDefaultPrevented",stopImmediatePropagation:"isImmediatePropagationStopped",stopPropagation:"isPropagationStopped"};t.fn.delegate=function(t,e,n){return this.on(e,t,n)},t.fn.undelegate=function(t,e,n){return this.off(e,t,n)},t.fn.live=function(e,n){return t(document.body).delegate(this.selector,e,n),this},t.fn.die=function(e,n){return t(document.body).undelegate(this.selector,e,n),this},t.fn.on=function(e,n,r,i,o){var s,c,h=this;return e&&!m(e)?(t.each(e,function(t,e){h.on(t,n,r,e,o)}),h):(m(n)||p(i)||i===!1||(i=r,r=n,n=f),(p(r)||r===!1)&&(i=r,r=f),i===!1&&(i=b),h.each(function(f,h){o&&(s=function(t){return u(h,t.type,i),i.apply(this,arguments)}),n&&(c=function(e){var r,o=t(e.target).closest(n,h).get(0);return o&&o!==h?(r=t.extend(l(e),{currentTarget:o,liveFired:h}),(s||i).apply(o,[r].concat(d.call(arguments,1)))):void 0}),a(h,e,i,r,n,c||s)}))},t.fn.off=function(e,n,r){var i=this;return e&&!m(e)?(t.each(e,function(t,e){i.off(t,n,e)}),i):(m(n)||p(r)||r===!1||(r=n,n=f),r===!1&&(r=b),i.each(function(){u(this,e,r,n)}))},t.fn.trigger=function(e,n){return e=m(e)||t.isPlainObject(e)?t.Event(e):c(e),e._args=n,this.each(function(){e.type in v&&"function"==typeof this[e.type]?this[e.type]():"dispatchEvent"in this?this.dispatchEvent(e):t(this).triggerHandler(e,n)})},t.fn.triggerHandler=function(e,r){var i,o;return this.each(function(s,a){i=l(m(e)?t.Event(e):e),i._args=r,i.target=a,t.each(n(a,e.type||e),function(t,e){return o=e.proxy(i),i.isImmediatePropagationStopped()?!1:void 0})}),o},"focusin focusout focus blur load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select keydown keypress keyup error".split(" ").forEach(function(e){t.fn[e]=function(t){return 0 in arguments?this.bind(e,t):this.trigger(e)}}),t.Event=function(t,e){m(t)||(e=t,t=e.type);var n=document.createEvent(g[t]||"Events"),r=!0;if(e)for(var i in e)"bubbles"==i?r=!!e[i]:n[i]=e[i];return n.initEvent(t,r,!0),c(n)}}(Zepto),function(t){function e(e,n,r){var i=t.Event(n);return t(e).trigger(i,r),!i.isDefaultPrevented()}function n(t,n,r,i){return t.global?e(n||y,r,i):void 0}function r(e){e.global&&0===t.active++&&n(e,null,"ajaxStart")}function i(e){e.global&&!--t.active&&n(e,null,"ajaxStop")}function o(t,e){var r=e.context;return e.beforeSend.call(r,t,e)===!1||n(e,r,"ajaxBeforeSend",[t,e])===!1?!1:void n(e,r,"ajaxSend",[t,e])}function s(t,e,r,i){var o=r.context,s="success";r.success.call(o,t,s,e),i&&i.resolveWith(o,[t,s,e]),n(r,o,"ajaxSuccess",[e,r,t]),u(s,e,r)}function a(t,e,r,i,o){var s=i.context;i.error.call(s,r,e,t),o&&o.rejectWith(s,[r,e,t]),n(i,s,"ajaxError",[r,i,t||e]),u(e,r,i)}function u(t,e,r){var o=r.context;r.complete.call(o,e,t),n(r,o,"ajaxComplete",[e,r]),i(r)}function c(){}function l(t){return t&&(t=t.split(";",2)[0]),t&&(t==D?"html":t==b?"json":w.test(t)?"script":S.test(t)&&"xml")||"text"}function f(t,e){return""==e?t:(t+"&"+e).replace(/[&?]{1,2}/,"?")}function h(e){e.processData&&e.data&&"string"!=t.type(e.data)&&(e.data=t.param(e.data,e.traditional)),!e.data||e.type&&"GET"!=e.type.toUpperCase()||(e.url=f(e.url,e.data),e.data=void 0)}function d(e,n,r,i){return t.isFunction(n)&&(i=r,r=n,n=void 0),t.isFunction(r)||(i=r,r=void 0),{url:e,data:n,success:r,dataType:i}}function p(e,n,r,i){var o,s=t.isArray(n),a=t.isPlainObject(n);t.each(n,function(n,u){o=t.type(u),i&&(n=r?i:i+"["+(a||"object"==o||"array"==o?n:"")+"]"),!i&&s?e.add(u.name,u.value):"array"==o||!r&&"object"==o?p(e,u,r,n):e.add(n,u)})}var m,_,g=0,y=window.document,v=/)<[^<]*)*<\/script>/gi,w=/^(?:text|application)\/javascript/i,S=/^(?:text|application)\/xml/i,b="application/json",D="text/html",M=/^\s*$/,x=y.createElement("a");x.href=window.location.href,t.active=0,t.ajaxJSONP=function(e,n){if(!("type"in e))return t.ajax(e);var r,i,u=e.jsonpCallback,c=(t.isFunction(u)?u():u)||"jsonp"+ ++g,l=y.createElement("script"),f=window[c],h=function(e){t(l).triggerHandler("error",e||"abort")},d={abort:h};return n&&n.promise(d),t(l).on("load error",function(o,u){clearTimeout(i),t(l).off().remove(),"error"!=o.type&&r?s(r[0],d,e,n):a(null,u||"error",d,e,n),window[c]=f,r&&t.isFunction(f)&&f(r[0]),f=r=void 0}),o(d,e)===!1?(h("abort"),d):(window[c]=function(){r=arguments},l.src=e.url.replace(/\?(.+)=\?/,"?$1="+c),y.head.appendChild(l),e.timeout>0&&(i=setTimeout(function(){h("timeout")},e.timeout)),d)},t.ajaxSettings={type:"GET",beforeSend:c,success:c,error:c,complete:c,context:null,global:!0,xhr:function(){return new window.XMLHttpRequest},accepts:{script:"text/javascript, application/javascript, application/x-javascript",json:b,xml:"application/xml, text/xml",html:D,text:"text/plain"},crossDomain:!1,timeout:0,processData:!0,cache:!0},t.ajax=function(e){var n,i=t.extend({},e||{}),u=t.Deferred&&t.Deferred();for(m in t.ajaxSettings)void 0===i[m]&&(i[m]=t.ajaxSettings[m]);r(i),i.crossDomain||(n=y.createElement("a"),n.href=i.url,n.href=n.href,i.crossDomain=x.protocol+"//"+x.host!=n.protocol+"//"+n.host),i.url||(i.url=window.location.toString()),h(i);var d=i.dataType,p=/\?.+=\?/.test(i.url);if(p&&(d="jsonp"),i.cache!==!1&&(e&&e.cache===!0||"script"!=d&&"jsonp"!=d)||(i.url=f(i.url,"_="+Date.now())),"jsonp"==d)return p||(i.url=f(i.url,i.jsonp?i.jsonp+"=?":i.jsonp===!1?"":"callback=?")),t.ajaxJSONP(i,u);var g,v=i.accepts[d],w={},S=function(t,e){w[t.toLowerCase()]=[t,e]},b=/^([\w-]+:)\/\//.test(i.url)?RegExp.$1:window.location.protocol,D=i.xhr(),E=D.setRequestHeader;if(u&&u.promise(D),i.crossDomain||S("X-Requested-With","XMLHttpRequest"),S("Accept",v||"*/*"),(v=i.mimeType||v)&&(v.indexOf(",")>-1&&(v=v.split(",",2)[0]),D.overrideMimeType&&D.overrideMimeType(v)),(i.contentType||i.contentType!==!1&&i.data&&"GET"!=i.type.toUpperCase())&&S("Content-Type",i.contentType||"application/x-www-form-urlencoded"),i.headers)for(_ in i.headers)S(_,i.headers[_]);if(D.setRequestHeader=S,D.onreadystatechange=function(){if(4==D.readyState){D.onreadystatechange=c,clearTimeout(g);var e,n=!1;if(D.status>=200&&D.status<300||304==D.status||0==D.status&&"file:"==b){d=d||l(i.mimeType||D.getResponseHeader("content-type")),e=D.responseText;try{"script"==d?(1,eval)(e):"xml"==d?e=D.responseXML:"json"==d&&(e=M.test(e)?null:t.parseJSON(e))}catch(r){n=r}n?a(n,"parsererror",D,i,u):s(e,D,i,u)}else a(D.statusText||null,D.status?"error":"abort",D,i,u)}},o(D,i)===!1)return D.abort(),a(null,"abort",D,i,u),D;if(i.xhrFields)for(_ in i.xhrFields)D[_]=i.xhrFields[_];var T="async"in i?i.async:!0;D.open(i.type,i.url,T,i.username,i.password);for(_ in w)E.apply(D,w[_]);return i.timeout>0&&(g=setTimeout(function(){D.onreadystatechange=c,D.abort(),a(null,"timeout",D,i,u)},i.timeout)),D.send(i.data?i.data:null),D},t.get=function(){return t.ajax(d.apply(null,arguments))},t.post=function(){var e=d.apply(null,arguments);return e.type="POST",t.ajax(e)},t.getJSON=function(){var e=d.apply(null,arguments);return e.dataType="json",t.ajax(e)},t.fn.load=function(e,n,r){if(!this.length)return this;var i,o=this,s=e.split(/\s/),a=d(e,n,r),u=a.success;return s.length>1&&(a.url=s[0],i=s[1]),a.success=function(e){o.html(i?t("
").html(e.replace(v,"")).find(i):e),u&&u.apply(o,arguments)},t.ajax(a),this};var E=encodeURIComponent;t.param=function(e,n){var r=[];return r.add=function(e,n){t.isFunction(n)&&(n=n()),null==n&&(n=""),this.push(E(e)+"="+E(n))},p(r,e,n),r.join("&").replace(/%20/g,"+")}}(Zepto),function(t){t.fn.serializeArray=function(){var e,n,r=[],i=function(t){return t.forEach?t.forEach(i):void r.push({name:e,value:t})};return this[0]&&t.each(this[0].elements,function(r,o){n=o.type,e=o.name,e&&"fieldset"!=o.nodeName.toLowerCase()&&!o.disabled&&"submit"!=n&&"reset"!=n&&"button"!=n&&"file"!=n&&("radio"!=n&&"checkbox"!=n||o.checked)&&i(t(o).val())}),r},t.fn.serialize=function(){var t=[];return this.serializeArray().forEach(function(e){t.push(encodeURIComponent(e.name)+"="+encodeURIComponent(e.value))}),t.join("&")},t.fn.submit=function(e){if(0 in arguments)this.bind("submit",e);else if(this.length){var n=t.Event("submit");this.eq(0).trigger(n),n.isDefaultPrevented()||this.get(0).submit()}return this}}(Zepto),function(t){"__proto__"in{}||t.extend(t.zepto,{Z:function(e,n){return e=e||[],t.extend(e,t.fn),e.selector=n||"",e.__Z=!0,e},isZ:function(e){return"array"===t.type(e)&&"__Z"in e}});try{getComputedStyle(void 0)}catch(e){var n=getComputedStyle;window.getComputedStyle=function(t){try{return n(t)}catch(e){return null}}}}(Zepto),!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.moment=e()}(this,function(){"use strict";function t(){return Hr.apply(null,arguments)}function e(t){Hr=t}function n(t){return"[object Array]"===Object.prototype.toString.call(t)}function r(t){return t instanceof Date||"[object Date]"===Object.prototype.toString.call(t)}function i(t,e){var n,r=[];for(n=0;n0)for(n in Lr)r=Lr[n],i=e[r],"undefined"!=typeof i&&(t[r]=i);return t}function d(e){h(this,e),this._d=new Date(e._d.getTime()),Fr===!1&&(Fr=!0,t.updateOffset(this),Fr=!1)}function p(t){return t instanceof d||null!=t&&null!=t._isAMomentObject}function m(t){return 0>t?Math.ceil(t):Math.floor(t)}function _(t){var e=+t,n=0;return 0!==e&&isFinite(e)&&(n=m(e)),n}function g(t,e,n){var r,i=Math.min(t.length,e.length),o=Math.abs(t.length-e.length),s=0;for(r=0;i>r;r++)(n&&t[r]!==e[r]||!n&&_(t[r])!==_(e[r]))&&s++;return s+o}function y(){}function v(t){return t?t.toLowerCase().replace("_","-"):t}function w(t){for(var e,n,r,i,o=0;o0;){if(r=S(i.slice(0,e).join("-")))return r;if(n&&n.length>=e&&g(i,n,!0)>=e-1)break;e--}o++}return null}function S(t){var e=null;if(!Nr[t]&&"undefined"!=typeof module&&module&&module.exports)try{e=jr._abbr,require("./locale/"+t),b(e)}catch(n){}return Nr[t]}function b(t,e){var n;return t&&(n="undefined"==typeof e?M(t):D(t,e),n&&(jr=n)),jr._abbr}function D(t,e){return null!==e?(e.abbr=t,Nr[t]=Nr[t]||new y,Nr[t].set(e),b(t),Nr[t]):(delete Nr[t],null)}function M(t){var e;if(t&&t._locale&&t._locale._abbr&&(t=t._locale._abbr),!t)return jr;if(!n(t)){if(e=S(t))return e;t=[t]}return w(t)}function x(t,e){var n=t.toLowerCase();Ar[n]=Ar[n+"s"]=Ar[e]=t}function E(t){return"string"==typeof t?Ar[t]||Ar[t.toLowerCase()]:void 0}function T(t){var e,n,r={};for(n in t)o(t,n)&&(e=E(n),e&&(r[e]=t[n]));return r}function Y(e,n){return function(r){return null!=r?(O(this,e,r),t.updateOffset(this,n),this):k(this,e)}}function k(t,e){return t._d["get"+(t._isUTC?"UTC":"")+e]()}function O(t,e,n){return t._d["set"+(t._isUTC?"UTC":"")+e](n)}function C(t,e){var n;if("object"==typeof t)for(n in t)this.set(n,t[n]);else if(t=E(t),"function"==typeof this[t])return this[t](e);return this}function J(t,e,n){var r=""+Math.abs(t),i=e-r.length,o=t>=0;return(o?n?"+":"":"-")+Math.pow(10,Math.max(0,i)).toString().substr(1)+r}function P(t,e,n,r){var i=r;"string"==typeof r&&(i=function(){return this[r]()}),t&&(Ir[t]=i),e&&(Ir[e[0]]=function(){return J(i.apply(this,arguments),e[1],e[2])}),n&&(Ir[n]=function(){return this.localeData().ordinal(i.apply(this,arguments),t)})}function H(t){return t.match(/\[[\s\S]/)?t.replace(/^\[|\]$/g,""):t.replace(/\\/g,"")}function j(t){var e,n,r=t.match(Ur);for(e=0,n=r.length;n>e;e++)r[e]=Ir[r[e]]?Ir[r[e]]:H(r[e]);return function(i){var o="";for(e=0;n>e;e++)o+=r[e]instanceof Function?r[e].call(i,t):r[e];return o}}function L(t,e){return t.isValid()?(e=F(e,t.localeData()),Gr[e]=Gr[e]||j(e),Gr[e](t)):t.localeData().invalidDate()}function F(t,e){function n(t){return e.longDateFormat(t)||t}var r=5;for(Wr.lastIndex=0;r>=0&&Wr.test(t);)t=t.replace(Wr,n),Wr.lastIndex=0,r-=1;return t}function N(t){return"function"==typeof t&&"[object Function]"===Object.prototype.toString.call(t)}function A(t,e,n){ii[t]=N(e)?e:function(t){return t&&n?n:e}}function U(t,e){return o(ii,t)?ii[t](e._strict,e._locale):new RegExp(W(t))}function W(t){return t.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(t,e,n,r,i){return e||n||r||i}).replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function G(t,e){var n,r=e;for("string"==typeof t&&(t=[t]),"number"==typeof e&&(r=function(t,n){n[e]=_(t)}),n=0;nr;r++){if(i=a([2e3,r]),n&&!this._longMonthsParse[r]&&(this._longMonthsParse[r]=new RegExp("^"+this.months(i,"").replace(".","")+"$","i"),this._shortMonthsParse[r]=new RegExp("^"+this.monthsShort(i,"").replace(".","")+"$","i")),n||this._monthsParse[r]||(o="^"+this.months(i,"")+"|^"+this.monthsShort(i,""),this._monthsParse[r]=new RegExp(o.replace(".",""),"i")),n&&"MMMM"===e&&this._longMonthsParse[r].test(t))return r;if(n&&"MMM"===e&&this._shortMonthsParse[r].test(t))return r;if(!n&&this._monthsParse[r].test(t))return r}}function $(t,e){var n;return"string"==typeof e&&(e=t.localeData().monthsParse(e),"number"!=typeof e)?t:(n=Math.min(t.date(),Z(t.year(),e)),t._d["set"+(t._isUTC?"UTC":"")+"Month"](e,n),t)}function B(e){return null!=e?($(this,e),t.updateOffset(this,!0),this):k(this,"Month")}function X(){return Z(this.year(),this.month())}function Q(t){var e,n=t._a;return n&&-2===c(t).overflow&&(e=n[ai]<0||n[ai]>11?ai:n[ui]<1||n[ui]>Z(n[si],n[ai])?ui:n[ci]<0||n[ci]>24||24===n[ci]&&(0!==n[li]||0!==n[fi]||0!==n[hi])?ci:n[li]<0||n[li]>59?li:n[fi]<0||n[fi]>59?fi:n[hi]<0||n[hi]>999?hi:-1,c(t)._overflowDayOfYear&&(si>e||e>ui)&&(e=ui),c(t).overflow=e),t}function K(e){t.suppressDeprecationWarnings===!1&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+e)}function te(t,e){var n=!0; +return s(function(){return n&&(K(t+"\n"+(new Error).stack),n=!1),e.apply(this,arguments)},e)}function ee(t,e){mi[t]||(K(e),mi[t]=!0)}function ne(t){var e,n,r=t._i,i=_i.exec(r);if(i){for(c(t).iso=!0,e=0,n=gi.length;n>e;e++)if(gi[e][1].exec(r)){t._f=gi[e][0];break}for(e=0,n=yi.length;n>e;e++)if(yi[e][1].exec(r)){t._f+=(i[6]||" ")+yi[e][0];break}r.match(ei)&&(t._f+="Z"),Se(t)}else t._isValid=!1}function re(e){var n=vi.exec(e._i);return null!==n?void(e._d=new Date(+n[1])):(ne(e),void(e._isValid===!1&&(delete e._isValid,t.createFromInputFallback(e))))}function ie(t,e,n,r,i,o,s){var a=new Date(t,e,n,r,i,o,s);return 1970>t&&a.setFullYear(t),a}function oe(t){var e=new Date(Date.UTC.apply(null,arguments));return 1970>t&&e.setUTCFullYear(t),e}function se(t){return ae(t)?366:365}function ae(t){return t%4===0&&t%100!==0||t%400===0}function ue(){return ae(this.year())}function ce(t,e,n){var r,i=n-e,o=n-t.day();return o>i&&(o-=7),i-7>o&&(o+=7),r=ke(t).add(o,"d"),{week:Math.ceil(r.dayOfYear()/7),year:r.year()}}function le(t){return ce(t,this._week.dow,this._week.doy).week}function fe(){return this._week.dow}function he(){return this._week.doy}function de(t){var e=this.localeData().week(this);return null==t?e:this.add(7*(t-e),"d")}function pe(t){var e=ce(this,1,4).week;return null==t?e:this.add(7*(t-e),"d")}function me(t,e,n,r,i){var o,s=6+i-r,a=oe(t,0,1+s),u=a.getUTCDay();return i>u&&(u+=7),n=null!=n?1*n:i,o=1+s+7*(e-1)-u+n,{year:o>0?t:t-1,dayOfYear:o>0?o:se(t-1)+o}}function _e(t){var e=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==t?e:this.add(t-e,"d")}function ge(t,e,n){return null!=t?t:null!=e?e:n}function ye(t){var e=new Date;return t._useUTC?[e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()]:[e.getFullYear(),e.getMonth(),e.getDate()]}function ve(t){var e,n,r,i,o=[];if(!t._d){for(r=ye(t),t._w&&null==t._a[ui]&&null==t._a[ai]&&we(t),t._dayOfYear&&(i=ge(t._a[si],r[si]),t._dayOfYear>se(i)&&(c(t)._overflowDayOfYear=!0),n=oe(i,0,t._dayOfYear),t._a[ai]=n.getUTCMonth(),t._a[ui]=n.getUTCDate()),e=0;3>e&&null==t._a[e];++e)t._a[e]=o[e]=r[e];for(;7>e;e++)t._a[e]=o[e]=null==t._a[e]?2===e?1:0:t._a[e];24===t._a[ci]&&0===t._a[li]&&0===t._a[fi]&&0===t._a[hi]&&(t._nextDay=!0,t._a[ci]=0),t._d=(t._useUTC?oe:ie).apply(null,o),null!=t._tzm&&t._d.setUTCMinutes(t._d.getUTCMinutes()-t._tzm),t._nextDay&&(t._a[ci]=24)}}function we(t){var e,n,r,i,o,s,a;e=t._w,null!=e.GG||null!=e.W||null!=e.E?(o=1,s=4,n=ge(e.GG,t._a[si],ce(ke(),1,4).year),r=ge(e.W,1),i=ge(e.E,1)):(o=t._locale._week.dow,s=t._locale._week.doy,n=ge(e.gg,t._a[si],ce(ke(),o,s).year),r=ge(e.w,1),null!=e.d?(i=e.d,o>i&&++r):i=null!=e.e?e.e+o:o),a=me(n,r,i,s,o),t._a[si]=a.year,t._dayOfYear=a.dayOfYear}function Se(e){if(e._f===t.ISO_8601)return void ne(e);e._a=[],c(e).empty=!0;var n,r,i,o,s,a=""+e._i,u=a.length,l=0;for(i=F(e._f,e._locale).match(Ur)||[],n=0;n0&&c(e).unusedInput.push(s),a=a.slice(a.indexOf(r)+r.length),l+=r.length),Ir[o]?(r?c(e).empty=!1:c(e).unusedTokens.push(o),z(o,r,e)):e._strict&&!r&&c(e).unusedTokens.push(o);c(e).charsLeftOver=u-l,a.length>0&&c(e).unusedInput.push(a),c(e).bigHour===!0&&e._a[ci]<=12&&e._a[ci]>0&&(c(e).bigHour=void 0),e._a[ci]=be(e._locale,e._a[ci],e._meridiem),ve(e),Q(e)}function be(t,e,n){var r;return null==n?e:null!=t.meridiemHour?t.meridiemHour(e,n):null!=t.isPM?(r=t.isPM(n),r&&12>e&&(e+=12),r||12!==e||(e=0),e):e}function De(t){var e,n,r,i,o;if(0===t._f.length)return c(t).invalidFormat=!0,void(t._d=new Date(0/0));for(i=0;io)&&(r=o,n=e));s(t,n||e)}function Me(t){if(!t._d){var e=T(t._i);t._a=[e.year,e.month,e.day||e.date,e.hour,e.minute,e.second,e.millisecond],ve(t)}}function xe(t){var e=new d(Q(Ee(t)));return e._nextDay&&(e.add(1,"d"),e._nextDay=void 0),e}function Ee(t){var e=t._i,i=t._f;return t._locale=t._locale||M(t._l),null===e||void 0===i&&""===e?f({nullInput:!0}):("string"==typeof e&&(t._i=e=t._locale.preparse(e)),p(e)?new d(Q(e)):(n(i)?De(t):i?Se(t):r(e)?t._d=e:Te(t),t))}function Te(e){var o=e._i;void 0===o?e._d=new Date:r(o)?e._d=new Date(+o):"string"==typeof o?re(e):n(o)?(e._a=i(o.slice(0),function(t){return parseInt(t,10)}),ve(e)):"object"==typeof o?Me(e):"number"==typeof o?e._d=new Date(o):t.createFromInputFallback(e)}function Ye(t,e,n,r,i){var o={};return"boolean"==typeof n&&(r=n,n=void 0),o._isAMomentObject=!0,o._useUTC=o._isUTC=i,o._l=n,o._i=t,o._f=e,o._strict=r,xe(o)}function ke(t,e,n,r){return Ye(t,e,n,r,!1)}function Oe(t,e){var r,i;if(1===e.length&&n(e[0])&&(e=e[0]),!e.length)return ke();for(r=e[0],i=1;it&&(t=-t,n="-"),n+J(~~(t/60),2)+e+J(~~t%60,2)})}function Le(t){var e=(t||"").match(ei)||[],n=e[e.length-1]||[],r=(n+"").match(Mi)||["-",0,0],i=+(60*r[1])+_(r[2]);return"+"===r[0]?i:-i}function Fe(e,n){var i,o;return n._isUTC?(i=n.clone(),o=(p(e)||r(e)?+e:+ke(e))-+i,i._d.setTime(+i._d+o),t.updateOffset(i,!1),i):ke(e).local()}function Ne(t){return 15*-Math.round(t._d.getTimezoneOffset()/15)}function Ae(e,n){var r,i=this._offset||0;return null!=e?("string"==typeof e&&(e=Le(e)),Math.abs(e)<16&&(e=60*e),!this._isUTC&&n&&(r=Ne(this)),this._offset=e,this._isUTC=!0,null!=r&&this.add(r,"m"),i!==e&&(!n||this._changeInProgress?en(this,Be(e-i,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,t.updateOffset(this,!0),this._changeInProgress=null)),this):this._isUTC?i:Ne(this)}function Ue(t,e){return null!=t?("string"!=typeof t&&(t=-t),this.utcOffset(t,e),this):-this.utcOffset()}function We(t){return this.utcOffset(0,t)}function Ge(t){return this._isUTC&&(this.utcOffset(0,t),this._isUTC=!1,t&&this.subtract(Ne(this),"m")),this}function Ie(){return this._tzm?this.utcOffset(this._tzm):"string"==typeof this._i&&this.utcOffset(Le(this._i)),this}function ze(t){return t=t?ke(t).utcOffset():0,(this.utcOffset()-t)%60===0}function Ze(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function qe(){if("undefined"!=typeof this._isDSTShifted)return this._isDSTShifted;var t={};if(h(t,this),t=Ee(t),t._a){var e=t._isUTC?a(t._a):ke(t._a);this._isDSTShifted=this.isValid()&&g(t._a,e.toArray())>0}else this._isDSTShifted=!1;return this._isDSTShifted}function Re(){return!this._isUTC}function Ve(){return this._isUTC}function $e(){return this._isUTC&&0===this._offset}function Be(t,e){var n,r,i,s=t,a=null;return He(t)?s={ms:t._milliseconds,d:t._days,M:t._months}:"number"==typeof t?(s={},e?s[e]=t:s.milliseconds=t):(a=xi.exec(t))?(n="-"===a[1]?-1:1,s={y:0,d:_(a[ui])*n,h:_(a[ci])*n,m:_(a[li])*n,s:_(a[fi])*n,ms:_(a[hi])*n}):(a=Ei.exec(t))?(n="-"===a[1]?-1:1,s={y:Xe(a[2],n),M:Xe(a[3],n),d:Xe(a[4],n),h:Xe(a[5],n),m:Xe(a[6],n),s:Xe(a[7],n),w:Xe(a[8],n)}):null==s?s={}:"object"==typeof s&&("from"in s||"to"in s)&&(i=Ke(ke(s.from),ke(s.to)),s={},s.ms=i.milliseconds,s.M=i.months),r=new Pe(s),He(t)&&o(t,"_locale")&&(r._locale=t._locale),r}function Xe(t,e){var n=t&&parseFloat(t.replace(",","."));return(isNaN(n)?0:n)*e}function Qe(t,e){var n={milliseconds:0,months:0};return n.months=e.month()-t.month()+12*(e.year()-t.year()),t.clone().add(n.months,"M").isAfter(e)&&--n.months,n.milliseconds=+e-+t.clone().add(n.months,"M"),n}function Ke(t,e){var n;return e=Fe(e,t),t.isBefore(e)?n=Qe(t,e):(n=Qe(e,t),n.milliseconds=-n.milliseconds,n.months=-n.months),n}function tn(t,e){return function(n,r){var i,o;return null===r||isNaN(+r)||(ee(e,"moment()."+e+"(period, number) is deprecated. Please use moment()."+e+"(number, period)."),o=n,n=r,r=o),n="string"==typeof n?+n:n,i=Be(n,r),en(this,i,t),this}}function en(e,n,r,i){var o=n._milliseconds,s=n._days,a=n._months;i=null==i?!0:i,o&&e._d.setTime(+e._d+o*r),s&&O(e,"Date",k(e,"Date")+s*r),a&&$(e,k(e,"Month")+a*r),i&&t.updateOffset(e,s||a)}function nn(t,e){var n=t||ke(),r=Fe(n,this).startOf("day"),i=this.diff(r,"days",!0),o=-6>i?"sameElse":-1>i?"lastWeek":0>i?"lastDay":1>i?"sameDay":2>i?"nextDay":7>i?"nextWeek":"sameElse";return this.format(e&&e[o]||this.localeData().calendar(o,this,ke(n)))}function rn(){return new d(this)}function on(t,e){var n;return e=E("undefined"!=typeof e?e:"millisecond"),"millisecond"===e?(t=p(t)?t:ke(t),+this>+t):(n=p(t)?+t:+ke(t),n<+this.clone().startOf(e))}function sn(t,e){var n;return e=E("undefined"!=typeof e?e:"millisecond"),"millisecond"===e?(t=p(t)?t:ke(t),+t>+this):(n=p(t)?+t:+ke(t),+this.clone().endOf(e)e-o?(n=t.clone().add(i-1,"months"),r=(e-o)/(o-n)):(n=t.clone().add(i+1,"months"),r=(e-o)/(n-o)),-(i+r)}function fn(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function hn(){var t=this.clone().utc();return 0e;e++)if(this._weekdaysParse[e]||(n=ke([2e3,1]).day(e),r="^"+this.weekdays(n,"")+"|^"+this.weekdaysShort(n,"")+"|^"+this.weekdaysMin(n,""),this._weekdaysParse[e]=new RegExp(r.replace(".",""),"i")),this._weekdaysParse[e].test(t))return e}function Gn(t){var e=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=t?(t=Fn(t,this.localeData()),this.add(t-e,"d")):e}function In(t){var e=(this.day()+7-this.localeData()._week.dow)%7;return null==t?e:this.add(t-e,"d")}function zn(t){return null==t?this.day()||7:this.day(this.day()%7?t:t-7)}function Zn(t,e){P(t,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),e)})}function qn(t,e){return e._meridiemParse}function Rn(t){return"p"===(t+"").toLowerCase().charAt(0)}function Vn(t,e,n){return t>11?n?"pm":"PM":n?"am":"AM"}function $n(t,e){e[hi]=_(1e3*("0."+t))}function Bn(){return this._isUTC?"UTC":""}function Xn(){return this._isUTC?"Coordinated Universal Time":""}function Qn(t){return ke(1e3*t)}function Kn(){return ke.apply(null,arguments).parseZone()}function tr(t,e,n){var r=this._calendar[t];return"function"==typeof r?r.call(e,n):r}function er(t){var e=this._longDateFormat[t],n=this._longDateFormat[t.toUpperCase()];return e||!n?e:(this._longDateFormat[t]=n.replace(/MMMM|MM|DD|dddd/g,function(t){return t.slice(1)}),this._longDateFormat[t])}function nr(){return this._invalidDate}function rr(t){return this._ordinal.replace("%d",t)}function ir(t){return t}function or(t,e,n,r){var i=this._relativeTime[n];return"function"==typeof i?i(t,e,n,r):i.replace(/%d/i,t)}function sr(t,e){var n=this._relativeTime[t>0?"future":"past"];return"function"==typeof n?n(e):n.replace(/%s/i,e)}function ar(t){var e,n;for(n in t)e=t[n],"function"==typeof e?this[n]=e:this["_"+n]=e;this._ordinalParseLenient=new RegExp(this._ordinalParse.source+"|"+/\d{1,2}/.source)}function ur(t,e,n,r){var i=M(),o=a().set(r,e);return i[n](o,t)}function cr(t,e,n,r,i){if("number"==typeof t&&(e=t,t=void 0),t=t||"",null!=e)return ur(t,e,n,i);var o,s=[];for(o=0;r>o;o++)s[o]=ur(t,o,n,i);return s}function lr(t,e){return cr(t,e,"months",12,"month")}function fr(t,e){return cr(t,e,"monthsShort",12,"month")}function hr(t,e){return cr(t,e,"weekdays",7,"day")}function dr(t,e){return cr(t,e,"weekdaysShort",7,"day")}function pr(t,e){return cr(t,e,"weekdaysMin",7,"day")}function mr(){var t=this._data;return this._milliseconds=$i(this._milliseconds),this._days=$i(this._days),this._months=$i(this._months),t.milliseconds=$i(t.milliseconds),t.seconds=$i(t.seconds),t.minutes=$i(t.minutes),t.hours=$i(t.hours),t.months=$i(t.months),t.years=$i(t.years),this}function _r(t,e,n,r){var i=Be(e,n);return t._milliseconds+=r*i._milliseconds,t._days+=r*i._days,t._months+=r*i._months,t._bubble()}function gr(t,e){return _r(this,t,e,1)}function yr(t,e){return _r(this,t,e,-1)}function vr(t){return 0>t?Math.floor(t):Math.ceil(t)}function wr(){var t,e,n,r,i,o=this._milliseconds,s=this._days,a=this._months,u=this._data;return o>=0&&s>=0&&a>=0||0>=o&&0>=s&&0>=a||(o+=864e5*vr(br(a)+s),s=0,a=0),u.milliseconds=o%1e3,t=m(o/1e3),u.seconds=t%60,e=m(t/60),u.minutes=e%60,n=m(e/60),u.hours=n%24,s+=m(n/24),i=m(Sr(s)),a+=i,s-=vr(br(i)),r=m(a/12),a%=12,u.days=s,u.months=a,u.years=r,this}function Sr(t){return 4800*t/146097}function br(t){return 146097*t/4800}function Dr(t){var e,n,r=this._milliseconds;if(t=E(t),"month"===t||"year"===t)return e=this._days+r/864e5,n=this._months+Sr(e),"month"===t?n:n/12;switch(e=this._days+Math.round(br(this._months)),t){case"week":return e/7+r/6048e5;case"day":return e+r/864e5;case"hour":return 24*e+r/36e5;case"minute":return 1440*e+r/6e4;case"second":return 86400*e+r/1e3;case"millisecond":return Math.floor(864e5*e)+r;default:throw new Error("Unknown unit "+t)}}function Mr(){return this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*_(this._months/12)}function xr(t){return function(){return this.as(t)}}function Er(t){return t=E(t),this[t+"s"]()}function Tr(t){return function(){return this._data[t]}}function Yr(){return m(this.days()/7)}function kr(t,e,n,r,i){return i.relativeTime(e||1,!!n,t,r)}function Or(t,e,n){var r=Be(t).abs(),i=fo(r.as("s")),o=fo(r.as("m")),s=fo(r.as("h")),a=fo(r.as("d")),u=fo(r.as("M")),c=fo(r.as("y")),l=i0,l[4]=n,kr.apply(null,l)}function Cr(t,e){return void 0===ho[t]?!1:void 0===e?ho[t]:(ho[t]=e,!0)}function Jr(t){var e=this.localeData(),n=Or(this,!t,e);return t&&(n=e.pastFuture(+this,n)),e.postformat(n)}function Pr(){var t,e,n,r=po(this._milliseconds)/1e3,i=po(this._days),o=po(this._months);t=m(r/60),e=m(t/60),r%=60,t%=60,n=m(o/12),o%=12;var s=n,a=o,u=i,c=e,l=t,f=r,h=this.asSeconds();return h?(0>h?"-":"")+"P"+(s?s+"Y":"")+(a?a+"M":"")+(u?u+"D":"")+(c||l||f?"T":"")+(c?c+"H":"")+(l?l+"M":"")+(f?f+"S":""):"P0D"}var Hr,jr,Lr=t.momentProperties=[],Fr=!1,Nr={},Ar={},Ur=/(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Q|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,Wr=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,Gr={},Ir={},zr=/\d/,Zr=/\d\d/,qr=/\d{3}/,Rr=/\d{4}/,Vr=/[+-]?\d{6}/,$r=/\d\d?/,Br=/\d{1,3}/,Xr=/\d{1,4}/,Qr=/[+-]?\d{1,6}/,Kr=/\d+/,ti=/[+-]?\d+/,ei=/Z|[+-]\d\d:?\d\d/gi,ni=/[+-]?\d+(\.\d{1,3})?/,ri=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,ii={},oi={},si=0,ai=1,ui=2,ci=3,li=4,fi=5,hi=6;P("M",["MM",2],"Mo",function(){return this.month()+1}),P("MMM",0,0,function(t){return this.localeData().monthsShort(this,t)}),P("MMMM",0,0,function(t){return this.localeData().months(this,t)}),x("month","M"),A("M",$r),A("MM",$r,Zr),A("MMM",ri),A("MMMM",ri),G(["M","MM"],function(t,e){e[ai]=_(t)-1}),G(["MMM","MMMM"],function(t,e,n,r){var i=n._locale.monthsParse(t,r,n._strict);null!=i?e[ai]=i:c(n).invalidMonth=t});var di="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),pi="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),mi={};t.suppressDeprecationWarnings=!1;var _i=/^\s*(?:[+-]\d{6}|\d{4})-(?:(\d\d-\d\d)|(W\d\d$)|(W\d\d-\d)|(\d\d\d))((T| )(\d\d(:\d\d(:\d\d(\.\d+)?)?)?)?([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,gi=[["YYYYYY-MM-DD",/[+-]\d{6}-\d{2}-\d{2}/],["YYYY-MM-DD",/\d{4}-\d{2}-\d{2}/],["GGGG-[W]WW-E",/\d{4}-W\d{2}-\d/],["GGGG-[W]WW",/\d{4}-W\d{2}/],["YYYY-DDD",/\d{4}-\d{3}/]],yi=[["HH:mm:ss.SSSS",/(T| )\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss",/(T| )\d\d:\d\d:\d\d/],["HH:mm",/(T| )\d\d:\d\d/],["HH",/(T| )\d\d/]],vi=/^\/?Date\((\-?\d+)/i;t.createFromInputFallback=te("moment construction falls back to js Date. This is discouraged and will be removed in upcoming major release. Please refer to https://github.com/moment/moment/issues/1407 for more info.",function(t){t._d=new Date(t._i+(t._useUTC?" UTC":""))}),P(0,["YY",2],0,function(){return this.year()%100}),P(0,["YYYY",4],0,"year"),P(0,["YYYYY",5],0,"year"),P(0,["YYYYYY",6,!0],0,"year"),x("year","y"),A("Y",ti),A("YY",$r,Zr),A("YYYY",Xr,Rr),A("YYYYY",Qr,Vr),A("YYYYYY",Qr,Vr),G(["YYYYY","YYYYYY"],si),G("YYYY",function(e,n){n[si]=2===e.length?t.parseTwoDigitYear(e):_(e)}),G("YY",function(e,n){n[si]=t.parseTwoDigitYear(e)}),t.parseTwoDigitYear=function(t){return _(t)+(_(t)>68?1900:2e3)};var wi=Y("FullYear",!1);P("w",["ww",2],"wo","week"),P("W",["WW",2],"Wo","isoWeek"),x("week","w"),x("isoWeek","W"),A("w",$r),A("ww",$r,Zr),A("W",$r),A("WW",$r,Zr),I(["w","ww","W","WW"],function(t,e,n,r){e[r.substr(0,1)]=_(t)});var Si={dow:0,doy:6};P("DDD",["DDDD",3],"DDDo","dayOfYear"),x("dayOfYear","DDD"),A("DDD",Br),A("DDDD",qr),G(["DDD","DDDD"],function(t,e,n){n._dayOfYear=_(t)}),t.ISO_8601=function(){};var bi=te("moment().min is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548",function(){var t=ke.apply(null,arguments);return this>t?this:t}),Di=te("moment().max is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548",function(){var t=ke.apply(null,arguments);return t>this?this:t});je("Z",":"),je("ZZ",""),A("Z",ei),A("ZZ",ei),G(["Z","ZZ"],function(t,e,n){n._useUTC=!0,n._tzm=Le(t)});var Mi=/([\+\-]|\d\d)/gi;t.updateOffset=function(){};var xi=/(\-)?(?:(\d*)\.)?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?)?/,Ei=/^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/;Be.fn=Pe.prototype;var Ti=tn(1,"add"),Yi=tn(-1,"subtract");t.defaultFormat="YYYY-MM-DDTHH:mm:ssZ";var ki=te("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(t){return void 0===t?this.localeData():this.locale(t)});P(0,["gg",2],0,function(){return this.weekYear()%100}),P(0,["GG",2],0,function(){return this.isoWeekYear()%100}),On("gggg","weekYear"),On("ggggg","weekYear"),On("GGGG","isoWeekYear"),On("GGGGG","isoWeekYear"),x("weekYear","gg"),x("isoWeekYear","GG"),A("G",ti),A("g",ti),A("GG",$r,Zr),A("gg",$r,Zr),A("GGGG",Xr,Rr),A("gggg",Xr,Rr),A("GGGGG",Qr,Vr),A("ggggg",Qr,Vr),I(["gggg","ggggg","GGGG","GGGGG"],function(t,e,n,r){e[r.substr(0,2)]=_(t)}),I(["gg","GG"],function(e,n,r,i){n[i]=t.parseTwoDigitYear(e)}),P("Q",0,0,"quarter"),x("quarter","Q"),A("Q",zr),G("Q",function(t,e){e[ai]=3*(_(t)-1)}),P("D",["DD",2],"Do","date"),x("date","D"),A("D",$r),A("DD",$r,Zr),A("Do",function(t,e){return t?e._ordinalParse:e._ordinalParseLenient}),G(["D","DD"],ui),G("Do",function(t,e){e[ui]=_(t.match($r)[0],10)});var Oi=Y("Date",!0);P("d",0,"do","day"),P("dd",0,0,function(t){return this.localeData().weekdaysMin(this,t)}),P("ddd",0,0,function(t){return this.localeData().weekdaysShort(this,t)}),P("dddd",0,0,function(t){return this.localeData().weekdays(this,t)}),P("e",0,0,"weekday"),P("E",0,0,"isoWeekday"),x("day","d"),x("weekday","e"),x("isoWeekday","E"),A("d",$r),A("e",$r),A("E",$r),A("dd",ri),A("ddd",ri),A("dddd",ri),I(["dd","ddd","dddd"],function(t,e,n){var r=n._locale.weekdaysParse(t);null!=r?e.d=r:c(n).invalidWeekday=t}),I(["d","e","E"],function(t,e,n,r){e[r]=_(t)});var Ci="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),Ji="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),Pi="Su_Mo_Tu_We_Th_Fr_Sa".split("_");P("H",["HH",2],0,"hour"),P("h",["hh",2],0,function(){return this.hours()%12||12}),Zn("a",!0),Zn("A",!1),x("hour","h"),A("a",qn),A("A",qn),A("H",$r),A("h",$r),A("HH",$r,Zr),A("hh",$r,Zr),G(["H","HH"],ci),G(["a","A"],function(t,e,n){n._isPm=n._locale.isPM(t),n._meridiem=t}),G(["h","hh"],function(t,e,n){e[ci]=_(t),c(n).bigHour=!0});var Hi=/[ap]\.?m?\.?/i,ji=Y("Hours",!0);P("m",["mm",2],0,"minute"),x("minute","m"),A("m",$r),A("mm",$r,Zr),G(["m","mm"],li);var Li=Y("Minutes",!1);P("s",["ss",2],0,"second"),x("second","s"),A("s",$r),A("ss",$r,Zr),G(["s","ss"],fi);var Fi=Y("Seconds",!1);P("S",0,0,function(){return~~(this.millisecond()/100)}),P(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),P(0,["SSS",3],0,"millisecond"),P(0,["SSSS",4],0,function(){return 10*this.millisecond()}),P(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),P(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),P(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),P(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),P(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),x("millisecond","ms"),A("S",Br,zr),A("SS",Br,Zr),A("SSS",Br,qr);var Ni;for(Ni="SSSS";Ni.length<=9;Ni+="S")A(Ni,Kr);for(Ni="S";Ni.length<=9;Ni+="S")G(Ni,$n);var Ai=Y("Milliseconds",!1);P("z",0,0,"zoneAbbr"),P("zz",0,0,"zoneName");var Ui=d.prototype;Ui.add=Ti,Ui.calendar=nn,Ui.clone=rn,Ui.diff=cn,Ui.endOf=Sn,Ui.format=dn,Ui.from=pn,Ui.fromNow=mn,Ui.to=_n,Ui.toNow=gn,Ui.get=C,Ui.invalidAt=kn,Ui.isAfter=on,Ui.isBefore=sn,Ui.isBetween=an,Ui.isSame=un,Ui.isValid=Tn,Ui.lang=ki,Ui.locale=yn,Ui.localeData=vn,Ui.max=Di,Ui.min=bi,Ui.parsingFlags=Yn,Ui.set=C,Ui.startOf=wn,Ui.subtract=Yi,Ui.toArray=xn,Ui.toObject=En,Ui.toDate=Mn,Ui.toISOString=hn,Ui.toJSON=hn,Ui.toString=fn,Ui.unix=Dn,Ui.valueOf=bn,Ui.year=wi,Ui.isLeapYear=ue,Ui.weekYear=Jn,Ui.isoWeekYear=Pn,Ui.quarter=Ui.quarters=Ln,Ui.month=B,Ui.daysInMonth=X,Ui.week=Ui.weeks=de,Ui.isoWeek=Ui.isoWeeks=pe,Ui.weeksInYear=jn,Ui.isoWeeksInYear=Hn,Ui.date=Oi,Ui.day=Ui.days=Gn,Ui.weekday=In,Ui.isoWeekday=zn,Ui.dayOfYear=_e,Ui.hour=Ui.hours=ji,Ui.minute=Ui.minutes=Li,Ui.second=Ui.seconds=Fi,Ui.millisecond=Ui.milliseconds=Ai,Ui.utcOffset=Ae,Ui.utc=We,Ui.local=Ge,Ui.parseZone=Ie,Ui.hasAlignedHourOffset=ze,Ui.isDST=Ze,Ui.isDSTShifted=qe,Ui.isLocal=Re,Ui.isUtcOffset=Ve,Ui.isUtc=$e,Ui.isUTC=$e,Ui.zoneAbbr=Bn,Ui.zoneName=Xn,Ui.dates=te("dates accessor is deprecated. Use date instead.",Oi),Ui.months=te("months accessor is deprecated. Use month instead",B),Ui.years=te("years accessor is deprecated. Use year instead",wi),Ui.zone=te("moment().zone is deprecated, use moment().utcOffset instead. https://github.com/moment/moment/issues/1779",Ue);var Wi=Ui,Gi={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},Ii={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},zi="Invalid date",Zi="%d",qi=/\d{1,2}/,Ri={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},Vi=y.prototype;Vi._calendar=Gi,Vi.calendar=tr,Vi._longDateFormat=Ii,Vi.longDateFormat=er,Vi._invalidDate=zi,Vi.invalidDate=nr,Vi._ordinal=Zi,Vi.ordinal=rr,Vi._ordinalParse=qi,Vi.preparse=ir,Vi.postformat=ir,Vi._relativeTime=Ri,Vi.relativeTime=or,Vi.pastFuture=sr,Vi.set=ar,Vi.months=q,Vi._months=di,Vi.monthsShort=R,Vi._monthsShort=pi,Vi.monthsParse=V,Vi.week=le,Vi._week=Si,Vi.firstDayOfYear=he,Vi.firstDayOfWeek=fe,Vi.weekdays=Nn,Vi._weekdays=Ci,Vi.weekdaysMin=Un,Vi._weekdaysMin=Pi,Vi.weekdaysShort=An,Vi._weekdaysShort=Ji,Vi.weekdaysParse=Wn,Vi.isPM=Rn,Vi._meridiemParse=Hi,Vi.meridiem=Vn,b("en",{ordinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(t){var e=t%10,n=1===_(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th";return t+n}}),t.lang=te("moment.lang is deprecated. Use moment.locale instead.",b),t.langData=te("moment.langData is deprecated. Use moment.localeData instead.",M);var $i=Math.abs,Bi=xr("ms"),Xi=xr("s"),Qi=xr("m"),Ki=xr("h"),to=xr("d"),eo=xr("w"),no=xr("M"),ro=xr("y"),io=Tr("milliseconds"),oo=Tr("seconds"),so=Tr("minutes"),ao=Tr("hours"),uo=Tr("days"),co=Tr("months"),lo=Tr("years"),fo=Math.round,ho={s:45,m:45,h:22,d:26,M:11},po=Math.abs,mo=Pe.prototype;mo.abs=mr,mo.add=gr,mo.subtract=yr,mo.as=Dr,mo.asMilliseconds=Bi,mo.asSeconds=Xi,mo.asMinutes=Qi,mo.asHours=Ki,mo.asDays=to,mo.asWeeks=eo,mo.asMonths=no,mo.asYears=ro,mo.valueOf=Mr,mo._bubble=wr,mo.get=Er,mo.milliseconds=io,mo.seconds=oo,mo.minutes=so,mo.hours=ao,mo.days=uo,mo.weeks=Yr,mo.months=co,mo.years=lo,mo.humanize=Jr,mo.toISOString=Pr,mo.toString=Pr,mo.toJSON=Pr,mo.locale=yn,mo.localeData=vn,mo.toIsoString=te("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",Pr),mo.lang=ki,P("X",0,0,"unix"),P("x",0,0,"valueOf"),A("x",ti),A("X",ni),G("X",function(t,e,n){n._d=new Date(1e3*parseFloat(t,10))}),G("x",function(t,e,n){n._d=new Date(_(t))}),t.version="2.10.5",e(ke),t.fn=Wi,t.min=Ce,t.max=Je,t.utc=a,t.unix=Qn,t.months=lr,t.isDate=r,t.locale=b,t.invalid=f,t.duration=Be,t.isMoment=p,t.weekdays=hr,t.parseZone=Kn,t.localeData=M,t.isDuration=He,t.monthsShort=fr,t.weekdaysMin=pr,t.defineLocale=D,t.weekdaysShort=dr,t.normalizeUnits=E,t.relativeTimeThreshold=Cr;var _o=t;return _o}),function(){var rsplit=function(t,e){for(var n,r,i,o=e.exec(t),s=new Array;null!=o;)n=o.index,r=e.lastIndex,0!=n&&(i=t.substring(0,n),s.push(t.substring(0,n)),t=t.slice(n)),s.push(o[0]),t=t.slice(o[0].length),o=e.exec(t);return""==!t&&s.push(t),s},chop=function(t){return t.substr(0,t.length-1)},extend=function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};EJS=function(t){if(t="string"==typeof t?{view:t}:t,this.set_options(t),t.precompiled)return this.template={},this.template.process=t.precompiled,void EJS.update(this.name,this);if(t.element){if("string"==typeof t.element){var e=t.element;if(t.element=document.getElementById(t.element),null==t.element)throw e+"does not exist!"}this.text=t.element.value?t.element.value:t.element.innerHTML,this.name=t.element.id,this.type="["}else if(t.url){t.url=EJS.endExt(t.url,this.extMatch),this.name=this.name?this.name:t.url;var n=t.url,r=EJS.get(this.name,this.cache);if(r)return r;if(r==EJS.INVALID_PATH)return null;try{this.text=EJS.request(n+(this.cache?"":"?"+Math.random()))}catch(i){}if(null==this.text)throw{type:"EJS",message:"There is no template at "+n}}var r=new EJS.Compiler(this.text,this.type);r.compile(t,this.name),EJS.update(this.name,this),this.template=r},EJS.prototype={render:function(t,e){t=t||{},this._extra_helpers=e;var n=new EJS.Helpers(t,e||{});return this.template.process.call(t,t,n)},update:function(element,options){return"string"==typeof element&&(element=document.getElementById(element)),null==options?(_template=this,function(t){EJS.prototype.update.call(_template,element,t)}):void("string"==typeof options?(params={},params.url=options,_template=this,params.onComplete=function(request){var object=eval(request.responseText);EJS.prototype.update.call(_template,element,object)},EJS.ajax_request(params)):element.innerHTML=this.render(options))},out:function(){return this.template.out},set_options:function(t){this.type=t.type||EJS.type,this.cache=null!=t.cache?t.cache:EJS.cache,this.text=t.text||null,this.name=t.name||null,this.ext=t.ext||EJS.ext,this.extMatch=new RegExp(this.ext.replace(/\./,"."))}},EJS.endExt=function(t,e){return t?(e.lastIndex=0,t+(e.test(t)?"":this.ext)):null},EJS.Scanner=function(t,e,n){extend(this,{left_delimiter:e+"%",right_delimiter:"%"+n,double_left:e+"%%",double_right:"%%"+n,left_equal:e+"%=",left_comment:e+"%#"}),this.SplitRegexp="["==e?/(\[%%)|(%%\])|(\[%=)|(\[%#)|(\[%)|(%\]\n)|(%\])|(\n)/:new RegExp("("+this.double_left+")|(%%"+this.double_right+")|("+this.left_equal+")|("+this.left_comment+")|("+this.left_delimiter+")|("+this.right_delimiter+"\n)|("+this.right_delimiter+")|(\n)"),this.source=t,this.stag=null,this.lines=0},EJS.Scanner.to_text=function(t){return null==t||void 0===t?"":t instanceof Date?t.toDateString():t.toString?t.toString():""},EJS.Scanner.prototype={scan:function(t){if(scanline=this.scanline,regex=this.SplitRegexp,""==!this.source)for(var e=rsplit(this.source,/\n/),n=0;n0){for(var t=0;t0&&buff.push(put_cmd+'"'+clean(content)+'")'),content="";break;case e.double_left:content+=e.left_delimiter;break;default:content+=t}else switch(t){case e.right_delimiter:switch(e.stag){case e.left_delimiter:"\n"==content[content.length-1]?(content=chop(content),buff.push(content),buff.cr()):buff.push(content);break;case e.left_equal:buff.push(insert_cmd+"(EJS.Scanner.to_text("+content+")))")}e.stag=null,content="";break;case e.double_right:content+=e.right_delimiter;break;default:content+=t}}),content.length>0&&buff.push(put_cmd+'"'+clean(content)+'")'),buff.close(),this.out=buff.script+";";var to_be_evaled="/*"+name+"*/this.process = function(_CONTEXT,_VIEW) { try { with(_VIEW) { with (_CONTEXT) {"+this.out+" return ___ViewO.join('');}}}catch(e){e.lineNumber=null;throw e;}};";try{eval(to_be_evaled)}catch(e){if("undefined"==typeof JSLINT)throw e;JSLINT(this.out);for(var i=0;i").replace(/''/g,"'"):""}},EJS.newRequest=function(){for(var t=[function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new XMLHttpRequest},function(){return new ActiveXObject("Microsoft.XMLHTTP")}],e=0;ec;c++)r.push({value:c,text:c});for(var l=0;12>l;l++)i.push({value:l,text:n[l]});for(var f=0;31>f;f++)o.push({value:f+1,text:f+1});var h=this.select_tag(t+"[year]",s,r,{id:t+"[year]"}),d=this.select_tag(t+"[month]",a,i,{id:t+"[month]"}),p=this.select_tag(t+"[day]",u,o,{id:t+"[day]"});return h+d+p},EJS.Helpers.prototype.form_tag=function(t,e){return e=e||{},e.action=t,1==e.multipart&&(e.method="post",e.enctype="multipart/form-data"),this.start_tag_for("form",e)},EJS.Helpers.prototype.form_tag_end=function(){return this.tag_end("form")},EJS.Helpers.prototype.hidden_field_tag=function(t,e,n){return this.input_field_tag(t,e,"hidden",n)},EJS.Helpers.prototype.input_field_tag=function(t,e,n,r){return r=r||{},r.id=r.id||t,r.value=e||"",r.type=n||"text",r.name=t,this.single_tag_for("input",r)},EJS.Helpers.prototype.is_current_page=function(t){return window.location.href==t||window.location.pathname==t?!0:!1},EJS.Helpers.prototype.link_to=function(t,e,n){if(!t)var t="null";if(!n)var n={};return n.confirm&&(n.onclick=' var ret_confirm = confirm("'+n.confirm+'"); if(!ret_confirm){ return false;} ',n.confirm=null),n.href=e,this.start_tag_for("a",n)+t+this.tag_end("a")},EJS.Helpers.prototype.submit_link_to=function(t,e,n){if(!t)var t="null";if(!n)var n={};return n.onclick=n.onclick||"",n.confirm&&(n.onclick=' var ret_confirm = confirm("'+n.confirm+'"); if(!ret_confirm){ return false;} ',n.confirm=null),n.value=t,n.type="submit",n.onclick=n.onclick+(e?this.url_for(e):"")+"return false;",this.start_tag_for("input",n)},EJS.Helpers.prototype.link_to_if=function(t,e,n,r,i,o){return this.link_to_unless(0==t,e,n,r,i,o)},EJS.Helpers.prototype.link_to_unless=function(t,e,n,r,i){return r=r||{},t?i&&"function"==typeof i?i(e,n,r,i):e:this.link_to(e,n,r)},EJS.Helpers.prototype.link_to_unless_current=function(t,e,n,r){return n=n||{},this.link_to_unless(this.is_current_page(e),t,e,n,r)},EJS.Helpers.prototype.password_field_tag=function(t,e,n){return this.input_field_tag(t,e,"password",n)},EJS.Helpers.prototype.select_tag=function(t,e,n,r){r=r||{},r.id=r.id||t,r.value=e,r.name=t;var i="";i+=this.start_tag_for("select",r);for(var o=0;o")},EJS.Helpers.prototype.start_tag_for=function(t,e){return this.tag(t,e)},EJS.Helpers.prototype.submit_tag=function(t,e){return e=e||{},e.type=e.type||"submit",e.value=t||"Submit",this.single_tag_for("input",e)},EJS.Helpers.prototype.tag=function(t,e,n){if(!n)var n=">";var r=" ";for(var i in e){if(null!=e[i])var o=e[i].toString();else var o="";"Class"==i&&(i="class"),r+=-1!=o.indexOf("'")?i+'="'+o+'" ':i+"='"+o+"' "}return"<"+t+r+n},EJS.Helpers.prototype.tag_end=function(t){return""},EJS.Helpers.prototype.text_area_tag=function(t,e,n){return n=n||{},n.id=n.id||t,n.name=n.name||t,e=e||"",n.size&&(n.cols=n.size.split("x")[0],n.rows=n.size.split("x")[1],delete n.size),n.cols=n.cols||50,n.rows=n.rows||4,this.start_tag_for("textarea",n)+e+this.tag_end("textarea")},EJS.Helpers.prototype.text_tag=EJS.Helpers.prototype.text_area_tag,EJS.Helpers.prototype.text_field_tag=function(t,e,n){return this.input_field_tag(t,e,"text",n)},EJS.Helpers.prototype.url_for=function(t){return'window.location="'+t+'";'},EJS.Helpers.prototype.img_tag=function(t,e,n){return n=n||{},n.src=t,n.alt=e,this.single_tag_for("img",n)}; diff --git a/app/src/main/assets/js/route.js b/app/src/main/assets/js/route.js new file mode 100644 index 0000000..d98c2bc --- /dev/null +++ b/app/src/main/assets/js/route.js @@ -0,0 +1,58 @@ +var ROUTE; +ROUTE = { + + preUrl: '/', + + lastUpdated: null, + preCache: function () { + this._routes = new EJS({ + url: 'ejs/routes.ejs' + }); + }, + elmCache: {}, + routeID:null, + + init: function () { + console.log('INIT'); + this.preCache(); + // this.getUpdatedTimes(); + }, + getRoute: function (id) { + var self, feedUrl, dest, jsonData; + self = this; + feedUrl = this.preUrl + 'getroute?route=' + id; + + console.log(feedUrl); + + jsonData = Android.getJson(feedUrl); + + if (jsonData != '') { + self.displayRoute(JSON.parse(jsonData)); + } + }, + displayRoute(data) { + console.log(data); + if (this.elmCache.dest$ == null) { + this.elmCache.dest$ = $('#trainResults'); + } + + var html = this._routes.render(data); + + this.elmCache.dest$.empty(); + this.elmCache.dest$.append(html); + + }, + getRouteId: function() { + console.log('getRouteId'); + routeID = Android.getRoute(); + console.log(routeID); + this.displayRoute(JSON.parse(routeID)); + } + +}; + + +Zepto(function ($) { + ROUTE.init(); + ROUTE.getRouteId(); +}); \ No newline at end of file diff --git a/app/src/main/assets/js/zprogress.js b/app/src/main/assets/js/zprogress.js new file mode 100644 index 0000000..ee3ed93 --- /dev/null +++ b/app/src/main/assets/js/zprogress.js @@ -0,0 +1,74 @@ +// zprogress (c) 2013 Thomas Fuchs +// MIT-licensed - https://github.com/madrobby/zprogress + +;(function($){ + var html = + ''+ + '
', + $wrapper, $indicator, value, timeout, + MARGIN = 12.5, + LMARGIN = MARGIN/100, + RMARGIN = 1 - LMARGIN + + function init(){ + if($wrapper) return + + $('body').append(html) + $wrapper = $('#zprogress') + $indicator = $('#zprogress_indicator') + } + + function anim(){ + $indicator.animate({ translateX: value*100+'%' }, 200) + } + + function clear(){ + if(timeout) clearTimeout(timeout) + timeout = undefined + } + + function trickle(){ + timeout = setTimeout(function(){ + $.zprogress.inc((RMARGIN-value)*.035*Math.random()) + trickle() + }, 350+(400*Math.random())) + } + + $.zprogress = { + start: function(){ + init() + clear() + value = LMARGIN + $wrapper.animate({ opacity: 1 }) + $indicator.animate({ translateX: '0%' }, 0) + setTimeout(function(){ + anim() + trickle() + },0) + }, + inc: function(delta){ + if(value + + + + + Feedmaster + + + + + + + + + + + + + + + + + +

Details

+ +
+
+ + + + diff --git a/app/src/main/java/com/silvrtree/traintimes/MainActivity.java b/app/src/main/java/com/silvrtree/traintimes/MainActivity.java new file mode 100644 index 0000000..47a46c8 --- /dev/null +++ b/app/src/main/java/com/silvrtree/traintimes/MainActivity.java @@ -0,0 +1,329 @@ +package com.silvrtree.traintimes; + +import android.content.Context; +import android.net.ConnectivityManager; +import android.net.NetworkInfo; +import android.os.Bundle; +import android.support.v4.app.FragmentTransaction; +import android.support.v7.app.AppCompatActivity; +import android.util.Log; +import android.view.Menu; +import android.view.MenuItem; +import android.view.View; +import android.webkit.JavascriptInterface; +import android.webkit.WebSettings; +import android.webkit.WebView; +import android.widget.FrameLayout; +import android.widget.ProgressBar; +import android.widget.Toast; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.URL; +import java.net.URLConnection; + +public class MainActivity extends AppCompatActivity { + + private static final String TAG = MainActivity.class.getSimpleName(); + private WebView mWebView; + private StopsFragment stopsFragment; + private Menu storedMenu; + + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + mWebView = (WebView) findViewById(R.id.activity_main_webview); + + WebSettings webSettings = mWebView.getSettings(); + webSettings.setJavaScriptEnabled(true); + webSettings.setDomStorageEnabled(true); + webSettings.setAllowFileAccessFromFileURLs(true); //Maybe you don't need this rule + webSettings.setAllowUniversalAccessFromFileURLs(true); + + + mWebView.addJavascriptInterface(new JsObject(), "Android"); + mWebView.loadUrl("file:///android_asset/feeds.html"); + } + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + // Inflate the menu; this adds items to the action bar if it is present. + getMenuInflater().inflate(R.menu.menu_main, menu); + storedMenu = menu; + return true; + } + + public void showStopsMenu() { + MainActivity.this.runOnUiThread(new Runnable() { + public void run() { + + storedMenu.findItem(R.id.action_pygglc).setVisible(false); + storedMenu.findItem(R.id.action_glcptk).setVisible(false); + storedMenu.findItem(R.id.action_ptkdbc).setVisible(false); + storedMenu.findItem(R.id.action_glqdbc).setVisible(false); + storedMenu.findItem(R.id.action_refresh).setVisible(false); + storedMenu.findItem(R.id.action_refresh).setVisible(false); + storedMenu.findItem(R.id.action_return).setVisible(true); + } + }); + + + } + + public void showProperMenu() { + MainActivity.this.runOnUiThread(new Runnable() { + public void run() { + + storedMenu.findItem(R.id.action_pygglc).setVisible(true); + storedMenu.findItem(R.id.action_glcptk).setVisible(true); + storedMenu.findItem(R.id.action_ptkdbc).setVisible(true); + storedMenu.findItem(R.id.action_glqdbc).setVisible(true); + storedMenu.findItem(R.id.action_refresh).setVisible(true); + storedMenu.findItem(R.id.action_refresh).setVisible(true); + storedMenu.findItem(R.id.action_return).setVisible(false); + } + }); + + + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + // Handle action bar item clicks here. The action bar will + // automatically handle clicks on the Home/Up button, so long + // as you specify a parent activity in AndroidManifest.xml. + int id = item.getItemId(); + + //noinspection SimplifiableIfStatement + if (id == R.id.action_refresh) { + removeFragment(); + doRefresh(); + return true; + } + + if (id == R.id.action_pygglc) { + //doGetPYGGLC(); + removeFragment(); + doGetTrains("pyg", "glc"); + return true; + } + + if (id == R.id.action_glcptk) { + removeFragment(); + doGetTrains("glc","ptk"); + return true; + } + + if (id == R.id.action_ptkdbc) { + removeFragment(); + doGetTrains("ptk","dbc"); + return true; + } + + if (id == R.id.action_glqdbc) { + removeFragment(); + doGetTrains("glq","dbc"); + return true; + } + + if (id == R.id.action_test) { + FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); + ft.setCustomAnimations(R.anim.frag_in, R.anim.frag_out); + if (stopsFragment == null) { + stopsFragment = StopsFragment.newInstance("bobbbbbb"); + ft.replace(R.id.fragment_placeholder, stopsFragment); + } + else + { + + stopsFragment.showStops(); + ft.show(stopsFragment); + } + + + ft.commit(); + showStopsMenu(); + //showStops + + } + + if (id == R.id.action_return) { + removeFragment(); + showProperMenu(); + + } + // getTrains + return super.onOptionsItemSelected(item); + } + + public void removeFragment() { + if (stopsFragment != null && stopsFragment.isAdded()) { + Log.d(TAG, "Fragment exists"); + FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); + ft.setCustomAnimations(R.anim.frag_in, R.anim.frag_out); + ft.hide(stopsFragment); + ft.commit(); + } + } + public void doRefresh() { + if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) { + // showProgress(); + mWebView.evaluateJavascript("APP.getUpdatedTimes();", null); + } else { + mWebView.loadUrl("javascript:APP.getUpdatedTimes();"); + } + } + + public void doGetPYGGLC() { + if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) { + // showProgress(); + mWebView.evaluateJavascript("APP.getTrains('pyg','glc');", null); + } else { + mWebView.loadUrl("javascript:APP.getTrains('pyg','glc');"); + } + } + + public void doGetTrains(String From, String To) { + if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) { + // showProgress(); + mWebView.evaluateJavascript("APP.getTrains('" + From + "','" + To + "');", null); + } else { + mWebView.loadUrl("javascript:APP.getTrains('" + From + "','" + To + "');"); + } + } + + public void doShowRoute(String route) { + FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); + ft.setCustomAnimations(R.anim.frag_in, R.anim.frag_out); + if (stopsFragment == null) { + stopsFragment = StopsFragment.newInstance(route); + ft.replace(R.id.fragment_placeholder, stopsFragment); + } + else + { + + stopsFragment.showStops(); + ft.show(stopsFragment); + } + + showStopsMenu(); + ft.commit(); + + } + + class JsObject { + Context mContext; + + @JavascriptInterface + public String toString() { + return "injectedObject"; + } + + @JavascriptInterface + public void showToast(String toast) { + Toast.makeText(getApplicationContext(), toast, Toast.LENGTH_SHORT).show(); + } + + @JavascriptInterface + public void showProgress() { + MainActivity.this.runOnUiThread(new Runnable() { + public void run() { + FrameLayout fl = (FrameLayout) findViewById(R.id.ProgressLayout); + fl.setVisibility(View.VISIBLE); + } + }); + + } + + + @JavascriptInterface + public void hideProgress() { + MainActivity.this.runOnUiThread(new Runnable() { + public void run() { + FrameLayout fl = (FrameLayout) findViewById(R.id.ProgressLayout); + fl.setVisibility(View.INVISIBLE); + } + }); + } + + @JavascriptInterface + public String getJson(String feedName) { + + String parsedString = ""; + + try { + + URL url = new URL("https://www.silvrtree.co.uk" + feedName); + Log.d(TAG, url.getPath()); + + URLConnection conn = url.openConnection(); + + HttpURLConnection httpConn = (HttpURLConnection) conn; + httpConn.setAllowUserInteraction(false); + httpConn.setInstanceFollowRedirects(true); + httpConn.setRequestMethod("GET"); + httpConn.connect(); + + InputStream is = httpConn.getInputStream(); + parsedString = convertinputStreamToString(is); + + + } catch (Exception e) { + e.printStackTrace(); + } + return parsedString; + } + + @JavascriptInterface + public boolean isNetworkAvailable() { + ConnectivityManager connectivityManager + = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); + NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo(); + return activeNetworkInfo != null && activeNetworkInfo.isConnected(); + } + + @JavascriptInterface + public void setRoute(String route) { + Log.d(TAG, "Setting route: " + route); + String feedUrl = "/getroute?route=" + route; + String routeData = getJson(feedUrl); + + doShowRoute(routeData); + } + } + + private void threadShowProgress() { + ProgressBar pb = (ProgressBar) findViewById(R.id.pbLoading); + pb.setVisibility(ProgressBar.VISIBLE); + + } + + + public static String convertinputStreamToString(InputStream ists) + throws IOException { + if (ists != null) { + StringBuilder sb = new StringBuilder(); + String line; + + try { + BufferedReader r1 = new BufferedReader(new InputStreamReader( + ists, "UTF-8")); + while ((line = r1.readLine()) != null) { + sb.append(line).append("\n"); + } + } finally { + ists.close(); + } + return sb.toString(); + } else { + return ""; + } + } + +} diff --git a/app/src/main/java/com/silvrtree/traintimes/StopsFragment.java b/app/src/main/java/com/silvrtree/traintimes/StopsFragment.java new file mode 100644 index 0000000..6f17bba --- /dev/null +++ b/app/src/main/java/com/silvrtree/traintimes/StopsFragment.java @@ -0,0 +1,123 @@ +package com.silvrtree.traintimes; + +import android.os.Bundle; +import android.support.v4.app.Fragment; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.webkit.WebView; +import android.widget.TextView; + +import org.json.JSONException; +import org.json.JSONObject; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; + + +/** + * Created by marti on 13/01/2016. + */ + +public class StopsFragment extends Fragment { + private static final String TAG = StopsFragment.class.getSimpleName(); + private View stopsView; + private String serviceID; + private String routeDataSource; + private JSONObject routeData; + + public static StopsFragment newInstance(String data) { + Log.d(TAG, "newInstance"); + StopsFragment stopsFragment = new StopsFragment(); + Bundle args = new Bundle(); + args.putString("routeDataSource", data); + stopsFragment.setArguments(args); + return stopsFragment; + } + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + // Get back arguments + Log.d(TAG, "onCreate"); + routeDataSource = getArguments().getString("routeData", ""); + Log.d(TAG, serviceID); + try { + routeData = new JSONObject(routeDataSource); + } catch (JSONException e) { + e.printStackTrace(); + } + // routeData = getJson(serviceID); + showStops(); + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + // Defines the xml file for the fragment + View view = inflater.inflate(R.layout.fragment_stops, container, false); + + stopsView = view; + return view; + } + + @Override + public void onActivityCreated(Bundle savedInstanceState) { + super.onActivityCreated(savedInstanceState); + + Log.d(TAG, "onActivityCreated"); + + } + + @Override + public void onStart() { + super.onStart(); + Log.d(TAG, "onStart"); + showStops(serviceID); + } + + @Override + public void onResume() { + super.onResume(); + Log.d(TAG, "onResume"); + + } + + public void showStops() { + // do something in fragment + Log.d(TAG, "showstops: " ); + + TextView stationName = stopsView.findItem(R.id.action_pygglc); + + + } + + + + + public static String convertinputStreamToString(InputStream ists) + throws IOException { + if (ists != null) { + StringBuilder sb = new StringBuilder(); + String line; + + try { + BufferedReader r1 = new BufferedReader(new InputStreamReader( + ists, "UTF-8")); + while ((line = r1.readLine()) != null) { + sb.append(line).append("\n"); + } + } finally { + ists.close(); + } + return sb.toString(); + } else { + return ""; + } + } + + +} diff --git a/app/src/main/res/anim/frag_in.xml b/app/src/main/res/anim/frag_in.xml new file mode 100644 index 0000000..72d1e4e --- /dev/null +++ b/app/src/main/res/anim/frag_in.xml @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/anim/frag_out.xml b/app/src/main/res/anim/frag_out.xml new file mode 100644 index 0000000..25783b1 --- /dev/null +++ b/app/src/main/res/anim/frag_out.xml @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_menu_refresh.xml b/app/src/main/res/drawable/ic_menu_refresh.xml new file mode 100644 index 0000000..46817c9 --- /dev/null +++ b/app/src/main/res/drawable/ic_menu_refresh.xml @@ -0,0 +1,25 @@ + + + + diff --git a/app/src/main/res/drawable/perm_group_sync_settings.png b/app/src/main/res/drawable/perm_group_sync_settings.png new file mode 100644 index 0000000..252a2a0 Binary files /dev/null and b/app/src/main/res/drawable/perm_group_sync_settings.png differ diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..5d96161 --- /dev/null +++ b/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,55 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_stops.xml b/app/src/main/res/layout/fragment_stops.xml new file mode 100644 index 0000000..4d2aa9e --- /dev/null +++ b/app/src/main/res/layout/fragment_stops.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/menu/menu_main.xml b/app/src/main/res/menu/menu_main.xml new file mode 100644 index 0000000..7fb2a22 --- /dev/null +++ b/app/src/main/res/menu/menu_main.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/menu/menu_return.xml b/app/src/main/res/menu/menu_return.xml new file mode 100644 index 0000000..d15f66d --- /dev/null +++ b/app/src/main/res/menu/menu_return.xml @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..a92d9ff Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..941be78 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..9320dbb Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..7434f17 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..e229290 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/values-w820dp/dimens.xml b/app/src/main/res/values-w820dp/dimens.xml new file mode 100644 index 0000000..63fc816 --- /dev/null +++ b/app/src/main/res/values-w820dp/dimens.xml @@ -0,0 +1,6 @@ + + + 64dp + diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml new file mode 100644 index 0000000..3ab3e9c --- /dev/null +++ b/app/src/main/res/values/colors.xml @@ -0,0 +1,6 @@ + + + #3F51B5 + #303F9F + #FF4081 + diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml new file mode 100644 index 0000000..47c8224 --- /dev/null +++ b/app/src/main/res/values/dimens.xml @@ -0,0 +1,5 @@ + + + 16dp + 16dp + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml new file mode 100644 index 0000000..dbd10a1 --- /dev/null +++ b/app/src/main/res/values/strings.xml @@ -0,0 +1,8 @@ + + TrainTimes + Paisley to Glasgow Central + Glasgow Central to Partick + Partick to Dumbarton Central + Glasgow Queen Street to Dumbarton Central + Refresh Times + diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..5885930 --- /dev/null +++ b/app/src/main/res/values/styles.xml @@ -0,0 +1,11 @@ + + + + + + diff --git a/app/src/test/java/com/silvrtree/traintimes/ExampleUnitTest.java b/app/src/test/java/com/silvrtree/traintimes/ExampleUnitTest.java new file mode 100644 index 0000000..9cef1d8 --- /dev/null +++ b/app/src/test/java/com/silvrtree/traintimes/ExampleUnitTest.java @@ -0,0 +1,15 @@ +package com.silvrtree.traintimes; + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * To work on unit tests, switch the Test Artifact in the Build Variants view. + */ +public class ExampleUnitTest { + @Test + public void addition_isCorrect() throws Exception { + assertEquals(4, 2 + 2); + } +} \ No newline at end of file diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..e0b366a --- /dev/null +++ b/build.gradle @@ -0,0 +1,23 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. + +buildscript { + repositories { + jcenter() + } + dependencies { + classpath 'com.android.tools.build:gradle:1.5.0' + + // NOTE: Do not place your application dependencies here; they belong + // in the individual module build.gradle files + } +} + +allprojects { + repositories { + jcenter() + } +} + +task clean(type: Delete) { + delete rootProject.buildDir +} diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..1d3591c --- /dev/null +++ b/gradle.properties @@ -0,0 +1,18 @@ +# Project-wide Gradle settings. + +# IDE (e.g. Android Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. + +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html + +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +# Default value: -Xmx10248m -XX:MaxPermSize=256m +# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 + +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. More details, visit +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +# org.gradle.parallel=true \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..05ef575 Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..f23df6e --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Wed Oct 21 11:34:03 PDT 2015 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip diff --git a/gradlew b/gradlew new file mode 100644 index 0000000..9d82f78 --- /dev/null +++ b/gradlew @@ -0,0 +1,160 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..8a0b282 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..e7b4def --- /dev/null +++ b/settings.gradle @@ -0,0 +1 @@ +include ':app'