- var minzoom = $(link).data("minzoom");
- if (minzoom) {
- var name = link.id.replace(/anchor$/, "");
- $(link).off("click.minzoom");
- if (zoom >= minzoom) {
- $(link)
- .attr("title", I18n.t("javascripts.site." + name + "_tooltip"))
- .removeClass("disabled");
- } else {
- $(link)
- .attr("title", I18n.t("javascripts.site." + name + "_disabled_tooltip"))
- .addClass("disabled")
- .on("click.minzoom", function () {
- alert(I18n.t("javascripts.site." + name + "_zoom_alert"));
- return false;
- });
- }
- }
+ var editDisabled = zoom < 13;
+ $('#edit_tab')
+ .tooltip({placement: 'bottom'})
+ .off('click.minzoom')
+ .on('click.minzoom', function() { return !editDisabled; })
+ .toggleClass('disabled', editDisabled)
+ .attr('data-original-title', editDisabled ?
+ I18n.t('javascripts.site.edit_disabled_tooltip') : '');
+}
+
+function escapeHTML(string) {
+ var htmlEscapes = {
+ '&': '&',
+ '<': '<',
+ '>': '>',
+ '"': '"',
+ "'": '''
+ };
+ return string == null ? '' : (string + '').replace(/[&<>"']/g, function(match) {
+ return htmlEscapes[match];