]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/application.js
Ignore clicks on the add note button when it is disabled
[rails.git] / app / assets / javascripts / application.js
index b257f7fedfd575f65a881dc213a9d88112cb8786..225ddaf44503ee78aaa2ec81455121df795c6e36 100644 (file)
@@ -122,6 +122,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