[OpenLayers-Commits] r11214 - sandbox/cmoullet/openlayers/examples

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Tue Feb 22 04:06:03 EST 2011


Author: cmoullet
Date: 2011-02-22 01:06:03 -0800 (Tue, 22 Feb 2011)
New Revision: 11214

Modified:
   sandbox/cmoullet/openlayers/examples/browser.html
   sandbox/cmoullet/openlayers/examples/browser.js
Log:
Cleanup of browser detection example

Modified: sandbox/cmoullet/openlayers/examples/browser.html
===================================================================
--- sandbox/cmoullet/openlayers/examples/browser.html	2011-02-22 09:05:40 UTC (rev 11213)
+++ sandbox/cmoullet/openlayers/examples/browser.html	2011-02-22 09:06:03 UTC (rev 11214)
@@ -81,20 +81,17 @@
 <h1 id="title">Browser detection</h1>
 
 <p id="shortdesc">
-    The goal of this script is to inform about the capacity of the browser used by the user
+    The goal of this script is to inform about the capacity of the browser used by the user.
 </p>
-
 <div id="docs">
     <p>
-        This example informs about the capacity of the browser
-    </p>
-
-    <p>
         See the <a href="browser.js" target="_blank">
         browser.js source</a> to see how this is done.
     </p>
 </div>
 
+<h1>Your browser information</h1>
+
 <div id="result">
 
 </div>

Modified: sandbox/cmoullet/openlayers/examples/browser.js
===================================================================
--- sandbox/cmoullet/openlayers/examples/browser.js	2011-02-22 09:05:40 UTC (rev 11213)
+++ sandbox/cmoullet/openlayers/examples/browser.js	2011-02-22 09:06:03 UTC (rev 11214)
@@ -1,13 +1,16 @@
 var isEventSupported = (function(undef) {
 
     var TAGNAMES = {
-        'select':'input','change':'input',
-        'submit':'form','reset':'form',
-        'error':'img','load':'img','abort':'img'
+        'select':'input',
+        'change':'input',
+        'submit':'form',
+        'reset':'form',
+        'error':'img',
+        'load':'img',
+        'abort':'img'
     };
 
     function isEventSupported(eventName, element) {
-
         element = element || document.createElement(TAGNAMES[eventName] || 'div');
         eventName = 'on' + eventName;
 
@@ -37,20 +40,6 @@
     return isEventSupported;
 })();
 
-function w(category, name, element) {
-    // Use eventTester.html?resultonly=true or eventTester.html
-    document.write('<tr>');
-    if (!getUrlParam('resultonly')) {
-        document.write('<td>' + category + '</td><td>' + name + '</td> ');
-    }
-    document.write('<td>' + (
-            isEventSupported(name, element)
-                    ? '<span style="background-color:green;color:white;">true</span></td>'
-                    : '<span style="background-color:red;color:white;">false</span></td>'
-            ));
-    document.write('<tr>');
-}
-
 function divResult(category, name, element, div) {
     div.innerHTML = div.innerHTML + category + " " + name + ": ";
     div.innerHTML = div.innerHTML + (
@@ -61,12 +50,3 @@
     div.innerHTML = div.innerHTML + "<br>";
 }
 
-function getUrlParam(param)
-{
-    param = param.replace(/([\[\](){}*?+^$.\\|])/g, "\\$1");
-    var regex = new RegExp("[?&]" + param + "=([^&#]*)");
-    var url = decodeURIComponent(window.location.href);
-    var match = regex.exec(url);
-    return match ? match[1] : "";
-}
-



More information about the Commits mailing list