PageRenderTime 45ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/build/Debug-iphonesimulator/iOP.app/www/js/index.js

https://bitbucket.org/davbaumgartner/iop
JavaScript | 76 lines | 55 code | 3 blank | 18 comment | 0 complexity | 4b96ddc2a610a1a87a2ee480a99e7a01 MD5 | raw file
  1. /*
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing,
  13. * software distributed under the License is distributed on an
  14. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  15. * KIND, either express or implied. See the License for the
  16. * specific language governing permissions and limitations
  17. * under the License.
  18. */
  19. var iOP = {
  20. current_page:'LC',
  21. timers:{},
  22. swap:'',
  23. init: function() {
  24. this.
  25. },
  26. liquidC: function() {
  27. document.getElementById('calflow').value = document.getElementById('volume')/document.getElementById()
  28. },
  29. timer: function(element) {
  30. function uniqid(c,e){
  31. function d(b,a){b=parseInt(b,10).toString(16);return a<b.length?b.slice(b.length-a):a>b.length?Array(1+(a-b.length)).join("0")+b:b}"undefined"==typeof c&&(c="");var a;this.a||(this.a={});this.a.b||(this.a.b=Math.floor(123456789*Math.random()));this.a.b++;a=c+d(parseInt((new Date).getTime()/1E3,10),8);a+=d(this.a.b,5);e&&(a+=(10*Math.random()).toFixed(8).toString());return a
  32. }
  33. function showTimer(timerid) {
  34. element.value = Date().getTime()-(this.timers[timerid]['time']);
  35. }
  36. function startTimer() {
  37. var _timerid = uniqid();
  38. this.timers[_timerid] = {'time':Date().getTime(),'last':false};
  39. this.swap = _timerid;
  40. return _timerid;
  41. }
  42. function stopTimer(timerid) {
  43. clearInterval(this.timers[timerid]['timer'])
  44. this.timers[timerid]['last'] = Date().getTime();
  45. element.value = (this.timers[timerid]['last'])-(this.timers[timerid]['time']);
  46. element.addEventListener('onclick',function() {
  47. });
  48. var timer = startTimer(),
  49. inter = setInterval(showTimer,500),
  50. timername = this.swap;
  51. this.timers[timername]['timer'] = inter;
  52. }
  53. },
  54. }
  55. var app = {
  56. initialize: function() {
  57. this.bindEvents();
  58. },
  59. bindEvents: function() {
  60. document.addEventListener('deviceready', this.onDeviceReady, false);
  61. },
  62. onDeviceReady: function() {
  63. app.receivedEvent('deviceready');
  64. },
  65. receivedEvent: function(id) {
  66. var parentElement = document.getElementById(id);
  67. var listeningElement = parentElement.querySelector('.listening');
  68. var receivedElement = parentElement.querySelector('.received');
  69. listeningElement.setAttribute('style', 'display:none;');
  70. receivedElement.setAttribute('style', 'display:block;');
  71. console.log('Received Event: ' + id);
  72. }
  73. };