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
Showing
91 changed files
with
59,781 additions
and
5,179 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
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
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
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
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
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 |
---|---|---|
@@ -1,26 +1,27 @@ | ||
'use strict'; | ||
|
||
var battery = navigator.battery || navigator.webkitBattery || navigator.mozBattery; | ||
var battery = navigator.battery || navigator.webkitBattery || | ||
navigator.mozBattery; | ||
|
||
function log(message){ | ||
function log(message) { | ||
document.querySelector('#data').innerHTML += message + '<br />'; | ||
} | ||
|
||
function logBattery(battery) { | ||
log('Battery level: ' + battery.level); | ||
log('Battery charging: ' + battery.charging); | ||
log('Battery discharging time: ', battery.dischargingTime); | ||
battery.addEventListener('chargingchange', function() { | ||
log('Battery chargingchange event: ' + battery.charging); | ||
}, false); | ||
log('Battery level: ' + battery.level); | ||
log('Battery charging: ' + battery.charging); | ||
log('Battery discharging time: ', battery.dischargingTime); | ||
battery.addEventListener('chargingchange', function() { | ||
log('Battery chargingchange event: ' + battery.charging); | ||
}, false); | ||
} | ||
|
||
if(navigator.getBattery) { | ||
navigator.getBattery().then(logBattery, function() { | ||
log('There was an error while getting the battery state.'); | ||
}); | ||
if (navigator.getBattery) { | ||
navigator.getBattery().then(logBattery, function() { | ||
log('There was an error while getting the battery state.'); | ||
}); | ||
} else if (battery) { | ||
logBattery(battery); | ||
logBattery(battery); | ||
} else { | ||
log('Shame! The Battery API is not supported on this platform.'); | ||
log('Shame! The Battery API is not supported on this platform.'); | ||
} |
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 |
---|---|---|
@@ -1,20 +1,26 @@ | ||
module.exports = function(grunt){ | ||
grunt.loadTasks('./indexgen'); | ||
grunt.initConfig({ | ||
index: { | ||
src: {'app':'tmpl/app-index.tmpl', 'main':'tmpl/main-index.tmpl'}, | ||
dest: {'app':'../<%= feature.new %>/index.html', 'main': '../index.html'}, | ||
js: '../<%= feature.new%>/js', | ||
feature: '../<%= feature.new %>' | ||
} | ||
|
||
}); | ||
|
||
grunt.registerTask('default', 'index'); | ||
|
||
if(!grunt.option('feature')){ | ||
grunt.fail.fatal("Please check the usage [ --feature is mandatory ]"); | ||
} | ||
|
||
grunt.config.set('feature.new',grunt.option('feature')); | ||
} | ||
module.exports = function(grunt) { | ||
grunt.loadTasks('./indexgen'); | ||
grunt.initConfig({ | ||
index: { | ||
src: { | ||
'app': 'tmpl/app-index.tmpl', | ||
'main': 'tmpl/main-index.tmpl' | ||
}, | ||
dest: { | ||
'app': '../<%= feature.new %>/index.html', | ||
'main': '../index.html' | ||
}, | ||
js: '../<%= feature.new%>/js', | ||
feature: '../<%= feature.new %>' | ||
} | ||
|
||
}); | ||
|
||
grunt.registerTask('default', 'index'); | ||
|
||
if (!grunt.option('feature')) { | ||
grunt.fail.fatal("Please check the usage [ --feature is mandatory ]"); | ||
} | ||
|
||
grunt.config.set('feature.new', grunt.option('feature')); | ||
} |
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 |
---|---|---|
@@ -1,15 +1,15 @@ | ||
module.exports = function( grunt ) { | ||
grunt.registerTask( "index", "Generate index.html depending on configuration", function() { | ||
var conf = grunt.config('index'), | ||
appTmpl = grunt.file.read(conf.src.app), | ||
mainTmpl = grunt.file.read(conf.src.main), | ||
mainjs = conf.js+"/main.js"; | ||
|
||
grunt.file.mkdir(conf.js); | ||
grunt.file.write(mainjs,'//Replace with main logic') | ||
grunt.file.write(conf.dest.app, grunt.template.process(appTmpl)); | ||
grunt.log.writeln('Generated \'' + conf.dest.app + '\' from \'' + conf.src.app + '\''); | ||
grunt.file.write(conf.dest.main, grunt.template.process(mainTmpl)); | ||
grunt.log.writeln('Generated \'' + conf.dest.main + '\' from \'' + conf.src.main + '\''); | ||
}); | ||
} | ||
module.exports = function(grunt) { | ||
grunt.registerTask("index", "Generate index.html depending on configuration", function() { | ||
var conf = grunt.config('index'), | ||
appTmpl = grunt.file.read(conf.src.app), | ||
mainTmpl = grunt.file.read(conf.src.main), | ||
mainjs = conf.js + "/main.js"; | ||
|
||
grunt.file.mkdir(conf.js); | ||
grunt.file.write(mainjs, '//Replace with main logic') | ||
grunt.file.write(conf.dest.app, grunt.template.process(appTmpl)); | ||
grunt.log.writeln('Generated \'' + conf.dest.app + '\' from \'' + conf.src.app + '\''); | ||
grunt.file.write(conf.dest.main, grunt.template.process(mainTmpl)); | ||
grunt.log.writeln('Generated \'' + conf.dest.main + '\' from \'' + conf.src.main + '\''); | ||
}); | ||
} |
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
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
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
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 |
---|---|---|
@@ -1,15 +1,17 @@ | ||
'use strict'; | ||
|
||
var logoElement = document.getElementById('orientee'); | ||
|
||
function handleDeviceOrientation(e) { | ||
var transform = 'rotate(' + e.gamma + 'deg) rotate3d(1, 0, 0, ' + e.beta + 'deg)'; | ||
var transform = 'rotate(' + e.gamma + 'deg) rotate3d(1, 0, 0, ' + | ||
e.beta + 'deg)'; | ||
logoElement.style.webkitTransform = transform; | ||
logoElement.style.transform = transform; | ||
} | ||
|
||
if (window.DeviceOrientationEvent) { | ||
window.ondeviceorientation = handleDeviceOrientation; | ||
} else { | ||
document.querySelector('p#isAvailable').innerHTML = 'Device Orientation is not available.'; | ||
document.querySelector('p#isAvailable').innerHTML = | ||
'Device Orientation is not available.'; | ||
} | ||
|
Oops, something went wrong.