cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agri...@apache.org
Subject spec commit: Add manual test for lazy-loading of cordova.js
Date Tue, 15 Jan 2013 19:13:35 GMT
Updated Branches:
  refs/heads/master e84886540 -> 794d58346


Add manual test for lazy-loading of cordova.js

https://issues.apache.org/jira/browse/CB-1978


Project: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/commit/794d5834
Tree: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/tree/794d5834
Diff: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/diff/794d5834

Branch: refs/heads/master
Commit: 794d58346a4d72d3215ee3c32c51c70b56b7c1ef
Parents: e848865
Author: Andrew Grieve <agrieve@chromium.org>
Authored: Tue Jan 15 14:12:02 2013 -0500
Committer: Andrew Grieve <agrieve@chromium.org>
Committed: Tue Jan 15 14:13:19 2013 -0500

----------------------------------------------------------------------
 cordova.js            |    4 ++-
 index.html            |    1 +
 lazyloadjs/index.html |   55 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 59 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/794d5834/cordova.js
----------------------------------------------------------------------
diff --git a/cordova.js b/cordova.js
index d5b29d8..e659e97 100644
--- a/cordova.js
+++ b/cordova.js
@@ -23,7 +23,9 @@ var VERSION='2.3.0';
 var scripts = document.getElementsByTagName('script');
 var cordovaPath = scripts[scripts.length - 1].src.replace('cordova.js', 'cordova-'+VERSION+'.js');
 
-document.write('<script type="text/javascript" charset="utf-8" src="' + cordovaPath +
'"></script>');
+if (!window._doNotWriteCordovaScript) {
+    document.write('<script type="text/javascript" charset="utf-8" src="' + cordovaPath
+ '"></script>');
+}
 
 function backHome() {
 	if (window.device && device.platform && device.platform.toLowerCase() ==
'android') {

http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/794d5834/index.html
----------------------------------------------------------------------
diff --git a/index.html b/index.html
index 836df48..502450a 100644
--- a/index.html
+++ b/index.html
@@ -51,6 +51,7 @@
     <a href="contacts/index.html" class="btn large">Contacts</a>
     <a href="events/index.html" class="btn large">Events</a>
     <a href="location/index.html" class="btn large">Location</a>
+    <a href="lazyloadjs/index.html" class="btn large">Lazy Loading of cordova.js</a>
     <a href="misc/index.html" class="btn large">Misc Content</a>
     <a href="network/index.html" class="btn large">Network</a>
     <a href="notification/index.html" class="btn large">Notification</a>

http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/794d5834/lazyloadjs/index.html
----------------------------------------------------------------------
diff --git a/lazyloadjs/index.html b/lazyloadjs/index.html
new file mode 100644
index 0000000..ac17d05
--- /dev/null
+++ b/lazyloadjs/index.html
@@ -0,0 +1,55 @@
+<!DOCTYPE html>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+
+<html>
+  <head>
+    <meta name="viewport" content="width=device-width,height=device-height,user-scalable=no,initial-scale=1.0"
/>
+    <meta http-equiv="Content-type" content="text/html; charset=utf-8"> <!-- ISO-8859-1
-->
+    <title>Lazy-Loading of cordova.js test</title>
+    <link rel="stylesheet" href="../master.css" type="text/css" media="screen" title="no
title" charset="utf-8"/>
+    <script>_doNotWriteCordovaScript = true</script>
+    <script type="text/javascript" charset="utf-8" src="../cordova.js"></script>
+<script type="text/javascript" charset="utf-8">
+    function init() {
+        window.setTimeout(function() {
+            var s = document.createElement('script');
+            s.src = cordovaPath;
+            document.body.appendChild(s);
+            s.onload = function() {
+                document.addEventListener("deviceready", function() {
+                    console.log("Device="+device.platform+" "+device.version);
+                    document.getElementById('info').innerHTML = 'Cordova loaded just fine.';
+                }, false);
+            };
+        }, 0);
+    }
+</script>
+  </head>
+  <body onload="init();" id="stage" class="theme">
+    <h1>Lazy-Loading of cordova.js</h1>
+    <div id="info">
+      onDeviceReady has not yet fired.
+    </div>
+    <h2> </h2><div class="backBtn" onclick="backHome();">Back</div>
+  </body>
+</html>


Mime
View raw message