]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/key.js
Use the jQuery data() function to access HTML 5 data attributes
[rails.git] / app / assets / javascripts / key.js
index daff6eee6981f63fc10c11d03c59fd6309b6ac72..1e4138b70fc7b449b4ba3cae54f5cf8c9b4a93df 100644 (file)
@@ -8,12 +8,10 @@ $(document).ready(function () {
           mapZoom = map.getZoom();
 
       $(".mapkey-table-entry").each(function () {
-        var entryLayer = $(this).attr("data-layer"),
-            entryZoomMin = parseInt($(this).attr("data-zoom-min")),
-            entryZoomMax = parseInt($(this).attr("data-zoom-max"));
+        var data = $(this).data();
 
-        if (mapLayer == entryLayer &&
-            mapZoom >= entryZoomMin && mapZoom <= entryZoomMax) {
+        if (mapLayer == data.layer &&
+            mapZoom >= data.zoomMin && mapZoom <= data.zoomMax) {
           $(this).show();
         } else {
           $(this).hide();