Advertisement
Guest User

index.js

a guest
Feb 11th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.06 KB | None | 0 0
  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 ref;
  20. var openPage = function() {
  21. ref = cordova.InAppBrowser.open('http://forritun.fss.is:1010', '_self', 'location=yes');
  22. }
  23. var app = {
  24. // Application Constructor
  25. initialize: function() {
  26. this.bindEvents();
  27. },
  28. // Bind Event Listeners
  29. //
  30. // Bind any events that are required on startup. Common events are:
  31. // 'load', 'deviceready', 'offline', and 'online'.
  32. bindEvents: function() {
  33. document.addEventListener('deviceready', this.onDeviceReady, false);
  34. },
  35. // deviceready Event Handler
  36. //
  37. // The scope of 'this' is the event. In order to call the 'receivedEvent'
  38. // function, we must explicitly call 'app.receivedEvent(...);'
  39. onDeviceReady: function() {
  40. app.receivedEvent('deviceready');
  41. document.getElementById("myBtn").addEventListener("click", openPage);
  42. window.open = cordova.InAppBrowser.open;
  43. },
  44. // Update DOM on a Received Event
  45. receivedEvent: function(id) {
  46. var parentElement = document.getElementById(id);
  47. var listeningElement = parentElement.querySelector('.listening');
  48. var receivedElement = parentElement.querySelector('.received');
  49.  
  50. console.log('Received Event: ' + id);
  51. }
  52. };
  53.  
  54. app.initialize();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement