]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/application.js
Tooltips for map controls
[rails.git] / app / assets / javascripts / application.js
index b257f7fedfd575f65a881dc213a9d88112cb8786..a33e281ce8e0762bfcc64faa693adebfc30b7911 100644 (file)
@@ -3,6 +3,7 @@
 //= require jquery.timers
 //= require jquery.cookie
 //= require jquery.throttle-debounce
+//= require bootstrap.tooltip
 //= require augment
 //= require osm
 //= require leaflet
@@ -122,6 +123,19 @@ function cookieContent(map) {
   return [center.lng, center.lat, map.getZoom(), map.getLayersCode()].join('|');
 }
 
+function escapeHTML(string) {
+  var htmlEscapes = {
+    '&': '&',
+    '<': '&lt;',
+    '>': '&gt;',
+    '"': '&quot;',
+    "'": '&#x27;'
+  };
+  return string == null ? '' : (string + '').replace(/[&<>"']/g, function(match) {
+      return htmlEscapes[match];
+  });
+}
+
 /*
  * Forms which have been cached by rails may have the wrong
  * authenticity token, so patch up any forms with the correct