forked from cfjedimaster/Cordova-Examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c01e4db
commit 3b5ca25
Showing
29 changed files
with
130,202 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# http://editorconfig.org | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
indent_style = space | ||
indent_size = 2 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[*.md] | ||
insert_final_newline = false | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Specifies intentionally untracked files to ignore when using Git | ||
# http://git-scm.com/docs/gitignore | ||
|
||
node_modules/ | ||
platforms/ | ||
plugins/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#mainVideo { | ||
width: 100%; | ||
height: 100%; | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width"> | ||
<title></title> | ||
|
||
<link href="lib/ionic/css/ionic.css" rel="stylesheet"> | ||
<link href="css/style.css" rel="stylesheet"> | ||
|
||
<!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above | ||
<link href="css/ionic.app.css" rel="stylesheet"> | ||
--> | ||
|
||
<!-- ionic/angularjs js --> | ||
<script src="lib/ionic/js/ionic.bundle.js"></script> | ||
|
||
<!-- cordova script (this will be a 404 during development) --> | ||
<script src="cordova.js"></script> | ||
|
||
<!-- your app's js --> | ||
<script src="js/app.js"></script> | ||
</head> | ||
<body ng-app="starter"> | ||
|
||
<ion-pane> | ||
<ion-header-bar class="bar-dark"> | ||
<h1 class="title">Apple Arial Viewer</h1> | ||
</ion-header-bar> | ||
<ion-content ng-controller="MainCtrl"> | ||
<ion-refresher | ||
pulling-text="Pull to select new video..." | ||
on-refresh="loadVideo()"> | ||
</ion-refresher> | ||
<video autoplay loop id="mainVideo" controls2> | ||
<source src="" /> | ||
</video> | ||
</ion-content> | ||
</ion-pane> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
// Ionic Starter App | ||
|
||
// angular.module is a global place for creating, registering and retrieving Angular modules | ||
// 'starter' is the name of this angular module example (also set in a <body> attribute in index.html) | ||
// the 2nd parameter is an array of 'requires' | ||
angular.module('starter', ['ionic']) | ||
|
||
.controller('MainCtrl', function($scope, AppleVideoService) { | ||
|
||
$scope.loadVideo = function() { | ||
AppleVideoService.getVideo().then(function(vid) { | ||
console.log(vid.url); | ||
document.querySelector("#mainVideo source").setAttribute("src", vid.url); | ||
document.querySelector("#mainVideo").load(); | ||
$scope.$broadcast('scroll.refreshComplete'); | ||
}); | ||
}; | ||
|
||
$scope.loadVideo(); | ||
|
||
}) | ||
.factory('AppleVideoService', function($http,$q) { | ||
|
||
var jsonURL = "http://a1.phobos.apple.com/us/r1000/000/Features/atv/AutumnResources/videos/entries.json"; | ||
var videoData = ""; | ||
|
||
//http://stackoverflow.com/a/7228322 | ||
var randomIntFromInterval = function (min,max) { | ||
return Math.floor(Math.random()*(max-min+1)+min); | ||
} | ||
|
||
/* | ||
first, I determine if night or data | ||
then, I pick a random video matching that | ||
*/ | ||
var randomVideo = function() { | ||
//what time is it? | ||
var hour = new Date().getHours(); | ||
if(hour > 6 && hour < 18) { | ||
return videoData.day[randomIntFromInterval(0, videoData.day.length)]; | ||
} else { | ||
return videoData.night[randomIntFromInterval(0, videoData.night.length)]; | ||
} | ||
}; | ||
|
||
/* | ||
I convert Apple's JSON into two array of day and night videos. That makes it easier to pick a random one. | ||
*/ | ||
var process = function(data) { | ||
var processed = {night:[], day:[]}; | ||
for(var i=0; i<data.length;i++) { | ||
for(var video in data[i].assets) { | ||
if(data[i].assets[video].timeOfDay === "day") { | ||
processed.day.push(data[i].assets[video]); | ||
} else { | ||
processed.night.push(data[i].assets[video]); | ||
} | ||
} | ||
} | ||
return processed; | ||
}; | ||
|
||
return { | ||
|
||
getVideo:function() { | ||
var deferred = $q.defer(); | ||
if(videoData === "") { | ||
$http.get(jsonURL).success(function(data) { | ||
videoData = process(data); | ||
deferred.resolve(randomVideo()); | ||
}); | ||
} else deferred.resolve(randomVideo()); | ||
return deferred.promise; | ||
} | ||
|
||
}; | ||
|
||
}) | ||
.run(function($ionicPlatform) { | ||
$ionicPlatform.ready(function() { | ||
// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard | ||
// for form inputs) | ||
if(window.cordova && window.cordova.plugins.Keyboard) { | ||
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true); | ||
} | ||
if(window.StatusBar) { | ||
StatusBar.styleDefault(); | ||
} | ||
|
||
|
||
}); | ||
}) |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
2,230 changes: 2,230 additions & 0 deletions
2,230
arialscreensaver/www/lib/ionic/fonts/ionicons.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Oops, something went wrong.