Added image upload and display

This commit is contained in:
Jake Howard 2015-12-22 22:38:27 +00:00
parent f277e8494e
commit a3c580aae0
3 changed files with 13 additions and 1 deletions

View file

@ -7,7 +7,7 @@
"create-build-dirs": "mkdir -p www/js www/css www/img", "create-build-dirs": "mkdir -p www/js www/css www/img",
"test": "npm run lint", "test": "npm run lint",
"build": "npm run create-build-dirs && npm run build-fonts && npm run build-images && npm run build-html && npm run build-js && npm run build-less", "build": "npm run create-build-dirs && npm run build-fonts && npm run build-images && npm run build-html && npm run build-js && npm run build-less",
"build-html": "cp src/index.html www/", "build-html": "cp src/*.html www/",
"build-fonts": "cp -R node_modules/bootstrap/dist/fonts www && cp -R node_modules/ionicons/fonts www ", "build-fonts": "cp -R node_modules/bootstrap/dist/fonts www && cp -R node_modules/ionicons/fonts www ",
"build-less": "lessc --silent src/less/style.less www/css/style.css && cleancss -d --s0 -o www/css/style.css www/css/style.css", "build-less": "lessc --silent src/less/style.less www/css/style.css && cleancss -d --s0 -o www/css/style.css www/css/style.css",
"build-js": "./scripts/build-js.sh", "build-js": "./scripts/build-js.sh",

View file

@ -19,6 +19,7 @@
</div> </div>
<footer> <footer>
<a class="btn btn-success btn-lg animated pulse infinite">Open Document / Images</a> <a class="btn btn-success btn-lg animated pulse infinite">Open Document / Images</a>
<input type="file" style="display: none" />
</footer> </footer>
<script type="text/javascript" src="cordova.js"></script> <script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="js/libs.js"></script> <script type="text/javascript" src="js/libs.js"></script>

View file

@ -17,3 +17,14 @@ document.addEventListener("deviceready", function () {
var watchID = navigator.compass.watchHeading(onSuccess, onError, options); var watchID = navigator.compass.watchHeading(onSuccess, onError, options);
}, false); }, false);
$('footer .btn').click(function(e) {
$('footer input').trigger('click');
});
$('footer input').on('change', function () {
const file = $(this)[0].files[0];
let reader = new FileReader();
reader.onload = function(e) { $('#compass').attr('src', e.target.result); };
reader.readAsDataURL(file);
});